2012-05-15 4 views
0

MFC 응용 프로그램을 vc6에서 vc9 (VS2008)로 포팅했습니다. 모든 것은 괜찮지 만 DEP가 활성화되어 있으면 프로그램이 충돌합니다 (아래 스택 트레이스). 나는 이미 NX-Flag로 놀려고했지만 아무것도 바뀌지 않았습니다. 또한 Parasoft Insure ++로 응용 프로그램을 만들려고했지만 메모리 손상이나 기타 문제는 표시되지 않습니다.DEP가 활성화 된 경우 마이그레이션 된 응용 프로그램이 손상됩니다.

미리 조언 해 주셔서 감사합니다. 아래에 설명 된대로

환경은 다음과 같습니다

  • DEP 옵션이 NOEXECUTE = 옵트 인, 프로그램이 제외 목록에 (하지 않을 경우,이 충돌하지 않지만, 또 다른 문제가있다).
  • MFC 메인 프레임 코드가없는 EXE에서 DLL에있다
  • 오래된 타사 ActiveX 구성 요소, DEP가 활성화 된 경우, 작동하지 않습니다 있습니다

스택 추적 :

> 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()  
+0

'DEP가 활성화 된 경우 일부 타사 ActiveX 구성 요소가 작동하지 않습니다. ' 이게 당신의 대답이 아닌가요? – tinman

+0

나는 생각한다. 나중에로드되지만 충돌은 시작 중에 발생합니다. 해결 방법이 있습니다. LoadLibrary를 통해 dll을로드하십시오. 그러나 나는 아직도 무엇이 잘못되었는지 알고 있습니다. – Alexey

답변

0

마치 ActiveX 구성 요소가 스택에서 코드를 실행하고있는 것처럼 보입니다 (따라서 DEP 오류).

+0

이미 말했듯이, ActiveX 구성 요소는 충돌하는 순간로드되지 않습니다. – Alexey

+0

죄송합니다, 이것을 보지 못했습니다 ... – mox

+0

문제 없습니다. 해결 방법은 정상적으로 작동합니다. 이로 인해 DEP로 인해 시스템 dll로드가 지연 될 수 있다는 결론이 도출됩니다. 이제 다른 문제가 있습니다. 응용 프로그램이 종료 될 때 멈 춥니 다. ( – Alexey