rpcrt4: Use the same phase values for clients and stubs.

This commit is contained in:
Alexandre Julliard 2011-07-28 22:34:57 +02:00
parent f3734fd687
commit 78e8fccbd6
3 changed files with 228 additions and 257 deletions

View File

@ -409,14 +409,14 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
case MES_ENCODE: case MES_ENCODE:
pEsMsg->StubMsg.BufferLength = mes_proc_header_buffer_size(); pEsMsg->StubMsg.BufferLength = mes_proc_header_buffer_size();
client_do_args( &pEsMsg->StubMsg, pFormat, PROXY_CALCSIZE, NULL, number_of_params, NULL ); client_do_args( &pEsMsg->StubMsg, pFormat, STUBLESS_CALCSIZE, NULL, number_of_params, NULL );
pEsMsg->ByteCount = pEsMsg->StubMsg.BufferLength - mes_proc_header_buffer_size(); pEsMsg->ByteCount = pEsMsg->StubMsg.BufferLength - mes_proc_header_buffer_size();
es_data_alloc(pEsMsg, pEsMsg->StubMsg.BufferLength); es_data_alloc(pEsMsg, pEsMsg->StubMsg.BufferLength);
mes_proc_header_marshal(pEsMsg); mes_proc_header_marshal(pEsMsg);
client_do_args( &pEsMsg->StubMsg, pFormat, PROXY_MARSHAL, NULL, number_of_params, NULL ); client_do_args( &pEsMsg->StubMsg, pFormat, STUBLESS_MARSHAL, NULL, number_of_params, NULL );
es_data_write(pEsMsg, pEsMsg->ByteCount); es_data_write(pEsMsg, pEsMsg->ByteCount);
break; break;
@ -425,7 +425,7 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
es_data_read(pEsMsg, pEsMsg->ByteCount); es_data_read(pEsMsg, pEsMsg->ByteCount);
client_do_args( &pEsMsg->StubMsg, pFormat, PROXY_UNMARSHAL, NULL, number_of_params, NULL ); client_do_args( &pEsMsg->StubMsg, pFormat, STUBLESS_UNMARSHAL, NULL, number_of_params, NULL );
break; break;
default: default:
RpcRaiseException(RPC_S_INTERNAL_ERROR); RpcRaiseException(RPC_S_INTERNAL_ERROR);

View File

