wine/dlls/rpcrt4 ndr_marshall.c ndr_misc.h
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Nov 28 05:04:09 CST 2005
ChangeSet ID: 21475
CVSROOT: /opt/cvs-commit
Module name: wine
Changes by: julliard at winehq.org 2005/11/28 05:04:09
Modified files:
dlls/rpcrt4 : ndr_marshall.c ndr_misc.h
Log message:
Robert Shearman <rob at codeweavers.com>
Extend conformance computation function to also compute variances.
MSDN suggests that conformance and variance are pretty much the same,
but there may be some subtleties to it.
Patch: http://cvs.winehq.org/patch.py?id=21475
Old revision New revision Changes Path
1.32 1.33 +17 -7 wine/dlls/rpcrt4/ndr_marshall.c
1.5 1.6 +5 -2 wine/dlls/rpcrt4/ndr_misc.h
Index: wine/dlls/rpcrt4/ndr_marshall.c
diff -u -p wine/dlls/rpcrt4/ndr_marshall.c:1.32 wine/dlls/rpcrt4/ndr_marshall.c:1.33
--- wine/dlls/rpcrt4/ndr_marshall.c:1.32 28 Nov 2005 11: 4: 9 -0000
+++ wine/dlls/rpcrt4/ndr_marshall.c 28 Nov 2005 11: 4: 9 -0000
@@ -286,17 +286,27 @@ PFORMAT_STRING ReadConformance(MIDL_STUB
return pFormat+4;
}
-PFORMAT_STRING ComputeConformance(MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pMemory,
- PFORMAT_STRING pFormat, ULONG_PTR def)
+static inline PFORMAT_STRING ReadVariance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
+{
+ pStubMsg->ActualCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
+ pStubMsg->Buffer += 4;
+ TRACE("unmarshalled variance is %ld\n", pStubMsg->ActualCount);
+ return pFormat+4;
+}
+
+PFORMAT_STRING ComputeConformanceOrVariance(
+ MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pMemory,
+ PFORMAT_STRING pFormat, ULONG_PTR def, ULONG *pCount)
{
BYTE dtype = pFormat[0] & 0xf;
short ofs = *(short *)&pFormat[2];
LPVOID ptr = NULL;
DWORD data = 0;
+ /* FIXME: is this correct? */
if (pFormat[0] == 0xff) {
/* null descriptor */
- pStubMsg->MaxCount = def;
+ *pCount = def;
goto finish_conf;
}
@@ -315,14 +325,14 @@ PFORMAT_STRING ComputeConformance(MIDL_S
ptr = pStubMsg->StackTop + ofs;
}
else {
- /* -Os mode, MaxCount is already set */
+ /* -Os mode, *pCount is already set */
goto finish_conf;
}
break;
case RPC_FC_CONSTANT_CONFORMANCE:
data = ofs | ((DWORD)pFormat[1] << 16);
TRACE("constant conformance, val=%ld\n", data);
- pStubMsg->MaxCount = data;
+ *pCount = data;
goto finish_conf;
case RPC_FC_TOP_LEVEL_MULTID_CONFORMANCE:
FIXME("toplevel multidimensional conformance, ofs=%d\n", ofs);
@@ -376,7 +386,7 @@ PFORMAT_STRING ComputeConformance(MIDL_S
done_conf_grab:
switch (pFormat[1]) {
case 0: /* no op */
- pStubMsg->MaxCount = data;
+ *pCount = data;
break;
case RPC_FC_DEREFERENCE:
/* already handled */
@@ -387,7 +397,7 @@ done_conf_grab:
}
finish_conf:
- TRACE("resulting conformance is %ld\n", pStubMsg->MaxCount);
+ TRACE("resulting conformance is %ld\n", *pCount);
return pFormat+4;
}
Index: wine/dlls/rpcrt4/ndr_misc.h
diff -u -p wine/dlls/rpcrt4/ndr_misc.h:1.5 wine/dlls/rpcrt4/ndr_misc.h:1.6
--- wine/dlls/rpcrt4/ndr_misc.h:1.5 28 Nov 2005 11: 4: 9 -0000
+++ wine/dlls/rpcrt4/ndr_misc.h 28 Nov 2005 11: 4: 9 -0000
@@ -35,8 +35,11 @@ LONG_PTR RPCRT4_NdrClientCall2(PMIDL_STU
HRESULT RPCRT4_GetPSFactory(REFIID riid, struct IPSFactoryBuffer **ppPS);
-PFORMAT_STRING ComputeConformance(MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pMemory,
- PFORMAT_STRING pFormat, ULONG_PTR def);
+#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(
+ MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pMemory,
+ PFORMAT_STRING pFormat, ULONG_PTR def, ULONG *pCount);
typedef unsigned char* (WINAPI *NDR_MARSHALL) (PMIDL_STUB_MESSAGE, unsigned char*, PFORMAT_STRING);
typedef unsigned char* (WINAPI *NDR_UNMARSHALL)(PMIDL_STUB_MESSAGE, unsigned char**,PFORMAT_STRING, unsigned char);
More information about the wine-cvs
mailing list