Access violation exception in 64-bit version of MFC

I am trying to port a 32-bit application to 64-bit. It looks like the calculations are working correctly, but I can’t set the views correctly. I use MFC, C ++ and OpenGL, the Intel compiler 10.0.027 inside VS2005 on a W7 x64 machine.

When the failure occurs, I get the following message: "First chance exception in 0xffffffff8043b1b6 in the 3DApp.exe file: 0xC0000005: access violation in place 0xffffffffff8043b1b6", and this is the stack trace:

ffffffff8043b1b6()  
user32.dll!UserCallWinProcCheckWow()  + 0x11d bytes 
user32.dll!DispatchMessageWorker()  + 0x12a bytes   
3DApp.exe!AfxInternalPumpMessage()  Line 183    C++
3DApp.exe!CWinThread::PumpMessage()  Line 896   C++
3DApp.exe!CWinThread::Run()  Line 625 + 0x13 bytes  C++

NOTE PLEASE why UserCallWinProcCheckWow is called, I thought the Wow suffix is ​​only for emulating 32-bit applications on a 64-bit computer.

Obviously, somewhere the 64-bit pointer is being treated as a 32-bit pointer, but I cannot specify where this happens. I downloaded debugging symbols from microsoft that show the top of the call stack.

Any help is greatly appreciated. Leon

EDIT

Call DispatchMessage code:

    if (pState->m_msgCur.message != WM_KICKIDLE && !AfxPreTranslateMessage(&(pState->m_msgCur)))
{
    ::TranslateMessage(&(pState->m_msgCur));
    ::DispatchMessage(&(pState->m_msgCur));
}

At this point, pState pointers are mapped to 64 bits.

Status pState-> m_msgCu:

  • pState-> m_msgCur {msg = 0x00000022 wp = 0x0000000000000000 lp = 0x0000000000000000} tagMSG
  • hwnd 0x0000000000020416 {unused = 0x00000000} HWND__ * message 0x00000022 unsigned int wParam 0x0000000000000000 unsigned __int64 lParam 0x0000000000000000 __int64 unsigned 0x000f3967
  • pt {x = 0x0000030f y = 0x00000356} tagPOINT
+3
source share
3 answers

. SetWindowLongPtr (GWLP_WNDPROC), WndProc LONG LONG_PTR. , WndProc WND , HWND WndProc .

+7

, DispatchMessage MFC. , .

+1

, 0x00000022 - WM_CHILDACTIVATE mesasage. , . , , , proedure . , DLL, , .

0

Source: https://habr.com/ru/post/1795143/


All Articles