-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 2014-10-29 05:26, schrieb Alistair Leslie-Hughes:
switch (entry->type) + { +
case DPNA_DATATYPE_DWORD: + memcpy(pvBuffer, &entry->data.value, sizeof(DWORD)); + break; + case DPNA_DATATYPE_GUID: + memcpy(pvBuffer, &entry->data.guid, sizeof(GUID)); + break; + case DPNA_DATATYPE_STRING: + memcpy(pvBuffer, &entry->data.string, entry->size); + break; + case DPNA_DATATYPE_STRING_ANSI: + memcpy(pvBuffer, &entry->data.ansi, entry->size); + break; + case DPNA_DATATYPE_BINARY: + memcpy(pvBuffer, &entry->data.binary, entry->size); + break; + }
Using assignments like in AddComponent would be nicer.
Since you're replacing everything but the function declaration you can rename the parameter names to get rid of the lpFoo names.
The string types need some tests for the terminating 0 character. AddComponent currently does not check if the string length matches the input size. (It doesn't overflow though since it allocates according to the string length.)
size = sizeof(GUID)-1; + hr =
IDirectPlay8Address_GetComponentByName(localaddr, UNKNOWN, &compguid, &size, &type); + ok(hr == DPNERR_BUFFERTOOSMALL, "got 0x%08x\n", hr); + ok(size == sizeof(GUID), "got %d expected %d\n", size, sizeof(GUID));
Does it return DPNERR_BUFFERTOSMALL if pvBuffer is NULL? The d3d private data API returns D3D_OK in this case. This is worth a check.
Does GetComponentByName correct the size downward when *pdwBufferSize
size? Also test this with pvBuffer != NULL
Your implementation suggests pdwDataType is only set if the buffer has an appropriate size. Is this the case?