зеркало из https://github.com/microsoft/Detours.git
Maintenance: Clean up some compiler warnings (#166)
Spotted with MinGW32 g++ * `uimports.cpp`: `IMAGE_DATA_DIRECTORY.VirtualAddress` is a `DWORD` type, not a pointer type, so compare against a scalar type. * `creatwth.cpp`: `LoadNtHeaderFromProcess` returns a `BOOL`, so compare with falsey check. ```sh i686-w64-mingw32-g++ -c -Wall -Wextra -Wpedantic ./creatwth.cpp # In file included from ./creatwth.cpp:329: # ./uimports.cpp: In function 'BOOL UpdateImports32(HANDLE, HMODULE, const CHAR**, DWORD)': # ./uimports.cpp:109:48: warning: NULL used in arithmetic [-Wpointer-arith] # 109 | if (inh.IMPORT_DIRECTORY.VirtualAddress != NULL && inh.IMPORT_DIRECTORY.Size == 0) { # | ^~~~ # ./creatwth.cpp: In function 'BOOL DetourUpdateProcessWithDllEx(HANDLE, HMODULE, BOOL, const CHAR**, DWORD)': # ./creatwth.cpp:624:80: warning: NULL used in arithmetic [-Wpointer-arith] # 624 | if (hModule == NULL || LoadNtHeaderFromProcess(hProcess, hModule, &inh) == NULL) { # | ^~~~ ```
This commit is contained in:
Родитель
8be832ee51
Коммит
99ac5f9162
|
@ -621,7 +621,7 @@ BOOL WINAPI DetourUpdateProcessWithDllEx(_In_ HANDLE hProcess,
|
||||||
|
|
||||||
IMAGE_NT_HEADERS32 inh;
|
IMAGE_NT_HEADERS32 inh;
|
||||||
|
|
||||||
if (hModule == NULL || LoadNtHeaderFromProcess(hProcess, hModule, &inh) == NULL) {
|
if (hModule == NULL || !LoadNtHeaderFromProcess(hProcess, hModule, &inh)) {
|
||||||
SetLastError(ERROR_INVALID_OPERATION);
|
SetLastError(ERROR_INVALID_OPERATION);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ static BOOL UPDATE_IMPORTS_XX(HANDLE hProcess,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inh.IMPORT_DIRECTORY.VirtualAddress != NULL && inh.IMPORT_DIRECTORY.Size == 0) {
|
if (inh.IMPORT_DIRECTORY.VirtualAddress == 0 && inh.IMPORT_DIRECTORY.Size == 0) {
|
||||||
|
|
||||||
// Don't worry about changing the PE file,
|
// Don't worry about changing the PE file,
|
||||||
// because the load information of the original PE header has been saved and will be restored.
|
// because the load information of the original PE header has been saved and will be restored.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче