How can I "fix" a mis-imported COM interface (c#/WPF)?
I want to add a custom pattern for UIAutomation, but I can't get the IUIAutomationRegistrar.RegisterPattern() method to work. I suspect part of the problem is that the method gets imported into c# like this:
void RegisterPattern([In] ref UIAutomationPatternInfo pattern,
out int pPatternId, out int pPatternAvailablePropertyId,
[In] uint propertyIdCount, out int pPropertyIds,
[In] uint eventIdCount, out int pEventIds);
but the interface in C/C++ looks like this:
HRESULT RegisterPattern(
[in] const UIAutomationPatternInfo *pattern,
[out] PATTERNID *pPatternId,
[out] PROPERTYID *pPatternAvailablePropertyId,
[in] UINT propertyIdCount,
[out] PROPERTYID *pPropertyIds,
[in] UINT eventIdCount,
[out] EVENTID *pEventIds
);
So the importer mistakenly assumed that "[out] PROPERTYID *pPropertyIds" was a reference to a single PROPERTYID (int) instead of a pointer to an array.
Is there a way to tell the importer how to do this right?
By the way, I started my question on StackOverflow, for more details than you really wanted:
https://stackoverflow.com/questions/72578187/how-add-pattern-and-or-property-to-uiautomation-c
https://stackoverflow.com/questions/72607121/are-there-updated-uiautomation-dlls-creating-custom-pattern-in-c