Migrated application crashes, if DEP is active

0

I've ported our MFC application from vc6 to vc9 (VS2008). Everything's fine, but if DEP is active, program crashes (s. stacktrace below). I've already tried to play around with NX-Flag, but nothing changes. I also tried to build the application with Parasoft Insure++, but no memory corruptions or any other issues are shown.

Thanks in advance for any advice.

The environment is as described below:

  • DEP option is NoExecute=OptOut, the program is in the exclude list (if not, it doesn't crash, but there are another issues).
  • MFC MainFrame code is in a dll, not in exe
  • There are some old 3rd-party ActiveX components, which do not work, if DEP is active

Stack trace:

>   mfc90d.dll!CThemeHelper::IsAppThemed()  Zeile 82    C++
    mfc90d.dll!CControlBar::OnCreate(tagCREATESTRUCTA * lpcs=0x00dde2b4)  Zeile 576 + 0x5 Bytes C++
    mfc90d.dll!CWnd::OnWndMsg(unsigned int message=1, unsigned int wParam=0, long lParam=14541492, long * pResult=0x00dde05c)  Zeile 2014 + 0xd Bytes   C++
    mfc90d.dll!CWnd::WindowProc(unsigned int message=1, unsigned int wParam=0, long lParam=14541492)  Zeile 1755 + 0x20 Bytes   C++
    mfc90d.dll!CControlBar::WindowProc(unsigned int nMsg=1, unsigned int wParam=0, long lParam=14541492)  Zeile 506 + 0x14 Bytes    C++
    mfc90d.dll!AfxCallWndProc(CWnd * pWnd=0x01ba3d80, HWND__ * hWnd=0x000b1110, unsigned int nMsg=1, unsigned int wParam=0, long lParam=14541492)  Zeile 240 + 0x1c Bytes   C++
    mfc90d.dll!AfxWndProc(HWND__ * hWnd=0x000b1110, unsigned int nMsg=1, unsigned int wParam=0, long lParam=14541492)  Zeile 403    C++
    bedamain.dll!AfxWndProcDllStatic(HWND__ * hWnd=0x000b1110, unsigned int nMsg=1, unsigned int wParam=0, long lParam=14541492)  Zeile 54 + 0x15 Bytes C++
        ...
    user32.dll!7e37e34f()   
    mfc90d.dll!CWnd::WindowProc(unsigned int message=1, unsigned int wParam=643120, long lParam=463138)  Zeile 1755 + 0x20 Bytes    C++
    mfc90d.dll!AfxGetModuleThreadState()  Zeile 498 + 0x11 Bytes    C++
    kernel32.dll!7c80a73d()     
    mfc90d.dll!AfxDeactivateActCtx(unsigned long dwFlags=0, unsigned long ulCookie=495452227)  Zeile 260 + 0x17 Bytes   C++
    mfc90d.dll!AFX_MAINTAIN_STATE2::~AFX_MAINTAIN_STATE2()  Zeile 63 + 0xe Bytes    C++
    bedamain.dll!AfxWndProcDllStatic(HWND__ * hWnd=0x00071122, unsigned int nMsg=5, unsigned int wParam=0, long lParam=43648228)  Zeile 54 + 0x27 Bytes C++
        ...
    user32.dll!7e37c17e()   
    mfc90d.dll!CWnd::DefWindowProcA(unsigned int nMsg=71, unsigned int wParam=48, long lParam=643672)  Zeile 1043 + 0x20 Bytes  C++
    mfc90d.dll!CWnd::WindowProc(unsigned int message=1, unsigned int wParam=14542916, long lParam=2024004508)  Zeile 1756 + 0x1c Bytes  C++
        ...
    user32.dll!7e37e4dc()   
    mfc90d.dll!AfxCtxCreateWindowExA(unsigned long dwExStyle=512, const char * lpClassName=0x00067b58, const char * lpWindowName=0x78a44e50, unsigned long dwStyle=13565952, int X=-2147483648, int Y=-2147483648, int nWidth=-2147483648, int nHeight=-2147483648, HWND__ * hWndParent=0x00000000, HMENU__ * hMenu=0x028d090d, HINSTANCE__ * hInstance=0x10000000, void * lpParam=0x00ddf644)  Zeile 438 + 0xa3 Bytes  C++
    mfc90d.dll!CWnd::CreateEx(unsigned long dwExStyle=0, const char * lpszClassName=0x00067b58, const char * lpszWindowName=0x78a44e50, unsigned long dwStyle=13598720, int x=-2147483648, int y=-2147483648, int nWidth=-2147483648, int nHeight=-2147483648, HWND__ * hWndParent=0x00000000, HMENU__ * nIDorHMenu=0x028d090d, void * lpParam=0x00ddf644)  Zeile 708 + 0x35 Bytes  C++
    mfc90d.dll!CFrameWnd::Create(const char * lpszClassName=0x00067b58, const char * lpszWindowName=0x78a44e50, unsigned long dwStyle=13598720, const tagRECT & rect={...}, CWnd * pParentWnd=0x00000000, const char * lpszMenuName=0x000003ec, unsigned long dwExStyle=0, CCreateContext * pContext=0x00ddf644)  Zeile 608 + 0x54 Bytes    C++
    mfc90d.dll!CFrameWnd::LoadFrame(unsigned int nIDResource=1004, unsigned long dwDefaultStyle=13598720, CWnd * pParentWnd=0x00000000, CCreateContext * pContext=0x00ddf644)  Zeile 740 + 0x35 Bytes   C++
    mfc90d.dll!CDocTemplate::CreateNewFrame(CDocument * pDoc=0x01ba39c8, CFrameWnd * pOther=0x00000000)  Zeile 277 + 0x22 Bytes C++
    mfc90d.dll!CSingleDocTemplate::OpenDocumentFile(const char * lpszPathName=0x00000000, int bMakeVisible=1)  Zeile 125 + 0x13 Bytes   C++
    mfc90d.dll!CDocManager::OnFileNew()  Zeile 848  C++
    mfc90d.dll!CWinApp::OnFileNew()  Zeile 22   C++
    mfc90d.dll!_AfxDispatchCmdMsg(CCmdTarget * pTarget=0x10111a48, unsigned int nID=57600, int nCode=0, void (void)* pfn=0x100a5a18, void * pExtra=0x00000000, unsigned int nSig=57, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Zeile 82    C++
    mfc90d.dll!CCmdTarget::OnCmdMsg(unsigned int nID=57600, int nCode=0, void * pExtra=0x00000000, AFX_CMDHANDLERINFO * pHandlerInfo=0x00000000)  Zeile 381 + 0x27 Bytes    C++
    mfc90d.dll!CWinApp::ProcessShellCommand(CCommandLineInfo & rCmdInfo={...})  Zeile 24 + 0x20 Bytes   C++
    bedamain.dll!CBeDaMainApp::InitInstance()  Zeile 261 + 0xc Bytes    C++
    bedamain.dll!InternalDllMain(HINSTANCE__ * hInstance=0x10000000, unsigned long dwReason=1, void * __formal=0x00ddfd30)  Zeile 100 + 0x13 Bytes  C++
    bedamain.dll!DllMain(HINSTANCE__ * hInstance=0x10000000, unsigned long dwReason=1, void * lpReserved=0x00ddfd30)  Zeile 272 C++
    bedamain.dll!__DllMainCRTStartup(void * hDllHandle=0x10000000, unsigned long dwReason=1, void * lpreserved=0x00ddfd30)  Zeile 546 + 0x11 Bytes  C
    bedamain.dll!_DllMainCRTStartup(void * hDllHandle=0x10000000, unsigned long dwReason=1, void * lpreserved=0x00ddfd30)  Zeile 510 + 0x11 Bytes   C
        ...
    ntdll.dll!7c928b7b()    
c++
mfc
visual-c++-6
visual-c++-2008
dep
asked on Stack Overflow May 15, 2012 by Alexey • edited May 15, 2012 by Alexey

1 Answer

0

It looks like as if your ActiveX component is executing code on the stack (hence the DEP failure).

answered on Stack Overflow May 16, 2012 by mox

User contributions licensed under CC BY-SA 3.0