能力值:
( LV2,RANK:10 )
|
-
-
2 楼
难度不是很大,微软有一个detours,在结合下面提示的部分代码,完全可以自己做一个
int createProcessWithDll(PCTSTR exePath,PCTSTR dllPath)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(STARTUPINFO));
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFO);
wofstream fout("dlldir.txt");
fout<<exePath<<endl<<dllPath;
fout.flush();
fout.close();
BOOL res = 0;
CHAR pDllPath[MAX_PATH];
ZeroMemory(&pDllPath, MAX_PATH*sizeof(CHAR));
WideCharToMultiByte(CP_ACP,0,dllPath,-1,pDllPath,MAX_PATH,"?",&res);
if(!res)
{
printf("WideCharToMultiByte---success\n");
}
else
{
printf("WideCharToMultiByte---failed\n");
}
if(DetourCreateProcessWithDll(exePath,NULL,NULL,
NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL,
&si, &pi, NULL, (PCSTR)pDllPath, NULL) !=0)
{
printf("DetourCreateProcessWithDll---success\n");
return 1;
}
else
{
printf("DetourCreateProcessWithDll---failed\n");
return 0;
}
}
|
|
|