Re: kernel32: Don't crash accessing an invalid handle in GlobalSize [try3]

2007-09-19 Thread James Hawkins
On 9/20/07, Dmitry Timoshkov <[EMAIL PROTECTED]> wrote: > "James Hawkins" <[EMAIL PROTECTED]> wrote: > > > This version compares the pointer value to 64000 instead of using a > > try/catch block, as suggested by Alexandre. > > > - if(pintern->Magic==MAGIC_GLOBAL_USED) > > + if(pintern > (

Re: kernel32: Don't crash accessing an invalid handle in GlobalSize [try3]

2007-09-19 Thread Dmitry Timoshkov
"James Hawkins" <[EMAIL PROTECTED]> wrote: > This version compares the pointer value to 64000 instead of using a > try/catch block, as suggested by Alexandre. > - if(pintern->Magic==MAGIC_GLOBAL_USED) > + if(pintern > (PGLOBAL32_INTERN)64000 && > pintern->Magic==MAGIC_GLOBAL_USED) >

Re: kernel32: Don't crash accessing an invalid handle in GlobalSize

2007-09-18 Thread Robert Shearman
James Hawkins wrote: > + if (IsBadReadPtr(pintern, 1)) > + { > + SetLastError(ERROR_INVALID_HANDLE); > + return 0; > + } > + >if(pintern->Magic==MAGIC_GLOBAL_USED) >{ > if (!pintern->Pointer) /* handle case of GlobalAlloc( ??,0) */ It would