Re: dpnet: Implement IDirectPlay8Address GetComponentByIndex (try 9)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2015-04-22 um 05:30 schrieb Alistair Leslie-Hughes:
+ if(*pdwBufferSize < entry->size || *pdwNameLen < namesize) + { + *pdwNameLen = namesize + 1; + *pdwBufferSize = entry->size; + return DPNERR_BUFFERTOOSMALL; + } + + if((*pdwNameLen && !pwszName) || (*pdwBufferSize && !pvBuffer)) + return E_POINTER; This check suggests that a NULL pwszName is ok if *pdwNameLen is 0. However, the above check fails in this situation. Depending on how you want this to behave there's either an error in your logic or you have some redundant checks in there.
Are you sure *pdwDataType is not set in the BUFFERTOOSMALL case? I mentioned pdwDataType in the last feedback already, please take a bit more care and check if some things I point out apply in a similar way to other places, and re-read the feedback you get after you think you have implemented all the changes to see if there's anything you missed.
+ case DPNA_DATATYPE_DWORD: + *(DWORD*)pvBuffer = entry->data.value ; The extra space in front of the semicolon looks weird.
hr = IDirectPlay8Address_GetComponentByIndex(localaddr, 100, NULL, NULL, NULL, &bufflen, &type); - todo_wine ok(hr == E_POINTER, "got 0x%08x\n", hr); + ok(hr == DPNERR_INVALIDPOINTER, "got 0x%08x\n", hr);
In the code you return E_POINTER. DPNERR_INVALIDPOINTER is defined as E_POINTER, but please try to be consistent.
hr = IDirectPlay8Address_GetComponentByIndex(localaddr, i, NULL, &namelen, NULL, &bufflen, &type); - todo_wine ok(hr == DPNERR_BUFFERTOOSMALL, "got 0x%08x\n", hr); + ok(hr == DPNERR_BUFFERTOOSMALL, "got 0x%08x\n", hr); + ok(namelen > 0, "namelen length is 0\n"); + ok(bufflen > 0, "bufflen length is 0\n");
Please check the exact length, not just > 0. Please also check the name string, and the string and lengths in the success case (e.g. if you pass a length > than the necessary size does dpnet change the size?). Also, as pointed out above -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVN25ZAAoJEN0/YqbEcdMwf1cP/jXMXUuyMNzg5JAVG6YMMKgJ yIac4X5zxnmcPrJMjMRKIr2xU3u6ZDki/Kk5/GulDCCd4NQGlDJP0QY9WuuZ9eIN YiAipjXLpO4DPVi6eTRlDIbfCSDfpNJnjSWdDGbjpF/dpUkJOOZzwWvkJKZr598O kZohPT1kwTs12sU3yQyT8N3NGQer+AaWHcfohMW5f0UeZ+whviwjg3CGavrR65mH Q2fWn92mgw8KPTu+zvJ5oBbWQLf24o+lBp/vQ6zeOIA2lxXVLoMfg5q8QRWvKge9 IiPIG8BEOfrTXXSEZSUauif97fdq23JGQJOOGYUyZ+YLg/4Pqj2nWZBOmFM+3gVy E5FgFPT4EdE1vpyn7cnWGufzNtnctTZGOJ4F7AKxdMoBPqXxDEgdjmMFqN0yeTH8 Pm6NGVJP7uR8+wqXApHoGN2S7ceZLuEhMhdGYHbFakx9McPzCEayWMGQ/CIlbjHt YRB5aaxOAk896Fmb+PMuv3G9d4+y4409iLB+/Jrda20VOFfAp1qzNa33R9rhWXN7 sSdCale2KKYwStnzSWAcH4Mn7L+i1B/Dl7Md83HqPumAPfwlSK8VZVeqF0ZVjLaR KlokPcmQnIuS/ia6gPdGVbmAHnpoIIn0CNtgstKBqXkvGUlasXsKhy2ofWkWoaiW lO+hrwausmSORbzMGVaW =fTwv -----END PGP SIGNATURE-----
participants (1)
-
Stefan Dösinger