Skip to content

Commit 2ad9cba

Browse files
author
common
committed
env/win32 - fix indenting and profiles for VirtualProtect and VirtualProtextEx
1 parent 935c83c commit 2ad9cba

File tree

1 file changed

+41
-37
lines changed

1 file changed

+41
-37
lines changed

src/environment/win32/env_w32_dll_export_kernel32_hooks.c

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,19 +1704,20 @@ int32_t env_w32_hook_VirtualProtect(struct emu_env *env, struct emu_env_hook *ho
17041704
uint32_t oldprotect;
17051705
POP_DWORD(c, &oldprotect);
17061706

1707-
uint32_t returnvalue;
1708-
if ( hook->hook.win->userhook != NULL )
1709-
{
1710-
returnvalue = hook->hook.win->userhook(env, hook, p_address, size, newprotect, oldprotect);
1711-
} else
1712-
{
1713-
returnvalue = 1;
1714-
}
1707+
uint32_t returnvalue;
1708+
if( hook->hook.win->userhook != NULL )
1709+
{
1710+
returnvalue = hook->hook.win->userhook(env, hook, p_address, size, newprotect, oldprotect);
1711+
} else
1712+
{
1713+
returnvalue = 1;
1714+
}
17151715

1716-
if (env->profile != NULL)
1716+
if( env->profile != NULL )
17171717
{
17181718
emu_profile_function_add(env->profile, "VirtualProtect");
17191719
emu_profile_argument_add_ptr(env->profile, "LPCVOID", "lpAddress", p_address);
1720+
emu_profile_argument_add_none(env->profile);
17201721
emu_profile_argument_add_int(env->profile, "DWORD" , "dwSize", size);
17211722
emu_profile_argument_add_int(env->profile, "DWORD" , "flNewProtect", newprotect);
17221723
emu_profile_argument_add_int(env->profile, "PDWORD" , "lpflOldProtectt", newprotect);
@@ -1729,15 +1730,16 @@ int32_t env_w32_hook_VirtualProtect(struct emu_env *env, struct emu_env_hook *ho
17291730
}
17301731

17311732

1733+
17321734
int32_t env_w32_hook_VirtualProtectEx(struct emu_env *env, struct emu_env_hook *hook)
17331735
{
1734-
logDebug(env->emu, "Hook me Captain Cook!\n");
1735-
logDebug(env->emu, "%s:%i %s\n",__FILE__,__LINE__,__FUNCTION__);
1736+
logDebug(env->emu, "Hook me Captain Cook!\n");
1737+
logDebug(env->emu, "%s:%i %s\n",__FILE__,__LINE__,__FUNCTION__);
17361738

1737-
struct emu_cpu *c = emu_cpu_get(env->emu);
1739+
struct emu_cpu *c = emu_cpu_get(env->emu);
17381740

1739-
uint32_t eip_save;
1740-
POP_DWORD(c, &eip_save);
1741+
uint32_t eip_save;
1742+
POP_DWORD(c, &eip_save);
17411743

17421744

17431745
/*
@@ -1752,40 +1754,42 @@ int32_t env_w32_hook_VirtualProtectEx(struct emu_env *env, struct emu_env_hook *
17521754
uint32_t h_process;
17531755
POP_DWORD(c, &h_process);
17541756

1755-
uint32_t p_address;
1756-
POP_DWORD(c, &p_address);
1757+
uint32_t p_address;
1758+
POP_DWORD(c, &p_address);
17571759

1758-
uint32_t size;
1759-
POP_DWORD(c, &size);
1760+
uint32_t size;
1761+
POP_DWORD(c, &size);
17601762

1761-
uint32_t newprotect;
1762-
POP_DWORD(c, &newprotect);
1763+
uint32_t newprotect;
1764+
POP_DWORD(c, &newprotect);
17631765

1764-
uint32_t oldprotect;
1765-
POP_DWORD(c, &oldprotect);
1766+
uint32_t oldprotect;
1767+
POP_DWORD(c, &oldprotect);
17661768

1767-
uint32_t returnvalue;
1768-
if ( hook->hook.win->userhook != NULL )
1769-
{
1770-
returnvalue = hook->hook.win->userhook(env, hook, p_address, size, newprotect, oldprotect);
1771-
} else
1772-
{
1773-
returnvalue = 1;
1774-
}
1769+
uint32_t returnvalue;
1770+
if( hook->hook.win->userhook != NULL )
1771+
{
1772+
returnvalue = hook->hook.win->userhook(env, hook, p_address, size, newprotect, oldprotect);
1773+
} else
1774+
{
1775+
returnvalue = 1;
1776+
}
17751777

1776-
if (env->profile != NULL)
1777-
{
1778+
if( env->profile != NULL )
1779+
{
17781780
emu_profile_function_add(env->profile, "VirtualProtectEx");
17791781
emu_profile_argument_add_ptr(env->profile, "HANDLE" , "hProcess", h_process);
1782+
emu_profile_argument_add_none(env->profile);
17801783
emu_profile_argument_add_ptr(env->profile, "LPCVOID", "lpAddress", p_address);
1784+
emu_profile_argument_add_none(env->profile);
17811785
emu_profile_argument_add_int(env->profile, "DWORD" , "dwSize", size);
17821786
emu_profile_argument_add_int(env->profile, "DWORD" , "flNewProtect", newprotect);
17831787
emu_profile_argument_add_int(env->profile, "PDWORD" , "lpflOldProtectt", newprotect);
17841788
emu_profile_function_returnvalue_int_set(env->profile, "BOOL", returnvalue);
1785-
}
1789+
}
17861790

1787-
emu_cpu_reg32_set(c, eax, returnvalue);
1788-
emu_cpu_eip_set(c, eip_save);
1789-
return 0;
1790-
}
1791+
emu_cpu_reg32_set(c, eax, returnvalue);
1792+
emu_cpu_eip_set(c, eip_save);
17911793

1794+
return 0;
1795+
}

0 commit comments

Comments
 (0)