Commit f0619172 authored by Alexandre Julliard's avatar Alexandre Julliard

include: Make CLIENT_CALL_RETURN definition platform-specific to handle the…

include: Make CLIENT_CALL_RETURN definition platform-specific to handle the return type incompatibility in NdrClientCall.
parent 9128dea4
......@@ -95,7 +95,7 @@ __ASM_GLOBAL_FUNC(call_stubless_func,
"addl %edx,%esp\n\t"
"jmp *%ecx" );
HRESULT WINAPI ObjectStubless(DWORD *args)
CLIENT_CALL_RETURN WINAPI ObjectStubless(DWORD *args)
{
DWORD index = args[0];
void **iface = (void **)args[2];
......
......@@ -548,10 +548,7 @@ void client_do_args_old_format(PMIDL_STUB_MESSAGE pStubMsg,
}
}
/* the return type should be CLIENT_CALL_RETURN, but this is incompatible
* with the way gcc returns structures. "void *" should be the largest type
* that MIDL should allow you to return anyway */
LONG_PTR WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, ...)
CLIENT_CALL_RETURN WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, ...)
{
/* pointer to start of stack where arguments start */
RPC_MESSAGE rpcMsg;
......@@ -629,7 +626,7 @@ LONG_PTR WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pForma
if (!(pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT))
{
pFormat = client_get_handle(&stubMsg, pProcHeader, pHandleFormat, &hBinding);
if (!pFormat) return 0;
if (!pFormat) goto done;
}
bV2Format = (pStubDesc->Version >= 0x20000);
......@@ -899,9 +896,9 @@ LONG_PTR WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pForma
client_free_handle(&stubMsg, pProcHeader, pHandleFormat, hBinding);
}
done:
TRACE("RetVal = 0x%lx\n", RetVal);
return RetVal;
return *(CLIENT_CALL_RETURN *)&RetVal;
}
/* Calls a function with the specified arguments, restoring the stack
......@@ -1638,7 +1635,7 @@ struct async_call_data
ULONG_PTR NdrCorrCache[256];
};
LONG_PTR WINAPIV NdrAsyncClientCall(PMIDL_STUB_DESC pStubDesc,
CLIENT_CALL_RETURN WINAPIV NdrAsyncClientCall(PMIDL_STUB_DESC pStubDesc,
PFORMAT_STRING pFormat, ...)
{
/* pointer to start of stack where arguments start */
......@@ -1658,6 +1655,7 @@ LONG_PTR WINAPIV NdrAsyncClientCall(PMIDL_STUB_DESC pStubDesc,
const NDR_PROC_HEADER * pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
/* -Oif or -Oicf generated format */
BOOL bV2Format = FALSE;
LONG_PTR RetVal;
__ms_va_list args;
TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc, pFormat);
......@@ -1720,7 +1718,7 @@ LONG_PTR WINAPIV NdrAsyncClientCall(PMIDL_STUB_DESC pStubDesc,
async_call_data->pHandleFormat = pFormat;
pFormat = client_get_handle(pStubMsg, pProcHeader, async_call_data->pHandleFormat, &async_call_data->hBinding);
if (!pFormat) return 0;
if (!pFormat) goto done;
bV2Format = (pStubDesc->Version >= 0x20000);
......@@ -1846,8 +1844,10 @@ LONG_PTR WINAPIV NdrAsyncClientCall(PMIDL_STUB_DESC pStubDesc,
}
}
done:
TRACE("returning 0\n");
return 0;
RetVal = 0;
return *(CLIENT_CALL_RETURN *)&RetVal;
}
RPC_STATUS NdrpCompleteAsyncClientCall(RPC_ASYNC_STATE *pAsync, void *Reply)
......
......@@ -414,11 +414,17 @@ typedef struct _MIDL_STUBLESS_PROXY_INFO
PMIDL_SYNTAX_INFO pSyntaxInfo;
} MIDL_STUBLESS_PROXY_INFO, *PMIDL_STUBLESS_PROXY_INFO;
#if defined(__i386__) && !defined(__MSC_VER) && !defined(__MINGW32__) && !defined(__CYGWIN__)
/* Calling convention for returning structures/unions is different between Windows and gcc on i386 */
typedef LONG_PTR CLIENT_CALL_RETURN;
#else
typedef union _CLIENT_CALL_RETURN
{
void *Pointer;
LONG_PTR Simple;
} CLIENT_CALL_RETURN;
#endif
typedef enum {
STUB_UNMARSHAL,
......@@ -645,15 +651,13 @@ RPCRTAPI void RPC_ENTRY
RPCRTAPI unsigned char* RPC_ENTRY
NdrUserMarshalSimpleTypeConvert( ULONG *pFlags, unsigned char *pBuffer, unsigned char FormatChar );
/* Note: this should return a CLIENT_CALL_RETURN, but calling convention for
* returning structures/unions is different between Windows and gcc on i386. */
LONG_PTR RPC_VAR_ENTRY
CLIENT_CALL_RETURN RPC_VAR_ENTRY
NdrClientCall2( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
LONG_PTR RPC_VAR_ENTRY
CLIENT_CALL_RETURN RPC_VAR_ENTRY
NdrClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
LONG_PTR RPC_VAR_ENTRY
CLIENT_CALL_RETURN RPC_VAR_ENTRY
NdrAsyncClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
LONG_PTR RPC_VAR_ENTRY
CLIENT_CALL_RETURN RPC_VAR_ENTRY
NdrDcomAsyncClientCall( PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ... );
RPCRTAPI void RPC_ENTRY
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment