[PATCH] winecrt0: Make __wine_(un)register_resources() cdecl.

Zebediah Figura z.figura12 at gmail.com
Mon Feb 10 15:25:57 CST 2020


From: Zebediah Figura <zfigura at codeweavers.com>

This fixes a bug where 64-bit winegstreamer.dll would fail to (un)register
CLSID_VideoProcessorMFT when run manually with regsvr32. The bug occurs because
__wine_(un)register_resources() in winecrt0 is built with -mabi=ms and thus
expects its first argument in %rcx, but winegstreamer passes it in %rdi.

Fixes: d401837994a31277103042fbe091e364c2fa55ea
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
I didn't test explicitly that d40183799 is the first broken commit, but unless
something else broke this earlier, it logically should be.

Based on e.g. 1f6681f47 and 60df3b14b I'm guessing this is the preferred fix. An
alternative fix would of course be not to use MSVCRTFLAGS if we are not
cross-compiling. I don't understand why that's not the preferred fix, given that
MSVCRTFLAGS seems to append nothing that would make a difference if we were not
cross-compiling (unless -fno-builtin makes a difference, but I can't tell why it
would).

 dlls/winecrt0/register.c | 4 ++--
 include/rpcproxy.h       | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/winecrt0/register.c b/dlls/winecrt0/register.c
index 8c15d1be721..cb5e7a50f76 100644
--- a/dlls/winecrt0/register.c
+++ b/dlls/winecrt0/register.c
@@ -94,7 +94,7 @@ static BOOL CALLBACK register_resource( HMODULE module, LPCWSTR type, LPWSTR nam
     return SUCCEEDED(info->result);
 }
 
-HRESULT __wine_register_resources( HMODULE module )
+HRESULT __cdecl __wine_register_resources( HMODULE module )
 {
     struct reg_info info;
 
@@ -106,7 +106,7 @@ HRESULT __wine_register_resources( HMODULE module )
     return info.result;
 }
 
-HRESULT __wine_unregister_resources( HMODULE module )
+HRESULT __cdecl __wine_unregister_resources( HMODULE module )
 {
     struct reg_info info;
 
diff --git a/include/rpcproxy.h b/include/rpcproxy.h
index 4d2c63e62d6..5b184329bd4 100644
--- a/include/rpcproxy.h
+++ b/include/rpcproxy.h
@@ -203,8 +203,8 @@ RPCRTAPI HRESULT RPC_ENTRY
 RPCRTAPI HRESULT RPC_ENTRY
   NdrDllUnregisterProxy( HMODULE hDll, const ProxyFileInfo **pProxyFileList, const CLSID *pclsid );
 
-HRESULT __wine_register_resources( HMODULE module ) DECLSPEC_HIDDEN;
-HRESULT __wine_unregister_resources( HMODULE module ) DECLSPEC_HIDDEN;
+HRESULT __cdecl __wine_register_resources( HMODULE module ) DECLSPEC_HIDDEN;
+HRESULT __cdecl __wine_unregister_resources( HMODULE module ) DECLSPEC_HIDDEN;
 
 #define CSTDSTUBBUFFERRELEASE(pFactory) \
 ULONG WINAPI CStdStubBuffer_Release(IRpcStubBuffer *This) \
-- 
2.25.0




More information about the wine-devel mailing list