64,636
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
#include<windows>
using namespace std;
int main(int argc, char ** argv)
{
bool we_loaded_it = false;
HINSTANCE h;
TCHAR dllname[] = "User32"; //默认查找user32.dll里面的指令
if(argc>1)
{
strcpy(dllname,argv[1]);
}
h = GetModuleHandle(dllname);
if(h == NULL)
{
h = LoadLibrary(dllname); //加载dll
if(h == NULL)
{
cout<<"ERROR LOADING DLL: "<<dllname<<endl;
return 1;
}
we_loaded_it = true;
}
BYTE* ptr = (BYTE*)h;
bool done = false;
for(int y = 0;!done;y++) //在dll中查找FF 56 4c并打印
{
try
{
if(ptr[y] == 0xFF && ptr[y+1] == 0x56 && ptr[y+2] == 0x4c )
{
int pos = (int)ptr + y;
cout<<"OPCODE found at 0x"<<hex<<pos<<endl;
}
}
catch(...)
{
cout<<"END OF "<<dllname<<" MEMORY REACHED"<<endl;
done = true;
}
}
if(we_loaded_it) FreeLibrary(h); //释放dll
return 0;
}