|
[求助]究竟从何而来?
分析一个类,首先要清楚这个类是从那些父类继承而来的,而且此类改写了哪些函数,更重要的是找到相关的消息执行的代码,比如一个按钮点击以后执行了什么。看雪上有个软件mfcspy可以帮助分析,下面是我对一个按钮的分析过程,将mfcspy上的“放大镜”拖放到按钮上的后,此工具提供了如下信息: HWND: 0004080E class:0012D440(CButton,size=0x40) CButton:CWnd:CCmdTarget:CObject [+00]vtbl address=004208E8(u1.exe+0208E8) [+04]CCmdTarget::m_dwRef=1 [+08]CCmdTarget::m_pOuterUnknown=00000000 [+0C]CCmdTarget::m_xInnerUnknown=00000000 [+10]CCmdTarget::m_xDispatch.m_vtbl=00000000 [+14]CCmdTarget::m_bResultExpected=00000001 [+18]CCmdTarget::m_xConnPtContainer.m_vtbl=00000000 [+1C]CCmdTarget::m_pModuleState=00145C50 [+20]CWnd::m_hWnd=0004080E [+24]CWnd::m_hWndOwner=00000000 [+28]CWnd::m_nFlags=00000000 [+2C]CWnd::m_pfnSuper=77D3B036 [+30]CWnd::m_nModalResult=00000000 [+34]CWnd::m_pDropTarget=00000000 [+38]CWnd::m_pCtrlCont=00000000 [+3C]CWnd::m_pCtrlSite=00000000 [vtbl+00]GetRuntimeClass =0041DAA2->73DCC37B(MFC42.DLL+09C37B) [vtbl+04]destructor =0040111C(u1.exe+00111C) [vtbl+08]Serialize =0040786F(u1.exe+00786F) [vtbl+0C]AssertValid =0040B59E(u1.exe+00B59E) [vtbl+10]Dump =0040786F(u1.exe+00786F) [vtbl+14]OnCmdMsg =0041DA9C->73D322B5(MFC42.DLL+0022B5) [vtbl+18]OnFinalRelease =0041DA96->73D47F7A(MFC42.DLL+017F7A) [vtbl+1C]IsInvokeAllowed =0041DA90->73DB7792(MFC42.DLL+087792) [vtbl+20]GetDispatchIID =0041DA8A->73D87940(MFC42.DLL+057940) [vtbl+24]GetTypeInfoCount =0041DA84->73DA557E(MFC42.DLL+07557E) [vtbl+28]GetTypeLibCache =0041DA7E->73DA557E(MFC42.DLL+07557E) [vtbl+2C]GetTypeLib =0041DA78->73D8F02C(MFC42.DLL+05F02C) [vtbl+30]GetMessageMap =004011F8(u1.exe+0011F8) [vtbl+34]GetCommandMap =0041DA72->73D8F0A9(MFC42.DLL+05F0A9) [vtbl+38]GetDispatchMap =0041DA6C->73D8F053(MFC42.DLL+05F053) [vtbl+3C]GetConnectionMap =0041DA66->73D8F09E(MFC42.DLL+05F09E) [vtbl+40]GetInterfaceMap =0041DA60->73DC071A(MFC42.DLL+09071A) [vtbl+44]GetEventSinkMap =0041DA5A->73D8F05E(MFC42.DLL+05F05E) [vtbl+48]OnCreateAggregates =0041DA54->73D9D7ED(MFC42.DLL+06D7ED) [vtbl+4C]GetInterfaceHook =0041DA4E->73D87940(MFC42.DLL+057940) [vtbl+50]GetExtraConnectionPoints=0041DA48->73D87940(MFC42.DLL+057940) [vtbl+54]GetConnectionHook =0041DA42->73D87940(MFC42.DLL+057940) [vtbl+58]PreSubclassWindow =0040128B(u1.exe+00128B) [vtbl+5C]Create =0041DA3C->73D3DA75(MFC42.DLL+00DA75) [vtbl+60]DestroyWindow =0041DA36->73D36BE1(MFC42.DLL+006BE1) [vtbl+64]PreCreateWindow =0041DA30->73D3BBCB(MFC42.DLL+00BBCB) [vtbl+68]CalcWindowRect =0041DA2A->73D3BE43(MFC42.DLL+00BE43) [vtbl+6C]OnToolHitTest =0041DA24->73D8DA03(MFC42.DLL+05DA03) [vtbl+70]GetScrollBarCtrl =0041DA1E->73D87940(MFC42.DLL+057940) [vtbl+74]WinHelpA =0041DA18->73D8DC2E(MFC42.DLL+05DC2E) [vtbl+78]ContinueModal =0041DA12->73D4679E(MFC42.DLL+01679E) [vtbl+7C]EndModalLoop =0041DA0C->73D467F4(MFC42.DLL+0167F4) [vtbl+80]OnCommand =0041DA06->73D331F1(MFC42.DLL+0031F1) [vtbl+84]OnNotify =0041DA00->73D33A0B(MFC42.DLL+003A0B) [vtbl+88]GetSuperWndProcAddr =0041D9FA->73D35FEA(MFC42.DLL+005FEA) [vtbl+8C]DoDataExchange =0040786F(u1.exe+00786F) [vtbl+90]BeginModalState =00402A91(u1.exe+002A91) [vtbl+94]EndModalState =00402A9D(u1.exe+002A9D) [vtbl+98]PreTranslateMessage =004012F0(u1.exe+0012F0) [vtbl+9C]OnAmbientProperty =0041D9F4->73D8ECF3(MFC42.DLL+05ECF3) [vtbl+A0]WindowProc =0041D9EE->73D31B77(MFC42.DLL+001B77) [vtbl+A4]OnWndMsg =0041D9E8->73D31BC2(MFC42.DLL+001BC2) [vtbl+A8]DefWindowProcA =0041D9E2->73D32127(MFC42.DLL+002127) [vtbl+AC]PostNcDestroy =0041D9DC->73DC067B(MFC42.DLL+09067B) [vtbl+B0]OnChildNotify =0041D9D6->73DBF004(MFC42.DLL+08F004) [vtbl+B4]CheckAutoCenter =0041D9D0->73D9D7ED(MFC42.DLL+06D7ED) [vtbl+B8]IsFrameWnd =0041D9CA->73DA557E(MFC42.DLL+07557E) [vtbl+BC]SetOccDialogInfo =0041D9C4->73D87940(MFC42.DLL+057940) message map=004208E0(u1.exe+0208E0) msg map entries at 00420778(u1.exe+020778) OnMsg:WM_SETCURSOR(0020),func=00401456(u1.exe+001456) OnMsg:WM_KILLFOCUS(0008),func=00401419(u1.exe+001419) OnMsg:WM_MOUSEMOVE(0200),func=00401490(u1.exe+001490) OnMsg:WM_SYSCOLORCHANGE(0015),func=00401339(u1.exe+001339) OnMsg:BD11,func=0040156F(u1.exe+00156F) OnMsg:WM_ACTIVATE(0006),func=0040142C(u1.exe+00142C) OnMsg:WM_ENABLE(000a),func=004013C1(u1.exe+0013C1) OnMsg:WM_CANCELMODE(001f),func=00401446(u1.exe+001446) OnMsg:WM_GETDLGCODE(0087),func=004012D6(u1.exe+0012D6) OnMsg:BC19,func=0040132E(u1.exe+00132E) OnMsg:00F4,func=00401362(u1.exe+001362) OnMsg:WM_MOUSELEAVE(02a3),func=00401565(u1.exe+001565) OnMsg:00F1,func=00401397(u1.exe+001397) OnMsg:00F0,func=004013B9(u1.exe+0013B9) 根据工具提供的信息,很清楚地知道了按钮的一些细节: CButton:CWnd:CCmdTarget:CObject:说明了按钮的继承关系。 再往下就是类对外暴露的属性和操作了,哪些是此按钮定义的属性,改写了那些操作都一目了然了。大多数都是MFC里的东西,所以也没有多少价值。 对于按钮可能最有价值的就是其消息映射了,也就是最后一节的内容。不过里面没有点击按钮消息映射,经过在ollydbg里进行跟踪调试,OnMsg:BD11,func=0040156F(u1.exe+00156F)是WM_LBUTTONDOWN的操作代码。 |
|
[求助]究竟从何而来?
这几天在网上看了一个博客里的文章《逆向动态调试分析“基于MFC对话框(非文本框)程序”时,定位用户初始化代码入口的方法》(http://hi.baidu.com/coderui),尝试着试验了一下。这篇文章是针对一些木马等程序的逆向分析而写的,借用作者的文字是:病毒运行后,是不需要出现对话框也不需要点击任何按钮就可以直接运行的,软件作者把功能和校验代码的调用位置都加在了程序的初始化函数里。在VC++ 6.0的MFC中,这些初始化函数一般为“InitInstance()”函数和“OnInitDialog()”函数。 恰好俺也想知道调试的软件开始执行了哪些代码,所以就按照作者的思路进行了调试: 程序被OD打开后会停在这里,这个是程序的入口点OEP: 0041E070 >/$ 55 PUSH EBP 0041E071 |. 8BEC MOV EBP,ESP 0041E073 |. 6A FF PUSH -1 0041E075 |. 68 88604200 PUSH u1.00426088 0041E07A |. 68 D4E14100 PUSH <JMP.&MSVCRT._except_handler3> ; SE 处理程序安装 ……(省略) 0041E198 |. FF15 DC004200 CALL DWORD PTR DS:[<&KERNEL32.GetModuleH>; \GetModuleHandleA 0041E19E |. 50 PUSH EAX 0041E19F |. E8 82000000 CALL u1.0041E226 0041E1A4 |. 8945 98 MOV DWORD PTR SS:[EBP-68],EAX 0041E1A7 |. 50 PUSH EAX ; /status 0041E1A8 |. FF15 D8044200 CALL DWORD PTR DS:[<&MSVCRT.exit>] ; \exit 找到“exit”退出函数上边的这个CALL,按[F4]执行到这里,然后再按[F7]进去,也就是说执行到“CALL u1.0041E226”,并跟踪进入此函数。 0041E226 /$ FF7424 10 PUSH DWORD PTR SS:[ESP+10] 0041E22A |. FF7424 10 PUSH DWORD PTR SS:[ESP+10] 0041E22E |. FF7424 10 PUSH DWORD PTR SS:[ESP+10] 0041E232 |. FF7424 10 PUSH DWORD PTR SS:[ESP+10] 0041E236 |. E8 43000000 CALL <JMP.&MFC42.#1576_AfxWinMain> 按[F4]执行到这里,接着对该主程序的代码段下内存访问断点,然后按[F9]运行 004068DF . B8 A8EB4100 MOV EAX,u1.0041EBA8 004068E4 . E8 27750100 CALL u1.0041DE10 004068E9 . 51 PUSH ECX 004068EA . 53 PUSH EBX 004068EB . 56 PUSH ESI 004068EC . 8BF1 MOV ESI,ECX 004068EE . 8D4D F0 LEA ECX,DWORD PTR SS:[EBP-10] 004068F1 . E8 92700100 CALL <JMP.&MFC42.#540_CString::CString> 恰好就是我想问的“究竟从何处来”,这里不明白的是为什么要下内存访问断点呢?最近也在看《深入浅出MFC》,知道_AfxWinMain()还远没有达到InitInstance()位置,还要执行InitApplication()而我们一般编写MFC的时候是很少更改MFC框架的,不知道此软件为什么会在此处出现用户代码? 下面是摘录书中的一些内容: 1.CWinApp-取代 WinMain 的地位: 传统上SDK 程序的WinMain 所完成的工作现在由CWinApp 的三个函数完成: virtual BOOL InitApplication(); virtual BOOL InitInstance(); virtual int Run(); 2.CFrameWnd-取代 WndProc 的地位: MFC 内建了一个所谓的Message Map 机制,会把消息自动送到「与消息对映之特定函数」去;消息与处理函数之间的对映关系由程序员指定。DECLARE_MESSAGE_MAP 另搭配其它宏,就可以很便利地将消息与其处理函数关联在一起。 BEGIN_MESSAGE_MAP(CMyFrameWnd, CFrameWnd) ON_WM_PAINT() ON_COMMAND(IDM_ABOUT, OnAbout) END_MESSAGE_MAP() 3.引爆器-Application object: CMyWinApp theApp; // application object。theApp 就是程序的application object,每一个MFC 应用程序都有一个,而且也只有这么一个。当你执行Hello,这个全域对象产生,于是构造式执行起来。也就是说定义了这么一个全局的application object,就自动执行了其构造函数,初始化了CWinApp 之中的成员变量:m_pszAppName、m_hThread、m_nThreadID、m_hInstance = NULL; m_pszHelpFilePath = NULL; m_pszProfileName = NULL; m_pszRegistryKey = NULL; m_pszExeName = NULL; m_lpCmdLine = NULL; m_pCmdInfo = NULL;等等。 4.隐晦不明的 WinMain: theApp 配置完成后,WinMain 登场。我们并未撰写WinMain 程序代码,这是MFC 早已准备好并由联结器直接加到应用程序代码中的,其源代码为: extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow){ // call shared/exported WinMain return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow); } int AFXAPI AfxWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow){ int nReturnCode = -1; CWinApp* pApp = AfxGetApp(); AfxWinInit(hInstance, hPrevInstance, lpCmdLine, nCmdShow); pApp->InitApplication(); pApp->InitInstance(); nReturnCode = pApp->Run(); AfxWinTerm(); return nReturnCode; } 因而导至调用: CWinApp::InitApplication(); //因为 CMyWinApp 并没有改写InitApplication,注册窗口类别的场所 CMyWinApp::InitInstance(); //因为 CMyWinApp 改写了 InitInstance,产生窗口并显示窗口的场所 CWinApp::Run(); //因为 CMyWinApp 并没有改写Run,攫取消息并分派消息的场所 5. AfxWinInit-AFX 内部初始化动作: BOOL AFXAPI AfxWinInit(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow){ CWinApp* pApp = AfxGetApp(); pApp->m_hInstance = hInstance; pApp->m_hPrevInstance = hPrevInstance; pApp->m_lpCmdLine = lpCmdLine; pApp->m_nCmdShow = nCmdShow; AfxInitThread(); } 而AfxInitThread()只是: SetMessageQueue() // attempt to make the message queue bigger ::SetWindowsHookEx() // set message filter proc // intialize CTL3D for this thread 6.CWinApp::InitApplication: AfxWinInit 之后的动作是pApp->InitApplication,初始化MFC内部管理的Document Template 和CDocManager。 7. CMyWinApp::InitInstance: BOOL CMyWinApp::InitInstance(){ m_pMainWnd = new CMyFrameWnd(); m_pMainWnd->ShowWindow(m_nCmdShow); m_pMainWnd->UpdateWindow(); return TRUE; } m_pMainWnd = new CMyFrameWnd();CMyWinApp::InitInstance 一开始new 了一个CMyFrameWnd 对象,准备用作主框窗口的C++ 对象。new 会引发构造式 CMyFrameWnd::CMyFrameWnd{ Create(NULL, "Hello MFC", WS_OVERLAPPEDWINDOW, rectDefault, NULL, "MainMenu"); } BOOL CFrameWnd::Create(){ CreateEx(dwExStyle, lpszClassName, lpszWindowName, dwStyle, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, pParentWnd->GetSafeHwnd(), hMenu, (LPVOID)pContext); } BOOL CWnd::CreateEx(){ CREATESTRUCT cs; PreCreateWindow(cs); AfxHookWindowCreate(this); HWND hWnd = ::CreateWindowEx(cs.dwExStyle, cs.lpszClass, cs.lpszName, cs.style, cs.x, cs.y, cs.cx, cs.cy, cs.hwndParent, cs.hMenu, cs.hInstance, cs.lpCreateParams); } BOOL CFrameWnd::PreCreateWindow(CREATESTRUCT& cs){ AfxDeferRegisterClass(AFX_WNDFRAMEORVIEW_REG); } #define AfxDeferRegisterClass(fClass) ((afxRegisteredClasses & fClass) ? TRUE : AfxEndDeferRegisterClass(fClass)) BOOL AFXAPI AfxEndDeferRegisterClass(short fClass){ WNDCLASS wndcls; memset(&wndcls, 0, sizeof(WNDCLASS)); // start with NULL defaults wndcls.lpfnWndProc = DefWindowProc; …… } 此函数定义了5中类别的窗口:"AfxWnd42sud" "AfxControlBar42sud" "AfxMDIFrame42sud" "AfxFrameOrView42sud" "AfxOleControl42sud",调用两个函数完成实际的窗口类别注册动作,一个是RegisterWithIcon,一个是AfxRegisterClass,最后是::RegisterClass(lpWndClass); 好复杂的MFC封装啊,上帝啊!!!!!!!!!!!!!!!!!! |
|
[求助]究竟从何而来?
最近又看了论坛上一哥们翻译的《Reversing MS VC++》,从C++的EH机制着手,看能不能找到这段代码的来源。 C++ EH Stack Layout在上面的文章中已经描述地很详细了,大致为ESP/ EH Registration Node /EBP三部分,在ollydbg中,于此处代码开始处下断点,查看堆栈ESP当前所指的堆栈开始到前往EBP之间的堆栈内容如下: 0012CB04 73D32047 返回到 MFC42.73D32047 0012CB08 00000006 0012CB0C 00000000 0012CB10 0012CDD0 0012CB14 0012CDD0 0012CB18 00145518 0012CB1C 7469BB7B 返回到 MSCTF.7469BB7B 0012CB20 0012CB30 ASCII "ToolbarWindow32" 0012CB24 7469BB98 ASCII "SysTabControl32" 0012CB28 00152A70 0012CB2C 7469BB6C 返回到 MSCTF.7469BB6C 来自 MSCTF.7468149C 0012CB30 6C6F6F54 0012CB34 57726162 0012CB38 6F646E69 0012CB3C 00323377 0012CB40 00000000 0012CB44 00000040 0012CB48 00152A48 0012CB4C 0012CB60 0012CB50 000C039A 0012CB54 000C039A 0012CB58 00000000 0012CB5C 00000000 0012CB60 0000000B 0012CB64 00001CFE 0012CB68 0012CB88 0012CB6C 00421808 u1.00421808 0012CB70 00000000 0012CB74 0012CBF4 指向下一个 SEH 记录的指针 0012CB78 73DCEFF1 SE 处理器 0012CB7C FFFFFFFF 如果说 “0012CB78 73DCEFF1 SE 处理器”就是EH Handler的话,根据EH Registration Node的结构定义(GS Cookie/Saved ESP/Next SHE Frame/EH Handler/State),下面就是Saved EBP/Return Address了。对照这个结构分析如下: GS Cookie:00421808 u1.00421808 Saved ESP:00000000 Next SHE Frame :0012CBF4 EH Handler:73DCEFF1 State :FFFFFFFF Saved EBP:0012CBA0 Return Address :73D31B9B Ollydbg中前往EBP的堆栈如下: 0012CB80 /0012CBA0 0012CB84 |73D31B9B 返回到 MFC42.73D31B9B 0012CB88 |00000464 0012CB8C |00000006 0012CB90 |00421580 u1.00421580 0012CB94 |0012CB9C 0012CB98 |00000464 0012CB9C |00000000 0012CBA0 ]0012CC00 一直分析下去,其实跟ollydbg中的SEH 链是一样的: SEH 链 -> 主线程 地址 SE 处理器 0012CB74 MFC42.73DCEFF1 0012CBF4 MFC42.73DCEFA4 0012CC40 MFC42.73DCEEF9 0012CCD0 USER32.77D4048F 0012CD30 USER32.77D4048F 0012CDB4 MFC42.73DCF851 0012FEF4 u1.0041E7EB 0012FFB0 u1.0041E1D4 0012FFE0 kernel32.7C839AC0 最终SHE链是从用户代码u1.0041E7EB而来: text:0041E7EB ; --------------------------------------------------------------------------- .text:0041E7EB .text:0041E7EB loc_41E7EB: ; DATA XREF: sub_40547D o .text:0041E7EB mov eax, offset stru_4267A0 .text:0041E7F0 jmp loc_41DDFC .text:0041E7F0 ; --------------------------------------------------------------------------- .rdata:004267A0 stru_4267A0 _msExcept7 <19930520h, 1, offset stru_426798, 0, 0, 0> .rdata:004267A0 ; DATA XREF: .text:loc_41E7EB o stru_4267A0是一个FuncInfo的结构体,它完整地描述了所有的try/catch块和所有的可展开对象,根据其定义分析如下: magicNumber:19930520h // compiler version. 0x19930520: up to VC6 maxState:1 // number of entries in unwind table UnwindMapEntry* pUnwindMap:offset stru_426798 // table of unwind destructors .rdata:00426798 stru_426798 _msExcInfo <-1, offset sub_41E7E0> .rdata:00426798 ; DATA XREF: .rdata:stru_4267A0 o 对此结构体引用的代码为.text:loc_41E7EB o: .text:0041E7EB ; --------------------------------------------------------------------------- .text:0041E7EB .text:0041E7EB loc_41E7EB: ; DATA XREF: sub_40547D o .text:0041E7EB mov eax, offset stru_4267A0 .text:0041E7F0 jmp loc_41DDFC .text:0041E7F0 ; --------------------------------------------------------------------------- .text:0041DDFC ; --------------------------------------------------------------------------- .text:0041DDFC .text:0041DDFC loc_41DDFC: ; CODE XREF: .text:0041E2BB j .text:0041DDFC ; .text:0041E2FF j ... .text:0041DDFC jmp ds:__CxxFrameHandler .text:0041DDFC ; --------------------------------------------------------------------------- loc_41E7EB又是由sub_40547D函数调用而来: .text:0040547D sub_40547D proc near ; DATA XREF: .rdata:00421530 o .text:0040547D .text:0040547D var_3130 = byte ptr -3130h .text:0040547D var_C = dword ptr -0Ch .text:0040547D var_4 = dword ptr -4 .text:0040547D .text:0040547D mov eax, offset loc_41E7EB .text:00405482 call __EH_prolog 而此函数却是一个类的方法之一,最终又是回到一个类的分析上来了。不知道这么走下来是不是正确的,改天再在OLLYDBG中跟踪一下看看。 |
|
[求助]究竟从何而来?
还是没有人跟帖,只好自己再分析一下了。 这次是从.rdata段开始分析的,看了论坛上“北斗之摇光”的一个帖子,学着分析,找到了CReminderThread类的信息: .rdata:00421150 off_421150 dd offset aCreminderthrea ; DATA XREF: sub_403F5A o .rdata:00421150 ; sub_405B42+49A o .rdata:00421150 ; "CReminderThread" .rdata:00421154 db 84h ; ? .rdata:00421155 db 1 .rdata:00421156 db 0 .rdata:00421157 db 0 .rdata:00421158 db 0FFh .rdata:00421159 db 0FFh .rdata:0042115A db 0 .rdata:0042115B db 0 .rdata:0042115C db 1Fh .rdata:0042115D db 3Fh ; ? .rdata:0042115E db 40h ; @ .rdata:0042115F db 0 .rdata:00421160 db 54h ; T .rdata:00421161 db 3Fh ; ? .rdata:00421162 db 40h ; @ .rdata:00421163 db 0 .rdata:00421164 db 0 .rdata:00421165 db 0 .rdata:00421166 db 0 .rdata:00421167 db 0 .rdata:00421168 unk_421168 db 0Fh ; DATA XREF: .rdata:0042119C o .rdata:00421169 db 0 .rdata:0042116A db 0 .rdata:0042116B db 0 .rdata:0042116C db 0 .rdata:0042116D db 0 .rdata:0042116E db 0 .rdata:0042116F db 0 .rdata:00421170 db 0 .rdata:00421171 db 0 .rdata:00421172 db 0 .rdata:00421173 db 0 .rdata:00421174 db 0 .rdata:00421175 db 0 .rdata:00421176 db 0 .rdata:00421177 db 0 .rdata:00421178 db 0Ch .rdata:00421179 db 0 .rdata:0042117A db 0 .rdata:0042117B db 0 .rdata:0042117C db 8 .rdata:0042117D db 41h ; A .rdata:0042117E db 40h ; @ .rdata:0042117F db 0 .rdata:00421180 db 0 .rdata:00421181 db 0 .rdata:00421182 db 0 .rdata:00421183 db 0 .rdata:00421184 db 0 .rdata:00421185 db 0 .rdata:00421186 db 0 .rdata:00421187 db 0 .rdata:00421188 db 0 .rdata:00421189 db 0 .rdata:0042118A db 0 .rdata:0042118B db 0 .rdata:0042118C db 0 .rdata:0042118D db 0 .rdata:0042118E db 0 .rdata:0042118F db 0 .rdata:00421190 db 0 .rdata:00421191 db 0 .rdata:00421192 db 0 .rdata:00421193 db 0 .rdata:00421194 db 0 .rdata:00421195 db 0 .rdata:00421196 db 0 .rdata:00421197 db 0 ………(太长,省略了) .rdata:00421260 off_421260 dd offset sub_40412D ; DATA XREF: sub_404133 o .rdata:00421264 dd offset unk_4211A0 .rdata:00421268 off_421268 dd offset sub_403F5A ; DATA XREF: sub_403F60+25 o .rdata:00421268 ; sub_403FB3+11 o .rdata:0042126C dd offset sub_403F97 .rdata:00421270 dd offset nullsub_5 .rdata:00421274 dd offset nullsub_4 .rdata:00421278 dd offset nullsub_5 .rdata:0042127C dd offset ?OnCmdMsg@CCmdTarget@@UAEHIHPAXPAUAFX_CMDHANDLERINFO@@@Z ; CCmdTarget::OnCmdMsg(uint,int,void *,AFX_CMDHANDLERINFO *) .rdata:00421280 dd offset ?OnFinalRelease@CCmdTarget@@UAEXXZ ; CCmdTarget::OnFinalRelease(void) .rdata:00421284 dd offset ?IsInvokeAllowed@CCmdTarget@@UAEHJ@Z ; CCmdTarget::IsInvokeAllowed(long) .rdata:00421288 dd offset ?GetDispatchIID@CCmdTarget@@UAEHPAU_GUID@@@Z ; CCmdTarget::GetDispatchIID(_GUID *) .rdata:0042128C dd offset ?GetTypeInfoCount@CCmdTarget@@UAEIXZ ; CCmdTarget::GetTypeInfoCount(void) .rdata:00421290 dd offset ?GetTypeLibCache@CCmdTarget@@UAEPAVCTypeLibCache@@XZ ; CCmdTarget::GetTypeLibCache(void) .rdata:00421294 dd offset ?GetTypeLib@CCmdTarget@@UAEJKPAPAUITypeLib@@@Z ; CCmdTarget::GetTypeLib(ulong,ITypeLib * *) .rdata:00421298 dd offset sub_403F19 .rdata:0042129C dd offset ?GetCommandMap@CCmdTarget@@MBEPBUAFX_OLECMDMAP@@XZ ; CCmdTarget::GetCommandMap(void) .rdata:004212A0 dd offset ?GetDispatchMap@CCmdTarget@@MBEPBUAFX_DISPMAP@@XZ ; CCmdTarget::GetDispatchMap(void) .rdata:004212A4 dd offset ?GetConnectionMap@CCmdTarget@@MBEPBUAFX_CONNECTIONMAP@@XZ ; CCmdTarget::GetConnectionMap(void) .rdata:004212A8 dd offset ?GetInterfaceMap@CCmdTarget@@MBEPBUAFX_INTERFACEMAP@@XZ ; CCmdTarget::GetInterfaceMap(void) .rdata:004212AC dd offset ?GetEventSinkMap@CCmdTarget@@MBEPBUAFX_EVENTSINKMAP@@XZ ; CCmdTarget::GetEventSinkMap(void) .rdata:004212B0 dd offset ?OnCreateAggregates@CCmdTarget@@UAEHXZ ; CCmdTarget::OnCreateAggregates(void) .rdata:004212B4 dd offset ?GetInterfaceHook@CCmdTarget@@UAEPAUIUnknown@@PBX@Z ; CCmdTarget::GetInterfaceHook(void const *) .rdata:004212B8 dd offset ?GetExtraConnectionPoints@CCmdTarget@@MAEHPAVCPtrArray@@@Z ; CCmdTarget::GetExtraConnectionPoints(CPtrArray *) .rdata:004212BC dd offset ?GetConnectionHook@CCmdTarget@@MAEPAUIConnectionPoint@@ABU_GUID@@@Z ; CCmdTarget::GetConnectionHook(_GUID const &) .rdata:004212C0 dd offset sub_403FEE .rdata:004212C4 dd offset ?Run@CWinThread@@UAEHXZ ; CWinThread::Run(void) .rdata:004212C8 dd offset ?PreTranslateMessage@CWinThread@@UAEHPAUtagMSG@@@Z ; CWinThread::PreTranslateMessage(tagMSG *) .rdata:004212CC dd offset ?PumpMessage@CWinThread@@UAEHXZ ; CWinThread::PumpMessage(void) .rdata:004212D0 dd offset ?OnIdle@CWinThread@@UAEHJ@Z ; CWinThread::OnIdle(long) .rdata:004212D4 dd offset ?IsIdleMessage@CWinThread@@UAEHPAUtagMSG@@@Z ; CWinThread::IsIdleMessage(tagMSG *) .rdata:004212D8 dd offset ?ExitInstance@CWinThread@@UAEHXZ ; CWinThread::ExitInstance(void) .rdata:004212DC dd offset ?ProcessWndProcException@CWinThread@@UAEJPAVCException@@PBUtagMSG@@@Z ; CWinThread::ProcessWndProcException(CException *,tagMSG const *) .rdata:004212E0 dd offset ?ProcessMessageFilter@CWinThread@@UAEHHPAUtagMSG@@@Z ; CWinThread::ProcessMessageFilter(int,tagMSG *) .rdata:004212E4 dd offset ?GetMainWnd@CWinThread@@UAEPAVCWnd@@XZ ; CWinThread::GetMainWnd(void) .rdata:004212E8 dd offset ?Delete@CWinThread@@UAEXXZ ; CWinThread::Delete(void) .rdata:004212EC align 10h 可是如何来分析这个类呢?父类是什么?重载了哪些函数?还是有点搞不明白,而且对其消息map分析不出来,发现没有一个消息有定义函数的。 |
|
[求助]究竟从何而来?
是俺这个问题没意思还是咋地了,怎么没有人帮忙分析呢,只好自己再顶。 我走到上一步,估计线程调用的是CReminderThread.CTrayIcon函数,可是类CReminderThread到哪里去找啊? |
|
[求助]究竟从何而来?
讲的再详细一点,就是在DoModel后一路跟踪下来,到了一个开线程的地方,找不到究竟线程执行了那些代码了。 AfxBeginThread 的参数说明、IDA反编译的代码和OLLYDBG的跟踪记录如下: CWinThread* AfxBeginThread( CRuntimeClass* pThreadClass, int nPriority = THREAD_PRIORITY_NORMAL, UINT nStackSize = 0, DWORD dwCreateFlags = 0, LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL ); 参数说明:pfnThreadProc:线程函数的地址,该参数不能设置为NULL,线程函数必须定义成全局函数或者类的静态成员函数 ----------------------------------------------------------------------------------------------------------------------------------------------------------- IDA中反汇编代码: push ebx push 4 push ebx push ebx push offset off_421150 call ?AfxBeginThread@@YGPAVCWinThread@@PAUCRuntimeClass@@HIKPAU_SECURITY_ATTRIBUTES@@@Z ; AfxBeginThread(CRuntimeClass *,int,uint,ulong,_SECURITY_ATTRIBUTES *) ------------------------------------------------------------------------------------------------------------------------------------------------------------------- OLLYDBG中断点后的堆栈和内存数据: 0012C560 00421150 u1.00421150 00421150 4C A0 42 00 0042A04C 43 52 65 6D 69 6E 64 65 72 54 68 72 65 61 64 00 CReminderThread. 0042A05C 43 54 72 61 79 49 63 6F 6E 00 00 00 43 53 47 44 CTrayIcon...CSGD 0042A06C 00 00 00 00 55 32 54 34 38 46 41 45 52 32 45 4C ....U2T48FAER2EL 0042A07C 00 00 00 00 3C 68 74 6D 6C 3E 0D 0A 0D 0A 3C 68 ....<html>....<h 0042A08C 65 61 64 3E 0D 0A 3C 6D 65 74 61 20 68 74 74 70 ead>..<meta http |
|
[求助]究竟从何而来?
没人回应啊,自己顶顶吧。 这几天又调试了一下,从DoModel模块往下走,发现是一个多线程的软件,估计是几个线程之间互相配合,通过信号来同步的,估计我下断点的地方不能够长时间的停止,那样会进入到SEH的处理中去了,回不到原来的调用地址了。 希望有朋友再给予指点,谢谢! |
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值