Re: d3drm: Add stubs for IDirect3DRMDevice methods.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, You aren't returning the version 1 interface from QueryInterface. Am 2015-07-11 um 14:40 schrieb Aaryaman Vasishta:
if (IsEqualGUID(riid, &IID_IDirect3DRMDevice3)) *out = (IUnknown*)&object->IDirect3DRMDevice3_iface; - else + else if (IsEqualGUID(riid, &IID_IDirect3DRMDevice2)) *out = (IUnknown*)&object->IDirect3DRMDevice2_iface; + else + *out = (IUnknown*)&object->IDirect3DRMDevice_iface;
You can call QueryInterface instead of doing GUID checks like this. Just initialize ref = 0, then call QI and you'll return a ref = 1 device. Another option, if you like this better, is to always return e.g. a IDirect3DRMDevice3 from Direct3DRMDevice_create, remove the riid parameter and do the QueryInterface in the caller. In this case init the refcount to 1 and call device3_Release in the caller after calling QI to obtain the right interface. The first 3 patches look good to me. I'll ack them tomorrow. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVok1NAAoJEN0/YqbEcdMwlFcQAJUgHXSjnseG9zIMJuKwiOoU K0IeSIAODnpT/+Mqc307owC7WBnKhTu4XLmZA1F7NxTxqdIcH85BsYx/LdLSeipq Y9KnTOg6dD00bNrujqyoZ5RmFI/pA+BXwhNXrwfbFg+RLr21ecQTpfRuDn3ENmPM VjWPHsfd4QIRqd+0Qo4LHAAS4UDmMm/avLdN+Gh5AOsDvOQYWW6reaerxYz6k61h rlkZwu1gLsSFTsA/PGz4W3nacVZkfcH8JourB80CJ/+bdPj1DfVImCpa2sx/WQ3g KMzwmR4MnS0n8/F2wGsqx/VMIKQ3zBblWVy4ZkZaMao6wA5IOoISSFXWrQlfUZrS GU5sRGwyVlaYK8qCzBOn3TdHhrrNLpg5hHkCqpN2JM1IgNYVaMevjZ+ISJhvaKXO GlQKwxOdB0M/SRWIPQ2261eQG/31lGEYm9ocu7i4USmNkaVZZCKlBt6wqsbmj6hF 7J2eU2KtfUoJwRozZRPaEdcKa0Xdp9AfrOrq4wilvEpIuUBI2leVVpOBQrbDD1c6 Z7/z8I1hmIw8ZPNl9NIIx7IyRrtnV3GBFG8rmWfRkHMMmIlZKqnC7+Yzgj5UF7Ai vr89VCzoAGj1Du/Xr8x5vmciLAdoRVNNTqV6QTPYqOgOQkodyls8RxH/IwM1sH/6 ZHUuK1kI7/vyX2WkYPi1 =1vdj -----END PGP SIGNATURE-----
On Sun, Jul 12, 2015 at 4:49 PM, Stefan Dösinger <stefandoesinger(a)gmail.com> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi,
You aren't returning the version 1 interface from QueryInterface.
Am 2015-07-11 um 14:40 schrieb Aaryaman Vasishta:
if (IsEqualGUID(riid, &IID_IDirect3DRMDevice3)) *out = (IUnknown*)&object->IDirect3DRMDevice3_iface; - else + else if (IsEqualGUID(riid, &IID_IDirect3DRMDevice2)) *out = (IUnknown*)&object->IDirect3DRMDevice2_iface; + else + *out = (IUnknown*)&object->IDirect3DRMDevice_iface;
You can call QueryInterface instead of doing GUID checks like this. Just initialize ref = 0, then call QI and you'll return a ref = 1 device.
Another option, if you like this better, is to always return e.g. a IDirect3DRMDevice3 from Direct3DRMDevice_create, remove the riid parameter and do the QueryInterface in the caller. In this case init the refcount to 1 and call device3_Release in the caller after calling QI to obtain the right interface.
Actually I should make it return struct d3drm_device **, as you suggested in the patchset mails at wine-devel, but I think I should implement the first option and then do the return d3drm_device ** part in a seperate patch right before sending the implementation patches (as this is called from multiple functions). What do you think? Jam
Am 12.07.2015 um 13:38 schrieb Aaryaman Vasishta <jem456.vasishta(a)gmail.com>:
Actually I should make it return struct d3drm_device **, as you suggested in the patchset mails at wine-devel, Right, I forgot.
but I think I should implement the first option and then do the return d3drm_device ** part in a seperate patch right before sending the implementation patches (as this is called from multiple functions). What do you think? Ya, change the return value in a separate patch, and for now use QueryInterface to return the requested interface version.
On 07/12/2015 01:19 PM, Stefan Dösinger wrote:
Hi,
You aren't returning the version 1 interface from QueryInterface.
Am 2015-07-11 um 14:40 schrieb Aaryaman Vasishta:
if (IsEqualGUID(riid, &IID_IDirect3DRMDevice3)) *out = (IUnknown*)&object->IDirect3DRMDevice3_iface; - else + else if (IsEqualGUID(riid, &IID_IDirect3DRMDevice2)) *out = (IUnknown*)&object->IDirect3DRMDevice2_iface; + else + *out = (IUnknown*)&object->IDirect3DRMDevice_iface; You can call QueryInterface instead of doing GUID checks like this. Just initialize ref = 0, then call QI and you'll return a ref = 1 device. Actually ref should be initialized with 1. To not leak objects when requesting the wrong interface the pattern is like this:
ref = 1; ... hres = QueryInterface(main, riid, ppv); Release(main); return hres;
Another option, if you like this better, is to always return e.g. a IDirect3DRMDevice3 from Direct3DRMDevice_create, remove the riid parameter and do the QueryInterface in the caller. In this case init the refcount to 1 and call device3_Release in the caller after calling QI to obtain the right interface.
The first 3 patches look good to me. I'll ack them tomorrow.
bye michael
participants (3)
-
Aaryaman Vasishta -
Michael Stefaniuc -
Stefan Dösinger