Sync to Wine-0_9_10:

Robert Shearman <rob@codeweavers.com>
- ndrtypes.h added into reactos/include
- too many changes to paste here. Look at the url below, checking all changes done after Wine-0_9_5 tag (including Wine-0_9_10 as the last one)
- http://cvs.winehq.com/cvsweb/wine/dlls/rpcrt4/?cvsroot=home/wine

svn path=/trunk/; revision=21362
This commit is contained in:
Aleksey Bragin 2006-03-20 21:52:24 +00:00
parent 1e8013cf73
commit 43a02bfa45
14 changed files with 1807 additions and 241 deletions

View file

@ -104,7 +104,7 @@ static HRESULT WINAPI ObjectStubless(DWORD index)
unsigned bytes = *(const WORD*)(fs+8) - STACK_ADJUST;
TRACE("(%p)->(%ld)([%d bytes]) ret=%08lx\n", iface, index, bytes, *(DWORD*)(args+bytes));
return RPCRT4_NdrClientCall2(This->stubless->pStubDesc, fs, args);
return NdrClientCall2(This->stubless->pStubDesc, fs, args);
}
#else /* __i386__ */
@ -119,20 +119,21 @@ struct StublessThunk { int dummy; };
HRESULT WINAPI StdProxy_Construct(REFIID riid,
LPUNKNOWN pUnkOuter,
PCInterfaceName name,
CInterfaceProxyVtbl *vtbl,
CInterfaceStubVtbl *svtbl,
const ProxyFileInfo *ProxyInfo,
int Index,
LPPSFACTORYBUFFER pPSFactory,
LPRPCPROXYBUFFER *ppProxy,
LPVOID *ppvObj)
{
StdProxyImpl *This;
const MIDL_STUBLESS_PROXY_INFO *stubless = NULL;
PCInterfaceName name = ProxyInfo->pNamesArray[Index];
CInterfaceProxyVtbl *vtbl = ProxyInfo->pProxyVtblList[Index];
TRACE("(%p,%p,%p,%p,%p) %s\n", pUnkOuter, vtbl, pPSFactory, ppProxy, ppvObj, name);
/* I can't find any other way to detect stubless proxies than this hack */
if (!IsEqualGUID(vtbl->header.piid, riid)) {
/* TableVersion = 2 means it is the stubless version of CInterfaceProxyVtbl */
if (ProxyInfo->TableVersion > 1) {
stubless = *(const void **)vtbl;
vtbl = (CInterfaceProxyVtbl *)((const void **)vtbl + 1);
TRACE("stubless=%p\n", stubless);
@ -150,11 +151,12 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
if (!This) return E_OUTOFMEMORY;
if (stubless) {
unsigned i, count = svtbl->header.DispatchTableCount;
CInterfaceStubVtbl *svtbl = ProxyInfo->pStubVtblList[Index];
unsigned long i, count = svtbl->header.DispatchTableCount;
/* Maybe the original vtbl is just modified directly to point at
* ObjectStublessClientXXX thunks in real Windows, but I don't like it
*/
TRACE("stubless thunks: count=%d\n", count);
TRACE("stubless thunks: count=%ld\n", count);
This->thunks = HeapAlloc(GetProcessHeap(),0,sizeof(struct StublessThunk)*count);
This->PVtbl = HeapAlloc(GetProcessHeap(),0,sizeof(LPVOID)*count);
for (i=0; i<count; i++) {
@ -162,7 +164,7 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
if (vtbl->Vtbl[i] == (LPVOID)-1) {
PFORMAT_STRING fs = stubless->ProcFormatString + stubless->FormatStringOffset[i];
unsigned bytes = *(const WORD*)(fs+8) - STACK_ADJUST;
TRACE("method %d: stacksize=%d\n", i, bytes);
TRACE("method %ld: stacksize=%d\n", i, bytes);
FILL_STUBLESS(thunk, i, bytes)
This->PVtbl[i] = thunk;
}
@ -186,7 +188,11 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
This->pChannel = NULL;
*ppProxy = (LPRPCPROXYBUFFER)&This->lpVtbl;
*ppvObj = &This->PVtbl;
IUnknown_AddRef((IUnknown *)*ppvObj);
/* if there is no outer unknown then the caller will control the lifetime
* of the proxy object through the proxy buffer, so no need to increment the
* ref count of the proxy object */
if (pUnkOuter)
IUnknown_AddRef((IUnknown *)*ppvObj);
IPSFactoryBuffer_AddRef(pPSFactory);
return S_OK;

View file

@ -95,9 +95,7 @@ static HRESULT WINAPI CStdPSFactory_CreateProxy(LPPSFACTORYBUFFER iface,
debugstr_guid(riid),ppProxy,ppv);
if (!FindProxyInfo(This->pProxyFileList,riid,&ProxyInfo,&Index))
return E_NOINTERFACE;
return StdProxy_Construct(riid, pUnkOuter, ProxyInfo->pNamesArray[Index],
ProxyInfo->pProxyVtblList[Index],
ProxyInfo->pStubVtblList[Index], iface, ppProxy, ppv);
return StdProxy_Construct(riid, pUnkOuter, ProxyInfo, Index, iface, ppProxy, ppv);
}
static HRESULT WINAPI CStdPSFactory_CreateStub(LPPSFACTORYBUFFER iface,
@ -139,9 +137,24 @@ HRESULT WINAPI NdrDllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv,
*ppv = NULL;
if (!pPSFactoryBuffer->lpVtbl) {
const ProxyFileInfo **pProxyFileList2;
pPSFactoryBuffer->lpVtbl = &CStdPSFactory_Vtbl;
pPSFactoryBuffer->RefCount = 0;
pPSFactoryBuffer->pProxyFileList = pProxyFileList;
for (pProxyFileList2 = pProxyFileList; *pProxyFileList2; pProxyFileList2++) {
int i;
for (i = 0; i < (*pProxyFileList2)->TableSize; i++) {
/* FIXME: i think that different vtables should be copied for
* async interfaces */
void * const *pSrcRpcStubVtbl = (void * const *)&CStdStubBuffer_Vtbl;
void **pRpcStubVtbl = (void **)&(*pProxyFileList2)->pStubVtblList[i]->Vtbl;
int j;
for (j = 0; j < sizeof(IRpcStubBufferVtbl)/sizeof(void *); j++)
if (!pRpcStubVtbl[j])
pRpcStubVtbl[j] = pSrcRpcStubVtbl[j];
}
}
}
if (IsEqualGUID(rclsid, pclsid))
return IPSFactoryBuffer_QueryInterface((LPPSFACTORYBUFFER)pPSFactoryBuffer, iid, ppv);

View file

@ -23,9 +23,8 @@
HRESULT WINAPI StdProxy_Construct(REFIID riid,
LPUNKNOWN pUnkOuter,
PCInterfaceName name,
CInterfaceProxyVtbl *vtbl,
CInterfaceStubVtbl *svtbl,
const ProxyFileInfo *ProxyInfo,
int Index,
LPPSFACTORYBUFFER pPSFactory,
LPRPCPROXYBUFFER *ppProxy,
LPVOID *ppvObj);
@ -43,4 +42,6 @@ HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
const MIDL_SERVER_INFO *CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface);
const IRpcStubBufferVtbl CStdStubBuffer_Vtbl;
#endif /* __WINE_CPSF_H */

View file

@ -144,7 +144,10 @@ HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface,
DWORD dwPhase = STUB_UNMARSHAL;
TRACE("(%p)->Invoke(%p,%p)\n",This,pMsg,pChannel);
STUB_HEADER(This).pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
if (STUB_HEADER(This).pDispatchTable)
STUB_HEADER(This).pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
else /* pure interpreted */
NdrStubCall2(iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
return S_OK;
}
@ -178,6 +181,20 @@ void WINAPI CStdStubBuffer_DebugServerRelease(LPRPCSTUBBUFFER iface,
TRACE("(%p)->DebugServerRelease(%p)\n",This,pv);
}
const IRpcStubBufferVtbl CStdStubBuffer_Vtbl =
{
CStdStubBuffer_QueryInterface,
CStdStubBuffer_AddRef,
NULL,
CStdStubBuffer_Connect,
CStdStubBuffer_Disconnect,
CStdStubBuffer_Invoke,
CStdStubBuffer_IsIIDSupported,
CStdStubBuffer_CountRefs,
CStdStubBuffer_DebugServerQueryInterface,
CStdStubBuffer_DebugServerRelease
};
const MIDL_SERVER_INFO *CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface)
{
CStdStubBuffer *This = (CStdStubBuffer *)iface;

View file

@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include "windef.h"
#include "winbase.h"
@ -300,20 +301,43 @@ static void WINAPI NdrFree(MIDL_STUB_MESSAGE *pStubMsg, unsigned char *Pointer)
pStubMsg->pfnFree(Pointer);
}
static inline BOOL IsConformanceOrVariancePresent(PFORMAT_STRING pFormat)
{
return (*(const ULONG *)pFormat != -1);
}
PFORMAT_STRING ReadConformance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
{
pStubMsg->MaxCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
pStubMsg->Buffer += 4;
TRACE("unmarshalled conformance is %ld\n", pStubMsg->MaxCount);
return pFormat+4;
if (pStubMsg->fHasNewCorrDesc)
return pFormat+6;
else
return pFormat+4;
}
static inline PFORMAT_STRING ReadVariance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
{
if (!IsConformanceOrVariancePresent(pFormat))
{
pStubMsg->Offset = 0;
pStubMsg->ActualCount = pStubMsg->MaxCount;
goto done;
}
pStubMsg->Offset = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
pStubMsg->Buffer += 4;
TRACE("offset is %ld\n", pStubMsg->Offset);
pStubMsg->ActualCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
pStubMsg->Buffer += 4;
TRACE("unmarshalled variance is %ld\n", pStubMsg->ActualCount);
return pFormat+4;
TRACE("variance is %ld\n", pStubMsg->ActualCount);
done:
if (pStubMsg->fHasNewCorrDesc)
return pFormat+6;
else
return pFormat+4;
}
PFORMAT_STRING ComputeConformanceOrVariance(
@ -325,8 +349,7 @@ PFORMAT_STRING ComputeConformanceOrVariance(
LPVOID ptr = NULL;
DWORD data = 0;
/* FIXME: is this correct? */
if (pFormat[0] == 0xff) {
if (!IsConformanceOrVariancePresent(pFormat)) {
/* null descriptor */
*pCount = def;
goto finish_conf;
@ -428,7 +451,10 @@ done_conf_grab:
finish_conf:
TRACE("resulting conformance is %ld\n", *pCount);
return pFormat+4;
if (pStubMsg->fHasNewCorrDesc)
return pFormat+6;
else
return pFormat+4;
}
@ -1773,7 +1799,10 @@ unsigned char * WINAPI NdrComplexStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
if (fMustAlloc || !*ppMemory)
{
*ppMemory = NdrAllocate(pStubMsg, size);
memset(*ppMemory, 0, size);
}
pFormat += 4;
if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat;
@ -2026,7 +2055,6 @@ unsigned char* WINAPI NdrConformantVaryingArrayUnmarshall( PMIDL_STUB_MESSAGE pS
PFORMAT_STRING pFormat,
unsigned char fMustAlloc )
{
DWORD offset;
DWORD esize = *(const WORD*)(pFormat+2);
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
@ -2038,13 +2066,11 @@ unsigned char* WINAPI NdrConformantVaryingArrayUnmarshall( PMIDL_STUB_MESSAGE pS
return NULL;
}
pFormat = ReadConformance(pStubMsg, pFormat);
offset = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
pStubMsg->Buffer += 4;
pFormat = ReadVariance(pStubMsg, pFormat);
if (!*ppMemory || fMustAlloc)
*ppMemory = NdrAllocate(pStubMsg, pStubMsg->MaxCount * esize);
memcpy(*ppMemory + offset, pStubMsg->Buffer, pStubMsg->ActualCount * esize);
memcpy(*ppMemory + pStubMsg->Offset, pStubMsg->Buffer, pStubMsg->ActualCount * esize);
pStubMsg->Buffer += pStubMsg->ActualCount * esize;
EmbeddedPointerUnmarshall(pStubMsg, ppMemory, pFormat, fMustAlloc);
@ -2111,24 +2137,39 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
unsigned char *pMemory,
PFORMAT_STRING pFormat)
{
DWORD size = 0, count, def;
ULONG count, def;
BOOL variance_present;
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return NULL;
}
def = *(const WORD*)&pFormat[2];
pFormat += 4;
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def);
size = pStubMsg->MaxCount;
TRACE("conformance=%ld\n", size);
TRACE("conformance = %ld\n", pStubMsg->MaxCount);
if (*(const DWORD*)pFormat != 0xffffffff)
FIXME("compute variance\n");
pFormat += 4;
variance_present = IsConformanceOrVariancePresent(pFormat);
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount);
TRACE("variance = %ld\n", pStubMsg->ActualCount);
NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, size);
NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->MaxCount);
pStubMsg->Buffer += 4;
if (variance_present)
{
NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->Offset);
pStubMsg->Buffer += 4;
NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->ActualCount);
pStubMsg->Buffer += 4;
}
for (count=0; count<size; count++)
for (count = 0; count < pStubMsg->ActualCount; count++)
pMemory = ComplexMarshall(pStubMsg, pMemory, pFormat, NULL);
STD_OVERFLOW_CHECK(pStubMsg);
@ -2144,25 +2185,33 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat,
unsigned char fMustAlloc)
{
DWORD size = 0, count, esize;
ULONG count, esize;
unsigned char *pMemory;
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return NULL;
}
pFormat += 4;
pFormat = ReadConformance(pStubMsg, pFormat);
size = pStubMsg->MaxCount;
TRACE("conformance=%ld\n", size);
pFormat += 4;
pFormat = ReadVariance(pStubMsg, pFormat);
esize = ComplexStructSize(pStubMsg, pFormat);
if (fMustAlloc || !*ppMemory)
*ppMemory = NdrAllocate(pStubMsg, size*esize);
{
*ppMemory = NdrAllocate(pStubMsg, pStubMsg->MaxCount * esize);
memset(*ppMemory, 0, pStubMsg->MaxCount * esize);
}
pMemory = *ppMemory;
for (count=0; count<size; count++)
for (count = 0; count < pStubMsg->ActualCount; count++)
pMemory = ComplexUnmarshall(pStubMsg, pMemory, pFormat, NULL, fMustAlloc);
return NULL;
@ -2175,21 +2224,33 @@ void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
unsigned char *pMemory,
PFORMAT_STRING pFormat)
{
DWORD size = 0, count, def;
ULONG count, def;
BOOL variance_present;
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return;
}
def = *(const WORD*)&pFormat[2];
pFormat += 4;
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def);
size = pStubMsg->MaxCount;
TRACE("conformance=%ld\n", size);
TRACE("conformance = %ld\n", pStubMsg->MaxCount);
pStubMsg->BufferLength += sizeof(ULONG);
if (*(const DWORD*)pFormat != 0xffffffff)
FIXME("compute variance\n");
pFormat += 4;
variance_present = IsConformanceOrVariancePresent(pFormat);
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount);
TRACE("variance = %ld\n", pStubMsg->ActualCount);
for (count=0; count<size; count++)
if (variance_present)
pStubMsg->BufferLength += 2*sizeof(ULONG);
for (count=0; count < pStubMsg->ActualCount; count++)
pMemory = ComplexBufferSize(pStubMsg, pMemory, pFormat, NULL);
}
@ -2202,6 +2263,13 @@ unsigned long WINAPI NdrComplexArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
DWORD size = 0;
FIXME("(%p,%p): stub\n", pStubMsg, pFormat);
if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return 0;
}
pFormat += 4;
pFormat = ReadConformance(pStubMsg, pFormat);
@ -2220,21 +2288,27 @@ void WINAPI NdrComplexArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
unsigned char *pMemory,
PFORMAT_STRING pFormat)
{
DWORD size = 0, count, def;
ULONG count, def;
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return;
}
def = *(const WORD*)&pFormat[2];
pFormat += 4;
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def);
size = pStubMsg->MaxCount;
TRACE("conformance=%ld\n", size);
TRACE("conformance = %ld\n", pStubMsg->MaxCount);
if (*(const DWORD*)pFormat != 0xffffffff)
FIXME("compute variance\n");
pFormat += 4;
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount);
TRACE("variance = %ld\n", pStubMsg->ActualCount);
for (count=0; count<size; count++)
for (count=0; count < pStubMsg->ActualCount; count++)
pMemory = ComplexFree(pStubMsg, pMemory, pFormat, NULL);
}
@ -2934,6 +3008,7 @@ static unsigned char *WINAPI NdrBaseTypeMarshall(
case RPC_FC_LONG:
case RPC_FC_ULONG:
case RPC_FC_ERROR_STATUS_T:
case RPC_FC_ENUM32:
ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG) - 1);
*(ULONG *)pStubMsg->Buffer = *(ULONG *)pMemory;
pStubMsg->Buffer += sizeof(ULONG);
@ -2956,7 +3031,14 @@ static unsigned char *WINAPI NdrBaseTypeMarshall(
TRACE("value: %s\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory));
break;
case RPC_FC_ENUM16:
case RPC_FC_ENUM32:
/* only 16-bits on the wire, so do a sanity check */
if (*(UINT *)pMemory > USHRT_MAX)
RpcRaiseException(RPC_X_ENUM_VALUE_OUT_OF_RANGE);
ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT) - 1);
*(USHORT *)pStubMsg->Buffer = *(UINT *)pMemory;
pStubMsg->Buffer += sizeof(USHORT);
TRACE("value: 0x%04x\n", *(UINT *)pMemory);
break;
default:
FIXME("Unhandled base type: 0x%02x\n", *pFormat);
}
@ -3004,6 +3086,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
case RPC_FC_LONG:
case RPC_FC_ULONG:
case RPC_FC_ERROR_STATUS_T:
case RPC_FC_ENUM32:
ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG) - 1);
**(ULONG **)ppMemory = *(ULONG *)pStubMsg->Buffer;
pStubMsg->Buffer += sizeof(ULONG);
@ -3028,7 +3111,12 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
TRACE("value: %s\n", wine_dbgstr_longlong(**(ULONGLONG **)ppMemory));
break;
case RPC_FC_ENUM16:
case RPC_FC_ENUM32:
ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT) - 1);
/* 16-bits on the wire, but int in memory */
**(UINT **)ppMemory = *(USHORT *)pStubMsg->Buffer;
pStubMsg->Buffer += sizeof(USHORT);
TRACE("value: 0x%08x\n", **(UINT **)ppMemory);
break;
default:
FIXME("Unhandled base type: 0x%02x\n", *pFormat);
}
@ -3059,11 +3147,13 @@ static void WINAPI NdrBaseTypeBufferSize(
case RPC_FC_WCHAR:
case RPC_FC_SHORT:
case RPC_FC_USHORT:
case RPC_FC_ENUM16:
ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(USHORT) - 1);
pStubMsg->BufferLength += sizeof(USHORT);
break;
case RPC_FC_LONG:
case RPC_FC_ULONG:
case RPC_FC_ENUM32:
ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(ULONG) - 1);
pStubMsg->BufferLength += sizeof(ULONG);
break;
@ -3083,8 +3173,6 @@ static void WINAPI NdrBaseTypeBufferSize(
ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(error_status_t) - 1);
pStubMsg->BufferLength += sizeof(error_status_t);
break;
case RPC_FC_ENUM16:
case RPC_FC_ENUM32:
default:
FIXME("Unhandled base type: 0x%02x\n", *pFormat);
}
@ -3121,6 +3209,7 @@ static unsigned long WINAPI NdrBaseTypeMemorySize(
return sizeof(error_status_t);
case RPC_FC_ENUM16:
case RPC_FC_ENUM32:
return sizeof(INT);
default:
FIXME("Unhandled base type: 0x%02x\n", *pFormat);
return 0;

View file

@ -269,6 +269,8 @@ void WINAPI NdrFreeBuffer(MIDL_STUB_MESSAGE *pStubMsg)
*/
unsigned char *WINAPI NdrSendReceive( MIDL_STUB_MESSAGE *stubmsg, unsigned char *buffer )
{
RPC_STATUS status;
TRACE("(stubmsg == ^%p, buffer == ^%p)\n", stubmsg, buffer);
/* FIXME: how to handle errors? (raise exception?) */
@ -281,10 +283,9 @@ unsigned char *WINAPI NdrSendReceive( MIDL_STUB_MESSAGE *stubmsg, unsigned char
return NULL;
}
if (I_RpcSendReceive(stubmsg->RpcMsg) != RPC_S_OK) {
WARN("I_RpcSendReceive did not return success.\n");
/* FIXME: raise exception? */
}
status = I_RpcSendReceive(stubmsg->RpcMsg);
if (status != RPC_S_OK)
RpcRaiseException(status);
stubmsg->BufferLength = stubmsg->RpcMsg->BufferLength;
stubmsg->BufferStart = stubmsg->RpcMsg->Buffer;

View file

@ -30,11 +30,6 @@
struct IPSFactoryBuffer;
LONG_PTR RPCRT4_NdrClientCall2(PMIDL_STUB_DESC pStubDesc,
PFORMAT_STRING pFormat, va_list args );
HRESULT RPCRT4_GetPSFactory(REFIID riid, struct IPSFactoryBuffer **ppPS);
#define ComputeConformance(pStubMsg, pMemory, pFormat, def) ComputeConformanceOrVariance(pStubMsg, pMemory, pFormat, def, &pStubMsg->MaxCount)
#define ComputeVariance(pStubMsg, pMemory, pFormat, def) ComputeConformanceOrVariance(pStubMsg, pMemory, pFormat, def, &pStubMsg->ActualCount)
PFORMAT_STRING ComputeConformanceOrVariance(

View file

@ -257,14 +257,16 @@ unsigned char * WINAPI NdrInterfacePointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
if (pStubMsg->Buffer + sizeof(DWORD) < (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) {
stream = RpcStream_Create(pStubMsg, TRUE);
if (stream) {
hr = COM_MarshalInterface(stream, riid, (LPUNKNOWN)pMemory,
pStubMsg->dwDestContext, pStubMsg->pvDestContext,
MSHLFLAGS_NORMAL);
if (pMemory)
hr = COM_MarshalInterface(stream, riid, (LPUNKNOWN)pMemory,
pStubMsg->dwDestContext, pStubMsg->pvDestContext,
MSHLFLAGS_NORMAL);
else
hr = S_OK;
IStream_Release(stream);
if (FAILED(hr)) {
IUnknown_Release((LPUNKNOWN)pMemory);
if (FAILED(hr))
RpcRaiseException(hr);
}
}
}
return NULL;
@ -355,17 +357,3 @@ void WINAPI NdrOleFree(void *NodeToFree)
if (!LoadCOM()) return;
COM_MemFree(NodeToFree);
}
/* internal */
HRESULT RPCRT4_GetPSFactory(REFIID riid, LPPSFACTORYBUFFER *pPS)
{
HRESULT hr;
CLSID clsid;
if (!LoadCOM()) return RPC_E_UNEXPECTED;
hr = COM_GetPSClsid(riid, &clsid);
if (FAILED(hr)) return hr;
hr = COM_GetClassObject(&clsid, CLSCTX_INPROC_SERVER, NULL,
&IID_IPSFactoryBuffer, (LPVOID *)pPS);
return hr;
}

File diff suppressed because it is too large Load diff

View file

@ -254,15 +254,13 @@ RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header,
hdr_size = Header->common.frag_len;
Header->common.flags |= RPC_FLG_FIRST;
Header->common.flags &= ~RPC_FLG_LAST;
while (!(Header->common.flags & RPC_FLG_LAST)) {
while (!(Header->common.flags & RPC_FLG_LAST)) {
/* decide if we need to split the packet into fragments */
if ((BufferLength + hdr_size) <= Connection->MaxTransmissionSize) {
Header->common.flags |= RPC_FLG_LAST;
Header->common.frag_len = BufferLength + hdr_size;
} else {
Header->common.frag_len = Connection->MaxTransmissionSize;
buffer_pos += Header->common.frag_len - hdr_size;
BufferLength -= Header->common.frag_len - hdr_size;
}
/* transmit packet header */
@ -293,6 +291,8 @@ RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header,
return GetLastError();
}
buffer_pos += Header->common.frag_len - hdr_size;
BufferLength -= Header->common.frag_len - hdr_size;
Header->common.flags &= ~RPC_FLG_FIRST;
}

View file

@ -303,7 +303,7 @@
@ stub NdrRpcSsDisableAllocate
@ stub NdrRpcSsEnableAllocate
@ stdcall NdrSendReceive(ptr ptr)
@ stub NdrServerCall2
@ stdcall NdrServerCall2(ptr)
@ stub NdrServerCall
@ stdcall NdrServerContextMarshall(ptr ptr long)
@ stdcall NdrServerContextNewMarshall(ptr ptr ptr ptr) # wxp
@ -323,7 +323,7 @@
@ stdcall NdrSimpleStructUnmarshall(ptr ptr ptr long)
@ stdcall NdrSimpleTypeMarshall(ptr ptr long)
@ stdcall NdrSimpleTypeUnmarshall(ptr ptr long)
@ stub NdrStubCall2
@ stdcall NdrStubCall2(ptr ptr ptr ptr)
@ stub NdrStubCall
@ stdcall NdrStubForwardingFunction(ptr ptr ptr ptr)
@ stdcall NdrStubGetBuffer(ptr ptr ptr)

View file

@ -0,0 +1,57 @@
/*
* NDR Types
*
* Copyright 2006 Robert Shearman (for CodeWeavers)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __NDRTYPES_H__
#define __NDRTYPES_H__
typedef struct
{
unsigned short MustSize : 1; /* 0x0001 - client interpreter MUST size this
* parameter, other parameters may be skipped, using the value in
* NDR_PROC_PARTIAL_OIF_HEADER::constant_client_buffer_size instead. */
unsigned short MustFree : 1; /* 0x0002 - server interpreter MUST size this
* parameter, other parameters may be skipped, using the value in
* NDR_PROC_PARTIAL_OIF_HEADER::constant_server_buffer_size instead. */
unsigned short IsPipe : 1; /* 0x0004 - The parameter is a pipe handle. See
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rpc/rpc/pipes.asp
* for more information on pipes. */
unsigned short IsIn : 1; /* 0x0008 - The parameter is an input */
unsigned short IsOut : 1; /* 0x0010 - The parameter is an output */
unsigned short IsReturn : 1; /* 0x0020 - The parameter is to be returned */
unsigned short IsBasetype : 1; /* 0x0040 - The parameter is simple and has the
* format defined by NDR_PARAM_OIF_BASETYPE rather than by
* NDR_PARAM_OIF_OTHER. */
unsigned short IsByValue : 1; /* 0x0080 - Set for compound types being sent by
* value. Can be of type: structure, union, transmit_as, represent_as,
* wire_marshal and SAFEARRAY. */
unsigned short IsSimpleRef : 1; /* 0x0100 - parameter that is a reference
* pointer to anything other than another pointer, and which has no
* allocate attributes. */
unsigned short IsDontCallFreeInst : 1; /* 0x0200 - Used for some represent_as types
* for when the free instance routine should not be called. */
unsigned short SaveForAsyncFinish : 1; /* 0x0400 - Unknown */
unsigned short Unused : 2;
unsigned short ServerAllocSize : 3; /* 0xe000 - If non-zero
* specifies the size of the object in numbers of 8byte blocks needed.
* It will be stored on the server's stack rather than using an allocate
* call. */
} PARAM_ATTRIBUTES;
#endif

View file

@ -164,67 +164,73 @@ typedef struct _NDR_ASYNC_MESSAGE *PNDR_ASYNC_MESSAGE;
typedef struct _NDR_CORRELATION_INFO *PNDR_CORRELATION_INFO;
#pragma pack(push,4)
typedef struct _MIDL_STUB_MESSAGE {
PRPC_MESSAGE RpcMsg;
unsigned char *Buffer;
unsigned char *BufferStart;
unsigned char *BufferEnd;
unsigned char *BufferMark;
unsigned long BufferLength;
unsigned long MemorySize;
unsigned char *Memory;
int IsClient;
int ReuseBuffer;
unsigned char *AllocAllNodesMemory;
unsigned char *AllocAllNodesMemoryEnd;
int IgnoreEmbeddedPointers;
unsigned char *PointerBufferMark;
unsigned char fBufferValid;
unsigned char uFlags;
unsigned long MaxCount;
unsigned long Offset;
unsigned long ActualCount;
void*(__RPC_API *pfnAllocate)(unsigned int);
void(__RPC_API *pfnFree)(void*);
unsigned char *StackTop;
unsigned char *pPresentedType;
unsigned char *pTransmitType;
handle_t SavedHandle;
const struct _MIDL_STUB_DESC *StubDesc;
struct _FULL_PTR_XLAT_TABLES *FullPtrXlatTables;
unsigned long FullPtrRefId;
int fCheckBounds;
int fInDontFree :1;
int fDontCallFreeInst :1;
int fInOnlyParam :1;
int fHasReturn :1;
unsigned long dwDestContext;
void*pvDestContext;
NDR_SCONTEXT *SavedContextHandles;
long ParamNumber;
struct IRpcChannelBuffer *pRpcChannelBuffer;
PARRAY_INFO pArrayInfo;
unsigned long *SizePtrCountArray;
unsigned long *SizePtrOffsetArray;
unsigned long *SizePtrLengthArray;
void*pArgQueue;
unsigned long dwStubPhase;
void *LowStackMark;
PNDR_ASYNC_MESSAGE pAsyncMsg;
PNDR_CORRELATION_INFO pCorrInfo;
unsigned char *pCorrMemory;
void *pMemoryList;
CS_STUB_INFO *pCSInfo;
unsigned char *ConformanceMark;
unsigned char *VarianceMark;
INT_PTR Unused;
struct _NDR_PROC_CONTEXT *pContext;
INT_PTR Reserved51_1;
INT_PTR Reserved51_2;
INT_PTR Reserved51_3;
INT_PTR Reserved51_4;
INT_PTR Reserved51_5;
} MIDL_STUB_MESSAGE,*PMIDL_STUB_MESSAGE;
typedef struct _MIDL_STUB_MESSAGE
{
PRPC_MESSAGE RpcMsg;
unsigned char *Buffer;
unsigned char *BufferStart;
unsigned char *BufferEnd;
unsigned char *BufferMark;
unsigned long BufferLength;
unsigned long MemorySize;
unsigned char *Memory;
int IsClient;
int ReuseBuffer;
struct NDR_ALLOC_ALL_NODES_CONTEXT *pAllocAllNodesContext;
struct NDR_POINTER_QUEUE_STATE *pPointerQueueState;
int IgnoreEmbeddedPointers;
unsigned char *PointerBufferMark;
unsigned char fBufferValid;
unsigned char uFlags;
unsigned short UniquePtrCount;
ULONG_PTR MaxCount;
unsigned long Offset;
unsigned long ActualCount;
void * (__RPC_API *pfnAllocate)(size_t);
void (__RPC_API *pfnFree)(void *);
unsigned char *StackTop;
unsigned char *pPresentedType;
unsigned char *pTransmitType;
handle_t SavedHandle;
const struct _MIDL_STUB_DESC *StubDesc;
struct _FULL_PTR_XLAT_TABLES *FullPtrXlatTables;
unsigned long FullPtrRefId;
unsigned long PointerLength;
int fInDontFree:1;
int fDontCallFreeInst:1;
int fInOnlyParam:1;
int fHasReturn:1;
int fHasExtensions:1;
int fHasNewCorrDesc:1;
int fUnused:10;
int fUnused2:16;
unsigned long dwDestContext;
void *pvDestContext;
NDR_SCONTEXT *SavedContextHandles;
long ParamNumber;
struct IRpcChannelBuffer *pRpcChannelBuffer;
PARRAY_INFO pArrayInfo;
unsigned long *SizePtrCountArray;
unsigned long *SizePtrOffsetArray;
unsigned long *SizePtrLengthArray;
void *pArgQueue;
unsigned long dwStubPhase;
void *LowStackMark;
PNDR_ASYNC_MESSAGE pAsyncMsg;
PNDR_CORRELATION_INFO pCorrInfo;
unsigned char *pCorrMemory;
void *pMemoryList;
CS_STUB_INFO *pCSInfo;
unsigned char *ConformanceMark;
unsigned char *VarianceMark;
INT_PTR Unused;
struct _NDR_PROC_CONTEXT *pContext;
INT_PTR Reserved51_1;
INT_PTR Reserved51_2;
INT_PTR Reserved51_3;
INT_PTR Reserved51_4;
INT_PTR Reserved51_5;
} MIDL_STUB_MESSAGE, *PMIDL_STUB_MESSAGE;
#pragma pack(pop)
typedef void*(__RPC_API *GENERIC_BINDING_ROUTINE)(void*);
typedef void (__RPC_API *GENERIC_UNBIND_ROUTINE)(void*,unsigned char*);

View file

@ -1,23 +1,44 @@
#ifndef _RPCNTERR_H
#define _RPCNTERR_H
#if __GNUC__ >=3
#pragma GCC system_header
#endif
/*
* Copyright (C) 2001 Peter Hunnisett
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define RPC_S_OK ERROR_SUCCESS
#define RPC_S_INVALID_ARG ERROR_INVALID_PARAMETER
#define RPC_S_OUT_OF_MEMORY ERROR_OUTOFMEMORY
#define RPC_S_OUT_OF_THREADS ERROR_MAX_THRDS_REACHED
#define RPC_S_INVALID_LEVEL ERROR_INVALID_PARAMETER
#define RPC_S_BUFFER_TOO_SMALL ERROR_INSUFFICIENT_BUFFER
#define RPC_S_INVALID_SECURITY_DESC ERROR_INVALID_SECURITY_DESCR
#define RPC_S_ACCESS_DENIED ERROR_ACCESS_DENIED
#define RPC_S_SERVER_OUT_OF_MEMORY ERROR_NOT_ENOUGH_SERVER_MEMORY
#define RPC_X_NO_MEMORY RPC_S_OUT_OF_MEMORY
#define RPC_X_INVALID_BOUND RPC_S_INVALID_BOUND
#define RPC_X_INVALID_TAG RPC_S_INVALID_TAG
#define RPC_X_ENUM_VALUE_TOO_LARGE RPC_X_ENUM_VALUE_OUT_OF_RANGE
#define RPC_X_SS_CONTEXT_MISMATCH ERROR_INVALID_HANDLE
#define RPC_X_INVALID_BUFFER ERROR_INVALID_USER_BUFFER
#define RPC_X_INVALID_PIPE_OPERATION RPC_X_WRONG_PIPE_ORDER
#endif
#ifndef __RPCNTERR_H__
#define __RPCNTERR_H__
#define RPC_S_OK ERROR_SUCCESS
#define RPC_S_INVALID_ARG ERROR_INVALID_PARAMETER
#define RPC_S_OUT_OF_MEMORY ERROR_OUTOFMEMORY
#define RPC_S_OUT_OF_THREADS ERROR_MAX_THRDS_REACHED
#define RPC_S_INVALID_LEVEL ERROR_INVALID_PARAMETER
#define RPC_S_BUFFER_TOO_SMALL ERROR_INSUFFICIENT_BUFFER
#define RPC_S_INVALID_SECURITY_DESC ERROR_INVALID_SECURITY_DESCR
#define RPC_S_ACCESS_DENIED ERROR_ACCESS_DENIED
#define RPC_S_SERVER_OUT_OF_MEMORY ERROR_NOT_ENOUGH_SERVER_MEMORY
#define RPC_S_ASYNC_CALL_PENDING ERROR_IO_PENDING
#define RPC_S_UNKNOWN_PRINCIPAL ERROR_NONE_MAPPED
#define RPC_S_TIMEOUT ERROR_TIMEOUT
#define RPC_X_NO_MEMORY RPC_S_OUT_OF_MEMORY
#define RPC_X_INVALID_BOUND RPC_S_INVALID_BOUND
#define RPC_X_INVALID_TAG RPC_S_INVALID_TAG
#define RPC_X_ENUM_VALUE_TOO_LARGE RPC_X_ENUM_VALUE_OUT_OF_RANGE
#define RPC_X_SS_CONTEXT_MISMATCH ERROR_INVALID_HANDLE
#define RPC_X_INVALID_BUFFER ERROR_INVALID_USER_BUFFER
#define RPC_X_PIPE_APP_MEMORY ERROR_OUTOFMEMORY
#define RPC_X_INVALID_PIPE_OPERATION RPC_X_WRONG_PIPE_ORDER
#endif /* __RPCNTERR_H__ */