diff options
author | midipix <writeonce@midipix.org> | 2016-12-11 19:44:51 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-12-11 19:56:28 -0500 |
commit | ff22b1948a1f2ee7f62d915c543d46a379e2082e (patch) | |
tree | afe918de0d2ed11e92064cc0142ea8fa31011f03 /include | |
parent | b80821b1a7d30d36e1a844036720cf682d5dda0f (diff) | |
download | pemagine-ff22b1948a1f2ee7f62d915c543d46a379e2082e.tar.bz2 pemagine-ff22b1948a1f2ee7f62d915c543d46a379e2082e.tar.xz |
api headers: added visual studio and hosted environment support.
Diffstat (limited to 'include')
-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 |
5 files changed, 40 insertions, 9 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 */ |