Commit b43e7994 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

rpcrt4: Dereference the pointer if necessary only after doing the

pointer checks and writing the pointer ID to the wire.
parent a4f5296e
...@@ -709,10 +709,6 @@ void WINAPI PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, ...@@ -709,10 +709,6 @@ void WINAPI PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pFormat += 2; pFormat += 2;
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
else desc = pFormat + *(const SHORT*)pFormat; else desc = pFormat + *(const SHORT*)pFormat;
if (attr & RPC_FC_P_DEREF) {
Pointer = *(unsigned char**)Pointer;
TRACE("deref => %p\n", Pointer);
}
switch (type) { switch (type) {
case RPC_FC_RP: /* ref pointer (always non-null) */ case RPC_FC_RP: /* ref pointer (always non-null) */
...@@ -736,6 +732,10 @@ void WINAPI PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, ...@@ -736,6 +732,10 @@ void WINAPI PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("calling marshaller for type 0x%x\n", (int)*desc); TRACE("calling marshaller for type 0x%x\n", (int)*desc);
if (Pointer) { if (Pointer) {
if (attr & RPC_FC_P_DEREF) {
Pointer = *(unsigned char**)Pointer;
TRACE("deref => %p\n", Pointer);
}
m = NdrMarshaller[*desc & NDR_TABLE_MASK]; m = NdrMarshaller[*desc & NDR_TABLE_MASK];
if (m) m(pStubMsg, Pointer, desc); if (m) m(pStubMsg, Pointer, desc);
else FIXME("no marshaller for data type=%02x\n", *desc); else FIXME("no marshaller for data type=%02x\n", *desc);
...@@ -763,10 +763,6 @@ void WINAPI PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, ...@@ -763,10 +763,6 @@ void WINAPI PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pFormat += 2; pFormat += 2;
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
else desc = pFormat + *(const SHORT*)pFormat; else desc = pFormat + *(const SHORT*)pFormat;
if (attr & RPC_FC_P_DEREF) {
pPointer = *(unsigned char***)pPointer;
TRACE("deref => %p\n", pPointer);
}
switch (type) { switch (type) {
case RPC_FC_RP: /* ref pointer (always non-null) */ case RPC_FC_RP: /* ref pointer (always non-null) */
...@@ -789,6 +785,12 @@ void WINAPI PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, ...@@ -789,6 +785,12 @@ void WINAPI PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
} }
if (pointer_id) { if (pointer_id) {
if (attr & RPC_FC_P_DEREF) {
if (!*pPointer || fMustAlloc)
*pPointer = NdrAllocate(pStubMsg, sizeof(void *));
pPointer = *(unsigned char***)pPointer;
TRACE("deref => %p\n", pPointer);
}
m = NdrUnmarshaller[*desc & NDR_TABLE_MASK]; m = NdrUnmarshaller[*desc & NDR_TABLE_MASK];
if (m) m(pStubMsg, pPointer, desc, fMustAlloc); if (m) m(pStubMsg, pPointer, desc, fMustAlloc);
else FIXME("no unmarshaller for data type=%02x\n", *desc); else FIXME("no unmarshaller for data type=%02x\n", *desc);
...@@ -813,10 +815,6 @@ void WINAPI PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, ...@@ -813,10 +815,6 @@ void WINAPI PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
pFormat += 2; pFormat += 2;
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
else desc = pFormat + *(const SHORT*)pFormat; else desc = pFormat + *(const SHORT*)pFormat;
if (attr & RPC_FC_P_DEREF) {
Pointer = *(unsigned char**)Pointer;
TRACE("deref => %p\n", Pointer);
}
switch (type) { switch (type) {
case RPC_FC_RP: /* ref pointer (always non-null) */ case RPC_FC_RP: /* ref pointer (always non-null) */
...@@ -834,6 +832,11 @@ void WINAPI PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, ...@@ -834,6 +832,11 @@ void WINAPI PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
RpcRaiseException(RPC_X_BAD_STUB_DATA); RpcRaiseException(RPC_X_BAD_STUB_DATA);
} }
if (attr & RPC_FC_P_DEREF) {
Pointer = *(unsigned char**)Pointer;
TRACE("deref => %p\n", Pointer);
}
m = NdrBufferSizer[*desc & NDR_TABLE_MASK]; m = NdrBufferSizer[*desc & NDR_TABLE_MASK];
if (m) m(pStubMsg, Pointer, desc); if (m) m(pStubMsg, Pointer, desc);
else FIXME("no buffersizer for data type=%02x\n", *desc); else FIXME("no buffersizer for data type=%02x\n", *desc);
...@@ -855,9 +858,6 @@ unsigned long WINAPI PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, ...@@ -855,9 +858,6 @@ unsigned long WINAPI PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
pFormat += 2; pFormat += 2;
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
else desc = pFormat + *(const SHORT*)pFormat; else desc = pFormat + *(const SHORT*)pFormat;
if (attr & RPC_FC_P_DEREF) {
TRACE("deref\n");
}
switch (type) { switch (type) {
case RPC_FC_RP: /* ref pointer (always non-null) */ case RPC_FC_RP: /* ref pointer (always non-null) */
...@@ -867,6 +867,10 @@ unsigned long WINAPI PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, ...@@ -867,6 +867,10 @@ unsigned long WINAPI PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
RpcRaiseException(RPC_X_BAD_STUB_DATA); RpcRaiseException(RPC_X_BAD_STUB_DATA);
} }
if (attr & RPC_FC_P_DEREF) {
TRACE("deref\n");
}
m = NdrMemorySizer[*desc & NDR_TABLE_MASK]; m = NdrMemorySizer[*desc & NDR_TABLE_MASK];
if (m) m(pStubMsg, desc); if (m) m(pStubMsg, desc);
else FIXME("no memorysizer for data type=%02x\n", *desc); else FIXME("no memorysizer for data type=%02x\n", *desc);
...@@ -891,13 +895,14 @@ void WINAPI PointerFree(PMIDL_STUB_MESSAGE pStubMsg, ...@@ -891,13 +895,14 @@ void WINAPI PointerFree(PMIDL_STUB_MESSAGE pStubMsg,
pFormat += 2; pFormat += 2;
if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat; if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
else desc = pFormat + *(const SHORT*)pFormat; else desc = pFormat + *(const SHORT*)pFormat;
if (!Pointer) return;
if (attr & RPC_FC_P_DEREF) { if (attr & RPC_FC_P_DEREF) {
Pointer = *(unsigned char**)Pointer; Pointer = *(unsigned char**)Pointer;
TRACE("deref => %p\n", Pointer); TRACE("deref => %p\n", Pointer);
} }
if (!Pointer) return;
m = NdrFreer[*desc & NDR_TABLE_MASK]; m = NdrFreer[*desc & NDR_TABLE_MASK];
if (m) m(pStubMsg, Pointer, desc); if (m) m(pStubMsg, Pointer, desc);
......
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