aboutsummaryrefslogtreecommitdiff
path: root/subhook_windows.c
diff options
context:
space:
mode:
authorZeex <zeex@rocketmail.com>2018-09-03 20:08:52 +0600
committerZeex <zeex@rocketmail.com>2018-09-03 20:10:28 +0600
commit12b527d6426276681536d685520daf0318fbcf13 (patch)
tree861508e36ddd0de4be235d3b82ea76b4018f43b9 /subhook_windows.c
parent504fce580e9300c3400c3275fabda72b39a363e2 (diff)
downloadsubhook-12b527d6426276681536d685520daf0318fbcf13.zip
subhook-12b527d6426276681536d685520daf0318fbcf13.tar.gz
subhook-12b527d6426276681536d685520daf0318fbcf13.tar.bz2
Clean up and improve comments
* Replace SUBHOOK_BITS equality comparisons with SUBHOOK_X86_64 macro definition checks (less error-prone) * Improve comments in subhook_disasm() and remove unused variable (address_size) * Update copyright year across all files
Diffstat (limited to 'subhook_windows.c')
-rw-r--r--subhook_windows.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/subhook_windows.c b/subhook_windows.c
index f28317c..13a514b 100644
--- a/subhook_windows.c
+++ b/subhook_windows.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015 Zeex
+/* Copyright (c) 2012-2018 Zeex
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,9 +29,9 @@
void *subhook_unprotect(void *address, size_t size) {
DWORD old;
- if (VirtualProtect(address, size, PAGE_EXECUTE_READWRITE, &old) == 0) {
+ if (VirtualProtect(address, size, PAGE_EXECUTE_READWRITE, &old) != 0) {
+ return address;
+ } else {
return NULL;
}
-
- return address;
}