Merge commit '4b96dbc8f49c5ae00c96935e0b576df88a5d8af9'

This commit is contained in:
Andrzej Janik 2021-01-03 17:54:01 +01:00
commit 659b2c6ec4
4 changed files with 7 additions and 21 deletions

View file

@ -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

View file

@ -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);

View file

@ -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

View file

@ -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);