Bernhard K��lbl (@besentv) commented about dlls/windows.devices.enumeration/tests/devices.c:
+ + hr = IActivationFactory_QueryInterface(factory, &IID_IDeviceInformationStatics2, (void **)&device_info_statics2); + ok(hr == S_OK || broken(hr == E_NOINTERFACE), "got hr %#lx\n", hr); + IActivationFactory_Release(factory); + if (hr != S_OK) + { + IInspectable_Release(inspectable); + win_skip("IDeviceInformationStatics2 not supported.\n"); + return; + } + + hr = IDeviceInformationStatics2_QueryInterface(device_info_statics2, &IID_IInspectable, (void **)&inspectable2); + ok(hr == S_OK, "got hr %#lx\n", hr); + ok(inspectable == inspectable2, "got inspectable %p, inspectable2 %p\n", inspectable, inspectable2); + IInspectable_Release(inspectable); + IInspectable_Release(inspectable2); Release in reverse order here, it's a bit cleaner.
``` IInspectable_Release(inspectable2); IInspectable_Release(inspectable); IActivationFactory_Release(factory); ``` And you could probably do a ref check == 1 on the last release. (Yeah yeah, me and ref checks, lol.) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/716#note_7008