@ -144,14 +144,6 @@ static inline void call_freer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemor
if (m) m(pStubMsg, pMemory, pFormat); if (m) m(pStubMsg, pMemory, pFormat);
} }
#define STUBLESS_UNMARSHAL 1
#define STUBLESS_INITOUT 2
#define STUBLESS_CALLSERVER 3
#define STUBLESS_CALCSIZE 4
#define STUBLESS_GETBUFFER 5
#define STUBLESS_MARSHAL 6
#define STUBLESS_FREE 7
void WINAPI NdrRpcSmSetClientToOsf(PMIDL_STUB_MESSAGE pMessage) void WINAPI NdrRpcSmSetClientToOsf(PMIDL_STUB_MESSAGE pMessage)
{ {
#if 0 /* these functions are not defined yet */ #if 0 /* these functions are not defined yet */
@ -345,8 +337,8 @@ static void client_free_handle(
} }
} }
void client_do_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, int phase, void **fpu_args, void client_do_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase,
unsigned short number_of_params, unsigned char *pRetVal ) void **fpu_args, unsigned short number_of_params, unsigned char *pRetVal )
{ {
const NDR_PARAM_OIF *params = (const NDR_PARAM_OIF *)pFormat; const NDR_PARAM_OIF *params = (const NDR_PARAM_OIF *)pFormat;
unsigned int i; unsigned int i;
@ -380,13 +372,13 @@ void client_do_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, int ph
switch (phase) switch (phase)
{ {
case PROXY_CALCSIZE: case STUBLESS_CALCSIZE:
if (params[i].attr.IsIn) call_buffer_sizer(pStubMsg, pArg, &params[i]); if (params[i].attr.IsIn) call_buffer_sizer(pStubMsg, pArg, &params[i]);
break; break;
case PROXY_MARSHAL: case STUBLESS_MARSHAL:
if (params[i].attr.IsIn) call_marshaller(pStubMsg, pArg, &params[i]); if (params[i].attr.IsIn) call_marshaller(pStubMsg, pArg, &params[i]);
break; break;
case PROXY_UNMARSHAL: case STUBLESS_UNMARSHAL:
if (params[i].attr.IsOut) if (params[i].attr.IsOut)
{ {
if (params[i].attr.IsReturn && pRetVal) pArg = pRetVal; if (params[i].attr.IsReturn && pRetVal) pArg = pRetVal;
@ -535,8 +527,6 @@ LONG_PTR CDECL ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pForma
INTERPRETER_OPT_FLAGS Oif_flags = { 0 }; INTERPRETER_OPT_FLAGS Oif_flags = { 0 };
/* cache of extension flags from NDR_PROC_HEADER_EXTS */ /* cache of extension flags from NDR_PROC_HEADER_EXTS */
INTERPRETER_OPT_FLAGS2 ext_flags = { 0 }; INTERPRETER_OPT_FLAGS2 ext_flags = { 0 };
/* the type of pass we are currently doing */
int phase;
/* header for procedure string */ /* header for procedure string */
const NDR_PROC_HEADER * pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0]; const NDR_PROC_HEADER * pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
/* the value to return to the client from the remote procedure */ /* the value to return to the client from the remote procedure */
@ -657,91 +647,90 @@ LONG_PTR CDECL ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pForma
} }
/* order of phases: /* order of phases:
* 1. PROXY_CALCSIZE - calculate the buffer size * 1. CALCSIZE - calculate the buffer size
* 2. PROXY_GETBUFFER - allocate the buffer * 2. GETBUFFER - allocate the buffer
* 3. PROXY_MARHSAL - marshal [in] params into the buffer * 3. MARSHAL - marshal [in] params into the buffer
* 4. PROXY_SENDRECEIVE - send/receive buffer * 4. SENDRECEIVE - send/receive buffer
* 5. PROXY_UNMARHSAL - unmarshal [out] params from buffer * 5. UNMARSHAL - unmarshal [out] params from buffer
*/ */
if ((pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) || if ((pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) ||
(pProcHeader->Oi_flags & RPC_FC_PROC_OIF_HAS_COMM_OR_FAULT)) (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_HAS_COMM_OR_FAULT))
{ {
__TRY __TRY
{ {
for (phase = PROXY_CALCSIZE; phase <= PROXY_UNMARSHAL; phase++) /* 1. CALCSIZE */
TRACE( "CALCSIZE\n" );
client_do_args(&stubMsg, pFormat, STUBLESS_CALCSIZE, fpu_stack,
number_of_params, (unsigned char *)&RetVal);
/* 2. GETBUFFER */
TRACE( "GETBUFFER\n" );
if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
{ {
TRACE("phase = %d\n", phase); /* allocate the buffer */
switch (phase) NdrProxyGetBuffer(This, &stubMsg);
}
else
{
/* allocate the buffer */
if (Oif_flags.HasPipes)
/* NdrGetPipeBuffer(...) */
FIXME("pipes not supported yet\n");
else
{ {
case PROXY_GETBUFFER: if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
{
/* allocate the buffer */
NdrProxyGetBuffer(This, &stubMsg);
}
else
{
/* allocate the buffer */
if (Oif_flags.HasPipes)
/* NdrGetPipeBuffer(...) */
FIXME("pipes not supported yet\n");
else
{
if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
#if 0 #if 0
NdrNsGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding); NdrNsGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding);
#else #else
FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n"); FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n");
#endif #endif
else
NdrGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding);
}
}
break;
case PROXY_SENDRECEIVE:
if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
{
/* send the [in] params and receive the [out] and [retval]
* params */
NdrProxySendReceive(This, &stubMsg);
}
else else
{ NdrGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding);
/* send the [in] params and receive the [out] and [retval]
* params */
if (Oif_flags.HasPipes)
/* NdrPipesSendReceive(...) */
FIXME("pipes not supported yet\n");
else
{
if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
#if 0
NdrNsSendReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
#else
FIXME("using auto handle - call NdrNsSendReceive when it gets implemented\n");
#endif
else
NdrSendReceive(&stubMsg, stubMsg.Buffer);
}
}
/* convert strings, floating point values and endianess into our
* preferred format */
if ((rpcMsg.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)
NdrConvert(&stubMsg, pFormat);
break;
case PROXY_CALCSIZE:
case PROXY_MARSHAL:
case PROXY_UNMARSHAL:
client_do_args(&stubMsg, pFormat, phase, fpu_stack,
number_of_params, (unsigned char *)&RetVal);
break;
default:
ERR("shouldn't reach here. phase %d\n", phase);
break;
} }
} }
/* 3. MARSHAL */
TRACE( "MARSHAL\n" );
client_do_args(&stubMsg, pFormat, STUBLESS_MARSHAL, fpu_stack,
number_of_params, (unsigned char *)&RetVal);
/* 4. SENDRECEIVE */
TRACE( "SENDRECEIVE\n" );
if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
{
/* send the [in] params and receive the [out] and [retval]
* params */
NdrProxySendReceive(This, &stubMsg);
}
else
{
/* send the [in] params and receive the [out] and [retval]
* params */
if (Oif_flags.HasPipes)
/* NdrPipesSendReceive(...) */
FIXME("pipes not supported yet\n");
else
{
if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
#if 0
NdrNsSendReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
#else
FIXME("using auto handle - call NdrNsSendReceive when it gets implemented\n");
#endif
else
NdrSendReceive(&stubMsg, stubMsg.Buffer);
}
}
/* convert strings, floating point values and endianess into our
* preferred format */
if ((rpcMsg.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)
NdrConvert(&stubMsg, pFormat);
/* 5. UNMARSHAL */
TRACE( "UNMARSHAL\n" );
client_do_args(&stubMsg, pFormat, STUBLESS_UNMARSHAL, fpu_stack,
number_of_params, (unsigned char *)&RetVal);
} }
__EXCEPT_ALL __EXCEPT_ALL
{ {
@ -777,70 +766,59 @@ LONG_PTR CDECL ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pForma
} }
else else
{ {
/* order of phases: /* 1. CALCSIZE */
* 1. PROXY_CALCSIZE - calculate the buffer size TRACE( "CALCSIZE\n" );
* 2. PROXY_GETBUFFER - allocate the buffer client_do_args(&stubMsg, pFormat, STUBLESS_CALCSIZE, fpu_stack,
* 3. PROXY_MARHSAL - marshal [in] params into the buffer number_of_params, (unsigned char *)&RetVal);
* 4. PROXY_SENDRECEIVE - send/receive buffer
* 5. PROXY_UNMARHSAL - unmarshal [out] params from buffer /* 2. GETBUFFER */
*/ TRACE( "GETBUFFER\n" );
for (phase = PROXY_CALCSIZE; phase <= PROXY_UNMARSHAL; phase++) if (Oif_flags.HasPipes)
/* NdrGetPipeBuffer(...) */
FIXME("pipes not supported yet\n");
else
{ {
TRACE("phase = %d\n", phase); if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
switch (phase)
{
case PROXY_GETBUFFER:
/* allocate the buffer */
if (Oif_flags.HasPipes)
/* NdrGetPipeBuffer(...) */
FIXME("pipes not supported yet\n");
else
{
if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
#if 0 #if 0
NdrNsGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding); NdrNsGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding);
#else #else
FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n"); FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n");
#endif #endif
else else
NdrGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding); NdrGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding);
}
break;
case PROXY_SENDRECEIVE:
/* send the [in] params and receive the [out] and [retval]
* params */
if (Oif_flags.HasPipes)
/* NdrPipesSendReceive(...) */
FIXME("pipes not supported yet\n");
else
{
if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
#if 0
NdrNsSendReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
#else
FIXME("using auto handle - call NdrNsSendReceive when it gets implemented\n");
#endif
else
NdrSendReceive(&stubMsg, stubMsg.Buffer);
}
/* convert strings, floating point values and endianess into our
* preferred format */
if ((rpcMsg.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)
NdrConvert(&stubMsg, pFormat);
break;
case PROXY_CALCSIZE:
case PROXY_MARSHAL:
case PROXY_UNMARSHAL:
client_do_args(&stubMsg, pFormat, phase, fpu_stack,
number_of_params, (unsigned char *)&RetVal);
break;
default:
ERR("shouldn't reach here. phase %d\n", phase);
break;
}
} }
/* 3. MARSHAL */
TRACE( "MARSHAL\n" );
client_do_args(&stubMsg, pFormat, STUBLESS_MARSHAL, fpu_stack,
number_of_params, (unsigned char *)&RetVal);
/* 4. SENDRECEIVE */
TRACE( "SENDRECEIVE\n" );
if (Oif_flags.HasPipes)
/* NdrPipesSendReceive(...) */
FIXME("pipes not supported yet\n");
else
{
if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
#if 0
NdrNsSendReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
#else
FIXME("using auto handle - call NdrNsSendReceive when it gets implemented\n");
#endif
else
NdrSendReceive(&stubMsg, stubMsg.Buffer);
}
/* convert strings, floating point values and endianess into our
* preferred format */
if ((rpcMsg.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)
NdrConvert(&stubMsg, pFormat);
/* 5. UNMARSHAL */
TRACE( "UNMARSHAL\n" );
client_do_args(&stubMsg, pFormat, STUBLESS_UNMARSHAL, fpu_stack,
number_of_params, (unsigned char *)&RetVal);
} }
if (ext_flags.HasNewCorrDesc) if (ext_flags.HasNewCorrDesc)
@ -1071,7 +1049,7 @@ static DWORD calc_arg_size(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
} }
static LONG_PTR *stub_do_args(MIDL_STUB_MESSAGE *pStubMsg, static LONG_PTR *stub_do_args(MIDL_STUB_MESSAGE *pStubMsg,
PFORMAT_STRING pFormat, int phase, PFORMAT_STRING pFormat, enum stubless_phase phase,
unsigned short number_of_params) unsigned short number_of_params)
{ {
const NDR_PARAM_OIF *params = (const NDR_PARAM_OIF *)pFormat; const NDR_PARAM_OIF *params = (const NDR_PARAM_OIF *)pFormat;
@ -1187,7 +1165,7 @@ LONG WINAPI NdrStubCall2(
/* cache of extension flags from NDR_PROC_HEADER_EXTS */ /* cache of extension flags from NDR_PROC_HEADER_EXTS */
INTERPRETER_OPT_FLAGS2 ext_flags = { 0 }; INTERPRETER_OPT_FLAGS2 ext_flags = { 0 };
/* the type of pass we are currently doing */ /* the type of pass we are currently doing */
int phase; enum stubless_phase phase;
/* header for procedure string */ /* header for procedure string */
const NDR_PROC_HEADER *pProcHeader; const NDR_PROC_HEADER *pProcHeader;
/* location to put retval into */ /* location to put retval into */
@ -1474,12 +1452,11 @@ LONG_PTR CDECL ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING
INTERPRETER_OPT_FLAGS Oif_flags = { 0 }; INTERPRETER_OPT_FLAGS Oif_flags = { 0 };
/* cache of extension flags from NDR_PROC_HEADER_EXTS */ /* cache of extension flags from NDR_PROC_HEADER_EXTS */
INTERPRETER_OPT_FLAGS2 ext_flags = { 0 }; INTERPRETER_OPT_FLAGS2 ext_flags = { 0 };
/* the type of pass we are currently doing */
int phase;
/* header for procedure string */ /* header for procedure string */
const NDR_PROC_HEADER * pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0]; const NDR_PROC_HEADER * pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
/* -Oif or -Oicf generated format */ /* -Oif or -Oicf generated format */
BOOL bV2Format = FALSE; BOOL bV2Format = FALSE;
RPC_STATUS status;
TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc, pFormat); TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc, pFormat);
@ -1596,72 +1573,65 @@ LONG_PTR CDECL ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING
} }
/* order of phases: /* order of phases:
* 1. PROXY_CALCSIZE - calculate the buffer size * 1. CALCSIZE - calculate the buffer size
* 2. PROXY_GETBUFFER - allocate the buffer * 2. GETBUFFER - allocate the buffer
* 3. PROXY_MARHSAL - marshal [in] params into the buffer * 3. MARSHAL - marshal [in] params into the buffer
* 4. PROXY_SENDRECEIVE - send buffer * 4. SENDRECEIVE - send buffer
* Then in NdrpCompleteAsyncClientCall: * Then in NdrpCompleteAsyncClientCall:
* 1. PROXY_SENDRECEIVE - receive buffer * 1. SENDRECEIVE - receive buffer
* 2. PROXY_UNMARHSAL - unmarshal [out] params from buffer * 2. UNMARSHAL - unmarshal [out] params from buffer
*/ */
for (phase = PROXY_CALCSIZE; phase <= PROXY_SENDRECEIVE; phase++)
/* 1. CALCSIZE */
TRACE( "CALCSIZE\n" );
client_do_args(pStubMsg, pFormat, STUBLESS_CALCSIZE, NULL, async_call_data->number_of_params, NULL);
/* 2. GETBUFFER */
TRACE( "GETBUFFER\n" );
if (Oif_flags.HasPipes)
/* NdrGetPipeBuffer(...) */
FIXME("pipes not supported yet\n");
else
{ {
RPC_STATUS status; if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
TRACE("phase = %d\n", phase);
switch (phase)
{
case PROXY_GETBUFFER:
/* allocate the buffer */
if (Oif_flags.HasPipes)
/* NdrGetPipeBuffer(...) */
FIXME("pipes not supported yet\n");
else
{
if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
#if 0 #if 0
NdrNsGetBuffer(pStubMsg, pStubMsg->BufferLength, async_call_data->hBinding); NdrNsGetBuffer(pStubMsg, pStubMsg->BufferLength, async_call_data->hBinding);
#else #else
FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n"); FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n");
#endif #endif
else else
NdrGetBuffer(pStubMsg, pStubMsg->BufferLength, async_call_data->hBinding); NdrGetBuffer(pStubMsg, pStubMsg->BufferLength, async_call_data->hBinding);
} }
pRpcMsg->RpcFlags |= RPC_BUFFER_ASYNC; pRpcMsg->RpcFlags |= RPC_BUFFER_ASYNC;
status = I_RpcAsyncSetHandle(pRpcMsg, pAsync); status = I_RpcAsyncSetHandle(pRpcMsg, pAsync);
if (status != RPC_S_OK)
RpcRaiseException(status);
/* 3. MARSHAL */
TRACE( "MARSHAL\n" );
client_do_args(pStubMsg, pFormat, STUBLESS_MARSHAL, NULL, async_call_data->number_of_params, NULL);
/* 4. SENDRECEIVE */
TRACE( "SEND\n" );
pRpcMsg->RpcFlags |= RPC_BUFFER_ASYNC;
/* send the [in] params only */
if (Oif_flags.HasPipes)
/* NdrPipesSend(...) */
FIXME("pipes not supported yet\n");
else
{
if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
#if 0
NdrNsSend(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
#else
FIXME("using auto handle - call NdrNsSend when it gets implemented\n");
#endif
else
{
pStubMsg->RpcMsg->BufferLength = pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer;
status = I_RpcSend(pStubMsg->RpcMsg);
if (status != RPC_S_OK) if (status != RPC_S_OK)
RpcRaiseException(status); RpcRaiseException(status);
break;
case PROXY_SENDRECEIVE:
pRpcMsg->RpcFlags |= RPC_BUFFER_ASYNC;
/* send the [in] params only */
if (Oif_flags.HasPipes)
/* NdrPipesSend(...) */
FIXME("pipes not supported yet\n");
else
{
if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
#if 0
NdrNsSend(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
#else
FIXME("using auto handle - call NdrNsSend when it gets implemented\n");
#endif
else
{
pStubMsg->RpcMsg->BufferLength = pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer;
status = I_RpcSend(pStubMsg->RpcMsg);
if (status != RPC_S_OK)
RpcRaiseException(status);
}
}
break;
case PROXY_CALCSIZE:
case PROXY_MARSHAL:
client_do_args(pStubMsg, pFormat, phase, NULL, async_call_data->number_of_params, NULL);
break;
default:
ERR("shouldn't reach here. phase %d\n", phase);
break;
} }
} }
@ -1675,8 +1645,6 @@ RPC_STATUS NdrpCompleteAsyncClientCall(RPC_ASYNC_STATE *pAsync, void *Reply)
/* pointer to start of stack where arguments start */ /* pointer to start of stack where arguments start */
PMIDL_STUB_MESSAGE pStubMsg; PMIDL_STUB_MESSAGE pStubMsg;
struct async_call_data *async_call_data; struct async_call_data *async_call_data;
/* the type of pass we are currently doing */
int phase;
/* header for procedure string */ /* header for procedure string */
const NDR_PROC_HEADER * pProcHeader; const NDR_PROC_HEADER * pProcHeader;
RPC_STATUS status = RPC_S_OK; RPC_STATUS status = RPC_S_OK;
@ -1689,56 +1657,48 @@ RPC_STATUS NdrpCompleteAsyncClientCall(RPC_ASYNC_STATE *pAsync, void *Reply)
pProcHeader = async_call_data->pProcHeader; pProcHeader = async_call_data->pProcHeader;
/* order of phases: /* order of phases:
* 1. PROXY_CALCSIZE - calculate the buffer size * 1. CALCSIZE - calculate the buffer size
* 2. PROXY_GETBUFFER - allocate the buffer * 2. GETBUFFER - allocate the buffer
* 3. PROXY_MARHSAL - marshal [in] params into the buffer * 3. MARSHAL - marshal [in] params into the buffer
* 4. PROXY_SENDRECEIVE - send buffer * 4. SENDRECEIVE - send buffer
* Then in NdrpCompleteAsyncClientCall: * Then in NdrpCompleteAsyncClientCall:
* 1. PROXY_SENDRECEIVE - receive buffer * 1. SENDRECEIVE - receive buffer
* 2. PROXY_UNMARHSAL - unmarshal [out] params from buffer * 2. UNMARSHAL - unmarshal [out] params from buffer
*/ */
for (phase = PROXY_SENDRECEIVE; phase <= PROXY_UNMARSHAL; phase++)
{ /* 1. SENDRECEIVE */
switch (phase) TRACE( "RECEIVE\n" );
{ pStubMsg->RpcMsg->RpcFlags |= RPC_BUFFER_ASYNC;
case PROXY_SENDRECEIVE: /* receive the [out] params */
pStubMsg->RpcMsg->RpcFlags |= RPC_BUFFER_ASYNC; if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
/* receive the [out] params */
if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
#if 0 #if 0
NdrNsReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle); NdrNsReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
#else #else
FIXME("using auto handle - call NdrNsReceive when it gets implemented\n"); FIXME("using auto handle - call NdrNsReceive when it gets implemented\n");
#endif #endif
else else
{ {
status = I_RpcReceive(pStubMsg->RpcMsg); status = I_RpcReceive(pStubMsg->RpcMsg);
if (status != RPC_S_OK) if (status != RPC_S_OK)
goto cleanup; goto cleanup;
pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength; pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength;
pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer; pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength; pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
pStubMsg->Buffer = pStubMsg->BufferStart; pStubMsg->Buffer = pStubMsg->BufferStart;
}
/* convert strings, floating point values and endianess into our
* preferred format */
#if 0
if ((pStubMsg->RpcMsg.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)
NdrConvert(pStubMsg, pFormat);
#endif
break;
case PROXY_UNMARSHAL:
client_do_args(pStubMsg, async_call_data->pParamFormat, phase,
NULL, async_call_data->number_of_params, Reply);
break;
default:
ERR("shouldn't reach here. phase %d\n", phase);
break;
}
} }
/* convert strings, floating point values and endianess into our
* preferred format */
#if 0
if ((pStubMsg->RpcMsg.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)
NdrConvert(pStubMsg, pFormat);
#endif
/* 2. UNMARSHAL */
TRACE( "UNMARSHAL\n" );
client_do_args(pStubMsg, async_call_data->pParamFormat, STUBLESS_UNMARSHAL,
NULL, async_call_data->number_of_params, Reply);
cleanup: cleanup:
if (pStubMsg->fHasNewCorrDesc) if (pStubMsg->fHasNewCorrDesc)
{ {

View File

@ -225,12 +225,23 @@ typedef struct _NDR_EHD_CONTEXT
#include "poppack.h" #include "poppack.h"
enum stubless_phase
{
STUBLESS_UNMARSHAL,
STUBLESS_INITOUT,
STUBLESS_CALLSERVER,
STUBLESS_CALCSIZE,
STUBLESS_GETBUFFER,
STUBLESS_MARSHAL,
STUBLESS_FREE
};
LONG_PTR CDECL ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, LONG_PTR CDECL ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat,
void **stack_top, void **fpu_stack ) DECLSPEC_HIDDEN; void **stack_top, void **fpu_stack ) DECLSPEC_HIDDEN;
LONG_PTR CDECL ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, LONG_PTR CDECL ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat,
void **stack_top ) DECLSPEC_HIDDEN; void **stack_top ) DECLSPEC_HIDDEN;
void client_do_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, int phase, void **fpu_args, void client_do_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase,
unsigned short number_of_params, unsigned char *pRetVal ) DECLSPEC_HIDDEN; void **fpu_args, unsigned short number_of_params, unsigned char *pRetVal ) DECLSPEC_HIDDEN;
PFORMAT_STRING convert_old_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, PFORMAT_STRING convert_old_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat,
unsigned int stack_size, BOOL object_proc, unsigned int stack_size, BOOL object_proc,
void *buffer, unsigned int size, unsigned int *count ) DECLSPEC_HIDDEN; void *buffer, unsigned int size, unsigned int *count ) DECLSPEC_HIDDEN;