Microsoft KB Archive/74277

{|
 * width="100%"|

INFO: Dangers of Uninitialized Data Structures

 * }

Q74277

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API)
 * Microsoft Windows Software Development Kit (SDK)

-

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 query words:

Keywords : kbOSWin2000 kbGrpDSUser kbOSWin kbWndw kbDSupport

Issue type : kbinfo

Technology : kbAudDeveloper kbSDKSearch kbWin32sSearch kbWin32API kbWinSDKSearch