I have some problems with heap corruption. The warning can be observed while using CreateWindowExW function. I know that it is usually a memory error, but how could I search it out in such situation? There are no new variables before calling CreateWindowExW and I can't step into this function. Here is the code.
HWND GetMainWnd(HINSTANCE hInstance){
static HWND hWnd = NULL;
if (hWnd)
return hWnd;
RETURN_AT_ERROR(hInstance, NULL);
WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = MainWndProc;
wcex.hInstance = hInstance;
wcex.hCursor = ::LoadCursorW(NULL, IDC_ARROW);
wcex.lpszClassName = g_config->GetWndClass();
ATOM atom = ::RegisterClassExW(&wcex);
RETURN_AT_ERROR(atom != 0, NULL);
hWnd = ::CreateWindowExW(WS_EX_LEFT, g_config->GetWndClass(), 0, WS_POPUP | WS_MINIMIZEBOX | WS_CLIPCHILDREN, 0, 0, 0, 0, 0, 0, hInstance, 0);
return hWnd;}
On this string
hWnd = ::CreateWindowExW(WS_EX_LEFT, g_config->GetWndClass(), 0, WS_POPUP | WS_MINIMIZEBOX | WS_CLIPCHILDREN, 0, 0, 0, 0, 0, 0, hInstance, 0);
there is a warning message box
Windows has triggered a breakpoint in drm.exe. This may be due to a corruption of the heap, which indicates a bug in drm.exe or any of the DLLs it has loaded. This may also be due to the user pressing F12 while drm.exe has focus. The output window may have more diagnostic information.
I press "Continue" and it shows
Unhandled exception at 0x77dae753 in app.exe: 0xC0000374: A heap has been corrupted.
However CreateWindowExW returns a non-zero value and window is created as it should be...
g_config->GetWndClass()
), or it may be happening in one of the message handlers invoked during window creation (like WM_CREATE). You'll have to narrow it down. – Pneumonoultramicroscopicsilicovolcanoconiosis