Skip to content

Commit 04472fc

Browse files
authored
Maintenance: Fix Compiler Warnings (microsoft#192)
Closes microsoft#188 and microsoft#189
1 parent 6782fe6 commit 04472fc

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/creatwth.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,7 @@ BOOL WINAPI DetourProcessViaHelperDllsW(_In_ DWORD dwTargetPid,
14361436
PDETOUR_EXE_HELPER helper = NULL;
14371437
HRESULT hr;
14381438
WCHAR szDllName[MAX_PATH];
1439-
int cchWrittenWideChar;
1439+
unsigned int cchWrittenWideChar;
14401440
DWORD nLen = GetEnvironmentVariableW(L"WINDIR", szExe, ARRAYSIZE(szExe));
14411441

14421442
DETOUR_TRACE(("DetourProcessViaHelperDlls(pid=%lu,dlls=%lu)\n", dwTargetPid, nDlls));

src/detours.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ static BOOL detour_is_region_empty(PDETOUR_REGION pRegion)
14661466

14671467
// Stop if any of the trampolines aren't free.
14681468
PDETOUR_TRAMPOLINE pTrampoline = ((PDETOUR_TRAMPOLINE)pRegion) + 1;
1469-
for (int i = 0; i < DETOUR_TRAMPOLINES_PER_REGION; i++) {
1469+
for (ULONG i = 0; i < DETOUR_TRAMPOLINES_PER_REGION; i++) {
14701470
if (pTrampoline[i].pbRemain != NULL &&
14711471
(pTrampoline[i].pbRemain < pbRegionBeg ||
14721472
pTrampoline[i].pbRemain >= pbRegionLim)) {
@@ -1637,7 +1637,7 @@ LONG WINAPI DetourTransactionCommit()
16371637

16381638
static BYTE detour_align_from_trampoline(PDETOUR_TRAMPOLINE pTrampoline, BYTE obTrampoline)
16391639
{
1640-
for (LONG n = 0; n < ARRAYSIZE(pTrampoline->rAlign); n++) {
1640+
for (ULONG n = 0; n < ARRAYSIZE(pTrampoline->rAlign); n++) {
16411641
if (pTrampoline->rAlign[n].obTrampoline == obTrampoline) {
16421642
return pTrampoline->rAlign[n].obTarget;
16431643
}
@@ -1647,7 +1647,7 @@ static BYTE detour_align_from_trampoline(PDETOUR_TRAMPOLINE pTrampoline, BYTE ob
16471647

16481648
static LONG detour_align_from_target(PDETOUR_TRAMPOLINE pTrampoline, LONG obTarget)
16491649
{
1650-
for (LONG n = 0; n < ARRAYSIZE(pTrampoline->rAlign); n++) {
1650+
for (ULONG n = 0; n < ARRAYSIZE(pTrampoline->rAlign); n++) {
16511651
if (pTrampoline->rAlign[n].obTarget == obTarget) {
16521652
return pTrampoline->rAlign[n].obTrampoline;
16531653
}
@@ -2425,7 +2425,7 @@ LONG WINAPI DetourDetach(_Inout_ PVOID *ppPointer,
24252425
//
24262426
LONG cbTarget = pTrampoline->cbRestore;
24272427
PBYTE pbTarget = pTrampoline->pbRemain - cbTarget;
2428-
if (cbTarget == 0 || cbTarget > sizeof(pTrampoline->rbCode)) {
2428+
if (cbTarget == 0 || pTrampoline->cbRestore > sizeof(pTrampoline->rbCode)) {
24292429
error = ERROR_INVALID_BLOCK;
24302430
if (s_fIgnoreTooSmall) {
24312431
goto stop;

src/disasm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,10 @@ class CDetourDis
295295
BOOL m_bOperandOverride;
296296
BOOL m_bAddressOverride;
297297
BOOL m_bRaxOverride; // AMD64 only
298-
BOOL m_bVex;
299-
BOOL m_bEvex;
300298
BOOL m_bF2;
301299
BOOL m_bF3; // x86 only
300+
BOOL m_bVex;
301+
BOOL m_bEvex;
302302
BYTE m_nSegmentOverride;
303303

304304
PBYTE * m_ppbTarget;

0 commit comments

Comments
 (0)