Commit a215f6b2 authored by Greg Turner's avatar Greg Turner Committed by Alexandre Julliard

- Clean up and add some comments.

- Add NDR Data representation constants. - Propagate DataRepresentation into and out of packet headers. - Implement NdrServerInitializeNew
parent 1563fab4
......@@ -105,7 +105,7 @@ void WINAPI NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned
TRACE("(pStubMsg == ^%p, pMemory == ^%p, pFormat == ^%p)\n", pStubMsg, pMemory, pFormat);
if (*pFormat == RPC_FC_C_CSTRING) {
/* we need 12 chars for the [maxlen, offset, len] DWORDS, + 1 byte for '\0' */
/* we need 12 octets for the [maxlen, offset, len] DWORDS, + 1 octet for '\0' */
pStubMsg->BufferLength = strlen(pMemory) + 13 + BUFFER_PARANOIA;
} else {
ERR("Unhandled string type: %#x\n", *pFormat);
......@@ -139,6 +139,8 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg
void WINAPI NdrConvert( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat )
{
FIXME("(pStubMsg == ^%p, pFormat == ^%p): stub.\n", pStubMsg, pFormat);
/* FIXME: since this stub doesn't do any converting, the proper behavior
is to raise an exception */
}
/***********************************************************************
......@@ -147,4 +149,6 @@ void WINAPI NdrConvert( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat )
void WINAPI NdrConvert2( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, long NumberParams )
{
FIXME("(pStubMsg == ^%p, pFormat == ^%p, NumberParams == %ld): stub.\n", pStubMsg, pFormat, NumberParams);
/* FIXME: since this stub doesn't do any converting, the proper behavior
is to raise an exception */
}
......@@ -40,6 +40,7 @@
#include "cpsf.h"
#include "ndr_misc.h"
#include "rpcndr.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
......@@ -178,6 +179,8 @@ void WINAPI NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE
TRACE("(pRpcMessage == ^%p, pStubMsg == ^%p, pStubDesc == ^%p, ProcNum == %d)\n",
pRpcMessage, pStubMsg, pStubDesc, ProcNum);
assert( pRpcMessage && pStubMsg && pStubDesc );
memset(pRpcMessage, 0, sizeof(RPC_MESSAGE));
memset(pStubMsg, 0, sizeof(MIDL_STUB_MESSAGE));
......@@ -198,7 +201,20 @@ void WINAPI NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE
unsigned char* WINAPI NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_MESSAGE pStubMsg,
PMIDL_STUB_DESC pStubDesc )
{
FIXME("(pRpcMsg == ^%p, pStubMsg == ^%p, pStubDesc == ^%p): stub.\n", pRpcMsg, pStubMsg, pStubDesc);
TRACE("(pRpcMsg == ^%p, pStubMsg == ^%p, pStubDesc == ^%p)\n", pRpcMsg, pStubMsg, pStubDesc);
assert( pRpcMsg && pStubMsg && pStubDesc );
memset(pStubMsg, 0, sizeof(MIDL_STUB_MESSAGE));
pStubMsg->ReuseBuffer = TRUE;
pStubMsg->IsClient = FALSE;
pStubMsg->StubDesc = pStubDesc;
pStubMsg->pfnAllocate = pStubDesc->pfnAllocate;
pStubMsg->pfnFree = pStubDesc->pfnFree;
pStubMsg->RpcMsg = pRpcMsg;
/* FIXME: determine the proper return value */
return NULL;
}
......@@ -254,6 +270,9 @@ unsigned char *WINAPI NdrSendReceive( MIDL_STUB_MESSAGE *stubmsg, unsigned char
return NULL;
}
/* not sure where MS does this; for now I'll stick it here */
stubmsg->RpcMsg->DataRepresentation = NDR_LOCAL_DATA_REPRESENTATION;
if (I_RpcSendReceive(stubmsg->RpcMsg) != RPC_S_OK) {
WARN("I_RpcSendReceive did not return success.\n");
}
......
......@@ -102,6 +102,10 @@ RPC_STATUS WINAPI I_RpcSend(PRPC_MESSAGE pMsg)
MAKELONG(sif->InterfaceId.SyntaxVersion.MinorVersion, sif->InterfaceId.SyntaxVersion.MajorVersion) :
MAKELONG(cif->InterfaceId.SyntaxVersion.MinorVersion, cif->InterfaceId.SyntaxVersion.MajorVersion);
hdr.opnum = pMsg->ProcNum;
/* only the low-order 3 octets of the DataRepresentation go in the header */
hdr.drep[0] = LOBYTE(LOWORD(pMsg->DataRepresentation));
hdr.drep[1] = HIBYTE(LOWORD(pMsg->DataRepresentation));
hdr.drep[2] = LOBYTE(HIWORD(pMsg->DataRepresentation));
hdr.len = pMsg->BufferLength;
/* transmit packet */
......
......@@ -145,6 +145,12 @@ static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
func = sif->If->DispatchTable->DispatchTable[msg.ProcNum];
}
/* put in the drep. FIXME: is this more universally applicable?
perhaps we should move this outward... */
msg.DataRepresentation =
MAKELONG( MAKEWORD(hdr.drep[0], hdr.drep[1]),
MAKEWORD(hdr.drep[2], 0));
/* dispatch */
if (func) func(&msg);
......
......@@ -26,6 +26,16 @@
#include "rpc.h"
#define NDR_LITTLE_ENDIAN ((UINT32) 0x00000010)
#define NDR_BIG_ENDIAN ((UINT32) 0x00000000)
/* Character Representation: ASCII
* Integer Representation: Little Endian
* FP Representation: IEEE
*/
#define NDR_LOCAL_DATA_REPRESENTATION ((UINT32) 0x00000010)
#define NDR_LOCAL_ENDIAN NDR_LITTLE_ENDIAN
#define TARGET_IS_NT40_OR_LATER 1
#define TARGET_IS_NT351_OR_WIN95_OR_LATER 1
......
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