SizeOfImage member causing program crash

后端 未结 1 641
情深已故
情深已故 2021-01-28 22:15

Im trying to look for BYTE patterns in programs but for some reason when i assign the value to from MINFO.SizeOfImage to ModuleSize it causes the progr

1条回答
  •  孤独总比滥情好
    2021-01-28 22:57

    You code worked just fine when i compiled it and injected. I even tested it against the current FindPattern i am using. I didnt get any errors. Heres my code & yours

    bool Compare(const BYTE* pData, const BYTE* bMask, const char* szMask)
    {
        for(;*szMask;++szMask,++pData,++bMask)
            if(*szMask=='x' && *pData!=*bMask)   return 0;
        return (*szMask) == NULL;
    }
    DWORD FindPattern(DWORD dwAddress, DWORD dwLen, BYTE *bMask, char * szMask)
    {
        for(DWORD i=0; i

    And then when i run this through it

    uint8 DecryptNeedle[] = {0x56, 0x8B, 0x74, 0x24, 0x08, 0x89, 0x71, 0x10, 
                     0x0F, 0xB6, 0x16, 0x0F, 0xB6, 0x46, 0x01, 0x03, 
                     0xC2, 0x8B, 0x51, 0x28, 0x25, 0xFF, 0x00, 0x00, 
                     0x00, 0x89, 0x41, 0x04, 0x0F, 0xB6, 0x04, 0x10};
    char DecryptMask[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    
    DWORD addrDecrypt       = FindPattern(dwModuleStartAddr, 0xA000, DecryptNeedle, DecryptMask);
    DWORD decrypt2 = YourFindPattern(DecryptNeedle, 32);
    

    output is identical in both.

    I would double check your injection code, and check whatelse could be causing the error. Also, do a quick error check

        if(hProcess)
        {
            if(!GetModuleInformation(hProcess,GetModuleHandle(NULL),&MINFO,sizeof(MODULEINFO)));
            {
                  //error
            }
            CloseHandle(hProcess);
            ModuleSize = MINFO.SizeOfImage;
        }
    

    0 讨论(0)
提交回复
热议问题