INFO: Dangers of Uninitialized Data Structures
ID: Q74277
|
The information in this article applies to:
-
Microsoft Windows Software Development Kit (SDK)
-
Microsoft Win32 Application Programming Interface (API)
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.
Keywords : kbGrpUser kbWndw
Version :
Platform :
Issue type : kbinfo