rpcrt4: Implement NdrPointerMemorySize and enable the corresponding tests.
This commit is contained in:
parent
49f1433cdc
commit
feeaf97c81
|
@ -1042,6 +1042,8 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attr & RPC_FC_P_DEREF) {
|
if (attr & RPC_FC_P_DEREF) {
|
||||||
|
ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(void*));
|
||||||
|
pStubMsg->MemorySize += sizeof(void*);
|
||||||
TRACE("deref\n");
|
TRACE("deref\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1554,10 +1556,14 @@ void WINAPI NdrPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
||||||
ULONG WINAPI NdrPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
ULONG WINAPI NdrPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
|
||||||
PFORMAT_STRING pFormat)
|
PFORMAT_STRING pFormat)
|
||||||
{
|
{
|
||||||
/* unsigned size = *(LPWORD)(pFormat+2); */
|
unsigned char *Buffer = pStubMsg->Buffer;
|
||||||
FIXME("(%p,%p): stub\n", pStubMsg, pFormat);
|
if (*pFormat != RPC_FC_RP)
|
||||||
PointerMemorySize(pStubMsg, pStubMsg->Buffer, pFormat);
|
{
|
||||||
return 0;
|
ALIGN_POINTER(pStubMsg->Buffer, 4);
|
||||||
|
safe_buffer_increment(pStubMsg, 4);
|
||||||
|
}
|
||||||
|
ALIGN_LENGTH(pStubMsg->MemorySize, 4);
|
||||||
|
return PointerMemorySize(pStubMsg, Buffer, pFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -6561,36 +6567,51 @@ static ULONG WINAPI NdrBaseTypeMemorySize(
|
||||||
case RPC_FC_WCHAR:
|
case RPC_FC_WCHAR:
|
||||||
case RPC_FC_SHORT:
|
case RPC_FC_SHORT:
|
||||||
case RPC_FC_USHORT:
|
case RPC_FC_USHORT:
|
||||||
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT));
|
||||||
safe_buffer_increment(pStubMsg, sizeof(USHORT));
|
safe_buffer_increment(pStubMsg, sizeof(USHORT));
|
||||||
|
ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(USHORT));
|
||||||
pStubMsg->MemorySize += sizeof(USHORT);
|
pStubMsg->MemorySize += sizeof(USHORT);
|
||||||
return sizeof(USHORT);
|
return sizeof(USHORT);
|
||||||
case RPC_FC_LONG:
|
case RPC_FC_LONG:
|
||||||
case RPC_FC_ULONG:
|
case RPC_FC_ULONG:
|
||||||
case RPC_FC_ENUM32:
|
case RPC_FC_ENUM32:
|
||||||
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG));
|
||||||
safe_buffer_increment(pStubMsg, sizeof(ULONG));
|
safe_buffer_increment(pStubMsg, sizeof(ULONG));
|
||||||
|
ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(ULONG));
|
||||||
pStubMsg->MemorySize += sizeof(ULONG);
|
pStubMsg->MemorySize += sizeof(ULONG);
|
||||||
return sizeof(ULONG);
|
return sizeof(ULONG);
|
||||||
case RPC_FC_FLOAT:
|
case RPC_FC_FLOAT:
|
||||||
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(float));
|
||||||
safe_buffer_increment(pStubMsg, sizeof(float));
|
safe_buffer_increment(pStubMsg, sizeof(float));
|
||||||
|
ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(float));
|
||||||
pStubMsg->MemorySize += sizeof(float);
|
pStubMsg->MemorySize += sizeof(float);
|
||||||
return sizeof(float);
|
return sizeof(float);
|
||||||
case RPC_FC_DOUBLE:
|
case RPC_FC_DOUBLE:
|
||||||
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(double));
|
||||||
safe_buffer_increment(pStubMsg, sizeof(double));
|
safe_buffer_increment(pStubMsg, sizeof(double));
|
||||||
|
ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(double));
|
||||||
pStubMsg->MemorySize += sizeof(double);
|
pStubMsg->MemorySize += sizeof(double);
|
||||||
return sizeof(double);
|
return sizeof(double);
|
||||||
case RPC_FC_HYPER:
|
case RPC_FC_HYPER:
|
||||||
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONGLONG));
|
||||||
safe_buffer_increment(pStubMsg, sizeof(ULONGLONG));
|
safe_buffer_increment(pStubMsg, sizeof(ULONGLONG));
|
||||||
|
ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(ULONGLONG));
|
||||||
pStubMsg->MemorySize += sizeof(ULONGLONG);
|
pStubMsg->MemorySize += sizeof(ULONGLONG);
|
||||||
return sizeof(ULONGLONG);
|
return sizeof(ULONGLONG);
|
||||||
case RPC_FC_ERROR_STATUS_T:
|
case RPC_FC_ERROR_STATUS_T:
|
||||||
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(error_status_t));
|
||||||
safe_buffer_increment(pStubMsg, sizeof(error_status_t));
|
safe_buffer_increment(pStubMsg, sizeof(error_status_t));
|
||||||
|
ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(error_status_t));
|
||||||
pStubMsg->MemorySize += sizeof(error_status_t);
|
pStubMsg->MemorySize += sizeof(error_status_t);
|
||||||
return sizeof(error_status_t);
|
return sizeof(error_status_t);
|
||||||
case RPC_FC_ENUM16:
|
case RPC_FC_ENUM16:
|
||||||
|
ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT));
|
||||||
safe_buffer_increment(pStubMsg, sizeof(USHORT));
|
safe_buffer_increment(pStubMsg, sizeof(USHORT));
|
||||||
|
ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(UINT));
|
||||||
pStubMsg->MemorySize += sizeof(UINT);
|
pStubMsg->MemorySize += sizeof(UINT);
|
||||||
return sizeof(UINT);
|
return sizeof(UINT);
|
||||||
case RPC_FC_IGNORE:
|
case RPC_FC_IGNORE:
|
||||||
|
ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(void *));
|
||||||
pStubMsg->MemorySize += sizeof(void *);
|
pStubMsg->MemorySize += sizeof(void *);
|
||||||
return sizeof(void *);
|
return sizeof(void *);
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -217,9 +217,6 @@ static void test_pointer_marshal(const unsigned char *formattypes,
|
||||||
StubMsg.Buffer = StubMsg.BufferStart;
|
StubMsg.Buffer = StubMsg.BufferStart;
|
||||||
StubMsg.MemorySize = 0;
|
StubMsg.MemorySize = 0;
|
||||||
|
|
||||||
if (0)
|
|
||||||
{
|
|
||||||
/* NdrPointerMemorySize crashes under Wine */
|
|
||||||
size = NdrPointerMemorySize( &StubMsg, formattypes );
|
size = NdrPointerMemorySize( &StubMsg, formattypes );
|
||||||
ok(size == StubMsg.MemorySize, "%s: mem size %u size %u\n", msgpfx, StubMsg.MemorySize, size);
|
ok(size == StubMsg.MemorySize, "%s: mem size %u size %u\n", msgpfx, StubMsg.MemorySize, size);
|
||||||
ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
|
ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
|
||||||
|
@ -247,7 +244,6 @@ static void test_pointer_marshal(const unsigned char *formattypes,
|
||||||
ok(size == srcsize + 4 + (srcsize == 8 ? 8 : 4), "%s: mem size %u\n", msgpfx, size);
|
ok(size == srcsize + 4 + (srcsize == 8 ? 8 : 4), "%s: mem size %u\n", msgpfx, size);
|
||||||
else
|
else
|
||||||
ok(size == srcsize + (srcsize == 8 ? 8 : 4), "%s: mem size %u\n", msgpfx, size);
|
ok(size == srcsize + (srcsize == 8 ? 8 : 4), "%s: mem size %u\n", msgpfx, size);
|
||||||
}
|
|
||||||
|
|
||||||
size = srcsize;
|
size = srcsize;
|
||||||
if(formattypes[1] & 0x10) size += 4;
|
if(formattypes[1] & 0x10) size += 4;
|
||||||
|
@ -493,7 +489,7 @@ static void test_simple_types(void)
|
||||||
else
|
else
|
||||||
*(unsigned int *)wiredata = (UINT_PTR)&i;
|
*(unsigned int *)wiredata = (UINT_PTR)&i;
|
||||||
*(unsigned short*)(wiredata + 4) = i;
|
*(unsigned short*)(wiredata + 4) = i;
|
||||||
test_pointer_marshal(fmtstr_up_enum16, &i, 2, wiredata, 6, NULL, 0, "up_enum16");
|
test_pointer_marshal(fmtstr_up_enum16, &i, 4, wiredata, 6, NULL, 0, "up_enum16");
|
||||||
|
|
||||||
l = 0xcafebabe;
|
l = 0xcafebabe;
|
||||||
if (use_pointer_ids)
|
if (use_pointer_ids)
|
||||||
|
@ -725,9 +721,6 @@ static void test_simple_struct_marshal(const unsigned char *formattypes,
|
||||||
ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart);
|
ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart);
|
||||||
ok(!memcmp(StubMsg.BufferStart, wiredata, wiredatalen), "%s: incorrectly marshaled %08x %08x %08x\n", msgpfx, *(DWORD*)StubMsg.BufferStart,*((DWORD*)StubMsg.BufferStart+1),*((DWORD*)StubMsg.BufferStart+2));
|
ok(!memcmp(StubMsg.BufferStart, wiredata, wiredatalen), "%s: incorrectly marshaled %08x %08x %08x\n", msgpfx, *(DWORD*)StubMsg.BufferStart,*((DWORD*)StubMsg.BufferStart+1),*((DWORD*)StubMsg.BufferStart+2));
|
||||||
|
|
||||||
if (0)
|
|
||||||
{
|
|
||||||
/* FIXME: Causes Wine to crash */
|
|
||||||
StubMsg.Buffer = StubMsg.BufferStart;
|
StubMsg.Buffer = StubMsg.BufferStart;
|
||||||
StubMsg.MemorySize = 0;
|
StubMsg.MemorySize = 0;
|
||||||
size = NdrSimpleStructMemorySize( &StubMsg, formattypes );
|
size = NdrSimpleStructMemorySize( &StubMsg, formattypes );
|
||||||
|
@ -737,12 +730,9 @@ static void test_simple_struct_marshal(const unsigned char *formattypes,
|
||||||
|
|
||||||
StubMsg.Buffer = StubMsg.BufferStart;
|
StubMsg.Buffer = StubMsg.BufferStart;
|
||||||
size = NdrSimpleStructMemorySize( &StubMsg, formattypes );
|
size = NdrSimpleStructMemorySize( &StubMsg, formattypes );
|
||||||
todo_wine {
|
|
||||||
ok(size == StubMsg.MemorySize, "%s: size != MemorySize\n", msgpfx);
|
ok(size == StubMsg.MemorySize, "%s: size != MemorySize\n", msgpfx);
|
||||||
}
|
|
||||||
ok(StubMsg.MemorySize == ((srcsize + 3) & ~3) + srcsize, "%s: mem size %u\n", msgpfx, size);
|
ok(StubMsg.MemorySize == ((srcsize + 3) & ~3) + srcsize, "%s: mem size %u\n", msgpfx, size);
|
||||||
ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart);
|
ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart);
|
||||||
}
|
|
||||||
size = srcsize;
|
size = srcsize;
|
||||||
/*** Unmarshalling first with must_alloc false ***/
|
/*** Unmarshalling first with must_alloc false ***/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue