Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some MSVC /W4 warnings #138

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hde/hde64.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

unsigned int hde64_disasm(const void *code, hde64s *hs)
{
uint8_t x, c, *p = (uint8_t *)code, cflags, opcode, pref = 0;
uint8_t x, c = 0, *p = (uint8_t *)code, cflags, opcode, pref = 0;
uint8_t *ht = hde64_table, m_mod, m_reg, m_rm, disp_size = 0;
uint8_t op64 = 0;

Expand Down
12 changes: 6 additions & 6 deletions src/hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ static MH_STATUS EnableHookLL(UINT pos, BOOL enable)
{
PJMP_REL_SHORT pShortJmp = (PJMP_REL_SHORT)pHook->pTarget;
pShortJmp->opcode = 0xEB;
pShortJmp->operand = (UINT8)(0 - (sizeof(JMP_REL_SHORT) + sizeof(JMP_REL)));
pShortJmp->operand = (UINT8)(UCHAR_MAX + 1ULL - (sizeof(JMP_REL_SHORT) + sizeof(JMP_REL)));
}
}
else
Expand All @@ -432,8 +432,8 @@ static MH_STATUS EnableHookLL(UINT pos, BOOL enable)
// Just-in-case measure.
FlushInstructionCache(GetCurrentProcess(), pPatchTarget, patchSize);

pHook->isEnabled = enable;
pHook->queueEnable = enable;
pHook->isEnabled = (UINT8)enable;
pHook->queueEnable = (UINT8)enable;

return MH_OK;
}
Expand Down Expand Up @@ -609,7 +609,7 @@ MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOrigina
pHook->pDetour = ct.pDetour;
#endif
pHook->pTrampoline = ct.pTrampoline;
pHook->patchAbove = ct.patchAbove;
pHook->patchAbove = (UINT8)ct.patchAbove;
pHook->isEnabled = FALSE;
pHook->queueEnable = FALSE;
pHook->nIP = ct.nIP;
Expand Down Expand Up @@ -793,14 +793,14 @@ static MH_STATUS QueueHook(LPVOID pTarget, BOOL queueEnable)
{
UINT i;
for (i = 0; i < g_hooks.size; ++i)
g_hooks.pItems[i].queueEnable = queueEnable;
g_hooks.pItems[i].queueEnable = (UINT8)queueEnable;
}
else
{
UINT pos = FindHookEntry(pTarget);
if (pos != INVALID_HOOK_POS)
{
g_hooks.pItems[pos].queueEnable = queueEnable;
g_hooks.pItems[pos].queueEnable = (UINT8)queueEnable;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/trampoline.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ BOOL CreateTrampolineFunction(PTRAMPOLINE ct)
#else
__movsb((LPBYTE)ct->pTrampoline + newPos, (LPBYTE)pCopySrc, copySize);
#endif
newPos += copySize;
newPos += (UINT8)copySize;
oldPos += hs.len;
} while (!finished);

Expand Down