зеркало из https://github.com/microsoft/Detours.git
Maintenace + CI: Enable debug logging on 'Debug' build configs (#175)
This enables 'Debug' build configs to build the debug output and breakpoints, and fixes all mistakes that slipped in printf format specifiers.
This commit is contained in:
Родитель
7f33ae3507
Коммит
259ad4173a
|
@ -22,6 +22,7 @@ jobs:
|
|||
matrix:
|
||||
os: [windows-2019, windows-2016]
|
||||
arch: [x86, x64, x64_arm, x64_arm64]
|
||||
conf: [Release, Debug]
|
||||
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
|
@ -44,10 +45,13 @@ jobs:
|
|||
env:
|
||||
# Tell detours what process to target
|
||||
DETOURS_TARGET_PROCESSOR: ${{ env.VSCMD_ARG_TGT_ARCH }}
|
||||
DETOURS_CONFIG: ${{ matrix.conf }}
|
||||
run: nmake
|
||||
|
||||
- name: Run unit tests for ${{ matrix.arch }} on ${{ matrix.os }}
|
||||
id: run-unit-tests
|
||||
env:
|
||||
DETOURS_CONFIG: ${{ matrix.conf }}
|
||||
run: cd tests && nmake test
|
||||
if: ${{ matrix.arch == 'x86' || matrix.arch == 'x64' }}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ CLIB=/MT
|
|||
!ENDIF
|
||||
|
||||
AFLAGS=/nologo /Zi /c /Fl
|
||||
CFLAGS=/nologo /Zi $(CLIB) /Gm- /W4 /WX /we4777 /we4800 /Od
|
||||
CFLAGS=/nologo /Zi $(CLIB) /Gm- /W4 /WX /we4777 /we4800 /Od /DDETOUR_DEBUG=$(DETOURS_DEBUG)
|
||||
|
||||
!IF $(DETOURS_SOURCE_BROWSING)==1
|
||||
CFLAGS=$(CFLAGS) /FR
|
||||
|
|
|
@ -16,7 +16,7 @@ DETOURS_SOURCE_BROWSING = 0
|
|||
|
||||
#######################/#######################################################
|
||||
##
|
||||
CFLAGS=/nologo /W4 /WX /we4777 /we4800 /Zi /MT /Gy /Gm- /Zl /Od
|
||||
CFLAGS=/nologo /W4 /WX /we4777 /we4800 /Zi /MT /Gy /Gm- /Zl /Od /DDETOUR_DEBUG=$(DETOURS_DEBUG)
|
||||
|
||||
!IF $(DETOURS_SOURCE_BROWSING)==1
|
||||
CFLAGS=$(CFLAGS) /FR
|
||||
|
|
|
@ -52,7 +52,7 @@ static BOOL WINAPI LoadNtHeaderFromProcess(HANDLE hProcess,
|
|||
IMAGE_DOS_HEADER idh;
|
||||
|
||||
if (!ReadProcessMemory(hProcess, pbModule, &idh, sizeof(idh), NULL)) {
|
||||
DETOUR_TRACE(("ReadProcessMemory(idh@%p..%p) failed: %d\n",
|
||||
DETOUR_TRACE(("ReadProcessMemory(idh@%p..%p) failed: %lx\n",
|
||||
pbModule, pbModule + sizeof(idh), GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ static BOOL WINAPI LoadNtHeaderFromProcess(HANDLE hProcess,
|
|||
|
||||
if (!ReadProcessMemory(hProcess, pbModule + idh.e_lfanew,
|
||||
pNtHeader, sizeof(*pNtHeader), NULL)) {
|
||||
DETOUR_TRACE(("ReadProcessMemory(inh@%p..%p:%p) failed: %d\n",
|
||||
DETOUR_TRACE(("ReadProcessMemory(inh@%p..%p:%p) failed: %lx\n",
|
||||
pbModule + idh.e_lfanew,
|
||||
pbModule + idh.e_lfanew + sizeof(*pNtHeader),
|
||||
pbModule,
|
||||
|
@ -142,7 +142,7 @@ static PBYTE FindAndAllocateNearBase(HANDLE hProcess, PBYTE pbModule, PBYTE pbBa
|
|||
if (GetLastError() == ERROR_INVALID_PARAMETER) {
|
||||
break;
|
||||
}
|
||||
DETOUR_TRACE(("VirtualQueryEx(%p) failed: %d\n",
|
||||
DETOUR_TRACE(("VirtualQueryEx(%p) failed: %lx\n",
|
||||
pbLast, GetLastError()));
|
||||
break;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ static PBYTE FindAndAllocateNearBase(HANDLE hProcess, PBYTE pbModule, PBYTE pbBa
|
|||
PBYTE pbAlloc = (PBYTE)VirtualAllocEx(hProcess, pbAddress, cbAlloc,
|
||||
MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
||||
if (pbAlloc == NULL) {
|
||||
DETOUR_TRACE(("VirtualAllocEx(%p) failed: %d\n", pbAddress, GetLastError()));
|
||||
DETOUR_TRACE(("VirtualAllocEx(%p) failed: %lx\n", pbAddress, GetLastError()));
|
||||
continue;
|
||||
}
|
||||
#ifdef _WIN64
|
||||
|
@ -246,7 +246,7 @@ static BOOL RecordExeRestore(HANDLE hProcess, HMODULE hModule, DETOUR_EXE_RESTOR
|
|||
der.pidh = (PBYTE)hModule;
|
||||
der.cbidh = sizeof(der.idh);
|
||||
if (!ReadProcessMemory(hProcess, der.pidh, &der.idh, sizeof(der.idh), NULL)) {
|
||||
DETOUR_TRACE(("ReadProcessMemory(idh@%p..%p) failed: %d\n",
|
||||
DETOUR_TRACE(("ReadProcessMemory(idh@%p..%p) failed: %lx\n",
|
||||
der.pidh, der.pidh + der.cbidh, GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ static BOOL RecordExeRestore(HANDLE hProcess, HMODULE hModule, DETOUR_EXE_RESTOR
|
|||
der.pinh = der.pidh + der.idh.e_lfanew;
|
||||
der.cbinh = FIELD_OFFSET(IMAGE_NT_HEADERS, OptionalHeader);
|
||||
if (!ReadProcessMemory(hProcess, der.pinh, &der.inh, der.cbinh, NULL)) {
|
||||
DETOUR_TRACE(("ReadProcessMemory(inh@%p..%p) failed: %d\n",
|
||||
DETOUR_TRACE(("ReadProcessMemory(inh@%p..%p) failed: %lx\n",
|
||||
der.pinh, der.pinh + der.cbinh, GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ static BOOL RecordExeRestore(HANDLE hProcess, HMODULE hModule, DETOUR_EXE_RESTOR
|
|||
}
|
||||
|
||||
if (!ReadProcessMemory(hProcess, der.pinh, &der.inh, der.cbinh, NULL)) {
|
||||
DETOUR_TRACE(("ReadProcessMemory(inh@%p..%p) failed: %d\n",
|
||||
DETOUR_TRACE(("ReadProcessMemory(inh@%p..%p) failed: %lx\n",
|
||||
der.pinh, der.pinh + der.cbinh, GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ static BOOL RecordExeRestore(HANDLE hProcess, HMODULE hModule, DETOUR_EXE_RESTOR
|
|||
if (der.inh32.CLR_DIRECTORY.VirtualAddress != 0 &&
|
||||
der.inh32.CLR_DIRECTORY.Size != 0) {
|
||||
|
||||
DETOUR_TRACE(("CLR32.VirtAddr=%x, CLR.Size=%x\n",
|
||||
DETOUR_TRACE(("CLR32.VirtAddr=%lx, CLR.Size=%lx\n",
|
||||
der.inh32.CLR_DIRECTORY.VirtualAddress,
|
||||
der.inh32.CLR_DIRECTORY.Size));
|
||||
|
||||
|
@ -295,7 +295,7 @@ static BOOL RecordExeRestore(HANDLE hProcess, HMODULE hModule, DETOUR_EXE_RESTOR
|
|||
if (der.inh64.CLR_DIRECTORY.VirtualAddress != 0 &&
|
||||
der.inh64.CLR_DIRECTORY.Size != 0) {
|
||||
|
||||
DETOUR_TRACE(("CLR64.VirtAddr=%x, CLR.Size=%x\n",
|
||||
DETOUR_TRACE(("CLR64.VirtAddr=%lx, CLR.Size=%lx\n",
|
||||
der.inh64.CLR_DIRECTORY.VirtualAddress,
|
||||
der.inh64.CLR_DIRECTORY.Size));
|
||||
|
||||
|
@ -306,7 +306,7 @@ static BOOL RecordExeRestore(HANDLE hProcess, HMODULE hModule, DETOUR_EXE_RESTOR
|
|||
if (der.pclr != 0) {
|
||||
der.cbclr = sizeof(der.clr);
|
||||
if (!ReadProcessMemory(hProcess, der.pclr, &der.clr, der.cbclr, NULL)) {
|
||||
DETOUR_TRACE(("ReadProcessMemory(clr@%p..%p) failed: %d\n",
|
||||
DETOUR_TRACE(("ReadProcessMemory(clr@%p..%p) failed: %lx\n",
|
||||
der.pclr, der.pclr + der.cbclr, GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ static BOOL UpdateFrom32To64(HANDLE hProcess, HMODULE hModule, WORD machine,
|
|||
//////////////////////////////////////////////////////// Read old headers.
|
||||
//
|
||||
if (!ReadProcessMemory(hProcess, pbModule, &idh, sizeof(idh), NULL)) {
|
||||
DETOUR_TRACE(("ReadProcessMemory(idh@%p..%p) failed: %d\n",
|
||||
DETOUR_TRACE(("ReadProcessMemory(idh@%p..%p) failed: %lx\n",
|
||||
pbModule, pbModule + sizeof(idh), GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ static BOOL UpdateFrom32To64(HANDLE hProcess, HMODULE hModule, WORD machine,
|
|||
|
||||
PBYTE pnh = pbModule + idh.e_lfanew;
|
||||
if (!ReadProcessMemory(hProcess, pnh, &inh32, sizeof(inh32), NULL)) {
|
||||
DETOUR_TRACE(("ReadProcessMemory(inh@%p..%p) failed: %d\n",
|
||||
DETOUR_TRACE(("ReadProcessMemory(inh@%p..%p) failed: %lx\n",
|
||||
pnh, pnh + sizeof(inh32), GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ static BOOL UpdateFrom32To64(HANDLE hProcess, HMODULE hModule, WORD machine,
|
|||
inh32.FileHeader.SizeOfOptionalHeader;
|
||||
ULONG cb = inh32.FileHeader.NumberOfSections * sizeof(IMAGE_SECTION_HEADER);
|
||||
if (!ReadProcessMemory(hProcess, psects, §s, cb, NULL)) {
|
||||
DETOUR_TRACE(("ReadProcessMemory(ish@%p..%p) failed: %d\n",
|
||||
DETOUR_TRACE(("ReadProcessMemory(ish@%p..%p) failed: %lx\n",
|
||||
psects, psects + cb, GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ static BOOL UpdateFrom32To64(HANDLE hProcess, HMODULE hModule, WORD machine,
|
|||
}
|
||||
|
||||
if (!WriteProcessMemory(hProcess, pnh, &inh64, sizeof(inh64), NULL)) {
|
||||
DETOUR_TRACE(("WriteProcessMemory(inh@%p..%p) failed: %d\n",
|
||||
DETOUR_TRACE(("WriteProcessMemory(inh@%p..%p) failed: %lx\n",
|
||||
pnh, pnh + sizeof(inh64), GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ static BOOL UpdateFrom32To64(HANDLE hProcess, HMODULE hModule, WORD machine,
|
|||
inh64.FileHeader.SizeOfOptionalHeader;
|
||||
cb = inh64.FileHeader.NumberOfSections * sizeof(IMAGE_SECTION_HEADER);
|
||||
if (!WriteProcessMemory(hProcess, psects, §s, cb, NULL)) {
|
||||
DETOUR_TRACE(("WriteProcessMemory(ish@%p..%p) failed: %d\n",
|
||||
DETOUR_TRACE(("WriteProcessMemory(ish@%p..%p) failed: %lx\n",
|
||||
psects, psects + cb, GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ static BOOL UpdateFrom32To64(HANDLE hProcess, HMODULE hModule, WORD machine,
|
|||
inh64.IMPORT_DIRECTORY.Size = 0;
|
||||
|
||||
if (!WriteProcessMemory(hProcess, pnh, &inh64, sizeof(inh64), NULL)) {
|
||||
DETOUR_TRACE(("WriteProcessMemory(inh@%p..%p) failed: %d\n",
|
||||
DETOUR_TRACE(("WriteProcessMemory(inh@%p..%p) failed: %lx\n",
|
||||
pnh, pnh + sizeof(inh64), GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ static BOOL IsWow64ProcessHelper(HANDLE hProcess,
|
|||
//
|
||||
HMODULE hKernel32 = LoadLibraryW(L"KERNEL32.DLL");
|
||||
if (hKernel32 == NULL) {
|
||||
DETOUR_TRACE(("LoadLibraryW failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("LoadLibraryW failed: %lx\n", GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -523,7 +523,7 @@ static BOOL IsWow64ProcessHelper(HANDLE hProcess,
|
|||
hKernel32, "IsWow64Process");
|
||||
|
||||
if (pfnIsWow64Process == NULL) {
|
||||
DETOUR_TRACE(("GetProcAddress failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("GetProcAddress failed: %lx\n", GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
return pfnIsWow64Process(hProcess, Wow64Process);
|
||||
|
@ -545,7 +545,7 @@ BOOL WINAPI DetourUpdateProcessWithDll(_In_ HANDLE hProcess,
|
|||
HMODULE hModule = NULL;
|
||||
HMODULE hLast = NULL;
|
||||
|
||||
DETOUR_TRACE(("DetourUpdateProcessWithDll(%p,dlls=%d)\n", hProcess, nDlls));
|
||||
DETOUR_TRACE(("DetourUpdateProcessWithDll(%p,dlls=%lx)\n", hProcess, nDlls));
|
||||
|
||||
for (;;) {
|
||||
IMAGE_NT_HEADERS32 inh;
|
||||
|
@ -598,7 +598,7 @@ BOOL WINAPI DetourUpdateProcessWithDll(_In_ HANDLE hProcess,
|
|||
bIs32BitProcess = TRUE;
|
||||
}
|
||||
|
||||
DETOUR_TRACE((" 32BitExe=%d 32BitProcess\n", bHas32BitExe, bIs32BitProcess));
|
||||
DETOUR_TRACE((" 32BitProcess=%d\n", bIs32BitProcess));
|
||||
|
||||
return DetourUpdateProcessWithDllEx(hProcess,
|
||||
hModule,
|
||||
|
@ -617,7 +617,7 @@ BOOL WINAPI DetourUpdateProcessWithDllEx(_In_ HANDLE hProcess,
|
|||
//
|
||||
BOOL bIs32BitExe = FALSE;
|
||||
|
||||
DETOUR_TRACE(("DetourUpdateProcessWithDllEx(%p,%p,dlls=%d)\n", hProcess, hModule, nDlls));
|
||||
DETOUR_TRACE(("DetourUpdateProcessWithDllEx(%p,%p,dlls=%lx)\n", hProcess, hModule, nDlls));
|
||||
|
||||
IMAGE_NT_HEADERS32 inh;
|
||||
|
||||
|
@ -632,7 +632,7 @@ BOOL WINAPI DetourUpdateProcessWithDllEx(_In_ HANDLE hProcess,
|
|||
bIs32BitExe = TRUE;
|
||||
}
|
||||
|
||||
DETOUR_TRACE((" 32BitExe=%d 32BitProcess\n", bIs32BitExe, bIs32BitProcess));
|
||||
DETOUR_TRACE((" 32BitExe=%d\n", bIs32BitExe));
|
||||
|
||||
if (hModule == NULL) {
|
||||
SetLastError(ERROR_INVALID_OPERATION);
|
||||
|
@ -719,17 +719,17 @@ BOOL WINAPI DetourUpdateProcessWithDllEx(_In_ HANDLE hProcess,
|
|||
|
||||
DWORD dwProtect;
|
||||
if (!DetourVirtualProtectSameExecuteEx(hProcess, der.pclr, sizeof(clr), PAGE_READWRITE, &dwProtect)) {
|
||||
DETOUR_TRACE(("VirtualProtectEx(clr) write failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("VirtualProtectEx(clr) write failed: %lx\n", GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!WriteProcessMemory(hProcess, der.pclr, &clr, sizeof(clr), NULL)) {
|
||||
DETOUR_TRACE(("WriteProcessMemory(clr) failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("WriteProcessMemory(clr) failed: %lx\n", GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!VirtualProtectEx(hProcess, der.pclr, sizeof(clr), dwProtect, &dwProtect)) {
|
||||
DETOUR_TRACE(("VirtualProtectEx(clr) restore failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("VirtualProtectEx(clr) restore failed: %lx\n", GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
DETOUR_TRACE(("CLR: %p..%p\n", der.pclr, der.pclr + der.cbclr));
|
||||
|
@ -738,7 +738,7 @@ BOOL WINAPI DetourUpdateProcessWithDllEx(_In_ HANDLE hProcess,
|
|||
if (der.clr.Flags & COMIMAGE_FLAGS_32BITREQUIRED) { // Is the 32BIT Required Flag set?
|
||||
// X64 never gets here because the process appears as a WOW64 process.
|
||||
// However, on IA64, it doesn't appear to be a WOW process.
|
||||
DETOUR_TRACE(("CLR Requires 32-bit\n", der.pclr, der.pclr + der.cbclr));
|
||||
DETOUR_TRACE(("CLR Requires 32-bit\n"));
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ BOOL WINAPI DetourUpdateProcessWithDllEx(_In_ HANDLE hProcess,
|
|||
//////////////////////////////// Save the undo data to the target process.
|
||||
//
|
||||
if (!DetourCopyPayloadToProcess(hProcess, DETOUR_EXE_RESTORE_GUID, &der, sizeof(der))) {
|
||||
DETOUR_TRACE(("DetourCopyPayloadToProcess failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("DetourCopyPayloadToProcess failed: %lx\n", GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -885,7 +885,7 @@ BOOL WINAPI DetourCopyPayloadToProcess(_In_ HANDLE hProcess,
|
|||
PBYTE pbBase = (PBYTE)VirtualAllocEx(hProcess, NULL, cbTotal,
|
||||
MEM_COMMIT, PAGE_READWRITE);
|
||||
if (pbBase == NULL) {
|
||||
DETOUR_TRACE(("VirtualAllocEx(%d) failed: %d\n", cbTotal, GetLastError()));
|
||||
DETOUR_TRACE(("VirtualAllocEx(%lx) failed: %lx\n", cbTotal, GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -902,7 +902,7 @@ BOOL WINAPI DetourCopyPayloadToProcess(_In_ HANDLE hProcess,
|
|||
idh.e_lfanew = sizeof(idh);
|
||||
if (!WriteProcessMemory(hProcess, pbTarget, &idh, sizeof(idh), &cbWrote) ||
|
||||
cbWrote != sizeof(idh)) {
|
||||
DETOUR_TRACE(("WriteProcessMemory(idh) failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("WriteProcessMemory(idh) failed: %lx\n", GetLastError()));
|
||||
return FALSE;
|
||||
}
|
||||
pbTarget += sizeof(idh);
|
||||
|
@ -960,7 +960,7 @@ BOOL WINAPI DetourCopyPayloadToProcess(_In_ HANDLE hProcess,
|
|||
}
|
||||
pbTarget += cbData;
|
||||
|
||||
DETOUR_TRACE(("Copied %d byte payload into target process at %p\n",
|
||||
DETOUR_TRACE(("Copied %lx byte payload into target process at %p\n",
|
||||
cbTotal, pbTarget - cbTotal));
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -987,7 +987,7 @@ VOID CALLBACK DetourFinishHelperProcess(_In_ HWND,
|
|||
|
||||
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, s_pHelper->pid);
|
||||
if (hProcess == NULL) {
|
||||
DETOUR_TRACE(("OpenProcess(pid=%d) failed: %d\n",
|
||||
DETOUR_TRACE(("OpenProcess(pid=%lx) failed: %lx\n",
|
||||
s_pHelper->pid, GetLastError()));
|
||||
Result = 9901;
|
||||
goto Cleanup;
|
||||
|
@ -1008,7 +1008,7 @@ VOID CALLBACK DetourFinishHelperProcess(_In_ HWND,
|
|||
}
|
||||
|
||||
if (!DetourUpdateProcessWithDll(hProcess, rlpDlls, s_pHelper->nDlls)) {
|
||||
DETOUR_TRACE(("DetourUpdateProcessWithDll(pid=%d) failed: %d\n",
|
||||
DETOUR_TRACE(("DetourUpdateProcessWithDll(pid=%lx) failed: %lx\n",
|
||||
s_pHelper->pid, GetLastError()));
|
||||
Result = 9903;
|
||||
goto Cleanup;
|
||||
|
@ -1184,7 +1184,7 @@ BOOL WINAPI DetourProcessViaHelperDllsA(_In_ DWORD dwTargetPid,
|
|||
HRESULT hr;
|
||||
DWORD nLen = GetEnvironmentVariableA("WINDIR", szExe, ARRAYSIZE(szExe));
|
||||
|
||||
DETOUR_TRACE(("DetourProcessViaHelperDlls(pid=%d,dlls=%d)\n", dwTargetPid, nDlls));
|
||||
DETOUR_TRACE(("DetourProcessViaHelperDlls(pid=%lx,dlls=%lx)\n", dwTargetPid, nDlls));
|
||||
if (nDlls < 1 || nDlls > 4096) {
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
goto Cleanup;
|
||||
|
@ -1229,7 +1229,7 @@ BOOL WINAPI DetourProcessViaHelperDllsA(_In_ DWORD dwTargetPid,
|
|||
if (!DetourCopyPayloadToProcess(pi.hProcess,
|
||||
DETOUR_EXE_HELPER_GUID,
|
||||
helper, helper->cb)) {
|
||||
DETOUR_TRACE(("DetourCopyPayloadToProcess failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("DetourCopyPayloadToProcess failed: %lx\n", GetLastError()));
|
||||
TerminateProcess(pi.hProcess, ~0u);
|
||||
CloseHandle(pi.hProcess);
|
||||
CloseHandle(pi.hThread);
|
||||
|
@ -1246,13 +1246,13 @@ BOOL WINAPI DetourProcessViaHelperDllsA(_In_ DWORD dwTargetPid,
|
|||
CloseHandle(pi.hThread);
|
||||
|
||||
if (dwResult != 0) {
|
||||
DETOUR_TRACE(("Rundll32.exe failed: result=%d\n", dwResult));
|
||||
DETOUR_TRACE(("Rundll32.exe failed: result=%lx\n", dwResult));
|
||||
goto Cleanup;
|
||||
}
|
||||
Result = TRUE;
|
||||
}
|
||||
else {
|
||||
DETOUR_TRACE(("CreateProcess failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("CreateProcess failed: %lx\n", GetLastError()));
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
|
@ -1284,7 +1284,7 @@ BOOL WINAPI DetourProcessViaHelperDllsW(_In_ DWORD dwTargetPid,
|
|||
int cchWrittenWideChar;
|
||||
DWORD nLen = GetEnvironmentVariableW(L"WINDIR", szExe, ARRAYSIZE(szExe));
|
||||
|
||||
DETOUR_TRACE(("DetourProcessViaHelperDlls(pid=%d,dlls=%d)\n", dwTargetPid, nDlls));
|
||||
DETOUR_TRACE(("DetourProcessViaHelperDlls(pid=%lx,dlls=%lx)\n", dwTargetPid, nDlls));
|
||||
if (nDlls < 1 || nDlls > 4096) {
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
goto Cleanup;
|
||||
|
@ -1334,7 +1334,7 @@ BOOL WINAPI DetourProcessViaHelperDllsW(_In_ DWORD dwTargetPid,
|
|||
if (!DetourCopyPayloadToProcess(pi.hProcess,
|
||||
DETOUR_EXE_HELPER_GUID,
|
||||
helper, helper->cb)) {
|
||||
DETOUR_TRACE(("DetourCopyPayloadToProcess failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("DetourCopyPayloadToProcess failed: %lx\n", GetLastError()));
|
||||
TerminateProcess(pi.hProcess, ~0u);
|
||||
CloseHandle(pi.hProcess);
|
||||
CloseHandle(pi.hThread);
|
||||
|
@ -1351,13 +1351,13 @@ BOOL WINAPI DetourProcessViaHelperDllsW(_In_ DWORD dwTargetPid,
|
|||
CloseHandle(pi.hThread);
|
||||
|
||||
if (dwResult != 0) {
|
||||
DETOUR_TRACE(("Rundll32.exe failed: result=%d\n", dwResult));
|
||||
DETOUR_TRACE(("Rundll32.exe failed: result=%lx\n", dwResult));
|
||||
goto Cleanup;
|
||||
}
|
||||
Result = TRUE;
|
||||
}
|
||||
else {
|
||||
DETOUR_TRACE(("CreateProcess failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("CreateProcess failed: %lx\n", GetLastError()));
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ inline void detour_find_jmp_bounds(PBYTE pbCode,
|
|||
// We have to place trampolines within +/- 2GB of code.
|
||||
ULONG_PTR lo = detour_2gb_below((ULONG_PTR)pbCode);
|
||||
ULONG_PTR hi = detour_2gb_above((ULONG_PTR)pbCode);
|
||||
DETOUR_TRACE(("[%p..%p..%p]\n", lo, pbCode, hi));
|
||||
DETOUR_TRACE(("[%p..%p..%p]\n", (PVOID)lo, pbCode, (PVOID)hi));
|
||||
|
||||
// And, within +/- 2GB of relative jmp targets.
|
||||
if (pbCode[0] == 0xe9) { // jmp +imm32
|
||||
|
@ -198,7 +198,7 @@ inline void detour_find_jmp_bounds(PBYTE pbCode,
|
|||
else {
|
||||
lo = detour_2gb_below((ULONG_PTR)pbNew);
|
||||
}
|
||||
DETOUR_TRACE(("[%p..%p..%p] +imm32\n", lo, pbCode, hi));
|
||||
DETOUR_TRACE(("[%p..%p..%p] +imm32\n", (PVOID)lo, pbCode, (PVOID)hi));
|
||||
}
|
||||
|
||||
*ppLower = (PDETOUR_TRAMPOLINE)lo;
|
||||
|
@ -399,7 +399,7 @@ inline void detour_find_jmp_bounds(PBYTE pbCode,
|
|||
// We have to place trampolines within +/- 2GB of code.
|
||||
ULONG_PTR lo = detour_2gb_below((ULONG_PTR)pbCode);
|
||||
ULONG_PTR hi = detour_2gb_above((ULONG_PTR)pbCode);
|
||||
DETOUR_TRACE(("[%p..%p..%p]\n", lo, pbCode, hi));
|
||||
DETOUR_TRACE(("[%p..%p..%p]\n", (PVOID)lo, pbCode, (PVOID)hi));
|
||||
|
||||
// And, within +/- 2GB of relative jmp vectors.
|
||||
if (pbCode[0] == 0xff && pbCode[1] == 0x25) { // jmp [+imm32]
|
||||
|
@ -411,7 +411,7 @@ inline void detour_find_jmp_bounds(PBYTE pbCode,
|
|||
else {
|
||||
lo = detour_2gb_below((ULONG_PTR)pbNew);
|
||||
}
|
||||
DETOUR_TRACE(("[%p..%p..%p] [+imm32]\n", lo, pbCode, hi));
|
||||
DETOUR_TRACE(("[%p..%p..%p] [+imm32]\n", (PVOID)lo, pbCode, (PVOID)hi));
|
||||
}
|
||||
// And, within +/- 2GB of relative jmp targets.
|
||||
else if (pbCode[0] == 0xe9) { // jmp +imm32
|
||||
|
@ -423,7 +423,7 @@ inline void detour_find_jmp_bounds(PBYTE pbCode,
|
|||
else {
|
||||
lo = detour_2gb_below((ULONG_PTR)pbNew);
|
||||
}
|
||||
DETOUR_TRACE(("[%p..%p..%p] +imm32\n", lo, pbCode, hi));
|
||||
DETOUR_TRACE(("[%p..%p..%p] +imm32\n", (PVOID)lo, pbCode, (PVOID)hi));
|
||||
}
|
||||
|
||||
*ppLower = (PDETOUR_TRAMPOLINE)lo;
|
||||
|
@ -818,7 +818,7 @@ inline void detour_find_jmp_bounds(PBYTE pbCode,
|
|||
// We have to place trampolines within +/- 2GB of code.
|
||||
ULONG_PTR lo = detour_2gb_below((ULONG_PTR)pbCode);
|
||||
ULONG_PTR hi = detour_2gb_above((ULONG_PTR)pbCode);
|
||||
DETOUR_TRACE(("[%p..%p..%p]\n", lo, pbCode, hi));
|
||||
DETOUR_TRACE(("[%p..%p..%p]\n", (PVOID)lo, pbCode, (PVOID)hi));
|
||||
|
||||
*ppLower = (PDETOUR_TRAMPOLINE)lo;
|
||||
*ppUpper = (PDETOUR_TRAMPOLINE)hi;
|
||||
|
@ -1124,7 +1124,7 @@ inline void detour_find_jmp_bounds(PBYTE pbCode,
|
|||
|
||||
ULONG_PTR lo = detour_2gb_below((ULONG_PTR)pbCode);
|
||||
ULONG_PTR hi = detour_2gb_above((ULONG_PTR)pbCode);
|
||||
DETOUR_TRACE(("[%p..%p..%p]\n", lo, pbCode, hi));
|
||||
DETOUR_TRACE(("[%p..%p..%p]\n", (PVOID)lo, pbCode, (PVOID)hi));
|
||||
|
||||
*ppLower = (PDETOUR_TRAMPOLINE)lo;
|
||||
*ppUpper = (PDETOUR_TRAMPOLINE)hi;
|
||||
|
@ -1237,7 +1237,7 @@ static PVOID detour_alloc_region_from_lo(PBYTE pbLo, PBYTE pbHi)
|
|||
break;
|
||||
}
|
||||
|
||||
DETOUR_TRACE((" Try %p => %p..%p %6x\n",
|
||||
DETOUR_TRACE((" Try %p => %p..%p %6lx\n",
|
||||
pbTry,
|
||||
mbi.BaseAddress,
|
||||
(PBYTE)mbi.BaseAddress + mbi.RegionSize - 1,
|
||||
|
@ -1287,7 +1287,7 @@ static PVOID detour_alloc_region_from_hi(PBYTE pbLo, PBYTE pbHi)
|
|||
break;
|
||||
}
|
||||
|
||||
DETOUR_TRACE((" Try %p => %p..%p %6x\n",
|
||||
DETOUR_TRACE((" Try %p => %p..%p %6lx\n",
|
||||
pbTry,
|
||||
mbi.BaseAddress,
|
||||
(PBYTE)mbi.BaseAddress + mbi.RegionSize - 1,
|
||||
|
@ -1704,7 +1704,7 @@ LONG WINAPI DetourTransactionCommitEx(_Out_opt_ PVOID **pppFailedPointer)
|
|||
#endif // DETOURS_ARM
|
||||
}
|
||||
else {
|
||||
DETOUR_TRACE(("detours: pbTramp =%p, pbRemain=%p, pbDetour=%p, cbRestore=%d\n",
|
||||
DETOUR_TRACE(("detours: pbTramp =%p, pbRemain=%p, pbDetour=%p, cbRestore=%x\n",
|
||||
o->pTrampoline,
|
||||
o->pTrampoline->pbRemain,
|
||||
o->pTrampoline->pbDetour,
|
||||
|
@ -1996,13 +1996,13 @@ LONG WINAPI DetourAttachEx(_Inout_ PVOID *ppPointer,
|
|||
}
|
||||
|
||||
if (s_nPendingThreadId != (LONG)GetCurrentThreadId()) {
|
||||
DETOUR_TRACE(("transaction conflict with thread id=%d\n", s_nPendingThreadId));
|
||||
DETOUR_TRACE(("transaction conflict with thread id=%ld\n", s_nPendingThreadId));
|
||||
return ERROR_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
// If any of the pending operations failed, then we don't need to do this.
|
||||
if (s_nPendingError != NO_ERROR) {
|
||||
DETOUR_TRACE(("pending transaction error=%d\n", s_nPendingError));
|
||||
DETOUR_TRACE(("pending transaction error=%ld\n", s_nPendingError));
|
||||
return s_nPendingError;
|
||||
}
|
||||
|
||||
|
@ -2183,7 +2183,7 @@ LONG WINAPI DetourAttachEx(_Inout_ PVOID *ppPointer,
|
|||
pTrampoline->rAlign[n].obTrampoline == 0) {
|
||||
break;
|
||||
}
|
||||
DETOUR_TRACE((" %d/%d",
|
||||
DETOUR_TRACE((" %x/%x",
|
||||
pTrampoline->rAlign[n].obTarget,
|
||||
pTrampoline->rAlign[n].obTrampoline
|
||||
));
|
||||
|
|
|
@ -160,7 +160,7 @@ PVOID WINAPI DetourFindFunction(_In_ LPCSTR pszModule,
|
|||
DETOUR_TRACE(("DetourFindFunction(%hs, %hs)\n", pszModule, pszFunction));
|
||||
PDETOUR_SYM_INFO pSymInfo = DetourLoadImageHlp();
|
||||
if (pSymInfo == NULL) {
|
||||
DETOUR_TRACE(("DetourLoadImageHlp failed: %d\n",
|
||||
DETOUR_TRACE(("DetourLoadImageHlp failed: %lx\n",
|
||||
GetLastError()));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ PVOID WINAPI DetourFindFunction(_In_ LPCSTR pszModule,
|
|||
(PCHAR)pszModule, NULL,
|
||||
(DWORD64)hModule, 0) == 0) {
|
||||
if (ERROR_SUCCESS != GetLastError()) {
|
||||
DETOUR_TRACE(("SymLoadModule64(%p) failed: %d\n",
|
||||
DETOUR_TRACE(("SymLoadModule64(%p) failed: %lx\n",
|
||||
pSymInfo->hProcess, GetLastError()));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -181,24 +181,24 @@ PVOID WINAPI DetourFindFunction(_In_ LPCSTR pszModule,
|
|||
ZeroMemory(&modinfo, sizeof(modinfo));
|
||||
modinfo.SizeOfStruct = sizeof(modinfo);
|
||||
if (!pSymInfo->pfSymGetModuleInfo64(pSymInfo->hProcess, (DWORD64)hModule, &modinfo)) {
|
||||
DETOUR_TRACE(("SymGetModuleInfo64(%p, %p) failed: %d\n",
|
||||
DETOUR_TRACE(("SymGetModuleInfo64(%p, %p) failed: %lx\n",
|
||||
pSymInfo->hProcess, hModule, GetLastError()));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hrRet = StringCchCopyA(szFullName, sizeof(szFullName)/sizeof(CHAR), modinfo.ModuleName);
|
||||
if (FAILED(hrRet)) {
|
||||
DETOUR_TRACE(("StringCchCopyA failed: %08x\n", hrRet));
|
||||
DETOUR_TRACE(("StringCchCopyA failed: %08lx\n", hrRet));
|
||||
return NULL;
|
||||
}
|
||||
hrRet = StringCchCatA(szFullName, sizeof(szFullName)/sizeof(CHAR), "!");
|
||||
if (FAILED(hrRet)) {
|
||||
DETOUR_TRACE(("StringCchCatA failed: %08x\n", hrRet));
|
||||
DETOUR_TRACE(("StringCchCatA failed: %08lx\n", hrRet));
|
||||
return NULL;
|
||||
}
|
||||
hrRet = StringCchCatA(szFullName, sizeof(szFullName)/sizeof(CHAR), pszFunction);
|
||||
if (FAILED(hrRet)) {
|
||||
DETOUR_TRACE(("StringCchCatA failed: %08x\n", hrRet));
|
||||
DETOUR_TRACE(("StringCchCatA failed: %08lx\n", hrRet));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ PVOID WINAPI DetourFindFunction(_In_ LPCSTR pszModule,
|
|||
#endif
|
||||
|
||||
if (!pSymInfo->pfSymFromName(pSymInfo->hProcess, szFullName, &symbol)) {
|
||||
DETOUR_TRACE(("SymFromName(%hs) failed: %d\n", szFullName, GetLastError()));
|
||||
DETOUR_TRACE(("SymFromName(%hs) failed: %lx\n", szFullName, GetLastError()));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ static BOOL UPDATE_IMPORTS_XX(HANDLE hProcess,
|
|||
if (!ReadProcessMemory(hProcess, pbModule, &idh, sizeof(idh), &cbRead)
|
||||
|| cbRead < sizeof(idh)) {
|
||||
|
||||
DETOUR_TRACE(("ReadProcessMemory(idh@%p..%p) failed: %d\n",
|
||||
DETOUR_TRACE(("ReadProcessMemory(idh@%p..%p) failed: %lx\n",
|
||||
pbModule, pbModule + sizeof(idh), GetLastError()));
|
||||
|
||||
finish:
|
||||
|
@ -51,7 +51,7 @@ static BOOL UPDATE_IMPORTS_XX(HANDLE hProcess,
|
|||
|
||||
if (!ReadProcessMemory(hProcess, pbModule + idh.e_lfanew, &inh, sizeof(inh), &cbRead)
|
||||
|| cbRead < sizeof(inh)) {
|
||||
DETOUR_TRACE(("ReadProcessMemory(inh@%p..%p) failed: %d\n",
|
||||
DETOUR_TRACE(("ReadProcessMemory(inh@%p..%p) failed: %lx\n",
|
||||
pbModule + idh.e_lfanew,
|
||||
pbModule + idh.e_lfanew + sizeof(inh),
|
||||
GetLastError()));
|
||||
|
@ -82,14 +82,14 @@ static BOOL UPDATE_IMPORTS_XX(HANDLE hProcess,
|
|||
sizeof(ish), &cbRead)
|
||||
|| cbRead < sizeof(ish)) {
|
||||
|
||||
DETOUR_TRACE(("ReadProcessMemory(ish@%p..%p) failed: %d\n",
|
||||
DETOUR_TRACE(("ReadProcessMemory(ish@%p..%p) failed: %lx\n",
|
||||
pbModule + dwSec + sizeof(ish) * i,
|
||||
pbModule + dwSec + sizeof(ish) * (i + 1),
|
||||
GetLastError()));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
DETOUR_TRACE(("ish[%d] : va=%08x sr=%d\n", i, ish.VirtualAddress, ish.SizeOfRawData));
|
||||
DETOUR_TRACE(("ish[%lx] : va=%08lx sr=%lx\n", i, ish.VirtualAddress, ish.SizeOfRawData));
|
||||
|
||||
// If the linker didn't suggest an IAT in the data directories, the
|
||||
// loader will look for the section of the import directory to be used
|
||||
|
@ -117,7 +117,7 @@ static BOOL UPDATE_IMPORTS_XX(HANDLE hProcess,
|
|||
do {
|
||||
IMAGE_IMPORT_DESCRIPTOR ImageImport;
|
||||
if (!ReadProcessMemory(hProcess, pImageImport, &ImageImport, sizeof(ImageImport), NULL)) {
|
||||
DETOUR_TRACE(("ReadProcessMemory failed: %u\n", GetLastError()));
|
||||
DETOUR_TRACE(("ReadProcessMemory failed: %lx\n", GetLastError()));
|
||||
goto finish;
|
||||
}
|
||||
inh.IMPORT_DIRECTORY.Size += sizeof(IMAGE_IMPORT_DESCRIPTOR);
|
||||
|
@ -136,8 +136,8 @@ static BOOL UPDATE_IMPORTS_XX(HANDLE hProcess,
|
|||
}
|
||||
|
||||
DETOUR_TRACE((" Imports: %p..%p\n",
|
||||
(DWORD_PTR)pbModule + inh.IMPORT_DIRECTORY.VirtualAddress,
|
||||
(DWORD_PTR)pbModule + inh.IMPORT_DIRECTORY.VirtualAddress +
|
||||
pbModule + inh.IMPORT_DIRECTORY.VirtualAddress,
|
||||
pbModule + inh.IMPORT_DIRECTORY.VirtualAddress +
|
||||
inh.IMPORT_DIRECTORY.Size));
|
||||
|
||||
DWORD nOldDlls = inh.IMPORT_DIRECTORY.Size / sizeof(IMAGE_IMPORT_DESCRIPTOR);
|
||||
|
@ -186,7 +186,7 @@ static BOOL UPDATE_IMPORTS_XX(HANDLE hProcess,
|
|||
|
||||
if (inh.IMPORT_DIRECTORY.VirtualAddress != 0) {
|
||||
// Read the old import directory if it exists.
|
||||
DETOUR_TRACE(("IMPORT_DIRECTORY perms=%x\n", dwProtect));
|
||||
DETOUR_TRACE(("IMPORT_DIRECTORY perms=%lx\n", dwProtect));
|
||||
|
||||
if (!ReadProcessMemory(hProcess,
|
||||
pbModule + inh.IMPORT_DIRECTORY.VirtualAddress,
|
||||
|
@ -194,7 +194,7 @@ static BOOL UPDATE_IMPORTS_XX(HANDLE hProcess,
|
|||
nOldDlls * sizeof(IMAGE_IMPORT_DESCRIPTOR), &cbRead)
|
||||
|| cbRead < nOldDlls * sizeof(IMAGE_IMPORT_DESCRIPTOR)) {
|
||||
|
||||
DETOUR_TRACE(("ReadProcessMemory(imports) failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("ReadProcessMemory(imports) failed: %lx\n", GetLastError()));
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ static BOOL UPDATE_IMPORTS_XX(HANDLE hProcess,
|
|||
for (n = 0; n < nDlls; n++) {
|
||||
HRESULT hrRet = StringCchCopyA((char*)pbNew + obStr, cbNew - obStr, plpDlls[n]);
|
||||
if (FAILED(hrRet)) {
|
||||
DETOUR_TRACE(("StringCchCopyA failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("StringCchCopyA failed: %lx\n", GetLastError()));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ static BOOL UPDATE_IMPORTS_XX(HANDLE hProcess,
|
|||
cbNew - obStr,
|
||||
DETOURS_STRINGIFY(DETOURS_BITS_XX));
|
||||
if (FAILED(hrRet)) {
|
||||
DETOUR_TRACE(("ReplaceOptionalSizeA failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("ReplaceOptionalSizeA failed: %lx\n", GetLastError()));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
@ -253,14 +253,14 @@ static BOOL UPDATE_IMPORTS_XX(HANDLE hProcess,
|
|||
#endif
|
||||
|
||||
if (!WriteProcessMemory(hProcess, pbNewIid, pbNew, obStr, NULL)) {
|
||||
DETOUR_TRACE(("WriteProcessMemory(iid) failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("WriteProcessMemory(iid) failed: %lx\n", GetLastError()));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
DETOUR_TRACE(("obBaseBef = %08x..%08x\n",
|
||||
DETOUR_TRACE(("obBaseBef = %08lx..%08lx\n",
|
||||
inh.IMPORT_DIRECTORY.VirtualAddress,
|
||||
inh.IMPORT_DIRECTORY.VirtualAddress + inh.IMPORT_DIRECTORY.Size));
|
||||
DETOUR_TRACE(("obBaseAft = %08x..%08x\n", obBase, obBase + obStr));
|
||||
DETOUR_TRACE(("obBaseAft = %08lx..%08lx\n", obBase, obBase + obStr));
|
||||
|
||||
// In this case the file didn't have an import directory in first place,
|
||||
// so we couldn't fix the missing IAT above. We still need to explicitly
|
||||
|
@ -278,20 +278,20 @@ static BOOL UPDATE_IMPORTS_XX(HANDLE hProcess,
|
|||
//
|
||||
if (!DetourVirtualProtectSameExecuteEx(hProcess, pbModule, inh.OptionalHeader.SizeOfHeaders,
|
||||
PAGE_EXECUTE_READWRITE, &dwProtect)) {
|
||||
DETOUR_TRACE(("VirtualProtectEx(inh) write failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("VirtualProtectEx(inh) write failed: %lx\n", GetLastError()));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
inh.OptionalHeader.CheckSum = 0;
|
||||
|
||||
if (!WriteProcessMemory(hProcess, pbModule, &idh, sizeof(idh), NULL)) {
|
||||
DETOUR_TRACE(("WriteProcessMemory(idh) failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("WriteProcessMemory(idh) failed: %lx\n", GetLastError()));
|
||||
goto finish;
|
||||
}
|
||||
DETOUR_TRACE(("WriteProcessMemory(idh:%p..%p)\n", pbModule, pbModule + sizeof(idh)));
|
||||
|
||||
if (!WriteProcessMemory(hProcess, pbModule + idh.e_lfanew, &inh, sizeof(inh), NULL)) {
|
||||
DETOUR_TRACE(("WriteProcessMemory(inh) failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("WriteProcessMemory(inh) failed: %lx\n", GetLastError()));
|
||||
goto finish;
|
||||
}
|
||||
DETOUR_TRACE(("WriteProcessMemory(inh:%p..%p)\n",
|
||||
|
@ -300,7 +300,7 @@ static BOOL UPDATE_IMPORTS_XX(HANDLE hProcess,
|
|||
|
||||
if (!VirtualProtectEx(hProcess, pbModule, inh.OptionalHeader.SizeOfHeaders,
|
||||
dwProtect, &dwProtect)) {
|
||||
DETOUR_TRACE(("VirtualProtectEx(idh) restore failed: %d\n", GetLastError()));
|
||||
DETOUR_TRACE(("VirtualProtectEx(idh) restore failed: %lx\n", GetLastError()));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,6 +100,12 @@ DETOURS_OPTION_BITS=64
|
|||
|
||||
##############################################################################
|
||||
##
|
||||
!IF "$(DETOURS_CONFIG)" == "Debug"
|
||||
DETOURS_DEBUG=1
|
||||
!ELSE
|
||||
DETOURS_DEBUG=0
|
||||
!ENDIF
|
||||
|
||||
INCD = $(ROOT)\include
|
||||
LIBD = $(ROOT)\lib.$(DETOURS_TARGET_PROCESSOR)$(DETOURS_CONFIG)
|
||||
BIND = $(ROOT)\bin.$(DETOURS_TARGET_PROCESSOR)$(DETOURS_CONFIG)
|
||||
|
|
Загрузка…
Ссылка в новой задаче