From 0a79eb3608289b29105a42fa1254e3a8b339289d Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 16 May 2019 13:53:33 +0200 Subject: [PATCH] include: Use the __thiscall attribute directly for the Mingw build. Signed-off-by: Alexandre Julliard --- dlls/msvcirt/msvcirt.c | 2 +- dlls/msvcp60/main.c | 2 +- dlls/msvcp90/cxx.h | 4 +- dlls/msvcp90/exception.c | 4 +- dlls/msvcp90/misc.c | 2 +- dlls/msvcp90/msvcp_main.c | 2 +- dlls/msvcrt/cpp.c | 4 +- dlls/msvcrt/cxx.h | 4 +- dlls/msvcrt/scheduler.c | 2 +- dlls/riched20/editor.h | 2 +- dlls/riched20/editstr.h | 2 +- dlls/riched20/tests/txtsrv.c | 132 +++++++++---------------- dlls/riched20/txthost.c | 2 +- dlls/windowscodecs/wincodecs_private.h | 13 +-- include/textserv.h | 120 +++++++++++----------- include/windef.h | 4 + include/wine/asm.h | 9 +- tools/winebuild/utils.c | 4 +- 18 files changed, 137 insertions(+), 177 deletions(-) diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c index c129e0fd302..fa0bbb54323 100644 --- a/dlls/msvcirt/msvcirt.c +++ b/dlls/msvcirt/msvcirt.c @@ -4464,7 +4464,7 @@ void __cdecl ios_sync_with_stdio(void) } -#ifdef __i386__ +#if defined(__i386__) && !defined(__MINGW32__) #define DEFINE_VTBL_WRAPPER(off) \ __ASM_GLOBAL_FUNC(vtbl_wrapper_ ## off, \ diff --git a/dlls/msvcp60/main.c b/dlls/msvcp60/main.c index 8a45ab02d67..a30f13c4aba 100644 --- a/dlls/msvcp60/main.c +++ b/dlls/msvcp60/main.c @@ -28,7 +28,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcp); -#ifdef __i386__ +#if defined(__i386__) && !defined(__MINGW32__) #define DEFINE_VTBL_WRAPPER(off) \ __ASM_GLOBAL_FUNC(vtbl_wrapper_ ## off, \ diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h index e14b7deaba5..b2bec6570b2 100644 --- a/dlls/msvcp90/cxx.h +++ b/dlls/msvcp90/cxx.h @@ -263,7 +263,7 @@ static void init_ ## type ## _cxx(char *base) \ #define DEFINE_CXX_DATA4(name, cl1, cl2, cl3, cl4, dtor) \ DEFINE_CXX_DATA(name, 4, cl1, cl2, cl3, cl4, dtor) -#ifdef __i386__ +#if defined(__i386__) && !defined(__MINGW32__) #define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (WINAPI*)type)&vtbl_wrapper_##off)args @@ -285,7 +285,7 @@ extern void *vtbl_wrapper_56; #else -#define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (__cdecl***)type)this)[0][off/4]args +#define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (__thiscall***)type)this)[0][off/4]args #endif diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c index 142fddf66f9..76ea893a45a 100644 --- a/dlls/msvcp90/exception.c +++ b/dlls/msvcp90/exception.c @@ -970,7 +970,7 @@ void __cdecl __ExceptionPtrCreate(exception_ptr *ep) ep->ref = NULL; } -#ifdef __i386__ +#if defined(__i386__) && !defined(__MINGW32__) extern void call_dtor(const cxx_exception_type *type, void *func, void *object); __ASM_GLOBAL_FUNC( call_dtor, @@ -985,7 +985,7 @@ static inline void call_dtor(const cxx_exception_type *type, unsigned int dtor, func(object); } #else -#define call_dtor(type, func, object) ((void (__cdecl*)(void*))(func))(object) +#define call_dtor(type, func, object) ((void (__thiscall*)(void*))(func))(object) #endif /********************************************************************* diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c index dac6a96564c..07cfcd83ccd 100644 --- a/dlls/msvcp90/misc.c +++ b/dlls/msvcp90/misc.c @@ -663,7 +663,7 @@ unsigned int __cdecl _Random_device(void) #endif #if _MSVCP_VER >= 110 -#if defined(__i386__) +#if defined(__i386__) && !defined(__MINGW32__) extern void *call_thiscall_func; __ASM_GLOBAL_FUNC(call_thiscall_func, diff --git a/dlls/msvcp90/msvcp_main.c b/dlls/msvcp90/msvcp_main.c index fbf4a79bdd6..ebf67be2766 100644 --- a/dlls/msvcp90/msvcp_main.c +++ b/dlls/msvcp90/msvcp_main.c @@ -28,7 +28,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcp); -#ifdef __i386__ +#if defined(__i386__) && !defined(__MINGW32__) #define DEFINE_VTBL_WRAPPER(off) \ __ASM_GLOBAL_FUNC(vtbl_wrapper_ ## off, \ diff --git a/dlls/msvcrt/cpp.c b/dlls/msvcrt/cpp.c index 4857d295fac..a1826a9b1ad 100644 --- a/dlls/msvcrt/cpp.c +++ b/dlls/msvcrt/cpp.c @@ -1717,7 +1717,7 @@ void __cdecl __ExceptionPtrCreate(exception_ptr *ep) ep->ref = NULL; } -#ifdef __i386__ +#if defined(__i386__) && !defined(__MINGW32__) extern void call_dtor(const cxx_exception_type *type, void *func, void *object); __ASM_GLOBAL_FUNC( call_dtor, @@ -1732,7 +1732,7 @@ static inline void call_dtor(const cxx_exception_type *type, unsigned int dtor, func(object); } #else -#define call_dtor(type, func, object) ((void (__cdecl*)(void*))(func))(object) +#define call_dtor(type, func, object) ((void (__thiscall*)(void*))(func))(object) #endif /********************************************************************* diff --git a/dlls/msvcrt/cxx.h b/dlls/msvcrt/cxx.h index 68783f5acd1..083681b84fc 100644 --- a/dlls/msvcrt/cxx.h +++ b/dlls/msvcrt/cxx.h @@ -240,7 +240,7 @@ typedef struct #endif -#ifdef __i386__ +#if defined(__i386__) && !defined(__MINGW32__) #define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (WINAPI*)type)&vtbl_wrapper_##off)args @@ -260,7 +260,7 @@ extern void *vtbl_wrapper_48; #else -#define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (__cdecl***)type)this)[0][off/4]args +#define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (__thiscall***)type)this)[0][off/4]args #endif diff --git a/dlls/msvcrt/scheduler.c b/dlls/msvcrt/scheduler.c index 55ab1c549e2..9e0de957402 100644 --- a/dlls/msvcrt/scheduler.c +++ b/dlls/msvcrt/scheduler.c @@ -36,7 +36,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); static int context_id = -1; static int scheduler_id = -1; -#ifdef __i386__ +#if defined(__i386__) && !defined(__MINGW32__) #define DEFINE_VTBL_WRAPPER(off) \ __ASM_GLOBAL_FUNC(vtbl_wrapper_ ## off, \ diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index 2e08eeee3f3..68264e7a75c 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -277,7 +277,7 @@ void ME_InitTableDef(ME_TextEditor *editor, struct RTFTable *tableDef) DECLSPEC_ /* txthost.c */ ITextHost *ME_CreateTextHost(HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion10) DECLSPEC_HIDDEN; -#ifdef __i386__ /* Use wrappers to perform thiscall on i386 */ +#if defined(__i386__) && !defined(__MINGW32__) /* Use wrappers to perform thiscall on i386 */ #define TXTHOST_VTABLE(This) (&itextHostStdcallVtbl) #else /* __i386__ */ #define TXTHOST_VTABLE(This) (This)->lpVtbl diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h index 87cd71cd4ec..2be903b4fde 100644 --- a/dlls/riched20/editstr.h +++ b/dlls/riched20/editstr.h @@ -51,7 +51,7 @@ #include "wine/heap.h" #include "wine/list.h" -#ifdef __i386__ +#if defined(__i386__) && !defined(__MINGW32__) extern const struct ITextHostVtbl itextHostStdcallVtbl DECLSPEC_HIDDEN; #endif /* __i386__ */ diff --git a/dlls/riched20/tests/txtsrv.c b/dlls/riched20/tests/txtsrv.c index 20d411afcbb..dd290e3fb2f 100644 --- a/dlls/riched20/tests/txtsrv.c +++ b/dlls/riched20/tests/txtsrv.c @@ -48,7 +48,7 @@ static PCreateTextServices pCreateTextServices; /* Use a special table for x86 machines to convert the thiscall * calling convention. This isn't needed on other platforms. */ -#ifdef __i386__ +#if defined(__i386__) && !defined(__MINGW32__) static ITextServicesVtbl itextServicesStdcallVtbl; #define TXTSERV_VTABLE(This) (&itextServicesStdcallVtbl) #else /* __i386__ */ @@ -129,24 +129,21 @@ static ULONG WINAPI ITextHostImpl_Release(ITextHost *iface) } } -static HDC WINAPI ITextHostImpl_TxGetDC(ITextHost *iface) +static HDC __thiscall ITextHostImpl_TxGetDC(ITextHost *iface) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxGetDC(%p)\n", This); return NULL; } -static INT WINAPI ITextHostImpl_TxReleaseDC(ITextHost *iface, - HDC hdc) +static INT __thiscall ITextHostImpl_TxReleaseDC(ITextHost *iface, HDC hdc) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxReleaseDC(%p)\n", This); return 0; } -static BOOL WINAPI ITextHostImpl_TxShowScrollBar(ITextHost *iface, - INT fnBar, - BOOL fShow) +static BOOL __thiscall ITextHostImpl_TxShowScrollBar(ITextHost *iface, INT fnBar, BOOL fShow) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxShowScrollBar(%p, fnBar=%d, fShow=%d)\n", @@ -154,9 +151,7 @@ static BOOL WINAPI ITextHostImpl_TxShowScrollBar(ITextHost *iface, return FALSE; } -static BOOL WINAPI ITextHostImpl_TxEnableScrollBar(ITextHost *iface, - INT fuSBFlags, - INT fuArrowflags) +static BOOL __thiscall ITextHostImpl_TxEnableScrollBar(ITextHost *iface, INT fuSBFlags, INT fuArrowflags) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxEnableScrollBar(%p, fuSBFlags=%d, fuArrowflags=%d)\n", @@ -164,11 +159,8 @@ static BOOL WINAPI ITextHostImpl_TxEnableScrollBar(ITextHost *iface, return FALSE; } -static BOOL WINAPI ITextHostImpl_TxSetScrollRange(ITextHost *iface, - INT fnBar, - LONG nMinPos, - INT nMaxPos, - BOOL fRedraw) +static BOOL __thiscall ITextHostImpl_TxSetScrollRange(ITextHost *iface, INT fnBar, LONG nMinPos, + INT nMaxPos, BOOL fRedraw) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxSetScrollRange(%p, fnBar=%d, nMinPos=%d, nMaxPos=%d, fRedraw=%d)\n", @@ -176,10 +168,7 @@ static BOOL WINAPI ITextHostImpl_TxSetScrollRange(ITextHost *iface, return FALSE; } -static BOOL WINAPI ITextHostImpl_TxSetScrollPos(ITextHost *iface, - INT fnBar, - INT nPos, - BOOL fRedraw) +static BOOL __thiscall ITextHostImpl_TxSetScrollPos(ITextHost *iface, INT fnBar, INT nPos, BOOL fRedraw) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxSetScrollPos(%p, fnBar=%d, nPos=%d, fRedraw=%d)\n", @@ -187,25 +176,21 @@ static BOOL WINAPI ITextHostImpl_TxSetScrollPos(ITextHost *iface, return FALSE; } -static void WINAPI ITextHostImpl_TxInvalidateRect(ITextHost *iface, - LPCRECT prc, - BOOL fMode) +static void __thiscall ITextHostImpl_TxInvalidateRect(ITextHost *iface, LPCRECT prc, BOOL fMode) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxInvalidateRect(%p, prc=%p, fMode=%d)\n", This, prc, fMode); } -static void WINAPI ITextHostImpl_TxViewChange(ITextHost *iface, BOOL fUpdate) +static void __thiscall ITextHostImpl_TxViewChange(ITextHost *iface, BOOL fUpdate) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxViewChange(%p, fUpdate=%d)\n", This, fUpdate); } -static BOOL WINAPI ITextHostImpl_TxCreateCaret(ITextHost *iface, - HBITMAP hbmp, - INT xWidth, INT yHeight) +static BOOL __thiscall ITextHostImpl_TxCreateCaret(ITextHost *iface, HBITMAP hbmp, INT xWidth, INT yHeight) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxCreateCaret(%p, nbmp=%p, xWidth=%d, yHeight=%d)\n", @@ -213,7 +198,7 @@ static BOOL WINAPI ITextHostImpl_TxCreateCaret(ITextHost *iface, return FALSE; } -static BOOL WINAPI ITextHostImpl_TxShowCaret(ITextHost *iface, BOOL fShow) +static BOOL __thiscall ITextHostImpl_TxShowCaret(ITextHost *iface, BOOL fShow) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxShowCaret(%p, fShow=%d)\n", @@ -221,16 +206,14 @@ static BOOL WINAPI ITextHostImpl_TxShowCaret(ITextHost *iface, BOOL fShow) return FALSE; } -static BOOL WINAPI ITextHostImpl_TxSetCaretPos(ITextHost *iface, - INT x, INT y) +static BOOL __thiscall ITextHostImpl_TxSetCaretPos(ITextHost *iface, INT x, INT y) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxSetCaretPos(%p, x=%d, y=%d)\n", This, x, y); return FALSE; } -static BOOL WINAPI ITextHostImpl_TxSetTimer(ITextHost *iface, - UINT idTimer, UINT uTimeout) +static BOOL __thiscall ITextHostImpl_TxSetTimer(ITextHost *iface, UINT idTimer, UINT uTimeout) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxSetTimer(%p, idTimer=%u, uTimeout=%u)\n", @@ -238,96 +221,83 @@ static BOOL WINAPI ITextHostImpl_TxSetTimer(ITextHost *iface, return FALSE; } -static void WINAPI ITextHostImpl_TxKillTimer(ITextHost *iface, UINT idTimer) +static void __thiscall ITextHostImpl_TxKillTimer(ITextHost *iface, UINT idTimer) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxKillTimer(%p, idTimer=%u)\n", This, idTimer); } -static void WINAPI ITextHostImpl_TxScrollWindowEx(ITextHost *iface, - INT dx, INT dy, - LPCRECT lprcScroll, - LPCRECT lprcClip, - HRGN hRgnUpdate, - LPRECT lprcUpdate, - UINT fuScroll) +static void __thiscall ITextHostImpl_TxScrollWindowEx(ITextHost *iface, INT dx, INT dy, LPCRECT lprcScroll, + LPCRECT lprcClip, HRGN hRgnUpdate, LPRECT lprcUpdate, + UINT fuScroll) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxScrollWindowEx(%p, %d, %d, %p, %p, %p, %p, %d)\n", This, dx, dy, lprcScroll, lprcClip, hRgnUpdate, lprcUpdate, fuScroll); } -static void WINAPI ITextHostImpl_TxSetCapture(ITextHost *iface, BOOL fCapture) +static void __thiscall ITextHostImpl_TxSetCapture(ITextHost *iface, BOOL fCapture) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxSetCapture(%p, fCapture=%d)\n", This, fCapture); } -static void WINAPI ITextHostImpl_TxSetFocus(ITextHost *iface) +static void __thiscall ITextHostImpl_TxSetFocus(ITextHost *iface) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxSetFocus(%p)\n", This); } -static void WINAPI ITextHostImpl_TxSetCursor(ITextHost *iface, - HCURSOR hcur, - BOOL fText) +static void __thiscall ITextHostImpl_TxSetCursor(ITextHost *iface, HCURSOR hcur, BOOL fText) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxSetCursor(%p, hcur=%p, fText=%d)\n", This, hcur, fText); } -static BOOL WINAPI ITextHostImpl_TxScreenToClient(ITextHost *iface, - LPPOINT lppt) +static BOOL __thiscall ITextHostImpl_TxScreenToClient(ITextHost *iface, LPPOINT lppt) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxScreenToClient(%p, lppt=%p)\n", This, lppt); return FALSE; } -static BOOL WINAPI ITextHostImpl_TxClientToScreen(ITextHost *iface, - LPPOINT lppt) +static BOOL __thiscall ITextHostImpl_TxClientToScreen(ITextHost *iface, LPPOINT lppt) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxClientToScreen(%p, lppt=%p)\n", This, lppt); return FALSE; } -static HRESULT WINAPI ITextHostImpl_TxActivate(ITextHost *iface, - LONG *plOldState) +static HRESULT __thiscall ITextHostImpl_TxActivate(ITextHost *iface, LONG *plOldState) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxActivate(%p, plOldState=%p)\n", This, plOldState); return E_NOTIMPL; } -static HRESULT WINAPI ITextHostImpl_TxDeactivate(ITextHost *iface, - LONG lNewState) +static HRESULT __thiscall ITextHostImpl_TxDeactivate(ITextHost *iface, LONG lNewState) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxDeactivate(%p, lNewState=%d)\n", This, lNewState); return E_NOTIMPL; } -static HRESULT WINAPI ITextHostImpl_TxGetClientRect(ITextHost *iface, - LPRECT prc) +static HRESULT __thiscall ITextHostImpl_TxGetClientRect(ITextHost *iface, LPRECT prc) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxGetClientRect(%p, prc=%p)\n", This, prc); return E_NOTIMPL; } -static HRESULT WINAPI ITextHostImpl_TxGetViewInset(ITextHost *iface, - LPRECT prc) +static HRESULT __thiscall ITextHostImpl_TxGetViewInset(ITextHost *iface, LPRECT prc) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxGetViewInset(%p, prc=%p)\n", This, prc); return E_NOTIMPL; } -static HRESULT WINAPI ITextHostImpl_TxGetCharFormat(ITextHost *iface, - const CHARFORMATW **ppCF) +static HRESULT __thiscall ITextHostImpl_TxGetCharFormat(ITextHost *iface, const CHARFORMATW **ppCF) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxGetCharFormat(%p, ppCF=%p)\n", This, ppCF); @@ -335,40 +305,35 @@ static HRESULT WINAPI ITextHostImpl_TxGetCharFormat(ITextHost *iface, return S_OK; } -static HRESULT WINAPI ITextHostImpl_TxGetParaFormat(ITextHost *iface, - const PARAFORMAT **ppPF) +static HRESULT __thiscall ITextHostImpl_TxGetParaFormat(ITextHost *iface, const PARAFORMAT **ppPF) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxGetParaFormat(%p, ppPF=%p)\n", This, ppPF); return E_NOTIMPL; } -static COLORREF WINAPI ITextHostImpl_TxGetSysColor(ITextHost *iface, - int nIndex) +static COLORREF __thiscall ITextHostImpl_TxGetSysColor(ITextHost *iface, int nIndex) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxGetSysColor(%p, nIndex=%d)\n", This, nIndex); return E_NOTIMPL; } -static HRESULT WINAPI ITextHostImpl_TxGetBackStyle(ITextHost *iface, - TXTBACKSTYLE *pStyle) +static HRESULT __thiscall ITextHostImpl_TxGetBackStyle(ITextHost *iface, TXTBACKSTYLE *pStyle) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxGetBackStyle(%p, pStyle=%p)\n", This, pStyle); return E_NOTIMPL; } -static HRESULT WINAPI ITextHostImpl_TxGetMaxLength(ITextHost *iface, - DWORD *pLength) +static HRESULT __thiscall ITextHostImpl_TxGetMaxLength(ITextHost *iface, DWORD *pLength) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxGetMaxLength(%p, pLength=%p)\n", This, pLength); return E_NOTIMPL; } -static HRESULT WINAPI ITextHostImpl_TxGetScrollBars(ITextHost *iface, - DWORD *pdwScrollBar) +static HRESULT __thiscall ITextHostImpl_TxGetScrollBars(ITextHost *iface, DWORD *pdwScrollBar) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxGetScrollBars(%p, pdwScrollBar=%p)\n", @@ -376,40 +341,35 @@ static HRESULT WINAPI ITextHostImpl_TxGetScrollBars(ITextHost *iface, return E_NOTIMPL; } -static HRESULT WINAPI ITextHostImpl_TxGetPasswordChar(ITextHost *iface, - WCHAR *pch) +static HRESULT __thiscall ITextHostImpl_TxGetPasswordChar(ITextHost *iface, WCHAR *pch) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxGetPasswordChar(%p, pch=%p)\n", This, pch); return E_NOTIMPL; } -static HRESULT WINAPI ITextHostImpl_TxGetAcceleratorPos(ITextHost *iface, - LONG *pch) +static HRESULT __thiscall ITextHostImpl_TxGetAcceleratorPos(ITextHost *iface, LONG *pch) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxGetAcceleratorPos(%p, pch=%p)\n", This, pch); return E_NOTIMPL; } -static HRESULT WINAPI ITextHostImpl_TxGetExtent(ITextHost *iface, - LPSIZEL lpExtent) +static HRESULT __thiscall ITextHostImpl_TxGetExtent(ITextHost *iface, LPSIZEL lpExtent) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxGetExtent(%p, lpExtent=%p)\n", This, lpExtent); return E_NOTIMPL; } -static HRESULT WINAPI ITextHostImpl_OnTxCharFormatChange(ITextHost *iface, - const CHARFORMATW *pcf) +static HRESULT __thiscall ITextHostImpl_OnTxCharFormatChange(ITextHost *iface, const CHARFORMATW *pcf) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to OnTxCharFormatChange(%p, pcf=%p)\n", This, pcf); return E_NOTIMPL; } -static HRESULT WINAPI ITextHostImpl_OnTxParaFormatChange(ITextHost *iface, - const PARAFORMAT *ppf) +static HRESULT __thiscall ITextHostImpl_OnTxParaFormatChange(ITextHost *iface, const PARAFORMAT *ppf) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to OnTxParaFormatChange(%p, ppf=%p)\n", This, ppf); @@ -418,9 +378,7 @@ static HRESULT WINAPI ITextHostImpl_OnTxParaFormatChange(ITextHost *iface, /* This must return S_OK for the native ITextServices object to initialize. */ -static HRESULT WINAPI ITextHostImpl_TxGetPropertyBits(ITextHost *iface, - DWORD dwMask, - DWORD *pdwBits) +static HRESULT __thiscall ITextHostImpl_TxGetPropertyBits(ITextHost *iface, DWORD dwMask, DWORD *pdwBits) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxGetPropertyBits(%p, dwMask=0x%08x, pdwBits=%p)\n", @@ -429,22 +387,21 @@ static HRESULT WINAPI ITextHostImpl_TxGetPropertyBits(ITextHost *iface, return S_OK; } -static HRESULT WINAPI ITextHostImpl_TxNotify(ITextHost *iface, DWORD iNotify, - void *pv) +static HRESULT __thiscall ITextHostImpl_TxNotify(ITextHost *iface, DWORD iNotify, void *pv) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxNotify(%p, iNotify=%d, pv=%p)\n", This, iNotify, pv); return E_NOTIMPL; } -static HIMC WINAPI ITextHostImpl_TxImmGetContext(ITextHost *iface) +static HIMC __thiscall ITextHostImpl_TxImmGetContext(ITextHost *iface) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxImmGetContext(%p)\n", This); return 0; } -static void WINAPI ITextHostImpl_TxImmReleaseContext(ITextHost *iface, HIMC himc) +static void __thiscall ITextHostImpl_TxImmReleaseContext(ITextHost *iface, HIMC himc) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxImmReleaseContext(%p, himc=%p)\n", This, himc); @@ -453,8 +410,7 @@ static void WINAPI ITextHostImpl_TxImmReleaseContext(ITextHost *iface, HIMC himc /* This function must set the variable pointed to by *lSelBarWidth. Otherwise an uninitialized value will be used to calculate positions and sizes even if E_NOTIMPL is returned. */ -static HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *iface, - LONG *lSelBarWidth) +static HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth(ITextHost *iface, LONG *lSelBarWidth) { ITextHostTestImpl *This = impl_from_ITextHost(iface); TRACECALL("Call to TxGetSelectionBarWidth(%p, lSelBarWidth=%p)\n", @@ -536,7 +492,7 @@ typedef struct static void setup_thiscall_wrappers(void) { -#ifdef __i386__ +#if defined(__i386__) && !defined(__MINGW32__) void** pVtable; void** pVtableEnd; THISCALL_TO_STDCALL_THUNK *thunk; diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c index 83a51834115..fc489f2c1f7 100644 --- a/dlls/riched20/txthost.c +++ b/dlls/riched20/txthost.c @@ -525,7 +525,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth(ITextHos } -#ifdef __i386__ /* thiscall functions are i386-specific */ +#if defined(__i386__) && !defined(__MINGW32__) /* thiscall functions are i386-specific */ #define STDCALL(func) (void *) __stdcall_ ## func #ifdef _MSC_VER diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h index 89bc47ed08b..2b3b10b7ee8 100644 --- a/dlls/windowscodecs/wincodecs_private.h +++ b/dlls/windowscodecs/wincodecs_private.h @@ -98,6 +98,8 @@ DECLARE_INTERFACE_(IMILBitmapScaler,IMILBitmapSource) }; #undef INTERFACE +#define THISCALLMETHOD_(type,method) type (__thiscall *method) + #define INTERFACE IMILUnknown1 DECLARE_INTERFACE_(IMILUnknown1,IUnknown) { @@ -105,19 +107,14 @@ DECLARE_INTERFACE_(IMILUnknown1,IUnknown) STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; - /*** thiscall method ***/ - STDMETHOD_(void,unknown1)(THIS_ void*) PURE; - /*** stdcall ***/ + THISCALLMETHOD_(void,unknown1)(THIS_ void*) PURE; STDMETHOD_(HRESULT,unknown2)(THIS_ void*, void*) PURE; - /*** thiscall method ***/ - STDMETHOD_(HRESULT,unknown3)(THIS_ void*) PURE; - /*** stdcall ***/ + THISCALLMETHOD_(HRESULT,unknown3)(THIS_ void*) PURE; STDMETHOD_(HRESULT,unknown4)(THIS_ void*) PURE; STDMETHOD_(HRESULT,unknown5)(THIS_ void*) PURE; STDMETHOD_(HRESULT,unknown6)(THIS_ DWORD64) PURE; STDMETHOD_(HRESULT,unknown7)(THIS_ void*) PURE; - /*** thiscall method ***/ - STDMETHOD_(HRESULT,unknown8)(THIS) PURE; + THISCALLMETHOD_(HRESULT,unknown8)(THIS) PURE; }; #undef INTERFACE diff --git a/include/textserv.h b/include/textserv.h index de3bb2d63ff..d3583f3a96e 100644 --- a/include/textserv.h +++ b/include/textserv.h @@ -23,6 +23,12 @@ extern "C" { #endif +#ifdef __cplusplus +#define THISCALLMETHOD_(type,method) virtual type __thiscall method +#else +#define THISCALLMETHOD_(type,method) type (__thiscall *method) +#endif + EXTERN_C const IID IID_ITextServices; EXTERN_C const IID IID_ITextHost; @@ -43,10 +49,10 @@ DECLARE_INTERFACE_(ITextServices,IUnknown) /*** ITextServices methods ***/ - STDMETHOD(TxSendMessage)( THIS_ + THISCALLMETHOD_(HRESULT,TxSendMessage)( THIS_ UINT msg, WPARAM wparam, LPARAM lparam, LRESULT* plresult) PURE; - STDMETHOD(TxDraw)( THIS_ + THISCALLMETHOD_(HRESULT,TxDraw)( THIS_ DWORD dwDrawAspect, LONG lindex, void* pvAspect, @@ -60,21 +66,21 @@ DECLARE_INTERFACE_(ITextServices,IUnknown) DWORD dwContinue, LONG lViewId) PURE; - STDMETHOD(TxGetHScroll)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetHScroll)( THIS_ LONG* plMin, LONG* plMax, LONG* plPos, LONG* plPage, BOOL* pfEnabled) PURE; - STDMETHOD(TxGetVScroll)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetVScroll)( THIS_ LONG* plMin, LONG* plMax, LONG* plPos, LONG* plPage, BOOL* pfEnabled) PURE; - STDMETHOD(OnTxSetCursor)( THIS_ + THISCALLMETHOD_(HRESULT,OnTxSetCursor)( THIS_ DWORD dwDrawAspect, LONG lindex, void* pvAspect, @@ -85,7 +91,7 @@ DECLARE_INTERFACE_(ITextServices,IUnknown) INT x, INT y) PURE; - STDMETHOD(TxQueryHitPoint)( THIS_ + THISCALLMETHOD_(HRESULT,TxQueryHitPoint)( THIS_ DWORD dwDrawAspect, LONG lindex, void* pvAspect, @@ -97,28 +103,28 @@ DECLARE_INTERFACE_(ITextServices,IUnknown) INT y, DWORD* pHitResult) PURE; - STDMETHOD(OnTxInplaceActivate)( THIS_ + THISCALLMETHOD_(HRESULT,OnTxInplaceActivate)( THIS_ LPCRECT prcClient) PURE; - STDMETHOD(OnTxInplaceDeactivate)( THIS ) PURE; + THISCALLMETHOD_(HRESULT,OnTxInplaceDeactivate)( THIS ) PURE; - STDMETHOD(OnTxUIActivate)( THIS ) PURE; + THISCALLMETHOD_(HRESULT,OnTxUIActivate)( THIS ) PURE; - STDMETHOD(OnTxUIDeactivate)( THIS ) PURE; + THISCALLMETHOD_(HRESULT,OnTxUIDeactivate)( THIS ) PURE; - STDMETHOD(TxGetText)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetText)( THIS_ BSTR* pbstrText) PURE; - STDMETHOD(TxSetText)( THIS_ + THISCALLMETHOD_(HRESULT,TxSetText)( THIS_ LPCWSTR pszText) PURE; - STDMETHOD(TxGetCurTargetX)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetCurTargetX)( THIS_ LONG* x) PURE; - STDMETHOD(TxGetBaseLinePos)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetBaseLinePos)( THIS_ LONG* x) PURE; - STDMETHOD(TxGetNaturalSize)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetNaturalSize)( THIS_ DWORD dwAspect, HDC hdcDraw, HDC hicTargetDev, @@ -128,14 +134,14 @@ DECLARE_INTERFACE_(ITextServices,IUnknown) LONG* pwidth, LONG* pheight) PURE; - STDMETHOD(TxGetDropTarget)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetDropTarget)( THIS_ IDropTarget** ppDropTarget) PURE; - STDMETHOD(OnTxPropertyBitsChange)( THIS_ + THISCALLMETHOD_(HRESULT,OnTxPropertyBitsChange)( THIS_ DWORD dwMask, DWORD dwBits) PURE; - STDMETHOD(TxGetCachedSize)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetCachedSize)( THIS_ DWORD* pdwWidth, DWORD* pdwHeight) PURE; @@ -210,58 +216,58 @@ DECLARE_INTERFACE_(ITextHost,IUnknown) STDMETHOD_(ULONG,Release)(THIS) PURE; /*** ITextHost methods ***/ - STDMETHOD_(HDC,TxGetDC)( THIS + THISCALLMETHOD_(HDC,TxGetDC)( THIS ) PURE; - STDMETHOD_(INT,TxReleaseDC)( THIS_ + THISCALLMETHOD_(INT,TxReleaseDC)( THIS_ HDC hdc) PURE; - STDMETHOD_(BOOL,TxShowScrollBar)( THIS_ + THISCALLMETHOD_(BOOL,TxShowScrollBar)( THIS_ INT fnBar, BOOL fShow) PURE; - STDMETHOD_(BOOL,TxEnableScrollBar)( THIS_ + THISCALLMETHOD_(BOOL,TxEnableScrollBar)( THIS_ INT fuSBFlags, INT fuArrowflags) PURE; - STDMETHOD_(BOOL,TxSetScrollRange)( THIS_ + THISCALLMETHOD_(BOOL,TxSetScrollRange)( THIS_ INT fnBar, LONG nMinPos, INT nMaxPos, BOOL fRedraw) PURE; - STDMETHOD_(BOOL,TxSetScrollPos)( THIS_ + THISCALLMETHOD_(BOOL,TxSetScrollPos)( THIS_ INT fnBar, INT nPos, BOOL fRedraw) PURE; - STDMETHOD_(void,TxInvalidateRect)( THIS_ + THISCALLMETHOD_(void,TxInvalidateRect)( THIS_ LPCRECT prc, BOOL fMode) PURE; - STDMETHOD_(void,TxViewChange)( THIS_ + THISCALLMETHOD_(void,TxViewChange)( THIS_ BOOL fUpdate) PURE; - STDMETHOD_(BOOL,TxCreateCaret)( THIS_ + THISCALLMETHOD_(BOOL,TxCreateCaret)( THIS_ HBITMAP hbmp, INT xWidth, INT yHeight) PURE; - STDMETHOD_(BOOL,TxShowCaret)( THIS_ + THISCALLMETHOD_(BOOL,TxShowCaret)( THIS_ BOOL fShow) PURE; - STDMETHOD_(BOOL,TxSetCaretPos)( THIS_ + THISCALLMETHOD_(BOOL,TxSetCaretPos)( THIS_ INT x, INT y) PURE; - STDMETHOD_(BOOL,TxSetTimer)( THIS_ + THISCALLMETHOD_(BOOL,TxSetTimer)( THIS_ UINT idTimer, UINT uTimeout) PURE; - STDMETHOD_(void,TxKillTimer)( THIS_ + THISCALLMETHOD_(void,TxKillTimer)( THIS_ UINT idTimer) PURE; - STDMETHOD_(void,TxScrollWindowEx)( THIS_ + THISCALLMETHOD_(void,TxScrollWindowEx)( THIS_ INT dx, INT dy, LPCRECT lprcScroll, @@ -270,82 +276,82 @@ DECLARE_INTERFACE_(ITextHost,IUnknown) LPRECT lprcUpdate, UINT fuScroll) PURE; - STDMETHOD_(void,TxSetCapture)( THIS_ + THISCALLMETHOD_(void,TxSetCapture)( THIS_ BOOL fCapture) PURE; - STDMETHOD_(void,TxSetFocus)( THIS + THISCALLMETHOD_(void,TxSetFocus)( THIS ) PURE; - STDMETHOD_(void,TxSetCursor)( THIS_ + THISCALLMETHOD_(void,TxSetCursor)( THIS_ HCURSOR hcur, BOOL fText) PURE; - STDMETHOD_(BOOL,TxScreenToClient)( THIS_ + THISCALLMETHOD_(BOOL,TxScreenToClient)( THIS_ LPPOINT lppt) PURE; - STDMETHOD_(BOOL,TxClientToScreen)( THIS_ + THISCALLMETHOD_(BOOL,TxClientToScreen)( THIS_ LPPOINT lppt) PURE; - STDMETHOD(TxActivate)( THIS_ + THISCALLMETHOD_(HRESULT,TxActivate)( THIS_ LONG* plOldState) PURE; - STDMETHOD(TxDeactivate)( THIS_ + THISCALLMETHOD_(HRESULT,TxDeactivate)( THIS_ LONG lNewState) PURE; - STDMETHOD(TxGetClientRect)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetClientRect)( THIS_ LPRECT prc) PURE; - STDMETHOD(TxGetViewInset)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetViewInset)( THIS_ LPRECT prc) PURE; - STDMETHOD(TxGetCharFormat)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetCharFormat)( THIS_ const CHARFORMATW** ppCF) PURE; - STDMETHOD(TxGetParaFormat)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetParaFormat)( THIS_ const PARAFORMAT** ppPF) PURE; - STDMETHOD_(COLORREF,TxGetSysColor)( THIS_ + THISCALLMETHOD_(COLORREF,TxGetSysColor)( THIS_ int nIndex) PURE; - STDMETHOD(TxGetBackStyle)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetBackStyle)( THIS_ TXTBACKSTYLE* pStyle) PURE; - STDMETHOD(TxGetMaxLength)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetMaxLength)( THIS_ DWORD* plength) PURE; - STDMETHOD(TxGetScrollBars)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetScrollBars)( THIS_ DWORD* pdwScrollBar) PURE; - STDMETHOD(TxGetPasswordChar)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetPasswordChar)( THIS_ WCHAR* pch) PURE; - STDMETHOD(TxGetAcceleratorPos)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetAcceleratorPos)( THIS_ LONG* pch) PURE; - STDMETHOD(TxGetExtent)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetExtent)( THIS_ LPSIZEL lpExtent) PURE; - STDMETHOD(OnTxCharFormatChange)( THIS_ + THISCALLMETHOD_(HRESULT,OnTxCharFormatChange)( THIS_ const CHARFORMATW* pcf) PURE; - STDMETHOD(OnTxParaFormatChange)( THIS_ + THISCALLMETHOD_(HRESULT,OnTxParaFormatChange)( THIS_ const PARAFORMAT* ppf) PURE; - STDMETHOD(TxGetPropertyBits)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetPropertyBits)( THIS_ DWORD dwMask, DWORD* pdwBits) PURE; - STDMETHOD(TxNotify)( THIS_ + THISCALLMETHOD_(HRESULT,TxNotify)( THIS_ DWORD iNotify, void* pv) PURE; - STDMETHOD_(HIMC,TxImmGetContext)( THIS + THISCALLMETHOD_(HIMC,TxImmGetContext)( THIS ) PURE; - STDMETHOD_(void,TxImmReleaseContext)( THIS_ + THISCALLMETHOD_(void,TxImmReleaseContext)( THIS_ HIMC himc) PURE; - STDMETHOD(TxGetSelectionBarWidth)( THIS_ + THISCALLMETHOD_(HRESULT,TxGetSelectionBarWidth)( THIS_ LONG* lSelBarWidth) PURE; }; diff --git a/include/windef.h b/include/windef.h index ff09b871b3b..0074d5cf6c4 100644 --- a/include/windef.h +++ b/include/windef.h @@ -106,6 +106,10 @@ extern "C" { # endif #endif +#ifndef __thiscall +# define __thiscall __stdcall +#endif + #ifndef __ms_va_list # if (defined(__x86_64__) || defined(__aarch64__)) && defined (__GNUC__) # define __ms_va_list __builtin_ms_va_list diff --git a/include/wine/asm.h b/include/wine/asm.h index a614d0e2f6a..4f3d0e4d1d0 100644 --- a/include/wine/asm.h +++ b/include/wine/asm.h @@ -90,14 +90,11 @@ /* thiscall support */ -#undef __thiscall -#define __thiscall __stdcall - -#ifdef __i386__ +#if defined(__i386__) && !defined(__MINGW32__) # ifdef _MSC_VER # define DEFINE_THISCALL_WRAPPER(func,args) \ - __declspec(naked) HRESULT __thiscall_##func(void) \ + __declspec(naked) void __thiscall_##func(void) \ { __asm { \ pop eax \ push ecx \ @@ -107,7 +104,7 @@ # else /* _MSC_VER */ # define DEFINE_THISCALL_WRAPPER(func,args) \ extern void __thiscall_ ## func(void); \ - __ASM_GLOBAL_FUNC( __thiscall_ ## func, \ + __ASM_STDCALL_FUNC( __thiscall_ ## func, args, \ "popl %eax\n\t" \ "pushl %ecx\n\t" \ "pushl %eax\n\t" \ diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index 851a4a75cbf..b8a51256093 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -900,8 +900,8 @@ const char *get_link_name( const ORDDEF *odp ) if (target_platform == PLATFORM_WINDOWS) { - if (odp->flags & FLAG_THISCALL) ret = strmake( "__thiscall_%s", odp->link_name ); - else if (odp->flags & FLAG_FASTCALL) ret = strmake( "@%s@%u", odp->link_name, get_args_size( odp )); + if (odp->flags & FLAG_THISCALL) return odp->link_name; + if (odp->flags & FLAG_FASTCALL) ret = strmake( "@%s@%u", odp->link_name, get_args_size( odp )); else if (!kill_at) ret = strmake( "%s@%u", odp->link_name, get_args_size( odp )); else return odp->link_name; }