dpnet: Improve Error checking in Get/Set SP (try 4)

Stefan Dösinger stefandoesinger at gmail.com
Thu Apr 10 02:18:05 CDT 2014


> +        hr = IDirectPlay8Address_SetSP(localaddr, &GUID_NULL);
> +        ok(hr == S_OK, "got 0x%08x\n", hr);
> +
> +        hr = IDirectPlay8Address_SetSP(localaddr, &IID_Random);
> +        ok(hr == S_OK, "got 0x%08x\n", hr);
That’s a step forward, but I also meant that you should call GetSP after setting GUID_NULL manually.

> +DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
Why do you have to define this? (I really don’t know; It may be correct, or maybe you just need #define INITGUID, or something else.)

>  static HRESULT WINAPI IDirectPlay8AddressImpl_SetUserData(IDirectPlay8Address *iface,
> @@ -313,6 +323,8 @@ HRESULT DPNET_CreateDirectPlay8Address(LPCLASSFACTORY iface, LPUNKNOWN punkOuter
>      return E_OUTOFMEMORY;
>    }
>    client->IDirectPlay8Address_iface.lpVtbl = &DirectPlay8Address_Vtbl;
> +  client->SP_guid = GUID_NULL;
> +  client->init = FALSE;
>    client->ref = 0; /* will be inited with QueryInterface */
>    return IDirectPlay8AddressImpl_QueryInterface (&client->IDirectPlay8Address_iface, riid, ppobj);
>  }
You shouldn’t have to set client->init = FALSE because you allocate client with HEAP_ZERO_MEMORY. If you prefer to set it for clarity that’s ok with me.

The same applies to SP_guid, for two reasons: First, it’s already initialized to zeroes, and you’re not reading it unless client->init is set to TRUE, which only happens after a successful SetSP call.

IMHO you can also correct the indentation in this function, but I’ll leave the decision up to you.

Cheers,
Stefan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20140410/592d2d61/attachment.sig>


More information about the wine-patches mailing list