Skip to content

Conversation

@kennykerr
Copy link
Collaborator

Fixes: #1299

jonwis
jonwis previously approved these changes Apr 28, 2023
@kennykerr kennykerr merged commit 65581a3 into master Apr 29, 2023
@kennykerr kennykerr deleted the capture_decay branch April 29, 2023 19:53
@oldnewthing
Copy link
Member

oldnewthing commented Apr 30, 2023

I was originally worried that this might be too permissive. There are some methods that take a REFIID followed by something that isn't the matched output pointer. However, they are exceedingly rare, and the only one that does it at the end of the parameter list that I could find (mind you, I gave up halfway through the D's) is IDebugProperty::EnumMembers, so I concluded that the very low risk wasn't worth the extra protection.

Unit test needs to include the forwarder pattern:

com_ptr<ICapture> f = capture<ICapture>([&](auto riid, auto ppv) { return CreateCapture2(10, riid, ppv); });

This pattern is used to accommodate methods that don't put the riid/ppv as the last two parameters.

HRESULT WeirdMethod(REFIID riid, char const* interloper, IUnknown** result, int straggler);

e.capture<IUnknown>(WeirdMethod, [](auto interloper, auto straggler, auto riid, auto result) { return WeirdMethod(riid, interloper, result, straggler); }, "interloper", 10);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: winrt::capture needs detector for "REFIID, IUnknown**" methods

5 participants