[release/9.0] Fix GetFormats and GetDataPresent #12193
Open
+8
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Customer Impact
This PR fixes issue #12190 where users receive an incomplete list of formats for the data they are dragging/dropping and receive
true
when callingGetDataPresent
with formats that the DataObject did not have, rendering APIs unusable. This regressed in 9.0 preview 1 while converting our interop code to leverage cswin32. We had accidentally removed a while loop in ourGetFormats()
method so we only retrieved the first format in the list.For
GetDataPresent
, we had updated to check the results ofQueryGetData
for success, butQueryGetData
can returnHRESULT.S_FALSE
which is considered "success", causing the return oftrue
for formats that the DataObject did not actually have.Testing
Tested with issue repro scenario to verify this fixes the issue. Adding additional tests to our suite will follow.
Risk
Low. Change involves adding back the while loop we had mistakenly removed and checking the result of
QueryGetData
explicitly forHRESULT.S_OK
as we did in old code.Microsoft Reviewers: Open in CodeFlow