diff options
author | Andrzej Janik <[email protected]> | 2021-01-03 17:54:01 +0100 |
---|---|---|
committer | Andrzej Janik <[email protected]> | 2021-01-03 17:54:01 +0100 |
commit | 4b96dbc8f49c5ae00c96935e0b576df88a5d8af9 (patch) | |
tree | a2430c8c89c87120addf59f862fd55120cf2dd31 | |
parent | dabc40cb19bf4e297c32284d26c74adbd6775e49 (diff) | |
download | ZLUDA-4b96dbc8f49c5ae00c96935e0b576df88a5d8af9.tar.gz ZLUDA-4b96dbc8f49c5ae00c96935e0b576df88a5d8af9.zip |
Squashed 'ext/detours/' changes from 39aa864..36b69b9
36b69b9 Make Detours MinGW Clang-compatible
git-subtree-dir: ext/detours
git-subtree-split: 36b69b971888b2ca0c5913563bae011efaa4a42e
-rw-r--r-- | src/creatwth.cpp | 1 | ||||
-rw-r--r-- | src/detours.h | 19 | ||||
-rw-r--r-- | src/image.cpp | 4 | ||||
-rw-r--r-- | src/modules.cpp | 4 |
4 files changed, 7 insertions, 21 deletions
diff --git a/src/creatwth.cpp b/src/creatwth.cpp index f7b51f4..abcba4f 100644 --- a/src/creatwth.cpp +++ b/src/creatwth.cpp @@ -11,6 +11,7 @@ #define DETOURS_INTERNAL #include "detours.h" #include <stddef.h> +#include <strsafe.h> #if DETOURS_VERSION != 0x4c0c1 // 0xMAJORcMINORcPATCH #error detours.h version mismatch diff --git a/src/detours.h b/src/detours.h index c08b6f1..4ebc644 100644 --- a/src/detours.h +++ b/src/detours.h @@ -118,11 +118,6 @@ ////////////////////////////////////////////////////////////////////////////// // -#if (_MSC_VER < 1299) -typedef LONG LONG_PTR; -typedef ULONG ULONG_PTR; -#endif - ///////////////////////////////////////////////// SAL 2.0 Annotations w/o SAL. // // These definitions are include so that Detours will build even if the @@ -846,24 +841,10 @@ VOID CALLBACK DetourFinishHelperProcess(_In_ HWND, ////////////////////////////////////////////////////////////////////////////// // -#if (_MSC_VER < 1299) -#include <imagehlp.h> -typedef IMAGEHLP_MODULE IMAGEHLP_MODULE64; -typedef PIMAGEHLP_MODULE PIMAGEHLP_MODULE64; -typedef IMAGEHLP_SYMBOL SYMBOL_INFO; -typedef PIMAGEHLP_SYMBOL PSYMBOL_INFO; - -static inline -LONG InterlockedCompareExchange(_Inout_ LONG *ptr, _In_ LONG nval, _In_ LONG oval) -{ - return (LONG)::InterlockedCompareExchange((PVOID*)ptr, (PVOID)nval, (PVOID)oval); -} -#else #pragma warning(push) #pragma warning(disable:4091) // empty typedef #include <dbghelp.h> #pragma warning(pop) -#endif #ifdef IMAGEAPI // defined by DBGHELP.H typedef LPAPI_VERSION (NTAPI *PF_ImagehlpApiVersionEx)(_In_ LPAPI_VERSION AppVersion); diff --git a/src/image.cpp b/src/image.cpp index 96282d2..1599d2e 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -146,6 +146,8 @@ protected: DWORD m_cbAlloc; }; +class CImageImportName; + class CImageImportFile { friend class CImage; @@ -1693,7 +1695,7 @@ BOOL CImage::Write(HANDLE hFile) m_nNextFileAddr = Max(m_SectionHeaders[n].PointerToRawData + m_SectionHeaders[n].SizeOfRawData, m_nNextFileAddr); - // Old images have VirtualSize == 0 as a matter of course, e.g. NT 3.1.
+ // Old images have VirtualSize == 0 as a matter of course, e.g. NT 3.1. // In which case, use SizeOfRawData instead. m_nNextVirtAddr = Max(m_SectionHeaders[n].VirtualAddress + (m_SectionHeaders[n].Misc.VirtualSize diff --git a/src/modules.cpp b/src/modules.cpp index a797121..8b2b25e 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -12,6 +12,8 @@ // #define DETOUR_DEBUG 1 #define DETOURS_INTERNAL #include "detours.h" +#include <strsafe.h> +#include <libloaderapi.h> #if DETOURS_VERSION != 0x4c0c1 // 0xMAJORcMINORcPATCH #error detours.h version mismatch @@ -340,7 +342,7 @@ PVOID WINAPI DetourGetEntryPoint(_In_opt_ HMODULE hModule) } SetLastError(NO_ERROR); - return GetProcAddress(hClr, "_CorExeMain"); + return (PVOID)GetProcAddress(hClr, "_CorExeMain"); } SetLastError(NO_ERROR); |