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:
R. Elliott Childre 2021-01-26 21:35:07 -05:00 коммит произвёл GitHub
Родитель 8be832ee51
Коммит 99ac5f9162
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -621,7 +621,7 @@ BOOL WINAPI DetourUpdateProcessWithDllEx(_In_ HANDLE hProcess,
IMAGE_NT_HEADERS32 inh;
if (hModule == NULL || LoadNtHeaderFromProcess(hProcess, hModule, &inh) == NULL) {
if (hModule == NULL || !LoadNtHeaderFromProcess(hProcess, hModule, &inh)) {
SetLastError(ERROR_INVALID_OPERATION);
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,
// because the load information of the original PE header has been saved and will be restored.