diff options
-rw-r--r-- | include/pemagine/bits/nt32/pe_inline_asm__common.h (renamed from include/pemagine/bits/nt32/pe_inline_asm__gcc.h) | 0 | ||||
-rw-r--r-- | include/pemagine/bits/nt64/pe_inline_asm__common.h (renamed from include/pemagine/bits/nt64/pe_inline_asm__gcc.h) | 0 | ||||
-rw-r--r-- | include/pemagine/pe_api.h | 1 | ||||
-rw-r--r-- | include/pemagine/pe_inline_asm.h | 46 | ||||
-rw-r--r-- | include/pemagine/pemagine.h | 2 | ||||
-rw-r--r-- | project/headers.mk | 4 |
6 files changed, 42 insertions, 11 deletions
diff --git a/include/pemagine/bits/nt32/pe_inline_asm__gcc.h b/include/pemagine/bits/nt32/pe_inline_asm__common.h index 10473b4..10473b4 100644 --- a/include/pemagine/bits/nt32/pe_inline_asm__gcc.h +++ b/include/pemagine/bits/nt32/pe_inline_asm__common.h diff --git a/include/pemagine/bits/nt64/pe_inline_asm__gcc.h b/include/pemagine/bits/nt64/pe_inline_asm__common.h index 94d4e34..94d4e34 100644 --- a/include/pemagine/bits/nt64/pe_inline_asm__gcc.h +++ b/include/pemagine/bits/nt64/pe_inline_asm__common.h diff --git a/include/pemagine/pe_api.h b/include/pemagine/pe_api.h index e192484..c6c456b 100644 --- a/include/pemagine/pe_api.h +++ b/include/pemagine/pe_api.h @@ -6,6 +6,7 @@ #include <psxtypes/psxtypes.h> #else #include <stdint.h> +#include <stddef.h> #endif /* pe_export */ diff --git a/include/pemagine/pe_inline_asm.h b/include/pemagine/pe_inline_asm.h index 65e1376..d1613e7 100644 --- a/include/pemagine/pe_inline_asm.h +++ b/include/pemagine/pe_inline_asm.h @@ -1,16 +1,44 @@ -#if defined(__NT32) -#if (__COMPILER__ == __GCC__) -#include "bits/nt32/pe_inline_asm__gcc.h" -#elif (__COMPILER__ == __MSVC__) +#ifndef _PE_INLINE_ASM_H_ +#define _PE_INLINE_ASM_H_ + +#include "pe_api.h" + +#ifdef _MSC_VER + +/* visual studio: begin */ +#ifdef _M_IX86 +#ifndef __SIZEOF_POINTER__ +#define __SIZEOF_POINTER__ 4 +#endif +#endif + +#ifdef _M_X64 +#ifndef __SIZEOF_POINTER__ +#define __SIZEOF_POINTER__ 8 +#endif +#endif + +#if (__SIZEOF_POINTER__ == 4) #include "bits/nt32/pe_inline_asm__msvc.h" #endif -#elif defined(__NT64) -#if (__COMPILER__ == __GCC__) -#include "bits/nt64/pe_inline_asm__gcc.h" -#elif (__COMPILER__ == __MSVC__) +#if (__SIZEOF_POINTER__ == 8) #include "bits/nt64/pe_inline_asm__msvc.h" #endif +/* visual studio: end */ + +#else + +/* all other compilers: begin */ +#if (__SIZEOF_POINTER__ == 4) +#include "bits/nt32/pe_inline_asm__common.h" +#endif + +#if (__SIZEOF_POINTER__ == 8) +#include "bits/nt64/pe_inline_asm__common.h" +#endif +/* all other compilers: end */ + #endif /* trivial */ @@ -18,3 +46,5 @@ static __inline__ void * pe_va_from_rva(const void * base, intptr_t offset) { return (void *)((intptr_t)base + offset); } + +#endif diff --git a/include/pemagine/pemagine.h b/include/pemagine/pemagine.h index 67159d0..ac84a97 100644 --- a/include/pemagine/pemagine.h +++ b/include/pemagine/pemagine.h @@ -188,7 +188,7 @@ pe_api int pe_enum_image_import_hdrs (const void * base, pe_api int pe_enum_modules_in_load_order (pe_enum_modules_callback *, void * ctx); pe_api int pe_enum_modules_in_memory_order (pe_enum_modules_callback *, void * ctx); pe_api int pe_enum_modules_in_init_order (pe_enum_modules_callback *, void * ctx); -pe_api void * pe_get_module_handle (const wchar16_t * name); +pe_api void * pe_get_module_handle (const uint16_t * name); pe_api void * pe_get_first_module_handle (void); /* process: system api */ diff --git a/project/headers.mk b/project/headers.mk index 3ffb290..0863c1b 100644 --- a/project/headers.mk +++ b/project/headers.mk @@ -6,11 +6,11 @@ API_HEADERS = \ $(PROJECT_DIR)/include/$(PACKAGE)/pe_structs.h \ API_HEADERS_NT32 = \ - $(PROJECT_DIR)/include/$(PACKAGE)/bits/nt32/pe_inline_asm__gcc.h \ + $(PROJECT_DIR)/include/$(PACKAGE)/bits/nt32/pe_inline_asm__common.h \ $(PROJECT_DIR)/include/$(PACKAGE)/bits/nt32/pe_inline_asm__msvc.h \ API_HEADERS_NT64 = \ - $(PROJECT_DIR)/include/$(PACKAGE)/bits/nt64/pe_inline_asm__gcc.h \ + $(PROJECT_DIR)/include/$(PACKAGE)/bits/nt64/pe_inline_asm__common.h \ $(PROJECT_DIR)/include/$(PACKAGE)/bits/nt64/pe_inline_asm__msvc.h \ INTERNAL_HEADERS = \ |