Microsoft KB Archive/192992

{|
 * width="100%"|

BUG: In-context Hooks for Event Handling Causes Stack Overflow

 * }

Q192992

-

The information in this article applies to:


 * Microsoft Win32 Software Development Kit (SDK)

-

SYMPTOMS
If your 16-bit application handles events using in-context hooks, Invalid Page Fault or General Protection Fault errors might occur. The 16-bit system modal dialog boxes are more prone to this error because of their very small stack size.

CAUSE
16-bit applications use a fixed-size stack. When an in-context hook is called on this stack, it pushes beyond the limits of the stack and causes Invalid Page Fault or General Protection Fault errors. A similar situation occurs when handling events that are sent from 16-bit system modal dialog boxes because they use a separate, small stack as well.

STATUS
Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION
A good workaround for this problem does not currently exist.

Make event handlers as short and simple as possible. This can reduce, though not necessarily eliminate, the probability of the stack overflowing.

There is also no convenient method for determining whether the current application is 16-bit or 32-bit and any non-trivial technique has the likelihood of a stack overflow.

One possible workaround for this problem is to use out-of-context hooks. However, this method has been known to cause resource problems with IAccessible servers like Internet Explorer and Microsoft Word. Therefore, one safe workaround for this problem is switching from in-context hooks to out-of-context hooks and vice versa, as needed.

NOTE: This problem does not occur with 32-bit applications as the stacks of these applications grow automatically.