structAFX_MSGMAP{ AFX_MSGMAP * pBaseMessageMap; AFX_MSGMAP_ENTRY * lpEntries; } structAFX_MSGMAP_ENTRY{ UINT nMessage; //Windows Message UINT nCode //Control code or WM_NOTIFY code UINT nID; //control ID (or 0 for windows messages) UINT nLastID; //used for entries specifying a range of control id's UINT nSig; //signature type(action) or pointer to message AFX_PMSG pfn; //routine to call (or specical value) }
staticNotEndAddr(pAddr){ auto i=0; for (i=0;i<6;i++){ if (Dword(i*4+pAddr)!=0) return1; //not end } return0; //reach the end } staticisMsgMap(checkAddr,startVa,endVa){ auto tmp1=Dword(checkAddr); auto tmp2=Dword(checkAddr+4);
auto pAddr=checkAddr+8; if (tmp2==checkAddr+8){
while(NotEndAddr(pAddr)){ if(Dword(pAddr+20)<startVa||Dword(pAddr+20)>endVa){ // Message("Invalid Addr at %0x.\n",pAddr); return0; }
pAddr=pAddr+24; } return1; } return0; }
staticmain(){ auto startRdataVa=0x0044E880; //the start addr of .rdata auto size=0x0000DAA8; //the size of .rdata
auto startValidVa=0x00400000; //check the addr is valid or not auto endValidVa=0x0046A000;
auto i=0; for(i=0;i<size;i=i+4){ if(isMsgMap(i+startRdataVa,startValidVa,endValidVa)){ Message("Found Possible MessageMap at %0x.\n",i+startRdataVa); } } Message("Finish searching.\n");