dpnet: Implement IDirectPlay8Address GetComponentByName (try 2 - resend)

Stefan Dösinger stefandoesinger at gmail.com
Wed Oct 29 09:21:06 CDT 2014


-----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?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJUUPfSAAoJEN0/YqbEcdMwlBoP/jL3jPsPavfF4iQEr/fKe5y3
HLT67L/yqgriTCo4soOECoa+9fh9+8YFvBKrDvN7ISpZyni+paK38kxifAtwR0Xl
QB7yrk3x+TVvIy8f3+QxwbqI7b/CX6AxEYcXG7Y30QNZchw+qN396HOs8XPU+HCG
umYrNcnknizbASMQwkl0vaoZgun0JJP3L1jSEFnuLSZkl3f9CTIq5exS3q+ndqn7
0P0iqvo1CI1Pry/5qQGCYYxKqoFRfrqKbF0q1kGcImnwjpz211iuEQyVo23UICVI
0iMX1X2KueFQ4r9QrzRJmo+/8H5PpKsEQrWlhdBZyhhOX6m3BMxOrQK9/7OIzpua
l8cYkrKpLCgMsvhF5hZchX1CY5ZomFdhOjFAQldYCpSVHuupnFqOPXx2qqmjGzU3
38h/liv4VgHLvpckLgvjsD8SGqtkBH/nk4WTk50fzWupegtLqnQ1gxILTNuh+e9Y
kX4PWcMbbMQ6t1rjrdjBz4hDX/wAF44vx4NDLnht59aV3of9xtKfVWW8SFV9il40
2WDPhHESojF8BU/Nt/qx70YokSPIqpmwXdg1RQPXi5FNj2W5uqZoGCxCTeFfnY60
a68+EOaZaQhdSW5VSjGGWprs9jfBN4wB5SPoUU24adu5ygjcUsGj3IHj9H6ssBPN
vwscAjUYyZDTzkgRQYAE
=OHT3
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list