diff --git a/include/funchook.h b/include/funchook.h index 8025ed1..7c73c78 100644 --- a/include/funchook.h +++ b/include/funchook.h @@ -39,7 +39,7 @@ extern "C" { * or libfunchook.so. Others are invisible. */ #ifdef FUNCHOOK_EXPORTS -#if defined(WIN32) +#if defined(_WIN32) #define FUNCHOOK_EXPORT __declspec(dllexport) #elif defined(__GNUC__) #define FUNCHOOK_EXPORT __attribute__((visibility("default"))) diff --git a/src/funchook.c b/src/funchook.c index b020d3c..d84b18b 100644 --- a/src/funchook.c +++ b/src/funchook.c @@ -39,7 +39,7 @@ #include #include #include -#ifdef WIN32 +#ifdef _WIN32 #include #ifndef PATH_MAX #define PATH_MAX MAX_PATH @@ -78,7 +78,7 @@ static void flush_instruction_cache(void *addr, size_t size) { #if defined __GNUC__ __builtin___clear_cache((char*)addr, (char*)addr + size); -#elif defined WIN32 +#elif defined _WIN32 FlushInstructionCache(GetCurrentProcess(), addr, size); #else #error unsupported OS or compiler @@ -230,12 +230,12 @@ static funchook_t *funchook_create_internal(void) num_entries_in_page = (page_size - offsetof(funchook_page_t, entries)) / sizeof(funchook_entry_t); #endif funchook_log(funchook, -#ifdef WIN32 +#ifdef _WIN32 " allocation_unit=%"PRIuPTR"\n" #endif " page_size=%"PRIuPTR"\n" " num_entries_in_page=%"PRIuPTR"\n", -#ifdef WIN32 +#ifdef _WIN32 allocation_unit, #endif page_size, num_entries_in_page); diff --git a/src/funchook_internal.h b/src/funchook_internal.h index 7ac7c36..36f05d3 100644 --- a/src/funchook_internal.h +++ b/src/funchook_internal.h @@ -31,7 +31,7 @@ #ifndef FUNCHOOK_INTERNAL_H #define FUNCHOOK_INTERNAL_H 1 #include "funchook.h" -#ifdef WIN32 +#ifdef _WIN32 #include #endif @@ -104,7 +104,7 @@ typedef struct { void *addr; size_t size; -#ifdef WIN32 +#ifdef _WIN32 DWORD protect; #endif } mem_state_t; diff --git a/test/libfunchook_test.c b/test/libfunchook_test.c index e3ebf74..6ec4764 100644 --- a/test/libfunchook_test.c +++ b/test/libfunchook_test.c @@ -1,4 +1,4 @@ -#ifdef WIN32 +#ifdef _WIN32 #define DLLEXPORT __declspec(dllexport) #else #define DLLEXPORT diff --git a/test/libfunchook_test_noasm.c b/test/libfunchook_test_noasm.c index c147e3c..2fd3157 100644 --- a/test/libfunchook_test_noasm.c +++ b/test/libfunchook_test_noasm.c @@ -1,4 +1,4 @@ -#ifdef WIN32 +#ifdef _WIN32 #define DLLEXPORT __declspec(dllexport) #else #define DLLEXPORT diff --git a/test/test_main.c b/test/test_main.c index 5b26a93..055b45d 100644 --- a/test/test_main.c +++ b/test/test_main.c @@ -3,7 +3,7 @@ #if defined(__linux__) && !defined(_GNU_SOURCE) #define _GNU_SOURCE #endif -#ifdef WIN32 +#ifdef _WIN32 #define _CRT_SECURE_NO_WARNINGS #endif #include @@ -14,7 +14,7 @@ #include #include #include -#ifdef WIN32 +#ifdef _WIN32 #include #include #define mode_t int @@ -31,7 +31,7 @@ #endif #include -#ifdef WIN32 +#ifdef _WIN32 #define DLLEXPORT __declspec(dllexport) #else #define DLLEXPORT @@ -133,7 +133,7 @@ enum load_type { static void *load_func(const char *module, const char *func) { void *addr; -#ifdef WIN32 +#ifdef _WIN32 HMODULE hMod = GetModuleHandleA(module); if (hMod == NULL) { @@ -601,7 +601,7 @@ int main() TEST_FUNCHOOK_EXPECT_ERROR(x86_test_error_jump1, FUNCHOOK_ERROR_CANNOT_FIX_IP_RELATIVE); TEST_FUNCHOOK_EXPECT_ERROR(x86_test_error_jump2, FUNCHOOK_ERROR_FOUND_BACK_JUMP); -#ifndef WIN32 +#ifndef _WIN32 TEST_FUNCHOOK_INT(x86_test_call_get_pc_thunk_ax, LOAD_TYPE_NO_LOAD); TEST_FUNCHOOK_INT(x86_test_call_get_pc_thunk_bx, LOAD_TYPE_NO_LOAD); TEST_FUNCHOOK_INT(x86_test_call_get_pc_thunk_cx, LOAD_TYPE_NO_LOAD); diff --git a/test/x86_test.S b/test/x86_test.S index b2e73c2..6693b78 100644 --- a/test/x86_test.S +++ b/test/x86_test.S @@ -61,7 +61,7 @@ label_2_1: #endif ret -#ifndef WIN32 +#ifndef _WIN32 .p2align 4,,15 .globl x86_test_call_get_pc_thunk_ax x86_test_call_get_pc_thunk_ax: