INF: Dangers of Uninitialized Data Structures

ID Number: Q74277

3.00 3.10

WINDOWS

Summary:

In general, all fields in structures passed to functions in the

Microsoft Windows graphical environment should be initialized. If a

field is not initialized, it may contain random data, which can cause

unexpected behavior.

For example, before an application registers a window class, it must

initialize the cbClsExtra and cbWndExtra fields of the WNDCLASS data

structure. Windows allocates cbClsExtra bytes for the class, and

cbWndExtra bytes for each window created using the class. If these

fields contain large random values, the application may run out of

memory quickly.

Additional reference words: 3.00 3.10