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 be better to wrap the Magic access with an exception handler rather than use IsBadReadPtr.