Thomas Faber : riched20: Implement MSVC asm wrappers.

Alexandre Julliard julliard at winehq.org
Mon Mar 18 16:20:13 CDT 2019


Module: wine
Branch: master
Commit: b64511c00a5aa1896f402460a1b2de0cda957fc5
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b64511c00a5aa1896f402460a1b2de0cda957fc5

Author: Thomas Faber <thomas.faber at reactos.org>
Date:   Fri Mar 15 09:37:01 2019 +0100

riched20: Implement MSVC asm wrappers.

Signed-off-by: Thomas Faber <thomas.faber at reactos.org>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/riched20/txthost.c | 23 +++++++++++++++++++++++
 dlls/riched20/txtsrv.c  | 12 ++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c
index eaa6aae..d709502 100644
--- a/dlls/riched20/txthost.c
+++ b/dlls/riched20/txthost.c
@@ -502,6 +502,16 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *i
 #ifdef __i386__  /* thiscall functions are i386-specific */
 
 #define THISCALL(func) (void *) __thiscall_ ## func
+#ifdef _MSC_VER
+#define DEFINE_THISCALL_WRAPPER(func,args) \
+    __declspec(naked) HRESULT __thiscall_##func(void) \
+    { \
+        __asm pop eax \
+        __asm push ecx \
+        __asm push eax \
+        __asm jmp func \
+    }
+#else /* _MSC_VER */
 #define DEFINE_THISCALL_WRAPPER(func,args) \
    extern HRESULT __thiscall_ ## func(void); \
    __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
@@ -509,6 +519,7 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *i
                    "pushl %ecx\n\t" \
                    "pushl %eax\n\t" \
                    "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
+#endif /* _MSC_VER */
 
 #else /* __i386__ */
 
@@ -560,6 +571,17 @@ DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8)
 #ifdef __i386__  /* thiscall functions are i386-specific */
 
 #define STDCALL(func) (void *) __stdcall_ ## func
+#ifdef _MSC_VER
+#define DEFINE_STDCALL_WRAPPER(num,func,args) \
+    __declspec(naked) HRESULT __stdcall_##func(void) \
+    { \
+        __asm pop eax \
+        __asm pop ecx \
+        __asm push eax \
+        __asm mov eax, [ecx] \
+        __asm jmp dword ptr [eax + 4*num] \
+    }
+#else /* _MSC_VER */
 #define DEFINE_STDCALL_WRAPPER(num,func,args) \
    extern HRESULT __stdcall_ ## func(void); \
    __ASM_GLOBAL_FUNC(__stdcall_ ## func, \
@@ -568,6 +590,7 @@ DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8)
                    "pushl %eax\n\t" \
                    "movl (%ecx), %eax\n\t" \
                    "jmp *(4*(" #num "))(%eax)" )
+#endif /* _MSC_VER */
 
 DEFINE_STDCALL_WRAPPER(3,ITextHostImpl_TxGetDC,4)
 DEFINE_STDCALL_WRAPPER(4,ITextHostImpl_TxReleaseDC,8)
diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c
index 639a94f..37b866a 100644
--- a/dlls/riched20/txtsrv.c
+++ b/dlls/riched20/txtsrv.c
@@ -36,6 +36,16 @@
 #ifdef __i386__  /* thiscall functions are i386-specific */
 
 #define THISCALL(func) (void *) __thiscall_ ## func
+#ifdef _MSC_VER
+#define DEFINE_THISCALL_WRAPPER(func,args) \
+    __declspec(naked) HRESULT __thiscall_##func(void) \
+    { \
+        __asm pop eax \
+        __asm push ecx \
+        __asm push eax \
+        __asm jmp func \
+    }
+#else /* _MSC_VER */
 #define DEFINE_THISCALL_WRAPPER(func,args) \
    extern HRESULT __thiscall_ ## func(void); \
    __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
@@ -43,6 +53,8 @@
                    "pushl %ecx\n\t" \
                    "pushl %eax\n\t" \
                    "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
+#endif /* _MSC_VER */
+
 #else /* __i386__ */
 
 #define THISCALL(func) func




More information about the wine-cvs mailing list