BUG: GP Fault When You Access Struct Member Using Huge PointerLast reviewed: August 8, 1997Article ID: Q149785 |
The information in this article applies to:
SYMPTOMSWhen you use a huge pointer to a structure to reference a member variable whose offset is greater than 32K from the beginning of the structure, a general protection (GP) fault occurs when optimizations are disabled.
CAUSEThe member offset is improperly sign-extended and added to the base address of the structure giving an invalid address.
RESOLUTIONThere are two workarounds:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
Sample Code
/* Compile options needed: /Od, /Mq (QuickWin App) */ #include <windows.h> typedef struct { char table[32768]; int nbtran; } MyStruct; MyStruct __huge *lptr; void main(void) { HANDLE hbuff = GlobalAlloc(GMEM_MOVEABLE,60000); lptr = (MyStruct __huge *) GlobalLock(hbuff); lptr->nbtran=10; // *** GPF here! *** } Keywords : CLIss kb16bitonly Version : 1.5 1.51 1.52 1.52b 1.52c Platform : WINDOWS Issue type : kbbug |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |