These patches are the beginning of adding support for the UI Automation client API.
From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- include/uiautomationcoreapi.h | 180 ++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+)
diff --git a/include/uiautomationcoreapi.h b/include/uiautomationcoreapi.h index 7f60fb45727..c68419caaa1 100644 --- a/include/uiautomationcoreapi.h +++ b/include/uiautomationcoreapi.h @@ -42,6 +42,186 @@ DECLARE_HANDLE(HUIAPATTERNOBJECT); DECLARE_HANDLE(HUIATEXTRANGE); DECLARE_HANDLE(HUIAEVENT);
+/* + * AutomationIdentifierType_Property GUIDs. + */ +DEFINE_GUID(RuntimeId_Property_GUID, 0xa39eebfa,0x7fba,0x4c89,0xb4,0xd4,0xb9,0x9e,0x2d,0xe7,0xd1,0x60); +DEFINE_GUID(BoundingRectangle_Property_GUID, 0x7bbfe8b2,0x3bfc,0x48dd,0xb7,0x29,0xc7,0x94,0xb8,0x46,0xe9,0xa1); +DEFINE_GUID(ProcessId_Property_GUID, 0x40499998,0x9c31,0x4245,0xa4,0x03,0x87,0x32,0x0e,0x59,0xea,0xf6); +DEFINE_GUID(ControlType_Property_GUID, 0xca774fea,0x28ac,0x4bc2,0x94,0xca,0xac,0xec,0x6d,0x6c,0x10,0xa3); +DEFINE_GUID(LocalizedControlType_Property_GUID, 0x8763404f,0xa1bd,0x452a,0x89,0xc4,0x3f,0x01,0xd3,0x83,0x38,0x06); +DEFINE_GUID(Name_Property_GUID, 0xc3a6921b,0x4a99,0x44f1,0xbc,0xa6,0x61,0x18,0x70,0x52,0xc4,0x31); +DEFINE_GUID(AcceleratorKey_Property_GUID, 0x514865df,0x2557,0x4cb9,0xae,0xed,0x6c,0xed,0x08,0x4c,0xe5,0x2c); +DEFINE_GUID(AccessKey_Property_GUID, 0x06827b12,0xa7f9,0x4a15,0x91,0x7c,0xff,0xa5,0xad,0x3e,0xb0,0xa7); +DEFINE_GUID(HasKeyboardFocus_Property_GUID, 0xcf8afd39,0x3f46,0x4800,0x96,0x56,0xb2,0xbf,0x12,0x52,0x99,0x05); +DEFINE_GUID(IsKeyboardFocusable_Property_GUID, 0xf7b8552a,0x0859,0x4b37,0xb9,0xcb,0x51,0xe7,0x20,0x92,0xf2,0x9f); +DEFINE_GUID(IsEnabled_Property_GUID, 0x2109427f,0xda60,0x4fed,0xbf,0x1b,0x26,0x4b,0xdc,0xe6,0xeb,0x3a); +DEFINE_GUID(AutomationId_Property_GUID, 0xc82c0500,0xb60e,0x4310,0xa2,0x67,0x30,0x3c,0x53,0x1f,0x8e,0xe5); +DEFINE_GUID(ClassName_Property_GUID, 0x157b7215,0x894f,0x4b65,0x84,0xe2,0xaa,0xc0,0xda,0x08,0xb1,0x6b); +DEFINE_GUID(HelpText_Property_GUID, 0x08555685,0x0977,0x45c7,0xa7,0xa6,0xab,0xaf,0x56,0x84,0x12,0x1a); +DEFINE_GUID(ClickablePoint_Property_GUID, 0x0196903b,0xb203,0x4818,0xa9,0xf3,0xf0,0x8e,0x67,0x5f,0x23,0x41); +DEFINE_GUID(Culture_Property_GUID, 0xe2d74f27,0x3d79,0x4dc2,0xb8,0x8b,0x30,0x44,0x96,0x3a,0x8a,0xfb); +DEFINE_GUID(IsControlElement_Property_GUID, 0x95f35085,0xabcc,0x4afd,0xa5,0xf4,0xdb,0xb4,0x6c,0x23,0x0f,0xdb); +DEFINE_GUID(IsContentElement_Property_GUID, 0x4bda64a8,0xf5d8,0x480b,0x81,0x55,0xef,0x2e,0x89,0xad,0xb6,0x72); +DEFINE_GUID(LabeledBy_Property_GUID, 0xe5b8924b,0xfc8a,0x4a35,0x80,0x31,0xcf,0x78,0xac,0x43,0xe5,0x5e); +DEFINE_GUID(IsPassword_Property_GUID, 0xe8482eb1,0x687c,0x497b,0xbe,0xbc,0x03,0xbe,0x53,0xec,0x14,0x54); +DEFINE_GUID(NewNativeWindowHandle_Property_GUID, 0x5196b33b,0x380a,0x4982,0x95,0xe1,0x91,0xf3,0xef,0x60,0xe0,0x24); +DEFINE_GUID(ItemType_Property_GUID, 0xcdda434d,0x6222,0x413b,0xa6,0x8a,0x32,0x5d,0xd1,0xd4,0x0f,0x39); +DEFINE_GUID(IsOffscreen_Property_GUID, 0x03c3d160,0xdb79,0x42db,0xa2,0xef,0x1c,0x23,0x1e,0xed,0xe5,0x07); +DEFINE_GUID(Orientation_Property_GUID, 0xa01eee62,0x3884,0x4415,0x88,0x7e,0x67,0x8e,0xc2,0x1e,0x39,0xba); +DEFINE_GUID(FrameworkId_Property_GUID, 0xdbfd9900,0x7e1a,0x4f58,0xb6,0x1b,0x70,0x63,0x12,0x0f,0x77,0x3b); +DEFINE_GUID(IsRequiredForForm_Property_GUID, 0x4f5f43cf,0x59fb,0x4bde,0xa2,0x70,0x60,0x2e,0x5e,0x11,0x41,0xe9); +DEFINE_GUID(ItemStatus_Property_GUID, 0x51de0321,0x3973,0x43e7,0x89,0x13,0x0b,0x08,0xe8,0x13,0xc3,0x7f); +DEFINE_GUID(IsDockPatternAvailable_Property_GUID, 0x2600a4c4,0x2ff8,0x4c96,0xae,0x31,0x8f,0xe6,0x19,0xa1,0x3c,0x6c); +DEFINE_GUID(IsExpandCollapsePatternAvailable_Property_GUID, 0x929d3806,0x5287,0x4725,0xaa,0x16,0x22,0x2a,0xfc,0x63,0xd5,0x95); +DEFINE_GUID(IsGridItemPatternAvailable_Property_GUID, 0x5a43e524,0xf9a2,0x4b12,0x84,0xc8,0xb4,0x8a,0x3e,0xfe,0xdd,0x34); +DEFINE_GUID(IsGridPatternAvailable_Property_GUID, 0x5622c26c,0xf0ef,0x4f3b,0x97,0xcb,0x71,0x4c,0x08,0x68,0x58,0x8b); +DEFINE_GUID(IsInvokePatternAvailable_Property_GUID, 0x4e725738,0x8364,0x4679,0xaa,0x6c,0xf3,0xf4,0x19,0x31,0xf7,0x50); +DEFINE_GUID(IsMultipleViewPatternAvailable_Property_GUID, 0xff0a31eb,0x8e25,0x469d,0x8d,0x6e,0xe7,0x71,0xa2,0x7c,0x1b,0x90); +DEFINE_GUID(IsRangeValuePatternAvailable_Property_GUID, 0xfda4244a,0xeb4d,0x43ff,0xb5,0xad,0xed,0x36,0xd3,0x73,0xec,0x4c); +DEFINE_GUID(IsScrollPatternAvailable_Property_GUID, 0x3ebb7b4a,0x828a,0x4b57,0x9d,0x22,0x2f,0xea,0x16,0x32,0xed,0x0d); +DEFINE_GUID(IsScrollItemPatternAvailable_Property_GUID, 0x1cad1a05,0x0927,0x4b76,0x97,0xe1,0x0f,0xcd,0xb2,0x09,0xb9,0x8a); +DEFINE_GUID(IsSelectionItemPatternAvailable_Property_GUID, 0x8becd62d,0x0bc3,0x4109,0xbe,0xe2,0x8e,0x67,0x15,0x29,0x0e,0x68); +DEFINE_GUID(IsSelectionPatternAvailable_Property_GUID, 0xf588acbe,0xc769,0x4838,0x9a,0x60,0x26,0x86,0xdc,0x11,0x88,0xc4); +DEFINE_GUID(IsTablePatternAvailable_Property_GUID, 0xcb83575f,0x45c2,0x4048,0x9c,0x76,0x15,0x97,0x15,0xa1,0x39,0xdf); +DEFINE_GUID(IsTableItemPatternAvailable_Property_GUID, 0xeb36b40d,0x8ea4,0x489b,0xa0,0x13,0xe6,0x0d,0x59,0x51,0xfe,0x34); +DEFINE_GUID(IsTextPatternAvailable_Property_GUID, 0xfbe2d69d,0xaff6,0x4a45,0x82,0xe2,0xfc,0x92,0xa8,0x2f,0x59,0x17); +DEFINE_GUID(IsTogglePatternAvailable_Property_GUID, 0x78686d53,0xfcd0,0x4b83,0x9b,0x78,0x58,0x32,0xce,0x63,0xbb,0x5b); +DEFINE_GUID(IsTransformPatternAvailable_Property_GUID, 0xa7f78804,0xd68b,0x4077,0xa5,0xc6,0x7a,0x5e,0xa1,0xac,0x31,0xc5); +DEFINE_GUID(IsValuePatternAvailable_Property_GUID, 0x0b5020a7,0x2119,0x473b,0xbe,0x37,0x5c,0xeb,0x98,0xbb,0xfb,0x22); +DEFINE_GUID(IsWindowPatternAvailable_Property_GUID, 0xe7a57bb1,0x5888,0x4155,0x98,0xdc,0xb4,0x22,0xfd,0x57,0xf2,0xbc); +DEFINE_GUID(Value_Value_Property_GUID, 0xe95f5e64,0x269f,0x4a85,0xba,0x99,0x40,0x92,0xc3,0xea,0x29,0x86); +DEFINE_GUID(Value_IsReadOnly_Property_GUID, 0xeb090f30,0xe24c,0x4799,0xa7,0x05,0x0d,0x24,0x7b,0xc0,0x37,0xf8); +DEFINE_GUID(RangeValue_Value_Property_GUID, 0x131f5d98,0xc50c,0x489d,0xab,0xe5,0xae,0x22,0x08,0x98,0xc5,0xf7); +DEFINE_GUID(RangeValue_IsReadOnly_Property_GUID, 0x25fa1055,0xdebf,0x4373,0xa7,0x9e,0x1f,0x1a,0x19,0x08,0xd3,0xc4); +DEFINE_GUID(RangeValue_Minimum_Property_GUID, 0x78cbd3b2,0x684d,0x4860,0xaf,0x93,0xd1,0xf9,0x5c,0xb0,0x22,0xfd); +DEFINE_GUID(RangeValue_Maximum_Property_GUID, 0x19319914,0xf979,0x4b35,0xa1,0xa6,0xd3,0x7e,0x05,0x43,0x34,0x73); +DEFINE_GUID(RangeValue_LargeChange_Property_GUID, 0xa1f96325,0x3a3d,0x4b44,0x8e,0x1f,0x4a,0x46,0xd9,0x84,0x40,0x19); +DEFINE_GUID(RangeValue_SmallChange_Property_GUID, 0x81c2c457,0x3941,0x4107,0x99,0x75,0x13,0x97,0x60,0xf7,0xc0,0x72); +DEFINE_GUID(Scroll_HorizontalScrollPercent_Property_GUID, 0xc7c13c0e,0xeb21,0x47ff,0xac,0xc4,0xb5,0xa3,0x35,0x0f,0x51,0x91); +DEFINE_GUID(Scroll_HorizontalViewSize_Property_GUID, 0x70c2e5d4,0xfcb0,0x4713,0xa9,0xaa,0xaf,0x92,0xff,0x79,0xe4,0xcd); +DEFINE_GUID(Scroll_VerticalScrollPercent_Property_GUID, 0x6c8d7099,0xb2a8,0x4948,0xbf,0xf7,0x3c,0xf9,0x05,0x8b,0xfe,0xfb); +DEFINE_GUID(Scroll_VerticalViewSize_Property_GUID, 0xde6a2e22,0xd8c7,0x40c5,0x83,0xba,0xe5,0xf6,0x81,0xd5,0x31,0x08); +DEFINE_GUID(Scroll_HorizontallyScrollable_Property_GUID, 0x8b925147,0x28cd,0x49ae,0xbd,0x63,0xf4,0x41,0x18,0xd2,0xe7,0x19); +DEFINE_GUID(Scroll_VerticallyScrollable_Property_GUID, 0x89164798,0x0068,0x4315,0xb8,0x9a,0x1e,0x7c,0xfb,0xbc,0x3d,0xfc); +DEFINE_GUID(Selection_Selection_Property_GUID, 0xaa6dc2a2,0x0e2b,0x4d38,0x96,0xd5,0x34,0xe4,0x70,0xb8,0x18,0x53); +DEFINE_GUID(Selection_CanSelectMultiple_Property_GUID, 0x49d73da5,0xc883,0x4500,0x88,0x3d,0x8f,0xcf,0x8d,0xaf,0x6c,0xbe); +DEFINE_GUID(Selection_IsSelectionRequired_Property_GUID, 0xb1ae4422,0x63fe,0x44e7,0xa5,0xa5,0xa7,0x38,0xc8,0x29,0xb1,0x9a); +DEFINE_GUID(Grid_RowCount_Property_GUID, 0x2a9505bf,0xc2eb,0x4fb6,0xb3,0x56,0x82,0x45,0xae,0x53,0x70,0x3e); +DEFINE_GUID(Grid_ColumnCount_Property_GUID, 0xfe96f375,0x44aa,0x4536,0xac,0x7a,0x2a,0x75,0xd7,0x1a,0x3e,0xfc); +DEFINE_GUID(GridItem_Row_Property_GUID, 0x6223972a,0xc945,0x4563,0x93,0x29,0xfd,0xc9,0x74,0xaf,0x25,0x53); +DEFINE_GUID(GridItem_Column_Property_GUID, 0xc774c15c,0x62c0,0x4519,0x8b,0xdc,0x47,0xbe,0x57,0x3c,0x8a,0xd5); +DEFINE_GUID(GridItem_RowSpan_Property_GUID, 0x4582291c,0x466b,0x4e93,0x8e,0x83,0x3d,0x17,0x15,0xec,0x0c,0x5e); +DEFINE_GUID(GridItem_ColumnSpan_Property_GUID, 0x583ea3f5,0x86d0,0x4b08,0xa6,0xec,0x2c,0x54,0x63,0xff,0xc1,0x09); +DEFINE_GUID(GridItem_Parent_Property_GUID, 0x9d912252,0xb97f,0x4ecc,0x85,0x10,0xea,0x0e,0x33,0x42,0x7c,0x72); +DEFINE_GUID(Dock_DockPosition_Property_GUID, 0x6d67f02e,0xc0b0,0x4b10,0xb5,0xb9,0x18,0xd6,0xec,0xf9,0x87,0x60); +DEFINE_GUID(ExpandCollapse_ExpandCollapseState_Property_GUID, 0x275a4c48,0x85a7,0x4f69,0xab,0xa0,0xaf,0x15,0x76,0x10,0x00,0x2b); +DEFINE_GUID(MultipleView_CurrentView_Property_GUID, 0x7a81a67a,0xb94f,0x4875,0x91,0x8b,0x65,0xc8,0xd2,0xf9,0x98,0xe5); +DEFINE_GUID(MultipleView_SupportedViews_Property_GUID, 0x8d5db9fd,0xce3c,0x4ae7,0xb7,0x88,0x40,0x0a,0x3c,0x64,0x55,0x47); +DEFINE_GUID(Window_CanMaximize_Property_GUID, 0x64fff53f,0x635d,0x41c1,0x95,0x0c,0xcb,0x5a,0xdf,0xbe,0x28,0xe3); +DEFINE_GUID(Window_CanMinimize_Property_GUID, 0xb73b4625,0x5988,0x4b97,0xb4,0xc2,0xa6,0xfe,0x6e,0x78,0xc8,0xc6); +DEFINE_GUID(Window_WindowVisualState_Property_GUID, 0x4ab7905f,0xe860,0x453e,0xa3,0x0a,0xf6,0x43,0x1e,0x5d,0xaa,0xd5); +DEFINE_GUID(Window_WindowInteractionState_Property_GUID, 0x4fed26a4,0x0455,0x4fa2,0xb2,0x1c,0xc4,0xda,0x2d,0xb1,0xff,0x9c); +DEFINE_GUID(Window_IsModal_Property_GUID, 0xff4e6892,0x37b9,0x4fca,0x85,0x32,0xff,0xe6,0x74,0xec,0xfe,0xed); +DEFINE_GUID(Window_IsTopmost_Property_GUID, 0xef7d85d3,0x0937,0x4962,0x92,0x41,0xb6,0x23,0x45,0xf2,0x40,0x41); +DEFINE_GUID(SelectionItem_IsSelected_Property_GUID, 0xf122835f,0xcd5f,0x43df,0xb7,0x9d,0x4b,0x84,0x9e,0x9e,0x60,0x20); +DEFINE_GUID(SelectionItem_SelectionContainer_Property_GUID, 0xa4365b6e,0x9c1e,0x4b63,0x8b,0x53,0xc2,0x42,0x1d,0xd1,0xe8,0xfb); +DEFINE_GUID(Table_RowHeaders_Property_GUID, 0xd9e35b87,0x6eb8,0x4562,0xaa,0xc6,0xa8,0xa9,0x07,0x52,0x36,0xa8); +DEFINE_GUID(Table_ColumnHeaders_Property_GUID, 0xaff1d72b,0x968d,0x42b1,0xb4,0x59,0x15,0x0b,0x29,0x9d,0xa6,0x64); +DEFINE_GUID(Table_RowOrColumnMajor_Property_GUID, 0x83be75c3,0x29fe,0x4a30,0x85,0xe1,0x2a,0x62,0x77,0xfd,0x10,0x6e); +DEFINE_GUID(TableItem_RowHeaderItems_Property_GUID, 0xb3f853a0,0x0574,0x4cd8,0xbc,0xd7,0xed,0x59,0x23,0x57,0x2d,0x97); +DEFINE_GUID(TableItem_ColumnHeaderItems_Property_GUID, 0x967a56a3,0x74b6,0x431e,0x8d,0xe6,0x99,0xc4,0x11,0x03,0x1c,0x58); +DEFINE_GUID(Toggle_ToggleState_Property_GUID, 0xb23cdc52,0x22c2,0x4c6c,0x9d,0xed,0xf5,0xc4,0x22,0x47,0x9e,0xde); +DEFINE_GUID(Transform_CanMove_Property_GUID, 0x1b75824d,0x208b,0x4fdf,0xbc,0xcd,0xf1,0xf4,0xe5,0x74,0x1f,0x4f); +DEFINE_GUID(Transform_CanResize_Property_GUID, 0xbb98dca5,0x4c1a,0x41d4,0xa4,0xf6,0xeb,0xc1,0x28,0x64,0x41,0x80); +DEFINE_GUID(Transform_CanRotate_Property_GUID, 0x10079b48,0x3849,0x476f,0xac,0x96,0x44,0xa9,0x5c,0x84,0x40,0xd9); +DEFINE_GUID(IsLegacyIAccessiblePatternAvailable_Property_GUID, 0xd8ebd0c7,0x929a,0x4ee7,0x8d,0x3a,0xd3,0xd9,0x44,0x13,0x02,0x7b); +DEFINE_GUID(LegacyIAccessible_ChildId_Property_GUID, 0x9a191b5d,0x9ef2,0x4787,0xa4,0x59,0xdc,0xde,0x88,0x5d,0xd4,0xe8); +DEFINE_GUID(LegacyIAccessible_Name_Property_GUID, 0xcaeb063d,0x40ae,0x4869,0xaa,0x5a,0x1b,0x8e,0x5d,0x66,0x67,0x39); +DEFINE_GUID(LegacyIAccessible_Value_Property_GUID, 0xb5c5b0b6,0x8217,0x4a77,0x97,0xa5,0x19,0x0a,0x85,0xed,0x01,0x56); +DEFINE_GUID(LegacyIAccessible_Description_Property_GUID, 0x46448418,0x7d70,0x4ea9,0x9d,0x27,0xb7,0xe7,0x75,0xcf,0x2a,0xd7); +DEFINE_GUID(LegacyIAccessible_Role_Property_GUID, 0x6856e59f,0xcbaf,0x4e31,0x93,0xe8,0xbc,0xbf,0x6f,0x7e,0x49,0x1c); +DEFINE_GUID(LegacyIAccessible_State_Property_GUID, 0xdf985854,0x2281,0x4340,0xab,0x9c,0xc6,0x0e,0x2c,0x58,0x03,0xf6); +DEFINE_GUID(LegacyIAccessible_Help_Property_GUID, 0x94402352,0x161c,0x4b77,0xa9,0x8d,0xa8,0x72,0xcc,0x33,0x94,0x7a); +DEFINE_GUID(LegacyIAccessible_KeyboardShortcut_Property_GUID, 0x8f6909ac,0x00b8,0x4259,0xa4,0x1c,0x96,0x62,0x66,0xd4,0x3a,0x8a); +DEFINE_GUID(LegacyIAccessible_Selection_Property_GUID, 0x8aa8b1e0,0x0891,0x40cc,0x8b,0x06,0x90,0xd7,0xd4,0x16,0x62,0x19); +DEFINE_GUID(LegacyIAccessible_DefaultAction_Property_GUID, 0x3b331729,0xeaad,0x4502,0xb8,0x5f,0x92,0x61,0x56,0x22,0x91,0x3c); +DEFINE_GUID(AriaRole_Property_GUID, 0xdd207b95,0xbe4a,0x4e0d,0xb7,0x27,0x63,0xac,0xe9,0x4b,0x69,0x16); +DEFINE_GUID(AriaProperties_Property_GUID, 0x4213678c,0xe025,0x4922,0xbe,0xb5,0xe4,0x3b,0xa0,0x8e,0x62,0x21); +DEFINE_GUID(IsDataValidForForm_Property_GUID, 0x445ac684,0xc3fc,0x4dd9,0xac,0xf8,0x84,0x5a,0x57,0x92,0x96,0xba); +DEFINE_GUID(ControllerFor_Property_GUID, 0x51124c8a,0xa5d2,0x4f13,0x9b,0xe6,0x7f,0xa8,0xba,0x9d,0x3a,0x90); +DEFINE_GUID(DescribedBy_Property_GUID, 0x7c5865b8,0x9992,0x40fd,0x8d,0xb0,0x6b,0xf1,0xd3,0x17,0xf9,0x98); +DEFINE_GUID(FlowsTo_Property_GUID, 0xe4f33d20,0x559a,0x47fb,0xa8,0x30,0xf9,0xcb,0x4f,0xf1,0xa7,0x0a); +DEFINE_GUID(ProviderDescription_Property_GUID, 0xdca5708a,0xc16b,0x4cd9,0xb8,0x89,0xbe,0xb1,0x6a,0x80,0x49,0x04); +DEFINE_GUID(IsItemContainerPatternAvailable_Property_GUID, 0x624b5ca7,0xfe40,0x4957,0xa0,0x19,0x20,0xc4,0xcf,0x11,0x92,0x0f); +DEFINE_GUID(IsVirtualizedItemPatternAvailable_Property_GUID, 0x302cb151,0x2ac8,0x45d6,0x97,0x7b,0xd2,0xb3,0xa5,0xa5,0x3f,0x20); +DEFINE_GUID(IsSynchronizedInputPatternAvailable_Property_GUID, 0x75d69cc5,0xd2bf,0x4943,0x87,0x6e,0xb4,0x5b,0x62,0xa6,0xcc,0x66); +DEFINE_GUID(OptimizeForVisualContent_Property_GUID, 0x6a852250,0xc75a,0x4e5d,0xb8,0x58,0xe3,0x81,0xb0,0xf7,0x88,0x61); +DEFINE_GUID(IsObjectModelPatternAvailable_Property_GUID, 0x6b21d89b,0x2841,0x412f,0x8e,0xf2,0x15,0xca,0x95,0x23,0x18,0xba); +DEFINE_GUID(Annotation_AnnotationTypeId_Property_GUID, 0x20ae484f,0x69ef,0x4c48,0x8f,0x5b,0xc4,0x93,0x8b,0x20,0x6a,0xc7); +DEFINE_GUID(Annotation_AnnotationTypeName_Property_GUID, 0x9b818892,0x5ac9,0x4af9,0xaa,0x96,0xf5,0x8a,0x77,0xb0,0x58,0xe3); +DEFINE_GUID(Annotation_Author_Property_GUID, 0x7a528462,0x9c5c,0x4a03,0xa9,0x74,0x8b,0x30,0x7a,0x99,0x37,0xf2); +DEFINE_GUID(Annotation_DateTime_Property_GUID, 0x99b5ca5d,0x1acf,0x414b,0xa4,0xd0,0x6b,0x35,0x0b,0x04,0x75,0x78); +DEFINE_GUID(Annotation_Target_Property_GUID, 0xb71b302d,0x2104,0x44ad,0x9c,0x5c,0x09,0x2b,0x49,0x07,0xd7,0x0f); +DEFINE_GUID(IsAnnotationPatternAvailable_Property_GUID, 0x0b5b3238,0x6d5c,0x41b6,0xbc,0xc4,0x5e,0x80,0x7f,0x65,0x51,0xc4); +DEFINE_GUID(IsTextPattern2Available_Property_GUID, 0x41cf921d,0xe3f1,0x4b22,0x9c,0x81,0xe1,0xc3,0xed,0x33,0x1c,0x22); +DEFINE_GUID(Styles_StyleId_Property_GUID, 0xda82852f,0x3817,0x4233,0x82,0xaf,0x02,0x27,0x9e,0x72,0xcc,0x77); +DEFINE_GUID(Styles_StyleName_Property_GUID, 0x1c12b035,0x05d1,0x4f55,0x9e,0x8e,0x14,0x89,0xf3,0xff,0x55,0x0d); +DEFINE_GUID(Styles_FillColor_Property_GUID, 0x63eff97a,0xa1c5,0x4b1d,0x84,0xeb,0xb7,0x65,0xf2,0xed,0xd6,0x32); +DEFINE_GUID(Styles_FillPatternStyle_Property_GUID, 0x81cf651f,0x482b,0x4451,0xa3,0x0a,0xe1,0x54,0x5e,0x55,0x4f,0xb8); +DEFINE_GUID(Styles_Shape_Property_GUID, 0xc71a23f8,0x778c,0x400d,0x84,0x58,0x3b,0x54,0x3e,0x52,0x69,0x84); +DEFINE_GUID(Styles_FillPatternColor_Property_GUID, 0x939a59fe,0x8fbd,0x4e75,0xa2,0x71,0xac,0x45,0x95,0x19,0x51,0x63); +DEFINE_GUID(Styles_ExtendedProperties_Property_GUID, 0xf451cda0,0xba0a,0x4681,0xb0,0xb0,0x0d,0xbd,0xb5,0x3e,0x58,0xf3); +DEFINE_GUID(IsStylesPatternAvailable_Property_GUID, 0x27f353d3,0x459c,0x4b59,0xa4,0x90,0x50,0x61,0x1d,0xac,0xaf,0xb5); +DEFINE_GUID(IsSpreadsheetPatternAvailable_Property_GUID, 0x6ff43732,0xe4b4,0x4555,0x97,0xbc,0xec,0xdb,0xbc,0x4d,0x18,0x88); +DEFINE_GUID(SpreadsheetItem_Formula_Property_GUID, 0xe602e47d,0x1b47,0x4bea,0x87,0xcf,0x3b,0x0b,0x0b,0x5c,0x15,0xb6); +DEFINE_GUID(SpreadsheetItem_AnnotationObjects_Property_GUID, 0xa3194c38,0xc9bc,0x4604,0x93,0x96,0xae,0x3f,0x9f,0x45,0x7f,0x7b); +DEFINE_GUID(SpreadsheetItem_AnnotationTypes_Property_GUID, 0xc70c51d0,0xd602,0x4b45,0xaf,0xbc,0xb4,0x71,0x2b,0x96,0xd7,0x2b); +DEFINE_GUID(IsSpreadsheetItemPatternAvailable_Property_GUID, 0x9fe79b2a,0x2f94,0x43fd,0x99,0x6b,0x54,0x9e,0x31,0x6f,0x4a,0xcd); +DEFINE_GUID(Transform2_CanZoom_Property_GUID, 0xf357e890,0xa756,0x4359,0x9c,0xa6,0x86,0x70,0x2b,0xf8,0xf3,0x81); +DEFINE_GUID(IsTransformPattern2Available_Property_GUID, 0x25980b4b,0xbe04,0x4710,0xab,0x4a,0xfd,0xa3,0x1d,0xbd,0x28,0x95); +DEFINE_GUID(LiveSetting_Property_GUID, 0xc12bcd8e,0x2a8e,0x4950,0x8a,0xe7,0x36,0x25,0x11,0x1d,0x58,0xeb); +DEFINE_GUID(IsTextChildPatternAvailable_Property_GUID, 0x559e65df,0x30ff,0x43b5,0xb5,0xed,0x5b,0x28,0x3b,0x80,0xc7,0xe9); +DEFINE_GUID(IsDragPatternAvailable_Property_GUID, 0xe997a7b7,0x1d39,0x4ca7,0xbe,0x0f,0x27,0x7f,0xcf,0x56,0x05,0xcc); +DEFINE_GUID(Drag_IsGrabbed_Property_GUID, 0x45f206f3,0x75cc,0x4cca,0xa9,0xb9,0xfc,0xdf,0xb9,0x82,0xd8,0xa2); +DEFINE_GUID(Drag_DropEffect_Property_GUID, 0x646f2779,0x48d3,0x4b23,0x89,0x02,0x4b,0xf1,0x00,0x00,0x5d,0xf3); +DEFINE_GUID(Drag_DropEffects_Property_GUID, 0xf5d61156,0x7ce6,0x49be,0xa8,0x36,0x92,0x69,0xdc,0xec,0x92,0x0f); +DEFINE_GUID(IsDropTargetPatternAvailable_Property_GUID, 0x0686b62e,0x8e19,0x4aaf,0x87,0x3d,0x38,0x4f,0x6d,0x3b,0x92,0xbe); +DEFINE_GUID(DropTarget_DropTargetEffect_Property_GUID, 0x8bb75975,0xa0ca,0x4981,0xb8,0x18,0x87,0xfc,0x66,0xe9,0x50,0x9d); +DEFINE_GUID(DropTarget_DropTargetEffects_Property_GUID, 0xbc1dd4ed,0xcb89,0x45f1,0xa5,0x92,0xe0,0x3b,0x08,0xae,0x79,0x0f); +DEFINE_GUID(Drag_GrabbedItems_Property_GUID, 0x77c1562c,0x7b86,0x4b21,0x9e,0xd7,0x3c,0xef,0xda,0x6f,0x4c,0x43); +DEFINE_GUID(Transform2_ZoomLevel_Property_GUID, 0xeee29f1a,0xf4a2,0x4b5b,0xac,0x65,0x95,0xcf,0x93,0x28,0x33,0x87); +DEFINE_GUID(Transform2_ZoomMinimum_Property_GUID, 0x742ccc16,0x4ad1,0x4e07,0x96,0xfe,0xb1,0x22,0xc6,0xe6,0xb2,0x2b); +DEFINE_GUID(Transform2_ZoomMaximum_Property_GUID, 0x42ab6b77,0xceb0,0x4eca,0xb8,0x2a,0x6c,0xfa,0x5f,0xa1,0xfc,0x08); +DEFINE_GUID(FlowsFrom_Property_GUID, 0x05c6844f,0x19de,0x48f8,0x95,0xfa,0x88,0x0d,0x5b,0x0f,0xd6,0x15); +DEFINE_GUID(IsTextEditPatternAvailable_Property_GUID, 0x7843425c,0x8b32,0x484c,0x9a,0xb5,0xe3,0x20,0x05,0x71,0xff,0xda); +DEFINE_GUID(IsPeripheral_Property_GUID, 0xda758276,0x7ed5,0x49d4,0x8e,0x68,0xec,0xc9,0xa2,0xd3,0x00,0xdd); +DEFINE_GUID(IsCustomNavigationPatternAvailable_Property_GUID, 0x8f8e80d4,0x2351,0x48e0,0x87,0x4a,0x54,0xaa,0x73,0x13,0x88,0x9a); +DEFINE_GUID(PositionInSet_Property_GUID, 0x33d1dc54,0x641e,0x4d76,0xa6,0xb1,0x13,0xf3,0x41,0xc1,0xf8,0x96); +DEFINE_GUID(SizeOfSet_Property_GUID, 0x1600d33c,0x3b9f,0x4369,0x94,0x31,0xaa,0x29,0x3f,0x34,0x4c,0xf1); +DEFINE_GUID(Level_Property_GUID, 0x242ac529,0xcd36,0x400f,0xaa,0xd9,0x78,0x76,0xef,0x3a,0xf6,0x27); +DEFINE_GUID(AnnotationTypes_Property_GUID, 0x64b71f76,0x53c4,0x4696,0xa2,0x19,0x20,0xe9,0x40,0xc9,0xa1,0x76); +DEFINE_GUID(AnnotationObjects_Property_GUID, 0x310910c8,0x7c6e,0x4f20,0xbe,0xcd,0x4a,0xaf,0x6d,0x19,0x11,0x56); +DEFINE_GUID(LandmarkType_Property_GUID, 0x454045f2,0x6f61,0x49f7,0xa4,0xf8,0xb5,0xf0,0xcf,0x82,0xda,0x1e); +DEFINE_GUID(LocalizedLandmarkType_Property_GUID, 0x7ac81980,0xeafb,0x4fb2,0xbf,0x91,0xf4,0x85,0xbe,0xf5,0xe8,0xe1); +DEFINE_GUID(FullDescription_Property_GUID, 0x0d4450ff,0x6aef,0x4f33,0x95,0xdd,0x7b,0xef,0xa7,0x2a,0x43,0x91); +DEFINE_GUID(FillColor_Property_GUID , 0x6e0ec4d0,0xe2a8,0x4a56,0x9d,0xe7,0x95,0x33,0x89,0x93,0x3b,0x39); +DEFINE_GUID(OutlineColor_Property_GUID, 0xc395d6c0,0x4b55,0x4762,0xa0,0x73,0xfd,0x30,0x3a,0x63,0x4f,0x52); +DEFINE_GUID(FillType_Property_GUID, 0xc6fc74e4,0x8cb9,0x429c,0xa9,0xe1,0x9b,0xc4,0xac,0x37,0x2b,0x62); +DEFINE_GUID(VisualEffects_Property_GUID, 0xe61a8565,0xaad9,0x46d7,0x9e,0x70,0x4e,0x8a,0x84,0x20,0xd4,0x20); +DEFINE_GUID(OutlineThickness_Property_GUID, 0x13e67cc7,0xdac2,0x4888,0xbd,0xd3,0x37,0x5c,0x62,0xfa,0x96,0x18); +DEFINE_GUID(CenterPoint_Property_GUID, 0x0cb00c08,0x540c,0x4edb,0x94,0x45,0x26,0x35,0x9e,0xa6,0x97,0x85); +DEFINE_GUID(Rotation_Property_GUID, 0x767cdc7d,0xaec0,0x4110,0xad,0x32,0x30,0xed,0xd4,0x03,0x49,0x2e); +DEFINE_GUID(Size_Property_GUID, 0x2b5f761d,0xf885,0x4404,0x97,0x3f,0x9b,0x1d,0x98,0xe3,0x6d,0x8f); +DEFINE_GUID(IsSelectionPattern2Available_Property_GUID, 0x490806fb,0x6e89,0x4a47,0x83,0x19,0xd2,0x66,0xe5,0x11,0xf0,0x21); +DEFINE_GUID(Selection2_FirstSelectedItem_Property_GUID, 0xcc24ea67,0x369c,0x4e55,0x9f,0xf7,0x38,0xda,0x69,0x54,0x0c,0x29); +DEFINE_GUID(Selection2_LastSelectedItem_Property_GUID, 0xcf7bda90,0x2d83,0x49f8,0x86,0x0c,0x9c,0xe3,0x94,0xcf,0x89,0xb4); +DEFINE_GUID(Selection2_CurrentSelectedItem_Property_GUID, 0x34257c26,0x83b5,0x41a6,0x93,0x9c,0xae,0x84,0x1c,0x13,0x62,0x36); +DEFINE_GUID(Selection2_ItemCount_Property_GUID, 0xbb49eb9f,0x456d,0x4048,0xb5,0x91,0x9c,0x20,0x26,0xb8,0x46,0x36); +DEFINE_GUID(HeadingLevel_Property_GUID, 0x29084272,0xaaaf,0x4a30,0x87,0x96,0x3c,0x12,0xf6,0x2b,0x6b,0xbb); +DEFINE_GUID(IsDialog_Property_GUID, 0x9d0dfb9b,0x8436,0x4501,0xbb,0xbb,0xe5,0x34,0xa4,0xfb,0x3b,0x3f); + + enum AutomationIdentifierType { AutomationIdentifierType_Property,
From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/uiautomationcore/Makefile.in | 3 +- dlls/uiautomationcore/tests/uiautomation.c | 206 ++++++++++++++++ dlls/uiautomationcore/uia_ids.c | 270 +++++++++++++++++++++ dlls/uiautomationcore/uia_main.c | 9 - 4 files changed, 478 insertions(+), 10 deletions(-) create mode 100644 dlls/uiautomationcore/uia_ids.c
diff --git a/dlls/uiautomationcore/Makefile.in b/dlls/uiautomationcore/Makefile.in index a1cf5575814..eedf7fb3be6 100644 --- a/dlls/uiautomationcore/Makefile.in +++ b/dlls/uiautomationcore/Makefile.in @@ -6,4 +6,5 @@ EXTRADLLFLAGS = -Wb,--prefer-native
C_SRCS = \ uia_main.c \ - uia_provider.c + uia_provider.c \ + uia_ids.c diff --git a/dlls/uiautomationcore/tests/uiautomation.c b/dlls/uiautomationcore/tests/uiautomation.c index 710991d5a3d..a4511c72c44 100644 --- a/dlls/uiautomationcore/tests/uiautomation.c +++ b/dlls/uiautomationcore/tests/uiautomation.c @@ -2703,12 +2703,218 @@ static void test_UiaProviderFromIAccessible(void) Accessible.ow_hwnd = NULL; }
+struct uia_lookup_id { + const GUID *guid; + int id; +}; + +static const struct uia_lookup_id uia_property_lookup_ids[] = { + { &RuntimeId_Property_GUID, UIA_RuntimeIdPropertyId }, + { &BoundingRectangle_Property_GUID, UIA_BoundingRectanglePropertyId }, + { &ProcessId_Property_GUID, UIA_ProcessIdPropertyId }, + { &ControlType_Property_GUID, UIA_ControlTypePropertyId }, + { &LocalizedControlType_Property_GUID, UIA_LocalizedControlTypePropertyId }, + { &Name_Property_GUID, UIA_NamePropertyId }, + { &AcceleratorKey_Property_GUID, UIA_AcceleratorKeyPropertyId }, + { &AccessKey_Property_GUID, UIA_AccessKeyPropertyId }, + { &HasKeyboardFocus_Property_GUID, UIA_HasKeyboardFocusPropertyId }, + { &IsKeyboardFocusable_Property_GUID, UIA_IsKeyboardFocusablePropertyId }, + { &IsEnabled_Property_GUID, UIA_IsEnabledPropertyId }, + { &AutomationId_Property_GUID, UIA_AutomationIdPropertyId }, + { &ClassName_Property_GUID, UIA_ClassNamePropertyId }, + { &HelpText_Property_GUID, UIA_HelpTextPropertyId }, + { &ClickablePoint_Property_GUID, UIA_ClickablePointPropertyId }, + { &Culture_Property_GUID, UIA_CulturePropertyId }, + { &IsControlElement_Property_GUID, UIA_IsControlElementPropertyId }, + { &IsContentElement_Property_GUID, UIA_IsContentElementPropertyId }, + { &LabeledBy_Property_GUID, UIA_LabeledByPropertyId }, + { &IsPassword_Property_GUID, UIA_IsPasswordPropertyId }, + { &NewNativeWindowHandle_Property_GUID, UIA_NativeWindowHandlePropertyId }, + { &ItemType_Property_GUID, UIA_ItemTypePropertyId }, + { &IsOffscreen_Property_GUID, UIA_IsOffscreenPropertyId }, + { &Orientation_Property_GUID, UIA_OrientationPropertyId }, + { &FrameworkId_Property_GUID, UIA_FrameworkIdPropertyId }, + { &IsRequiredForForm_Property_GUID, UIA_IsRequiredForFormPropertyId }, + { &ItemStatus_Property_GUID, UIA_ItemStatusPropertyId }, + { &IsDockPatternAvailable_Property_GUID, UIA_IsDockPatternAvailablePropertyId }, + { &IsExpandCollapsePatternAvailable_Property_GUID, UIA_IsExpandCollapsePatternAvailablePropertyId }, + { &IsGridItemPatternAvailable_Property_GUID, UIA_IsGridItemPatternAvailablePropertyId }, + { &IsGridPatternAvailable_Property_GUID, UIA_IsGridPatternAvailablePropertyId }, + { &IsInvokePatternAvailable_Property_GUID, UIA_IsInvokePatternAvailablePropertyId }, + { &IsMultipleViewPatternAvailable_Property_GUID, UIA_IsMultipleViewPatternAvailablePropertyId }, + { &IsRangeValuePatternAvailable_Property_GUID, UIA_IsRangeValuePatternAvailablePropertyId }, + { &IsScrollPatternAvailable_Property_GUID, UIA_IsScrollPatternAvailablePropertyId }, + { &IsScrollItemPatternAvailable_Property_GUID, UIA_IsScrollItemPatternAvailablePropertyId }, + { &IsSelectionItemPatternAvailable_Property_GUID, UIA_IsSelectionItemPatternAvailablePropertyId }, + { &IsSelectionPatternAvailable_Property_GUID, UIA_IsSelectionPatternAvailablePropertyId }, + { &IsTablePatternAvailable_Property_GUID, UIA_IsTablePatternAvailablePropertyId }, + { &IsTableItemPatternAvailable_Property_GUID, UIA_IsTableItemPatternAvailablePropertyId }, + { &IsTextPatternAvailable_Property_GUID, UIA_IsTextPatternAvailablePropertyId }, + { &IsTogglePatternAvailable_Property_GUID, UIA_IsTogglePatternAvailablePropertyId }, + { &IsTransformPatternAvailable_Property_GUID, UIA_IsTransformPatternAvailablePropertyId }, + { &IsValuePatternAvailable_Property_GUID, UIA_IsValuePatternAvailablePropertyId }, + { &IsWindowPatternAvailable_Property_GUID, UIA_IsWindowPatternAvailablePropertyId }, + { &Value_Value_Property_GUID, UIA_ValueValuePropertyId }, + { &Value_IsReadOnly_Property_GUID, UIA_ValueIsReadOnlyPropertyId }, + { &RangeValue_Value_Property_GUID, UIA_RangeValueValuePropertyId }, + { &RangeValue_IsReadOnly_Property_GUID, UIA_RangeValueIsReadOnlyPropertyId }, + { &RangeValue_Minimum_Property_GUID, UIA_RangeValueMinimumPropertyId }, + { &RangeValue_Maximum_Property_GUID, UIA_RangeValueMaximumPropertyId }, + { &RangeValue_LargeChange_Property_GUID, UIA_RangeValueLargeChangePropertyId }, + { &RangeValue_SmallChange_Property_GUID, UIA_RangeValueSmallChangePropertyId }, + { &Scroll_HorizontalScrollPercent_Property_GUID, UIA_ScrollHorizontalScrollPercentPropertyId }, + { &Scroll_HorizontalViewSize_Property_GUID, UIA_ScrollHorizontalViewSizePropertyId }, + { &Scroll_VerticalScrollPercent_Property_GUID, UIA_ScrollVerticalScrollPercentPropertyId }, + { &Scroll_VerticalViewSize_Property_GUID, UIA_ScrollVerticalViewSizePropertyId }, + { &Scroll_HorizontallyScrollable_Property_GUID, UIA_ScrollHorizontallyScrollablePropertyId }, + { &Scroll_VerticallyScrollable_Property_GUID, UIA_ScrollVerticallyScrollablePropertyId }, + { &Selection_Selection_Property_GUID, UIA_SelectionSelectionPropertyId }, + { &Selection_CanSelectMultiple_Property_GUID, UIA_SelectionCanSelectMultiplePropertyId }, + { &Selection_IsSelectionRequired_Property_GUID, UIA_SelectionIsSelectionRequiredPropertyId }, + { &Grid_RowCount_Property_GUID, UIA_GridRowCountPropertyId }, + { &Grid_ColumnCount_Property_GUID, UIA_GridColumnCountPropertyId }, + { &GridItem_Row_Property_GUID, UIA_GridItemRowPropertyId }, + { &GridItem_Column_Property_GUID, UIA_GridItemColumnPropertyId }, + { &GridItem_RowSpan_Property_GUID, UIA_GridItemRowSpanPropertyId }, + { &GridItem_ColumnSpan_Property_GUID, UIA_GridItemColumnSpanPropertyId }, + { &GridItem_Parent_Property_GUID, UIA_GridItemContainingGridPropertyId }, + { &Dock_DockPosition_Property_GUID, UIA_DockDockPositionPropertyId }, + { &ExpandCollapse_ExpandCollapseState_Property_GUID, UIA_ExpandCollapseExpandCollapseStatePropertyId }, + { &MultipleView_CurrentView_Property_GUID, UIA_MultipleViewCurrentViewPropertyId }, + { &MultipleView_SupportedViews_Property_GUID, UIA_MultipleViewSupportedViewsPropertyId }, + { &Window_CanMaximize_Property_GUID, UIA_WindowCanMaximizePropertyId }, + { &Window_CanMinimize_Property_GUID, UIA_WindowCanMinimizePropertyId }, + { &Window_WindowVisualState_Property_GUID, UIA_WindowWindowVisualStatePropertyId }, + { &Window_WindowInteractionState_Property_GUID, UIA_WindowWindowInteractionStatePropertyId }, + { &Window_IsModal_Property_GUID, UIA_WindowIsModalPropertyId }, + { &Window_IsTopmost_Property_GUID, UIA_WindowIsTopmostPropertyId }, + { &SelectionItem_IsSelected_Property_GUID, UIA_SelectionItemIsSelectedPropertyId }, + { &SelectionItem_SelectionContainer_Property_GUID, UIA_SelectionItemSelectionContainerPropertyId }, + { &Table_RowHeaders_Property_GUID, UIA_TableRowHeadersPropertyId }, + { &Table_ColumnHeaders_Property_GUID, UIA_TableColumnHeadersPropertyId }, + { &Table_RowOrColumnMajor_Property_GUID, UIA_TableRowOrColumnMajorPropertyId }, + { &TableItem_RowHeaderItems_Property_GUID, UIA_TableItemRowHeaderItemsPropertyId }, + { &TableItem_ColumnHeaderItems_Property_GUID, UIA_TableItemColumnHeaderItemsPropertyId }, + { &Toggle_ToggleState_Property_GUID, UIA_ToggleToggleStatePropertyId }, + { &Transform_CanMove_Property_GUID, UIA_TransformCanMovePropertyId }, + { &Transform_CanResize_Property_GUID, UIA_TransformCanResizePropertyId }, + { &Transform_CanRotate_Property_GUID, UIA_TransformCanRotatePropertyId }, + { &IsLegacyIAccessiblePatternAvailable_Property_GUID, UIA_IsLegacyIAccessiblePatternAvailablePropertyId }, + { &LegacyIAccessible_ChildId_Property_GUID, UIA_LegacyIAccessibleChildIdPropertyId }, + { &LegacyIAccessible_Name_Property_GUID, UIA_LegacyIAccessibleNamePropertyId }, + { &LegacyIAccessible_Value_Property_GUID, UIA_LegacyIAccessibleValuePropertyId }, + { &LegacyIAccessible_Description_Property_GUID, UIA_LegacyIAccessibleDescriptionPropertyId }, + { &LegacyIAccessible_Role_Property_GUID, UIA_LegacyIAccessibleRolePropertyId }, + { &LegacyIAccessible_State_Property_GUID, UIA_LegacyIAccessibleStatePropertyId }, + { &LegacyIAccessible_Help_Property_GUID, UIA_LegacyIAccessibleHelpPropertyId }, + { &LegacyIAccessible_KeyboardShortcut_Property_GUID, UIA_LegacyIAccessibleKeyboardShortcutPropertyId }, + { &LegacyIAccessible_Selection_Property_GUID, UIA_LegacyIAccessibleSelectionPropertyId }, + { &LegacyIAccessible_DefaultAction_Property_GUID, UIA_LegacyIAccessibleDefaultActionPropertyId }, + { &AriaRole_Property_GUID, UIA_AriaRolePropertyId }, + { &AriaProperties_Property_GUID, UIA_AriaPropertiesPropertyId }, + { &IsDataValidForForm_Property_GUID, UIA_IsDataValidForFormPropertyId }, + { &ControllerFor_Property_GUID, UIA_ControllerForPropertyId }, + { &DescribedBy_Property_GUID, UIA_DescribedByPropertyId }, + { &FlowsTo_Property_GUID, UIA_FlowsToPropertyId }, + { &ProviderDescription_Property_GUID, UIA_ProviderDescriptionPropertyId }, + { &IsItemContainerPatternAvailable_Property_GUID, UIA_IsItemContainerPatternAvailablePropertyId }, + { &IsVirtualizedItemPatternAvailable_Property_GUID, UIA_IsVirtualizedItemPatternAvailablePropertyId }, + { &IsSynchronizedInputPatternAvailable_Property_GUID, UIA_IsSynchronizedInputPatternAvailablePropertyId }, + /* Implemented on Win8+ */ + { &OptimizeForVisualContent_Property_GUID, UIA_OptimizeForVisualContentPropertyId }, + { &IsObjectModelPatternAvailable_Property_GUID, UIA_IsObjectModelPatternAvailablePropertyId }, + { &Annotation_AnnotationTypeId_Property_GUID, UIA_AnnotationAnnotationTypeIdPropertyId }, + { &Annotation_AnnotationTypeName_Property_GUID, UIA_AnnotationAnnotationTypeNamePropertyId }, + { &Annotation_Author_Property_GUID, UIA_AnnotationAuthorPropertyId }, + { &Annotation_DateTime_Property_GUID, UIA_AnnotationDateTimePropertyId }, + { &Annotation_Target_Property_GUID, UIA_AnnotationTargetPropertyId }, + { &IsAnnotationPatternAvailable_Property_GUID, UIA_IsAnnotationPatternAvailablePropertyId }, + { &IsTextPattern2Available_Property_GUID, UIA_IsTextPattern2AvailablePropertyId }, + { &Styles_StyleId_Property_GUID, UIA_StylesStyleIdPropertyId }, + { &Styles_StyleName_Property_GUID, UIA_StylesStyleNamePropertyId }, + { &Styles_FillColor_Property_GUID, UIA_StylesFillColorPropertyId }, + { &Styles_FillPatternStyle_Property_GUID, UIA_StylesFillPatternStylePropertyId }, + { &Styles_Shape_Property_GUID, UIA_StylesShapePropertyId }, + { &Styles_FillPatternColor_Property_GUID, UIA_StylesFillPatternColorPropertyId }, + { &Styles_ExtendedProperties_Property_GUID, UIA_StylesExtendedPropertiesPropertyId }, + { &IsStylesPatternAvailable_Property_GUID, UIA_IsStylesPatternAvailablePropertyId }, + { &IsSpreadsheetPatternAvailable_Property_GUID, UIA_IsSpreadsheetPatternAvailablePropertyId }, + { &SpreadsheetItem_Formula_Property_GUID, UIA_SpreadsheetItemFormulaPropertyId }, + { &SpreadsheetItem_AnnotationObjects_Property_GUID, UIA_SpreadsheetItemAnnotationObjectsPropertyId }, + { &SpreadsheetItem_AnnotationTypes_Property_GUID, UIA_SpreadsheetItemAnnotationTypesPropertyId }, + { &IsSpreadsheetItemPatternAvailable_Property_GUID, UIA_IsSpreadsheetItemPatternAvailablePropertyId }, + { &Transform2_CanZoom_Property_GUID, UIA_Transform2CanZoomPropertyId }, + { &IsTransformPattern2Available_Property_GUID, UIA_IsTransformPattern2AvailablePropertyId }, + { &LiveSetting_Property_GUID, UIA_LiveSettingPropertyId }, + { &IsTextChildPatternAvailable_Property_GUID, UIA_IsTextChildPatternAvailablePropertyId }, + { &IsDragPatternAvailable_Property_GUID, UIA_IsDragPatternAvailablePropertyId }, + { &Drag_IsGrabbed_Property_GUID, UIA_DragIsGrabbedPropertyId }, + { &Drag_DropEffect_Property_GUID, UIA_DragDropEffectPropertyId }, + { &Drag_DropEffects_Property_GUID, UIA_DragDropEffectsPropertyId }, + { &IsDropTargetPatternAvailable_Property_GUID, UIA_IsDropTargetPatternAvailablePropertyId }, + { &DropTarget_DropTargetEffect_Property_GUID, UIA_DropTargetDropTargetEffectPropertyId }, + { &DropTarget_DropTargetEffects_Property_GUID, UIA_DropTargetDropTargetEffectsPropertyId }, + { &Drag_GrabbedItems_Property_GUID, UIA_DragGrabbedItemsPropertyId }, + { &Transform2_ZoomLevel_Property_GUID, UIA_Transform2ZoomLevelPropertyId }, + { &Transform2_ZoomMinimum_Property_GUID, UIA_Transform2ZoomMinimumPropertyId }, + { &Transform2_ZoomMaximum_Property_GUID, UIA_Transform2ZoomMaximumPropertyId }, + { &FlowsFrom_Property_GUID, UIA_FlowsFromPropertyId }, + { &IsTextEditPatternAvailable_Property_GUID, UIA_IsTextEditPatternAvailablePropertyId }, + { &IsPeripheral_Property_GUID, UIA_IsPeripheralPropertyId }, + /* Implemented on Win10v1507+. */ + { &IsCustomNavigationPatternAvailable_Property_GUID, UIA_IsCustomNavigationPatternAvailablePropertyId }, + { &PositionInSet_Property_GUID, UIA_PositionInSetPropertyId }, + { &SizeOfSet_Property_GUID, UIA_SizeOfSetPropertyId }, + { &Level_Property_GUID, UIA_LevelPropertyId }, + { &AnnotationTypes_Property_GUID, UIA_AnnotationTypesPropertyId }, + { &AnnotationObjects_Property_GUID, UIA_AnnotationObjectsPropertyId }, + /* Implemented on Win10v1809+. */ + { &LandmarkType_Property_GUID, UIA_LandmarkTypePropertyId }, + { &LocalizedLandmarkType_Property_GUID, UIA_LocalizedLandmarkTypePropertyId }, + { &FullDescription_Property_GUID, UIA_FullDescriptionPropertyId }, + { &FillColor_Property_GUID, UIA_FillColorPropertyId }, + { &OutlineColor_Property_GUID, UIA_OutlineColorPropertyId }, + { &FillType_Property_GUID, UIA_FillTypePropertyId }, + { &VisualEffects_Property_GUID, UIA_VisualEffectsPropertyId }, + { &OutlineThickness_Property_GUID, UIA_OutlineThicknessPropertyId }, + { &CenterPoint_Property_GUID, UIA_CenterPointPropertyId }, + { &Rotation_Property_GUID, UIA_RotationPropertyId }, + { &Size_Property_GUID, UIA_SizePropertyId }, + { &IsSelectionPattern2Available_Property_GUID, UIA_IsSelectionPattern2AvailablePropertyId }, + { &Selection2_FirstSelectedItem_Property_GUID, UIA_Selection2FirstSelectedItemPropertyId }, + { &Selection2_LastSelectedItem_Property_GUID, UIA_Selection2LastSelectedItemPropertyId }, + { &Selection2_CurrentSelectedItem_Property_GUID, UIA_Selection2CurrentSelectedItemPropertyId }, + { &Selection2_ItemCount_Property_GUID, UIA_Selection2ItemCountPropertyId }, + { &HeadingLevel_Property_GUID, UIA_HeadingLevelPropertyId }, + { &IsDialog_Property_GUID, UIA_IsDialogPropertyId }, +}; + +static void test_UiaLookupId(void) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(uia_property_lookup_ids); i++) + { + int prop_id = UiaLookupId(AutomationIdentifierType_Property, uia_property_lookup_ids[i].guid); + + if (!prop_id) + { + win_skip("No propertyId for GUID %s, skipping further tests.\n", debugstr_guid(uia_property_lookup_ids[i].guid)); + break; + } + + ok(prop_id == uia_property_lookup_ids[i].id, "Unexpected Property id, expected %d, got %d\n", + uia_property_lookup_ids[i].id, prop_id); + } +} + START_TEST(uiautomation) { HMODULE uia_dll = LoadLibraryA("uiautomationcore.dll");
test_UiaHostProviderFromHwnd(); test_uia_reserved_value_ifaces(); + test_UiaLookupId(); if (uia_dll) { pUiaProviderFromIAccessible = (void *)GetProcAddress(uia_dll, "UiaProviderFromIAccessible"); diff --git a/dlls/uiautomationcore/uia_ids.c b/dlls/uiautomationcore/uia_ids.c new file mode 100644 index 00000000000..b80289b3372 --- /dev/null +++ b/dlls/uiautomationcore/uia_ids.c @@ -0,0 +1,270 @@ +/* + * Copyright 2022 Connor McAdams for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include "uiautomation.h" +#include "ocidl.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(uiautomation); + +struct uia_prop_info { + const GUID *guid; + int prop_id; +}; + +static int __cdecl uia_property_guid_compare(const void *a, const void *b) +{ + const GUID *guid = a; + const struct uia_prop_info *property = b; + return memcmp(guid, property->guid, sizeof(*guid)); +} + +/* Sorted by GUID. */ +static const struct uia_prop_info default_uia_properties[] = { + { &AutomationId_Property_GUID, UIA_AutomationIdPropertyId, }, + { &FrameworkId_Property_GUID, UIA_FrameworkIdPropertyId, }, + { &IsTransformPatternAvailable_Property_GUID, UIA_IsTransformPatternAvailablePropertyId, }, + { &IsScrollItemPatternAvailable_Property_GUID, UIA_IsScrollItemPatternAvailablePropertyId, }, + { &IsExpandCollapsePatternAvailable_Property_GUID, UIA_IsExpandCollapsePatternAvailablePropertyId, }, + { &CenterPoint_Property_GUID, UIA_CenterPointPropertyId, }, + { &IsTableItemPatternAvailable_Property_GUID, UIA_IsTableItemPatternAvailablePropertyId, }, + { &Scroll_HorizontalScrollPercent_Property_GUID, UIA_ScrollHorizontalScrollPercentPropertyId, }, + { &AccessKey_Property_GUID, UIA_AccessKeyPropertyId, }, + { &RangeValue_Maximum_Property_GUID, UIA_RangeValueMaximumPropertyId, }, + { &ClassName_Property_GUID, UIA_ClassNamePropertyId, }, + { &Transform2_ZoomMinimum_Property_GUID, UIA_Transform2ZoomMinimumPropertyId, }, + { &LegacyIAccessible_Description_Property_GUID, UIA_LegacyIAccessibleDescriptionPropertyId, }, + { &Transform2_ZoomLevel_Property_GUID, UIA_Transform2ZoomLevelPropertyId, }, + { &Name_Property_GUID, UIA_NamePropertyId, }, + { &GridItem_RowSpan_Property_GUID, UIA_GridItemRowSpanPropertyId, }, + { &Size_Property_GUID, UIA_SizePropertyId, }, + { &IsTextPattern2Available_Property_GUID, UIA_IsTextPattern2AvailablePropertyId, }, + { &Styles_FillPatternStyle_Property_GUID, UIA_StylesFillPatternStylePropertyId, }, + { &FlowsTo_Property_GUID, UIA_FlowsToPropertyId, }, + { &ItemStatus_Property_GUID, UIA_ItemStatusPropertyId, }, + { &Scroll_VerticalViewSize_Property_GUID, UIA_ScrollVerticalViewSizePropertyId, }, + { &Selection_IsSelectionRequired_Property_GUID, UIA_SelectionIsSelectionRequiredPropertyId, }, + { &IsGridItemPatternAvailable_Property_GUID, UIA_IsGridItemPatternAvailablePropertyId, }, + { &Window_CanMinimize_Property_GUID, UIA_WindowCanMinimizePropertyId, }, + { &RangeValue_LargeChange_Property_GUID, UIA_RangeValueLargeChangePropertyId, }, + { &Selection2_CurrentSelectedItem_Property_GUID, UIA_Selection2CurrentSelectedItemPropertyId, }, + { &Culture_Property_GUID, UIA_CulturePropertyId, }, + { &LegacyIAccessible_DefaultAction_Property_GUID, UIA_LegacyIAccessibleDefaultActionPropertyId, }, + { &Level_Property_GUID, UIA_LevelPropertyId, }, + { &IsKeyboardFocusable_Property_GUID, UIA_IsKeyboardFocusablePropertyId, }, + { &GridItem_Row_Property_GUID, UIA_GridItemRowPropertyId, }, + { &IsSpreadsheetItemPatternAvailable_Property_GUID, UIA_IsSpreadsheetItemPatternAvailablePropertyId, }, + { &Table_ColumnHeaders_Property_GUID, UIA_TableColumnHeadersPropertyId, }, + { &Drag_GrabbedItems_Property_GUID, UIA_DragGrabbedItemsPropertyId, }, + { &Annotation_Target_Property_GUID, UIA_AnnotationTargetPropertyId, }, + { &IsSelectionItemPatternAvailable_Property_GUID, UIA_IsSelectionItemPatternAvailablePropertyId, }, + { &IsDropTargetPatternAvailable_Property_GUID, UIA_IsDropTargetPatternAvailablePropertyId, }, + { &Dock_DockPosition_Property_GUID, UIA_DockDockPositionPropertyId, }, + { &Styles_StyleId_Property_GUID, UIA_StylesStyleIdPropertyId, }, + { &Value_IsReadOnly_Property_GUID, UIA_ValueIsReadOnlyPropertyId, }, + { &IsSpreadsheetPatternAvailable_Property_GUID, UIA_IsSpreadsheetPatternAvailablePropertyId, }, + { &Styles_StyleName_Property_GUID, UIA_StylesStyleNamePropertyId, }, + { &IsAnnotationPatternAvailable_Property_GUID, UIA_IsAnnotationPatternAvailablePropertyId, }, + { &SpreadsheetItem_AnnotationObjects_Property_GUID, UIA_SpreadsheetItemAnnotationObjectsPropertyId, }, + { &IsInvokePatternAvailable_Property_GUID, UIA_IsInvokePatternAvailablePropertyId, }, + { &HasKeyboardFocus_Property_GUID, UIA_HasKeyboardFocusPropertyId, }, + { &ClickablePoint_Property_GUID, UIA_ClickablePointPropertyId, }, + { &NewNativeWindowHandle_Property_GUID, UIA_NativeWindowHandlePropertyId, }, + { &SizeOfSet_Property_GUID, UIA_SizeOfSetPropertyId, }, + { &LegacyIAccessible_Name_Property_GUID, UIA_LegacyIAccessibleNamePropertyId, }, + { &Window_CanMaximize_Property_GUID, UIA_WindowCanMaximizePropertyId, }, + { &Scroll_HorizontallyScrollable_Property_GUID, UIA_ScrollHorizontallyScrollablePropertyId, }, + { &ExpandCollapse_ExpandCollapseState_Property_GUID, UIA_ExpandCollapseExpandCollapseStatePropertyId, }, + { &Transform_CanRotate_Property_GUID, UIA_TransformCanRotatePropertyId, }, + { &IsRangeValuePatternAvailable_Property_GUID, UIA_IsRangeValuePatternAvailablePropertyId, }, + { &IsScrollPatternAvailable_Property_GUID, UIA_IsScrollPatternAvailablePropertyId, }, + { &IsTransformPattern2Available_Property_GUID, UIA_IsTransformPattern2AvailablePropertyId, }, + { &LabeledBy_Property_GUID, UIA_LabeledByPropertyId, }, + { &ItemType_Property_GUID, UIA_ItemTypePropertyId, }, + { &Transform_CanMove_Property_GUID, UIA_TransformCanMovePropertyId, }, + { &LocalizedControlType_Property_GUID, UIA_LocalizedControlTypePropertyId, }, + { &Annotation_AnnotationTypeId_Property_GUID, UIA_AnnotationAnnotationTypeIdPropertyId, }, + { &FlowsFrom_Property_GUID, UIA_FlowsFromPropertyId, }, + { &OptimizeForVisualContent_Property_GUID, UIA_OptimizeForVisualContentPropertyId, }, + { &IsVirtualizedItemPatternAvailable_Property_GUID, UIA_IsVirtualizedItemPatternAvailablePropertyId, }, + { &GridItem_Parent_Property_GUID, UIA_GridItemContainingGridPropertyId, }, + { &LegacyIAccessible_Help_Property_GUID, UIA_LegacyIAccessibleHelpPropertyId, }, + { &Toggle_ToggleState_Property_GUID, UIA_ToggleToggleStatePropertyId, }, + { &IsTogglePatternAvailable_Property_GUID, UIA_IsTogglePatternAvailablePropertyId, }, + { &LegacyIAccessible_State_Property_GUID, UIA_LegacyIAccessibleStatePropertyId, }, + { &PositionInSet_Property_GUID, UIA_PositionInSetPropertyId, }, + { &RangeValue_IsReadOnly_Property_GUID, UIA_RangeValueIsReadOnlyPropertyId, }, + { &Drag_DropEffects_Property_GUID, UIA_DragDropEffectsPropertyId, }, + { &RangeValue_SmallChange_Property_GUID, UIA_RangeValueSmallChangePropertyId, }, + { &IsTextEditPatternAvailable_Property_GUID, UIA_IsTextEditPatternAvailablePropertyId, }, + { &GridItem_Column_Property_GUID, UIA_GridItemColumnPropertyId, }, + { &LegacyIAccessible_ChildId_Property_GUID, UIA_LegacyIAccessibleChildIdPropertyId, }, + { &Annotation_DateTime_Property_GUID, UIA_AnnotationDateTimePropertyId, }, + { &IsTablePatternAvailable_Property_GUID, UIA_IsTablePatternAvailablePropertyId, }, + { &SelectionItem_IsSelected_Property_GUID, UIA_SelectionItemIsSelectedPropertyId, }, + { &Window_WindowVisualState_Property_GUID, UIA_WindowWindowVisualStatePropertyId, }, + { &IsOffscreen_Property_GUID, UIA_IsOffscreenPropertyId, }, + { &Annotation_Author_Property_GUID, UIA_AnnotationAuthorPropertyId, }, + { &Orientation_Property_GUID, UIA_OrientationPropertyId, }, + { &Value_Value_Property_GUID, UIA_ValueValuePropertyId, }, + { &VisualEffects_Property_GUID, UIA_VisualEffectsPropertyId, }, + { &Selection2_FirstSelectedItem_Property_GUID, UIA_Selection2FirstSelectedItemPropertyId, }, + { &IsGridPatternAvailable_Property_GUID, UIA_IsGridPatternAvailablePropertyId, }, + { &SelectionItem_SelectionContainer_Property_GUID, UIA_SelectionItemSelectionContainerPropertyId, }, + { &HeadingLevel_Property_GUID, UIA_HeadingLevelPropertyId, }, + { &DropTarget_DropTargetEffect_Property_GUID, UIA_DropTargetDropTargetEffectPropertyId, }, + { &Grid_ColumnCount_Property_GUID, UIA_GridColumnCountPropertyId, }, + { &AnnotationTypes_Property_GUID, UIA_AnnotationTypesPropertyId, }, + { &IsPeripheral_Property_GUID, UIA_IsPeripheralPropertyId, }, + { &Transform2_ZoomMaximum_Property_GUID, UIA_Transform2ZoomMaximumPropertyId, }, + { &Drag_DropEffect_Property_GUID, UIA_DragDropEffectPropertyId, }, + { &MultipleView_CurrentView_Property_GUID, UIA_MultipleViewCurrentViewPropertyId, }, + { &Styles_FillColor_Property_GUID, UIA_StylesFillColorPropertyId, }, + { &Rotation_Property_GUID, UIA_RotationPropertyId, }, + { &SpreadsheetItem_Formula_Property_GUID, UIA_SpreadsheetItemFormulaPropertyId, }, + { &IsEnabled_Property_GUID, UIA_IsEnabledPropertyId, }, + { &LocalizedLandmarkType_Property_GUID, UIA_LocalizedLandmarkTypePropertyId, }, + { &IsDataValidForForm_Property_GUID, UIA_IsDataValidForFormPropertyId, }, + { &IsControlElement_Property_GUID, UIA_IsControlElementPropertyId, }, + { &HelpText_Property_GUID, UIA_HelpTextPropertyId, }, + { &Table_RowHeaders_Property_GUID, UIA_TableRowHeadersPropertyId, }, + { &ControllerFor_Property_GUID, UIA_ControllerForPropertyId, }, + { &ProviderDescription_Property_GUID, UIA_ProviderDescriptionPropertyId, }, + { &AriaProperties_Property_GUID, UIA_AriaPropertiesPropertyId, }, + { &LiveSetting_Property_GUID, UIA_LiveSettingPropertyId, }, + { &Selection2_LastSelectedItem_Property_GUID, UIA_Selection2LastSelectedItemPropertyId, }, + { &Transform2_CanZoom_Property_GUID, UIA_Transform2CanZoomPropertyId, }, + { &Window_IsModal_Property_GUID, UIA_WindowIsModalPropertyId, }, + { &Annotation_AnnotationTypeName_Property_GUID, UIA_AnnotationAnnotationTypeNamePropertyId, }, + { &AriaRole_Property_GUID, UIA_AriaRolePropertyId, }, + { &Scroll_VerticallyScrollable_Property_GUID, UIA_ScrollVerticallyScrollablePropertyId, }, + { &RangeValue_Value_Property_GUID, UIA_RangeValueValuePropertyId, }, + { &ProcessId_Property_GUID, UIA_ProcessIdPropertyId, }, + { &Scroll_VerticalScrollPercent_Property_GUID, UIA_ScrollVerticalScrollPercentPropertyId, }, + { &IsObjectModelPatternAvailable_Property_GUID, UIA_IsObjectModelPatternAvailablePropertyId, }, + { &IsDialog_Property_GUID, UIA_IsDialogPropertyId, }, + { &IsTextPatternAvailable_Property_GUID, UIA_IsTextPatternAvailablePropertyId, }, + { &LegacyIAccessible_Role_Property_GUID, UIA_LegacyIAccessibleRolePropertyId, }, + { &Selection2_ItemCount_Property_GUID, UIA_Selection2ItemCountPropertyId, }, + { &TableItem_RowHeaderItems_Property_GUID, UIA_TableItemRowHeaderItemsPropertyId, }, + { &Styles_ExtendedProperties_Property_GUID, UIA_StylesExtendedPropertiesPropertyId, }, + { &Selection_Selection_Property_GUID, UIA_SelectionSelectionPropertyId, }, + { &TableItem_ColumnHeaderItems_Property_GUID, UIA_TableItemColumnHeaderItemsPropertyId, }, + { &Window_WindowInteractionState_Property_GUID, UIA_WindowWindowInteractionStatePropertyId, }, + { &Selection_CanSelectMultiple_Property_GUID, UIA_SelectionCanSelectMultiplePropertyId, }, + { &Transform_CanResize_Property_GUID, UIA_TransformCanResizePropertyId, }, + { &IsValuePatternAvailable_Property_GUID, UIA_IsValuePatternAvailablePropertyId, }, + { &IsItemContainerPatternAvailable_Property_GUID, UIA_IsItemContainerPatternAvailablePropertyId, }, + { &IsContentElement_Property_GUID, UIA_IsContentElementPropertyId, }, + { &LegacyIAccessible_KeyboardShortcut_Property_GUID, UIA_LegacyIAccessibleKeyboardShortcutPropertyId, }, + { &IsPassword_Property_GUID, UIA_IsPasswordPropertyId, }, + { &IsWindowPatternAvailable_Property_GUID, UIA_IsWindowPatternAvailablePropertyId, }, + { &RangeValue_Minimum_Property_GUID, UIA_RangeValueMinimumPropertyId, }, + { &BoundingRectangle_Property_GUID, UIA_BoundingRectanglePropertyId, }, + { &LegacyIAccessible_Value_Property_GUID, UIA_LegacyIAccessibleValuePropertyId, }, + { &IsDragPatternAvailable_Property_GUID, UIA_IsDragPatternAvailablePropertyId, }, + { &DescribedBy_Property_GUID, UIA_DescribedByPropertyId, }, + { &IsSelectionPatternAvailable_Property_GUID, UIA_IsSelectionPatternAvailablePropertyId, }, + { &Grid_RowCount_Property_GUID, UIA_GridRowCountPropertyId, }, + { &OutlineColor_Property_GUID, UIA_OutlineColorPropertyId, }, + { &Table_RowOrColumnMajor_Property_GUID, UIA_TableRowOrColumnMajorPropertyId, }, + { &IsDockPatternAvailable_Property_GUID, UIA_IsDockPatternAvailablePropertyId, }, + { &IsSynchronizedInputPatternAvailable_Property_GUID,UIA_IsSynchronizedInputPatternAvailablePropertyId, }, + { &OutlineThickness_Property_GUID, UIA_OutlineThicknessPropertyId, }, + { &IsLegacyIAccessiblePatternAvailable_Property_GUID,UIA_IsLegacyIAccessiblePatternAvailablePropertyId, }, + { &AnnotationObjects_Property_GUID, UIA_AnnotationObjectsPropertyId, }, + { &IsRequiredForForm_Property_GUID, UIA_IsRequiredForFormPropertyId, }, + { &SpreadsheetItem_AnnotationTypes_Property_GUID, UIA_SpreadsheetItemAnnotationTypesPropertyId, }, + { &FillColor_Property_GUID, UIA_FillColorPropertyId, }, + { &IsStylesPatternAvailable_Property_GUID, UIA_IsStylesPatternAvailablePropertyId, }, + { &Window_IsTopmost_Property_GUID, UIA_WindowIsTopmostPropertyId, }, + { &IsCustomNavigationPatternAvailable_Property_GUID, UIA_IsCustomNavigationPatternAvailablePropertyId, }, + { &Scroll_HorizontalViewSize_Property_GUID, UIA_ScrollHorizontalViewSizePropertyId, }, + { &AcceleratorKey_Property_GUID, UIA_AcceleratorKeyPropertyId, }, + { &IsTextChildPatternAvailable_Property_GUID, UIA_IsTextChildPatternAvailablePropertyId, }, + { &LegacyIAccessible_Selection_Property_GUID, UIA_LegacyIAccessibleSelectionPropertyId, }, + { &FillType_Property_GUID, UIA_FillTypePropertyId, }, + { &ControlType_Property_GUID, UIA_ControlTypePropertyId, }, + { &IsMultipleViewPatternAvailable_Property_GUID, UIA_IsMultipleViewPatternAvailablePropertyId, }, + { &DropTarget_DropTargetEffects_Property_GUID, UIA_DropTargetDropTargetEffectsPropertyId, }, + { &LandmarkType_Property_GUID, UIA_LandmarkTypePropertyId, }, + { &Drag_IsGrabbed_Property_GUID, UIA_DragIsGrabbedPropertyId, }, + { &GridItem_ColumnSpan_Property_GUID, UIA_GridItemColumnSpanPropertyId, }, + { &Styles_Shape_Property_GUID, UIA_StylesShapePropertyId, }, + { &RuntimeId_Property_GUID, UIA_RuntimeIdPropertyId, }, + { &IsSelectionPattern2Available_Property_GUID, UIA_IsSelectionPattern2AvailablePropertyId, }, + { &MultipleView_SupportedViews_Property_GUID, UIA_MultipleViewSupportedViewsPropertyId, }, + { &Styles_FillPatternColor_Property_GUID, UIA_StylesFillPatternColorPropertyId, }, + { &FullDescription_Property_GUID, UIA_FullDescriptionPropertyId, }, +}; + +static const struct uia_prop_info *uia_prop_info_from_guid(const GUID *guid) +{ + struct uia_prop_info *prop; + + if ((prop = bsearch(guid, default_uia_properties, ARRAY_SIZE(default_uia_properties), sizeof(*prop), + uia_property_guid_compare))) + return prop; + + return NULL; +} + +/*********************************************************************** + * UiaLookupId (uiautomationcore.@) + */ +int WINAPI UiaLookupId(enum AutomationIdentifierType type, const GUID *guid) +{ + int ret_id = 0; + + TRACE("(%d, %s)\n", type, debugstr_guid(guid)); + + switch (type) + { + case AutomationIdentifierType_Property: + { + const struct uia_prop_info *prop = uia_prop_info_from_guid(guid); + + if (prop) + ret_id = prop->prop_id; + else + FIXME("Failed to find propertyId for GUID %s\n", debugstr_guid(guid)); + + break; + } + + case AutomationIdentifierType_Pattern: + case AutomationIdentifierType_Event: + case AutomationIdentifierType_ControlType: + case AutomationIdentifierType_TextAttribute: + case AutomationIdentifierType_LandmarkType: + case AutomationIdentifierType_Annotation: + case AutomationIdentifierType_Changes: + case AutomationIdentifierType_Style: + FIXME("Unimplemented AutomationIdentifierType %d\n", type); + break; + + default: + FIXME("Invalid AutomationIdentifierType %d\n", type); + break; + } + + return ret_id; +} diff --git a/dlls/uiautomationcore/uia_main.c b/dlls/uiautomationcore/uia_main.c index 9f257684333..63e1079582a 100644 --- a/dlls/uiautomationcore/uia_main.c +++ b/dlls/uiautomationcore/uia_main.c @@ -297,15 +297,6 @@ HRESULT WINAPI UiaGetReservedNotSupportedValue(IUnknown **value) return S_OK; }
-/*********************************************************************** - * UiaLookupId (uiautomationcore.@) - */ -int WINAPI UiaLookupId(enum AutomationIdentifierType type, const GUID *guid) -{ - FIXME("(%d, %s) stub!\n", type, debugstr_guid(guid)); - return 1; -} - /*********************************************************************** * UiaReturnRawElementProvider (uiautomationcore.@) */
From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/uiautomationcore/uia_main.c | 9 +++++++++ dlls/uiautomationcore/uiautomationcore.spec | 2 +- include/uiautomationcoreapi.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/uiautomationcore/uia_main.c b/dlls/uiautomationcore/uia_main.c index 63e1079582a..c74d3edbf07 100644 --- a/dlls/uiautomationcore/uia_main.c +++ b/dlls/uiautomationcore/uia_main.c @@ -359,3 +359,12 @@ HRESULT WINAPI UiaDisconnectProvider(IRawElementProviderSimple *provider) FIXME("(%p): stub\n", provider); return E_NOTIMPL; } + +/*********************************************************************** + * UiaGetPropertyValue (uiautomationcore.@) + */ +HRESULT WINAPI UiaGetPropertyValue(HUIANODE huianode, PROPERTYID prop_id, VARIANT *out_val) +{ + FIXME("(%p, %d, %p): stub\n", huianode, prop_id, out_val); + return E_NOTIMPL; +} diff --git a/dlls/uiautomationcore/uiautomationcore.spec b/dlls/uiautomationcore/uiautomationcore.spec index 70d78d52085..ed3453a2f68 100644 --- a/dlls/uiautomationcore/uiautomationcore.spec +++ b/dlls/uiautomationcore/uiautomationcore.spec @@ -62,7 +62,7 @@ @ stub UiaFind @ stub UiaGetErrorDescription @ stub UiaGetPatternProvider -@ stub UiaGetPropertyValue +@ stdcall UiaGetPropertyValue(ptr long ptr) @ stdcall UiaGetReservedMixedAttributeValue(ptr) @ stdcall UiaGetReservedNotSupportedValue(ptr) @ stub UiaGetRootNode diff --git a/include/uiautomationcoreapi.h b/include/uiautomationcoreapi.h index c68419caaa1..6cb5b5c37f5 100644 --- a/include/uiautomationcoreapi.h +++ b/include/uiautomationcoreapi.h @@ -255,6 +255,7 @@ LRESULT WINAPI UiaReturnRawElementProvider(HWND hwnd, WPARAM wParam, LPARAM lPar BOOL WINAPI UiaTextRangeRelease(HUIATEXTRANGE hobj); HRESULT WINAPI UiaHostProviderFromHwnd(HWND hwnd, IRawElementProviderSimple **elprov); HRESULT WINAPI UiaProviderFromIAccessible(IAccessible *acc, long child_id, DWORD flags, IRawElementProviderSimple **elprov); +HRESULT WINAPI UiaGetPropertyValue(HUIANODE huianode, PROPERTYID prop_id, VARIANT *out_val);
#ifdef __cplusplus }
From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/uiautomationcore/Makefile.in | 5 +- dlls/uiautomationcore/tests/uiautomation.c | 886 ++++++++++++++++++++ dlls/uiautomationcore/uia_classes.idl | 28 + dlls/uiautomationcore/uia_client.c | 126 +++ dlls/uiautomationcore/uiautomationcore.spec | 2 +- include/uiautomationcoreapi.h | 1 + 6 files changed, 1046 insertions(+), 2 deletions(-) create mode 100644 dlls/uiautomationcore/uia_classes.idl create mode 100644 dlls/uiautomationcore/uia_client.c
diff --git a/dlls/uiautomationcore/Makefile.in b/dlls/uiautomationcore/Makefile.in index eedf7fb3be6..228c5e7f318 100644 --- a/dlls/uiautomationcore/Makefile.in +++ b/dlls/uiautomationcore/Makefile.in @@ -7,4 +7,7 @@ EXTRADLLFLAGS = -Wb,--prefer-native C_SRCS = \ uia_main.c \ uia_provider.c \ - uia_ids.c + uia_ids.c \ + uia_client.c + +IDL_SRCS = uia_classes.idl diff --git a/dlls/uiautomationcore/tests/uiautomation.c b/dlls/uiautomationcore/tests/uiautomation.c index a4511c72c44..35b7e738bd4 100644 --- a/dlls/uiautomationcore/tests/uiautomation.c +++ b/dlls/uiautomationcore/tests/uiautomation.c @@ -66,6 +66,7 @@ static HRESULT (WINAPI *pUiaProviderFromIAccessible)(IAccessible *, long, DWORD, #define NAVDIR_INTERNAL_HWND 10
DEFINE_EXPECT(winproc_GETOBJECT_CLIENT); +DEFINE_EXPECT(winproc_GETOBJECT_UiaRoot); DEFINE_EXPECT(Accessible_accNavigate); DEFINE_EXPECT(Accessible_get_accParent); DEFINE_EXPECT(Accessible_get_accChildCount); @@ -1089,7 +1090,504 @@ static struct Accessible Accessible_child2 = FALSE, 0, };
+static struct Provider +{ + IRawElementProviderSimple IRawElementProviderSimple_iface; + IRawElementProviderFragment IRawElementProviderFragment_iface; + LONG ref; + + const char *prov_name; + IRawElementProviderFragment *parent; + enum ProviderOptions prov_opts; + HWND hwnd; +} Provider, Provider2, Provider_child; + +enum { + PROV_GET_PROVIDER_OPTIONS, + PROV_GET_PROPERTY_VALUE, + PROV_GET_HOST_RAW_ELEMENT_PROVIDER, + FRAG_NAVIGATE, +}; + +static const char *prov_method_str[] = { + "get_ProviderOptions", + "GetPropertyValue", + "get_HostRawElementProvider", + "Navigate", +}; + +static const char *get_prov_method_str(int method) +{ + if (method >= ARRAY_SIZE(prov_method_str)) + return NULL; + else + return prov_method_str[method]; +} + +enum { + METHOD_OPTIONAL = 0x01, + METHOD_TODO = 0x02, +}; + +struct prov_method_sequence { + struct Provider *prov; + int method; + int flags; +}; + +static int sequence_cnt, sequence_size; +static struct prov_method_sequence *sequence; + +static void flush_method_sequence(void) +{ + HeapFree(GetProcessHeap(), 0, sequence); + sequence = NULL; + sequence_cnt = sequence_size = 0; +} + +static void add_method_call(struct Provider *prov, int method) +{ + struct prov_method_sequence prov_method = {0}; + + if (!sequence) + { + sequence_size = 10; + sequence = HeapAlloc(GetProcessHeap(), 0, sequence_size * sizeof(*sequence)); + } + if (sequence_cnt == sequence_size) + { + sequence_size *= 2; + sequence = HeapReAlloc(GetProcessHeap(), 0, sequence, sequence_size * sizeof(*sequence)); + } + + prov_method.prov = prov; + prov_method.method = method; + prov_method.flags = 0; + sequence[sequence_cnt++] = prov_method; +} + +#define ok_method_sequence( exp, context ) \ + ok_method_sequence_( (exp), (context), __FILE__, __LINE__) +static void ok_method_sequence_(const struct prov_method_sequence *expected_list, const char *context, + const char *file, int line) +{ + const struct prov_method_sequence *expected = expected_list; + const struct prov_method_sequence *actual; + unsigned int count = 0; + + add_method_call(NULL, 0); + actual = sequence; + + if (context) + winetest_push_context("%s", context); + + while (expected->prov && actual->prov) + { + if (expected->prov == actual->prov && expected->method == actual->method) + { + if (expected->flags & METHOD_TODO) + todo_wine ok_(file, line)(1, "%d: expected %s_%s, got %s_%s\n", count, expected->prov->prov_name, + get_prov_method_str(expected->method), actual->prov->prov_name, get_prov_method_str(actual->method)); + expected++; + actual++; + } + else if (expected->flags & METHOD_TODO) + { + todo_wine ok_(file, line)(0, "%d: expected %s_%s, got %s_%s\n", count, expected->prov->prov_name, + get_prov_method_str(expected->method), actual->prov->prov_name, get_prov_method_str(actual->method)); + expected++; + } + else if (expected->flags & METHOD_OPTIONAL) + expected++; + else + { + ok_(file, line)(0, "%d: expected %s_%s, got %s_%s\n", count, expected->prov->prov_name, + get_prov_method_str(expected->method), actual->prov->prov_name, get_prov_method_str(actual->method)); + expected++; + actual++; + } + count++; + } + + /* Handle trailing optional/todo_wine methods. */ + while (expected->prov && ((expected->flags & METHOD_OPTIONAL) || + ((expected->flags & METHOD_TODO) && !strcmp(winetest_platform, "wine")))) + { + if (expected->flags & METHOD_TODO) + todo_wine ok_(file, line)(0, "%d: expected %s_%s\n", count, expected->prov->prov_name, + get_prov_method_str(expected->method)); + count++; + expected++; + } + + if (expected->prov || actual->prov) + { + if (expected->prov) + ok_( file, line)(0, "incomplete sequence: expected %s_%s, got nothing\n", expected->prov->prov_name, + get_prov_method_str(expected->method)); + else + ok_( file, line)(0, "incomplete sequence: expected nothing, got %s_%s\n", actual->prov->prov_name, + get_prov_method_str(actual->method)); + } + + if (context) + winetest_pop_context(); + + flush_method_sequence(); +} + +/* + * Parsing the string returned by UIA_ProviderDescriptionPropertyId is + * the only way to know what an HUIANODE represents internally. It + * returns a formatted string which always starts with: + * "[pid:<process-id>,providerId:0x<hwnd-ptr> " + * On Windows versions 10v1507 and below, "providerId:" is "hwnd:" + * + * This is followed by strings for each provider it represents. These are + * formatted as: + * "<prov-type>:<prov-desc> (<origin>)" + * and are terminated with ";", the final provider has no ";" terminator, + * instead it has "]". + * + * If the given provider is the one used for navigation towards a parent, it has + * "(parent link)" as a suffix on "<prov-type>". + * + * <prov-type> is one of "Annotation", "Main", "Override", "Hwnd", or + * "Nonclient". + * + * <prov-desc> is the string returned from calling GetPropertyValue on the + * IRawElementProviderSimple being represented with a property ID of + * UIA_ProviderDescriptionPropertyId. + * + * <origin> is the name of the module that the + * IRawElementProviderSimple comes from. For unmanaged code, it's: + * "unmanaged:<executable>" + * and for managed code, it's: + * "managed:<assembly-qualified-name>" + * + * An example: + * [pid:1500,providerId:0x2F054C Main:Provider (unmanaged:uiautomation_test.exe); Hwnd(parent link):HWND Proxy (unmanaged:uiautomationcore.dll)] + */ +static BOOL get_provider_desc(BSTR prov_desc, const WCHAR *prov_type, WCHAR *out_name) +{ + const WCHAR *str, *str2; + + str = wcsstr(prov_desc, prov_type); + if (!str) + return FALSE; + + if (!out_name) + return TRUE; + + str += wcslen(prov_type); + str2 = wcschr(str, L'('); + lstrcpynW(out_name, str, ((str2 - str))); + + return TRUE; +} + +#define check_node_provider_desc( prov_desc, prov_type, prov_name, parent_link ) \ + check_node_provider_desc_( (prov_desc), (prov_type), (prov_name), (parent_link), __FILE__, __LINE__) +static void check_node_provider_desc_(BSTR prov_desc, const WCHAR *prov_type, const WCHAR *prov_name, + BOOL parent_link, const char *file, int line) +{ + WCHAR buf[2048]; + + if (parent_link) + wsprintfW(buf, L"%s(parent link):", prov_type); + else + wsprintfW(buf, L"%s:", prov_type); + + if (!get_provider_desc(prov_desc, buf, buf)) + { + if (parent_link) + wsprintfW(buf, L"%s:", prov_type); + else + wsprintfW(buf, L"%s(parent link):", prov_type); + + if (!get_provider_desc(prov_desc, buf, buf)) + { + ok_(file, line)(0, "failed to get provider string for %s\n", debugstr_w(prov_type)); + return; + } + else + { + if (parent_link) + ok_(file, line)(0, "expected parent link provider %s\n", debugstr_w(prov_type)); + else + ok_(file, line)(0, "unexpected parent link provider %s\n", debugstr_w(prov_type)); + } + } + + if (prov_name) + ok_(file, line)(!wcscmp(prov_name, buf), "unexpected provider name %s\n", debugstr_w(buf)); +} + +#define check_node_provider_desc_prefix( prov_desc, pid, prov_id ) \ + check_node_provider_desc_prefix_( (prov_desc), (pid), (prov_id), __FILE__, __LINE__) +static void check_node_provider_desc_prefix_(BSTR prov_desc, DWORD pid, HWND prov_id, const char *file, int line) +{ + const WCHAR *str, *str2; + WCHAR buf[128]; + DWORD prov_pid; + HWND prov_hwnd; + WCHAR *end; + + str = wcsstr(prov_desc, L"pid:"); + str += wcslen(L"pid:"); + str2 = wcschr(str, L','); + lstrcpynW(buf, str, (str2 - str) + 1); + prov_pid = wcstoul(buf, &end, 10); + ok_(file, line)(prov_pid == pid, "Unexpected pid %lu\n", prov_pid); + + str = wcsstr(prov_desc, L"providerId:"); + if (str) + str += wcslen(L"providerId:"); + else + { + str = wcsstr(prov_desc, L"hwnd:"); + str += wcslen(L"hwnd:"); + } + str2 = wcschr(str, L' '); + lstrcpynW(buf, str, (str2 - str) + 1); + prov_hwnd = ULongToHandle(wcstoul(buf, &end, 16)); + ok_(file, line)(prov_hwnd == prov_id, "Unexpected hwnd %p\n", prov_hwnd); +} + +static inline struct Provider *impl_from_ProviderSimple(IRawElementProviderSimple *iface) +{ + return CONTAINING_RECORD(iface, struct Provider, IRawElementProviderSimple_iface); +} + +HRESULT WINAPI ProviderSimple_QueryInterface(IRawElementProviderSimple *iface, REFIID riid, void **ppv) +{ + struct Provider *This = impl_from_ProviderSimple(iface); + + *ppv = NULL; + if (IsEqualIID(riid, &IID_IRawElementProviderSimple) || IsEqualIID(riid, &IID_IUnknown)) + *ppv = iface; + else if (IsEqualIID(riid, &IID_IRawElementProviderFragment)) + *ppv = &This->IRawElementProviderFragment_iface; + else + return E_NOINTERFACE; + + IRawElementProviderSimple_AddRef(iface); + return S_OK; +} + +ULONG WINAPI ProviderSimple_AddRef(IRawElementProviderSimple *iface) +{ + struct Provider *This = impl_from_ProviderSimple(iface); + return InterlockedIncrement(&This->ref); +} + +ULONG WINAPI ProviderSimple_Release(IRawElementProviderSimple *iface) +{ + struct Provider *This = impl_from_ProviderSimple(iface); + return InterlockedDecrement(&This->ref); +} + +HRESULT WINAPI ProviderSimple_get_ProviderOptions(IRawElementProviderSimple *iface, + enum ProviderOptions *ret_val) +{ + struct Provider *This = impl_from_ProviderSimple(iface); + + add_method_call(This, PROV_GET_PROVIDER_OPTIONS); + + *ret_val = 0; + if (This->prov_opts) + { + *ret_val = This->prov_opts; + return S_OK; + } + + return E_NOTIMPL; +} + +HRESULT WINAPI ProviderSimple_GetPatternProvider(IRawElementProviderSimple *iface, + PATTERNID pattern_id, IUnknown **ret_val) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +HRESULT WINAPI ProviderSimple_GetPropertyValue(IRawElementProviderSimple *iface, + PROPERTYID prop_id, VARIANT *ret_val) +{ + struct Provider *This = impl_from_ProviderSimple(iface); + + add_method_call(This, PROV_GET_PROPERTY_VALUE); + + VariantInit(ret_val); + switch (prop_id) + { + case UIA_NativeWindowHandlePropertyId: + V_VT(ret_val) = VT_I4; + V_I4(ret_val) = HandleToULong(This->hwnd); + break; + + case UIA_ProviderDescriptionPropertyId: + { + WCHAR buf[1024] = {}; + + mbstowcs(buf, This->prov_name, strlen(This->prov_name)); + V_VT(ret_val) = VT_BSTR; + V_BSTR(ret_val) = SysAllocString(buf); + break; + } + + default: + break; + } + + return S_OK; +} + +HRESULT WINAPI ProviderSimple_get_HostRawElementProvider(IRawElementProviderSimple *iface, + IRawElementProviderSimple **ret_val) +{ + struct Provider *This = impl_from_ProviderSimple(iface); + + add_method_call(This, PROV_GET_HOST_RAW_ELEMENT_PROVIDER); + + *ret_val = NULL; + if (This->hwnd) + return UiaHostProviderFromHwnd(This->hwnd, ret_val); + + return S_OK; +} + +IRawElementProviderSimpleVtbl ProviderSimpleVtbl = { + ProviderSimple_QueryInterface, + ProviderSimple_AddRef, + ProviderSimple_Release, + ProviderSimple_get_ProviderOptions, + ProviderSimple_GetPatternProvider, + ProviderSimple_GetPropertyValue, + ProviderSimple_get_HostRawElementProvider, +}; + +static inline struct Provider *impl_from_ProviderFragment(IRawElementProviderFragment *iface) +{ + return CONTAINING_RECORD(iface, struct Provider, IRawElementProviderFragment_iface); +} + +static HRESULT WINAPI ProviderFragment_QueryInterface(IRawElementProviderFragment *iface, REFIID riid, + void **ppv) +{ + struct Provider *Provider = impl_from_ProviderFragment(iface); + return IRawElementProviderSimple_QueryInterface(&Provider->IRawElementProviderSimple_iface, riid, ppv); +} + +static ULONG WINAPI ProviderFragment_AddRef(IRawElementProviderFragment *iface) +{ + struct Provider *Provider = impl_from_ProviderFragment(iface); + return IRawElementProviderSimple_AddRef(&Provider->IRawElementProviderSimple_iface); +} + +static ULONG WINAPI ProviderFragment_Release(IRawElementProviderFragment *iface) +{ + struct Provider *Provider = impl_from_ProviderFragment(iface); + return IRawElementProviderSimple_Release(&Provider->IRawElementProviderSimple_iface); +} + +static HRESULT WINAPI ProviderFragment_Navigate(IRawElementProviderFragment *iface, + enum NavigateDirection direction, IRawElementProviderFragment **ret_val) +{ + struct Provider *This = impl_from_ProviderFragment(iface); + + add_method_call(This, FRAG_NAVIGATE); + + *ret_val = NULL; + if ((direction == NavigateDirection_Parent) && This->parent) + { + *ret_val = This->parent; + IRawElementProviderFragment_AddRef(This->parent); + } + return S_OK; +} + +static HRESULT WINAPI ProviderFragment_GetRuntimeId(IRawElementProviderFragment *iface, + SAFEARRAY **ret_val) +{ + ok(0, "unexpected call\n"); + *ret_val = NULL; + return E_NOTIMPL; +} + +static HRESULT WINAPI ProviderFragment_get_BoundingRectangle(IRawElementProviderFragment *iface, + struct UiaRect *ret_val) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI ProviderFragment_GetEmbeddedFragmentRoots(IRawElementProviderFragment *iface, + SAFEARRAY **ret_val) +{ + ok(0, "unexpected call\n"); + *ret_val = NULL; + return E_NOTIMPL; +} + +static HRESULT WINAPI ProviderFragment_SetFocus(IRawElementProviderFragment *iface) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI ProviderFragment_get_FragmentRoot(IRawElementProviderFragment *iface, + IRawElementProviderFragmentRoot **ret_val) +{ + ok(0, "unexpected call\n"); + *ret_val = NULL; + return E_NOTIMPL; +} + +static const IRawElementProviderFragmentVtbl ProviderFragmentVtbl = { + ProviderFragment_QueryInterface, + ProviderFragment_AddRef, + ProviderFragment_Release, + ProviderFragment_Navigate, + ProviderFragment_GetRuntimeId, + ProviderFragment_get_BoundingRectangle, + ProviderFragment_GetEmbeddedFragmentRoots, + ProviderFragment_SetFocus, + ProviderFragment_get_FragmentRoot, +}; + +static struct Provider Provider = +{ + { &ProviderSimpleVtbl }, + { &ProviderFragmentVtbl }, + 1, + "Provider", + NULL, + 0, 0, +}; + +static struct Provider Provider2 = +{ + { &ProviderSimpleVtbl }, + { &ProviderFragmentVtbl }, + 1, + "Provider2", + NULL, + 0, 0, +}; + +static struct Provider Provider_child = +{ + { &ProviderSimpleVtbl }, + { &ProviderFragmentVtbl }, + 1, + "Provider_child", + &Provider.IRawElementProviderFragment_iface, + 0, 0, +}; + static IAccessible *acc_client; +static IRawElementProviderSimple *prov_root; static LRESULT WINAPI test_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) @@ -1103,6 +1601,14 @@ static LRESULT WINAPI test_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPAR
break; } + else if (lParam == UiaRootObjectId) + { + CHECK_EXPECT(winproc_GETOBJECT_UiaRoot); + if (prov_root) + return UiaReturnRawElementProvider(hwnd, wParam, lParam, prov_root); + + break; + }
break;
@@ -2908,6 +3414,385 @@ static void test_UiaLookupId(void) } }
+static const struct prov_method_sequence node_from_prov1[] = { + { &Provider, PROV_GET_PROVIDER_OPTIONS }, + { 0 } +}; + +static const struct prov_method_sequence node_from_prov2[] = { + { &Provider, PROV_GET_PROVIDER_OPTIONS }, + /* Win10v1507 and below call this. */ + { &Provider, PROV_GET_PROPERTY_VALUE, METHOD_OPTIONAL }, /* UIA_NativeWindowHandlePropertyId */ + { &Provider, PROV_GET_HOST_RAW_ELEMENT_PROVIDER, METHOD_TODO }, + { &Provider, PROV_GET_PROPERTY_VALUE, METHOD_TODO }, /* UIA_NativeWindowHandlePropertyId */ + { &Provider, FRAG_NAVIGATE, METHOD_TODO }, /* NavigateDirection_Parent */ + /* Only called on Windows versions past Win10v1507. */ + { &Provider, PROV_GET_PROVIDER_OPTIONS, METHOD_OPTIONAL }, + { &Provider, PROV_GET_PROPERTY_VALUE, METHOD_TODO }, /* UIA_ProviderDescriptionPropertyId */ + { 0 } +}; + +static const struct prov_method_sequence node_from_prov3[] = { + { &Provider_child, PROV_GET_PROVIDER_OPTIONS }, + /* Win10v1507 and below call this. */ + { &Provider_child, PROV_GET_PROPERTY_VALUE, METHOD_OPTIONAL }, /* UIA_NativeWindowHandlePropertyId */ + { &Provider_child, PROV_GET_HOST_RAW_ELEMENT_PROVIDER, METHOD_TODO }, + { &Provider_child, PROV_GET_PROPERTY_VALUE, METHOD_TODO }, /* UIA_NativeWindowHandlePropertyId */ + { &Provider_child, FRAG_NAVIGATE, METHOD_TODO }, /* NavigateDirection_Parent */ + /* Only called on Windows versions past Win10v1507. */ + { &Provider_child, PROV_GET_PROVIDER_OPTIONS, METHOD_OPTIONAL }, + { &Provider_child, PROV_GET_PROPERTY_VALUE, METHOD_TODO }, /* UIA_ProviderDescriptionPropertyId */ + { 0 } +}; + +static const struct prov_method_sequence node_from_prov4[] = { + { &Provider, PROV_GET_PROVIDER_OPTIONS }, + /* Win10v1507 and below call this. */ + { &Provider, PROV_GET_PROPERTY_VALUE, METHOD_OPTIONAL }, /* UIA_NativeWindowHandlePropertyId */ + { &Provider, PROV_GET_HOST_RAW_ELEMENT_PROVIDER, METHOD_TODO }, + { &Provider, FRAG_NAVIGATE, METHOD_TODO }, /* NavigateDirection_Parent */ + /* Only called on Windows versions past Win10v1507. */ + { &Provider, PROV_GET_PROVIDER_OPTIONS, METHOD_OPTIONAL }, + { &Provider, PROV_GET_PROPERTY_VALUE, METHOD_TODO }, /* UIA_ProviderDescriptionPropertyId */ + { 0 } +}; + +static const struct prov_method_sequence node_from_prov5[] = { + { &Provider, PROV_GET_PROVIDER_OPTIONS }, + /* Win10v1507 and below call this. */ + { &Provider, PROV_GET_PROPERTY_VALUE, METHOD_OPTIONAL }, /* UIA_NativeWindowHandlePropertyId */ + { &Provider, PROV_GET_HOST_RAW_ELEMENT_PROVIDER, METHOD_TODO }, + { &Provider2, PROV_GET_PROVIDER_OPTIONS, METHOD_TODO }, + /* Win10v1507 and below call this. */ + { &Provider2, PROV_GET_PROPERTY_VALUE, METHOD_OPTIONAL }, /* UIA_NativeWindowHandlePropertyId */ + { &Provider2, PROV_GET_HOST_RAW_ELEMENT_PROVIDER, METHOD_TODO }, + { &Provider2, FRAG_NAVIGATE, METHOD_TODO }, /* NavigateDirection_Parent */ + /* These three are only done on Win10v1507 and below. */ + { &Provider2, PROV_GET_PROVIDER_OPTIONS, METHOD_OPTIONAL }, + { &Provider2, PROV_GET_PROVIDER_OPTIONS, METHOD_OPTIONAL }, + { &Provider2, FRAG_NAVIGATE, METHOD_OPTIONAL }, /* NavigateDirection_Parent */ + { &Provider, FRAG_NAVIGATE, METHOD_TODO }, /* NavigateDirection_Parent */ + /* This is only done on Win10v1507. */ + { &Provider2, PROV_GET_PROVIDER_OPTIONS, METHOD_OPTIONAL }, + /* Only called on Windows versions past Win10v1507. */ + { &Provider, PROV_GET_PROVIDER_OPTIONS, METHOD_OPTIONAL }, + /* Win10v1507 and below call this. */ + { &Provider2, PROV_GET_PROPERTY_VALUE, METHOD_OPTIONAL }, /* UIA_ProviderDescriptionPropertyId */ + { &Provider, PROV_GET_PROPERTY_VALUE, METHOD_TODO }, /* UIA_ProviderDescriptionPropertyId */ + { 0 } +}; + +static const struct prov_method_sequence node_from_prov6[] = { + { &Provider, PROV_GET_PROVIDER_OPTIONS }, + /* Win10v1507 and below call this. */ + { &Provider, PROV_GET_PROPERTY_VALUE, METHOD_OPTIONAL }, /* UIA_NativeWindowHandlePropertyId */ + { &Provider, PROV_GET_HOST_RAW_ELEMENT_PROVIDER, METHOD_TODO }, + { &Provider2, PROV_GET_PROVIDER_OPTIONS, METHOD_TODO }, + /* Win10v1507 and below call this. */ + { &Provider2, PROV_GET_PROPERTY_VALUE, METHOD_OPTIONAL }, /* UIA_NativeWindowHandlePropertyId */ + { &Provider2, PROV_GET_HOST_RAW_ELEMENT_PROVIDER, METHOD_TODO }, + { &Provider2, FRAG_NAVIGATE, METHOD_TODO }, /* NavigateDirection_Parent */ + { &Provider2, PROV_GET_PROVIDER_OPTIONS, METHOD_TODO }, + { &Provider2, PROV_GET_PROVIDER_OPTIONS, METHOD_TODO }, + /* Only called on Windows versions past Win10v1507. */ + { &Provider, PROV_GET_HOST_RAW_ELEMENT_PROVIDER, METHOD_OPTIONAL }, + { &Provider2, FRAG_NAVIGATE, METHOD_OPTIONAL }, /* NavigateDirection_Parent */ + { &Provider, FRAG_NAVIGATE, METHOD_TODO }, /* NavigateDirection_Parent */ + /* This is only done on Win10v1507. */ + { &Provider2, PROV_GET_PROVIDER_OPTIONS, METHOD_OPTIONAL }, + /* Only called on Windows versions past Win10v1507. */ + { &Provider, PROV_GET_PROVIDER_OPTIONS, METHOD_OPTIONAL }, + { &Provider2, PROV_GET_PROPERTY_VALUE, METHOD_TODO }, /* UIA_ProviderDescriptionPropertyId */ + { &Provider, PROV_GET_PROPERTY_VALUE, METHOD_TODO }, /* UIA_ProviderDescriptionPropertyId */ + { 0 } +}; + +static const struct prov_method_sequence node_from_prov7[] = { + { &Provider_child, PROV_GET_PROVIDER_OPTIONS }, + /* Win10v1507 and below call this. */ + { &Provider_child, PROV_GET_PROPERTY_VALUE, METHOD_OPTIONAL }, /* UIA_NativeWindowHandlePropertyId */ + { &Provider_child, PROV_GET_HOST_RAW_ELEMENT_PROVIDER, METHOD_TODO }, + { &Provider2, PROV_GET_PROVIDER_OPTIONS, METHOD_TODO }, + /* Win10v1507 and below call this. */ + { &Provider2, PROV_GET_PROPERTY_VALUE, METHOD_OPTIONAL }, /* UIA_NativeWindowHandlePropertyId */ + { &Provider2, PROV_GET_HOST_RAW_ELEMENT_PROVIDER, METHOD_TODO }, + { &Provider2, FRAG_NAVIGATE, METHOD_TODO }, /* NavigateDirection_Parent */ + { &Provider2, PROV_GET_PROVIDER_OPTIONS, METHOD_TODO }, + { &Provider2, PROV_GET_PROVIDER_OPTIONS, METHOD_TODO }, + /* Only called on Windows versions past Win10v1507. */ + { &Provider_child, PROV_GET_HOST_RAW_ELEMENT_PROVIDER, METHOD_OPTIONAL }, + { &Provider2, FRAG_NAVIGATE, METHOD_OPTIONAL }, /* NavigateDirection_Parent */ + { &Provider_child, FRAG_NAVIGATE, METHOD_TODO }, /* NavigateDirection_Parent */ + /* This is only done on Win10v1507. */ + { &Provider2, PROV_GET_PROVIDER_OPTIONS, METHOD_OPTIONAL }, + /* Only called on Windows versions past Win10v1507. */ + { &Provider_child, PROV_GET_PROVIDER_OPTIONS, METHOD_OPTIONAL }, + { &Provider2, PROV_GET_PROPERTY_VALUE, METHOD_TODO }, /* UIA_ProviderDescriptionPropertyId */ + { &Provider_child, PROV_GET_PROPERTY_VALUE, METHOD_TODO }, /* UIA_ProviderDescriptionPropertyId */ + { 0 } +}; + +static void test_UiaNodeFromProvider(void) +{ + WNDCLASSA cls; + HUIANODE node; + HRESULT hr; + ULONG ref; + HWND hwnd; + VARIANT v; + + cls.style = 0; + cls.lpfnWndProc = test_wnd_proc; + cls.cbClsExtra = 0; + cls.cbWndExtra = 0; + cls.hInstance = GetModuleHandleA(NULL); + cls.hIcon = 0; + cls.hCursor = NULL; + cls.hbrBackground = NULL; + cls.lpszMenuName = NULL; + cls.lpszClassName = "UiaNodeFromProvider class"; + + RegisterClassA(&cls); + + hwnd = CreateWindowA("UiaNodeFromProvider class", "Test window", WS_OVERLAPPEDWINDOW, + 0, 0, 100, 100, NULL, NULL, NULL, NULL); + + CoInitializeEx(NULL, COINIT_MULTITHREADED); + + hr = UiaNodeFromProvider(NULL, &node); + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + + hr = UiaNodeFromProvider(&Provider.IRawElementProviderSimple_iface, NULL); + ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr); + + /* Must have a successful call to get_ProviderOptions. */ + Provider.prov_opts = 0; + node = (void *)0xdeadbeef; + hr = UiaNodeFromProvider(&Provider.IRawElementProviderSimple_iface, &node); + ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr); + ok(!node, "node != NULL\n"); + ok_method_sequence(node_from_prov1, "node_from_prov1"); + + /* No HWND exposed through Provider. */ + Provider.prov_opts = ProviderOptions_ServerSideProvider; + node = (void *)0xdeadbeef; + hr = UiaNodeFromProvider(&Provider.IRawElementProviderSimple_iface, &node); + ok(Provider.ref == 2, "Unexpected refcnt %ld\n", Provider.ref); + + hr = UiaGetPropertyValue(node, UIA_ProviderDescriptionPropertyId, &v); + todo_wine ok(hr == S_OK, "Unexpected hr %#lx\n", hr); + if (SUCCEEDED(hr)) + { + check_node_provider_desc_prefix(V_BSTR(&v), GetCurrentProcessId(), NULL); + check_node_provider_desc(V_BSTR(&v), L"Main", L"Provider", TRUE); + VariantClear(&v); + } + + ok_method_sequence(node_from_prov2, "node_from_prov2"); + + /* HUIANODE represents a COM interface. */ + ref = IUnknown_AddRef((IUnknown *)node); + ok(ref == 2, "Unexpected refcnt %ld\n", ref); + + ref = IUnknown_AddRef((IUnknown *)node); + ok(ref == 3, "Unexpected refcnt %ld\n", ref); + + ref = IUnknown_Release((IUnknown *)node); + ok(ref == 2, "Unexpected refcnt %ld\n", ref); + + ref = IUnknown_Release((IUnknown *)node); + ok(ref == 1, "Unexpected refcnt %ld\n", ref); + + ref = IUnknown_Release((IUnknown *)node); + ok(ref == 0, "Unexpected refcnt %ld\n", ref); + ok(Provider.ref == 1, "Unexpected refcnt %ld\n", Provider.ref); + + /* + * No HWND exposed through Provider_child, but it returns a parent from + * NavigateDirection_Parent. Behavior doesn't change. + */ + Provider_child.prov_opts = ProviderOptions_ServerSideProvider; + node = (void *)0xdeadbeef; + hr = UiaNodeFromProvider(&Provider_child.IRawElementProviderSimple_iface, &node); + ok(Provider_child.ref == 2, "Unexpected refcnt %ld\n", Provider_child.ref); + + hr = UiaGetPropertyValue(node, UIA_ProviderDescriptionPropertyId, &v); + todo_wine ok(hr == S_OK, "Unexpected hr %#lx\n", hr); + if (SUCCEEDED(hr)) + { + check_node_provider_desc_prefix(V_BSTR(&v), GetCurrentProcessId(), NULL); + check_node_provider_desc(V_BSTR(&v), L"Main", L"Provider_child", TRUE); + VariantClear(&v); + } + + ok_method_sequence(node_from_prov3, "node_from_prov3"); + IUnknown_Release((IUnknown *)node); + ok(Provider_child.ref == 1, "Unexpected refcnt %ld\n", Provider_child.ref); + + /* HWND exposed, but Provider2 not returned from WM_GETOBJECT. */ + Provider.hwnd = hwnd; + prov_root = NULL; + node = (void *)0xdeadbeef; + SET_EXPECT(winproc_GETOBJECT_UiaRoot); + /* Win10v1507 and below send this, Windows 7 sends it twice. */ + SET_EXPECT_MULTI(winproc_GETOBJECT_CLIENT, 2); + hr = UiaNodeFromProvider(&Provider.IRawElementProviderSimple_iface, &node); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(Provider.ref == 2, "Unexpected refcnt %ld\n", Provider.ref); + todo_wine CHECK_CALLED(winproc_GETOBJECT_UiaRoot); + called_winproc_GETOBJECT_CLIENT = expect_winproc_GETOBJECT_CLIENT = 0; + + hr = UiaGetPropertyValue(node, UIA_ProviderDescriptionPropertyId, &v); + todo_wine ok(hr == S_OK, "Unexpected hr %#lx\n", hr); + if (SUCCEEDED(hr)) + { + check_node_provider_desc_prefix(V_BSTR(&v), GetCurrentProcessId(), hwnd); + + /* Newer versions of Windows have "Hwnd(parent link):" */ + if (get_provider_desc(V_BSTR(&v), L"Hwnd(parent link):", NULL)) + { + check_node_provider_desc(V_BSTR(&v), L"Main", L"Provider", FALSE); + check_node_provider_desc(V_BSTR(&v), L"Nonclient", NULL, FALSE); + check_node_provider_desc(V_BSTR(&v), L"Hwnd", NULL, TRUE); + } + else + { + check_node_provider_desc(V_BSTR(&v), L"Annotation", NULL, TRUE); + check_node_provider_desc(V_BSTR(&v), L"Main", NULL, FALSE); + check_node_provider_desc(V_BSTR(&v), L"Nonclient", NULL, FALSE); + check_node_provider_desc(V_BSTR(&v), L"Hwnd", L"Provider", FALSE); + } + VariantClear(&v); + } + + ok_method_sequence(node_from_prov4, "node_from_prov4"); + + ok(!!node, "node == NULL\n"); + IUnknown_Release((IUnknown *)node); + ok(Provider.ref == 1, "Unexpected refcnt %ld\n", Provider.ref); + + /* Return Provider2 in response to WM_GETOBJECT. */ + Provider.hwnd = Provider2.hwnd = hwnd; + Provider.prov_opts = Provider2.prov_opts = ProviderOptions_ServerSideProvider; + prov_root = &Provider2.IRawElementProviderSimple_iface; + node = (void *)0xdeadbeef; + SET_EXPECT(winproc_GETOBJECT_UiaRoot); + /* Windows 7 sends this. */ + SET_EXPECT(winproc_GETOBJECT_CLIENT); + hr = UiaNodeFromProvider(&Provider.IRawElementProviderSimple_iface, &node); + ok(hr == S_OK, "Unexpected hr %#lx\n", hr); + todo_wine CHECK_CALLED(winproc_GETOBJECT_UiaRoot); + called_winproc_GETOBJECT_CLIENT = expect_winproc_GETOBJECT_CLIENT = 0; + + /* Win10v1507 and below hold a reference to the root provider for the HWND */ + ok(broken(Provider2.ref == 2) || Provider2.ref == 1, "Unexpected refcnt %ld\n", Provider2.ref); + ok(Provider.ref == 2, "Unexpected refcnt %ld\n", Provider.ref); + ok(!!node, "node == NULL\n"); + + hr = UiaGetPropertyValue(node, UIA_ProviderDescriptionPropertyId, &v); + todo_wine ok(hr == S_OK, "Unexpected hr %#lx\n", hr); + if (SUCCEEDED(hr)) + { + check_node_provider_desc_prefix(V_BSTR(&v), GetCurrentProcessId(), hwnd); + + /* Newer versions of Windows have "Hwnd(parent link):" */ + if (get_provider_desc(V_BSTR(&v), L"Hwnd(parent link):", NULL)) + { + check_node_provider_desc(V_BSTR(&v), L"Main", L"Provider", FALSE); + check_node_provider_desc(V_BSTR(&v), L"Nonclient", NULL, FALSE); + check_node_provider_desc(V_BSTR(&v), L"Hwnd", NULL, TRUE); + } + else + { + check_node_provider_desc(V_BSTR(&v), L"Main", L"Provider2", TRUE); + check_node_provider_desc(V_BSTR(&v), L"Nonclient", NULL, FALSE); + check_node_provider_desc(V_BSTR(&v), L"Hwnd", L"Provider", FALSE); + } + VariantClear(&v); + } + + ok_method_sequence(node_from_prov5, "node_from_prov5"); + + IUnknown_Release((IUnknown *)node); + ok(Provider.ref == 1, "Unexpected refcnt %ld\n", Provider.ref); + ok(Provider2.ref == 1, "Unexpected refcnt %ld\n", Provider2.ref); + + /* + * Windows 10 newer than v1507 only matches older behavior if + * Provider is a ClientSideProvider. + */ + Provider.prov_opts = ProviderOptions_ClientSideProvider; + Provider2.prov_opts = ProviderOptions_ServerSideProvider; + prov_root = &Provider2.IRawElementProviderSimple_iface; + node = (void *)0xdeadbeef; + SET_EXPECT(winproc_GETOBJECT_UiaRoot); + /* Windows 7 sends this. */ + SET_EXPECT(winproc_GETOBJECT_CLIENT); + hr = UiaNodeFromProvider(&Provider.IRawElementProviderSimple_iface, &node); + ok(hr == S_OK, "Unexpected hr %#lx\n", hr); + todo_wine CHECK_CALLED(winproc_GETOBJECT_UiaRoot); + called_winproc_GETOBJECT_CLIENT = expect_winproc_GETOBJECT_CLIENT = 0; + + hr = UiaGetPropertyValue(node, UIA_ProviderDescriptionPropertyId, &v); + todo_wine ok(hr == S_OK, "Unexpected hr %#lx\n", hr); + if (SUCCEEDED(hr)) + { + check_node_provider_desc_prefix(V_BSTR(&v), GetCurrentProcessId(), hwnd); + check_node_provider_desc(V_BSTR(&v), L"Main", L"Provider2", TRUE); + check_node_provider_desc(V_BSTR(&v), L"Nonclient", NULL, FALSE); + check_node_provider_desc(V_BSTR(&v), L"Hwnd", L"Provider", FALSE); + VariantClear(&v); + } + ok_method_sequence(node_from_prov6, "node_from_prov6"); + + todo_wine ok(Provider2.ref == 2, "Unexpected refcnt %ld\n", Provider2.ref); + ok(Provider.ref == 2, "Unexpected refcnt %ld\n", Provider.ref); + + ok(!!node, "node == NULL\n"); + IUnknown_Release((IUnknown *)node); + ok(Provider.ref == 1, "Unexpected refcnt %ld\n", Provider.ref); + ok(Provider2.ref == 1, "Unexpected refcnt %ld\n", Provider2.ref); + + /* Provider_child has a parent, so it will be "(parent link)". */ + Provider_child.prov_opts = ProviderOptions_ClientSideProvider; + Provider_child.hwnd = hwnd; + Provider2.prov_opts = ProviderOptions_ServerSideProvider; + prov_root = &Provider2.IRawElementProviderSimple_iface; + node = (void *)0xdeadbeef; + SET_EXPECT(winproc_GETOBJECT_UiaRoot); + /* Windows 7 sends this. */ + SET_EXPECT(winproc_GETOBJECT_CLIENT); + hr = UiaNodeFromProvider(&Provider_child.IRawElementProviderSimple_iface, &node); + ok(hr == S_OK, "Unexpected hr %#lx\n", hr); + todo_wine CHECK_CALLED(winproc_GETOBJECT_UiaRoot); + called_winproc_GETOBJECT_CLIENT = expect_winproc_GETOBJECT_CLIENT = 0; + + hr = UiaGetPropertyValue(node, UIA_ProviderDescriptionPropertyId, &v); + todo_wine ok(hr == S_OK, "Unexpected hr %#lx\n", hr); + if (SUCCEEDED(hr)) + { + check_node_provider_desc_prefix(V_BSTR(&v), GetCurrentProcessId(), hwnd); + check_node_provider_desc(V_BSTR(&v), L"Main", L"Provider2", FALSE); + check_node_provider_desc(V_BSTR(&v), L"Nonclient", NULL, FALSE); + check_node_provider_desc(V_BSTR(&v), L"Hwnd", L"Provider_child", TRUE); + VariantClear(&v); + } + ok_method_sequence(node_from_prov7, "node_from_prov7"); + + todo_wine ok(Provider2.ref == 2, "Unexpected refcnt %ld\n", Provider2.ref); + ok(Provider_child.ref == 2, "Unexpected refcnt %ld\n", Provider.ref); + + ok(!!node, "node == NULL\n"); + IUnknown_Release((IUnknown *)node); + ok(Provider_child.ref == 1, "Unexpected refcnt %ld\n", Provider.ref); + ok(Provider2.ref == 1, "Unexpected refcnt %ld\n", Provider2.ref); + + CoUninitialize(); + DestroyWindow(hwnd); + UnregisterClassA("UiaNodeFromProvider class", NULL); + prov_root = NULL; +} + START_TEST(uiautomation) { HMODULE uia_dll = LoadLibraryA("uiautomationcore.dll"); @@ -2915,6 +3800,7 @@ START_TEST(uiautomation) test_UiaHostProviderFromHwnd(); test_uia_reserved_value_ifaces(); test_UiaLookupId(); + test_UiaNodeFromProvider(); if (uia_dll) { pUiaProviderFromIAccessible = (void *)GetProcAddress(uia_dll, "UiaProviderFromIAccessible"); diff --git a/dlls/uiautomationcore/uia_classes.idl b/dlls/uiautomationcore/uia_classes.idl new file mode 100644 index 00000000000..31fc142bb2f --- /dev/null +++ b/dlls/uiautomationcore/uia_classes.idl @@ -0,0 +1,28 @@ +/* + * Copyright 2022 Connor McAdams for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +import "oaidl.idl"; + +[ + object, + uuid(bccb6799-d831-4057-bd50-6425823ff1a3), + pointer_default(unique), +] +interface IWineUiaNode : IUnknown +{ +} diff --git a/dlls/uiautomationcore/uia_client.c b/dlls/uiautomationcore/uia_client.c new file mode 100644 index 00000000000..c82064fbe34 --- /dev/null +++ b/dlls/uiautomationcore/uia_client.c @@ -0,0 +1,126 @@ +/* + * Copyright 2022 Connor McAdams for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include "uiautomation.h" +#include "initguid.h" +#include "uia_classes.h" + +#include "wine/debug.h" +#include "wine/heap.h" + +WINE_DEFAULT_DEBUG_CHANNEL(uiautomation); + +/* + * IWineUiaNode interface. + */ +struct uia_node { + IWineUiaNode IWineUiaNode_iface; + LONG ref; + + IRawElementProviderSimple *elprov; +}; + +static inline struct uia_node *impl_from_IWineUiaNode(IWineUiaNode *iface) +{ + return CONTAINING_RECORD(iface, struct uia_node, IWineUiaNode_iface); +} + +static HRESULT WINAPI uia_node_QueryInterface(IWineUiaNode *iface, REFIID riid, void **ppv) +{ + *ppv = NULL; + if (IsEqualIID(riid, &IID_IWineUiaNode) || IsEqualIID(riid, &IID_IUnknown)) + *ppv = iface; + else + return E_NOINTERFACE; + + IWineUiaNode_AddRef(iface); + return S_OK; +} + +static ULONG WINAPI uia_node_AddRef(IWineUiaNode *iface) +{ + struct uia_node *node = impl_from_IWineUiaNode(iface); + ULONG ref = InterlockedIncrement(&node->ref); + + TRACE("%p, refcount %ld\n", node, ref); + return ref; +} + +static ULONG WINAPI uia_node_Release(IWineUiaNode *iface) +{ + struct uia_node *node = impl_from_IWineUiaNode(iface); + ULONG ref = InterlockedDecrement(&node->ref); + + TRACE("%p, refcount %ld\n", node, ref); + if (!ref) + { + IRawElementProviderSimple_Release(node->elprov); + heap_free(node); + } + + return ref; +} + +static const IWineUiaNodeVtbl uia_node_vtbl = { + uia_node_QueryInterface, + uia_node_AddRef, + uia_node_Release, +}; + +/*********************************************************************** + * UiaNodeFromProvider (uiautomationcore.@) + */ +HRESULT WINAPI UiaNodeFromProvider(IRawElementProviderSimple *elprov, HUIANODE *huianode) +{ + static const int supported_prov_opts = ProviderOptions_ServerSideProvider; + enum ProviderOptions prov_opts; + struct uia_node *node; + HRESULT hr; + + TRACE("(%p, %p)\n", elprov, huianode); + + if (!elprov || !huianode) + return E_INVALIDARG; + + *huianode = NULL; + + node = heap_alloc_zero(sizeof(*node)); + if (!node) + return E_OUTOFMEMORY; + + hr = IRawElementProviderSimple_get_ProviderOptions(elprov, &prov_opts); + if (FAILED(hr)) + { + heap_free(node); + return hr; + } + + if (prov_opts & ~supported_prov_opts) + FIXME("Ignoring unsupported ProviderOption(s) %#x\n", prov_opts & ~supported_prov_opts); + + node->IWineUiaNode_iface.lpVtbl = &uia_node_vtbl; + node->elprov = elprov; + IRawElementProviderSimple_AddRef(elprov); + node->ref = 1; + + *huianode = (void *)&node->IWineUiaNode_iface; + + return hr; +} diff --git a/dlls/uiautomationcore/uiautomationcore.spec b/dlls/uiautomationcore/uiautomationcore.spec index ed3453a2f68..887741fa43b 100644 --- a/dlls/uiautomationcore/uiautomationcore.spec +++ b/dlls/uiautomationcore/uiautomationcore.spec @@ -79,7 +79,7 @@ @ stub UiaNodeFromFocus @ stub UiaNodeFromHandle @ stub UiaNodeFromPoint -@ stub UiaNodeFromProvider +@ stdcall UiaNodeFromProvider(ptr ptr) @ stub UiaNodeRelease @ stub UiaPatternRelease #@ stub UiaProviderForNonClient diff --git a/include/uiautomationcoreapi.h b/include/uiautomationcoreapi.h index 6cb5b5c37f5..353547c4ad6 100644 --- a/include/uiautomationcoreapi.h +++ b/include/uiautomationcoreapi.h @@ -256,6 +256,7 @@ BOOL WINAPI UiaTextRangeRelease(HUIATEXTRANGE hobj); HRESULT WINAPI UiaHostProviderFromHwnd(HWND hwnd, IRawElementProviderSimple **elprov); HRESULT WINAPI UiaProviderFromIAccessible(IAccessible *acc, long child_id, DWORD flags, IRawElementProviderSimple **elprov); HRESULT WINAPI UiaGetPropertyValue(HUIANODE huianode, PROPERTYID prop_id, VARIANT *out_val); +HRESULT WINAPI UiaNodeFromProvider(IRawElementProviderSimple *elprov, HUIANODE *huianode);
#ifdef __cplusplus }
From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/uiautomationcore/tests/uiautomation.c | 13 ++++++----- dlls/uiautomationcore/uia_client.c | 24 +++++++++++++++++++++ dlls/uiautomationcore/uiautomationcore.spec | 2 +- include/uiautomationcoreapi.h | 1 + 4 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/dlls/uiautomationcore/tests/uiautomation.c b/dlls/uiautomationcore/tests/uiautomation.c index 35b7e738bd4..677933765a9 100644 --- a/dlls/uiautomationcore/tests/uiautomation.c +++ b/dlls/uiautomationcore/tests/uiautomation.c @@ -3597,8 +3597,7 @@ static void test_UiaNodeFromProvider(void) ref = IUnknown_AddRef((IUnknown *)node); ok(ref == 3, "Unexpected refcnt %ld\n", ref);
- ref = IUnknown_Release((IUnknown *)node); - ok(ref == 2, "Unexpected refcnt %ld\n", ref); + ok(UiaNodeRelease(node), "UiaNodeRelease returned FALSE\n");
ref = IUnknown_Release((IUnknown *)node); ok(ref == 1, "Unexpected refcnt %ld\n", ref); @@ -3626,7 +3625,7 @@ static void test_UiaNodeFromProvider(void) }
ok_method_sequence(node_from_prov3, "node_from_prov3"); - IUnknown_Release((IUnknown *)node); + ok(UiaNodeRelease(node), "UiaNodeRelease returned FALSE\n"); ok(Provider_child.ref == 1, "Unexpected refcnt %ld\n", Provider_child.ref);
/* HWND exposed, but Provider2 not returned from WM_GETOBJECT. */ @@ -3668,7 +3667,7 @@ static void test_UiaNodeFromProvider(void) ok_method_sequence(node_from_prov4, "node_from_prov4");
ok(!!node, "node == NULL\n"); - IUnknown_Release((IUnknown *)node); + ok(UiaNodeRelease(node), "UiaNodeRelease returned FALSE\n"); ok(Provider.ref == 1, "Unexpected refcnt %ld\n", Provider.ref);
/* Return Provider2 in response to WM_GETOBJECT. */ @@ -3713,7 +3712,7 @@ static void test_UiaNodeFromProvider(void)
ok_method_sequence(node_from_prov5, "node_from_prov5");
- IUnknown_Release((IUnknown *)node); + ok(UiaNodeRelease(node), "UiaNodeRelease returned FALSE\n"); ok(Provider.ref == 1, "Unexpected refcnt %ld\n", Provider.ref); ok(Provider2.ref == 1, "Unexpected refcnt %ld\n", Provider2.ref);
@@ -3749,7 +3748,7 @@ static void test_UiaNodeFromProvider(void) ok(Provider.ref == 2, "Unexpected refcnt %ld\n", Provider.ref);
ok(!!node, "node == NULL\n"); - IUnknown_Release((IUnknown *)node); + ok(UiaNodeRelease(node), "UiaNodeRelease returned FALSE\n"); ok(Provider.ref == 1, "Unexpected refcnt %ld\n", Provider.ref); ok(Provider2.ref == 1, "Unexpected refcnt %ld\n", Provider2.ref);
@@ -3783,7 +3782,7 @@ static void test_UiaNodeFromProvider(void) ok(Provider_child.ref == 2, "Unexpected refcnt %ld\n", Provider.ref);
ok(!!node, "node == NULL\n"); - IUnknown_Release((IUnknown *)node); + ok(UiaNodeRelease(node), "UiaNodeRelease returned FALSE\n"); ok(Provider_child.ref == 1, "Unexpected refcnt %ld\n", Provider.ref); ok(Provider2.ref == 1, "Unexpected refcnt %ld\n", Provider2.ref);
diff --git a/dlls/uiautomationcore/uia_client.c b/dlls/uiautomationcore/uia_client.c index c82064fbe34..58b9bc07a79 100644 --- a/dlls/uiautomationcore/uia_client.c +++ b/dlls/uiautomationcore/uia_client.c @@ -84,6 +84,14 @@ static const IWineUiaNodeVtbl uia_node_vtbl = { uia_node_Release, };
+static struct uia_node *unsafe_impl_from_IWineUiaNode(IWineUiaNode *iface) +{ + if (!iface || (iface->lpVtbl != &uia_node_vtbl)) + return NULL; + + return CONTAINING_RECORD(iface, struct uia_node, IWineUiaNode_iface); +} + /*********************************************************************** * UiaNodeFromProvider (uiautomationcore.@) */ @@ -124,3 +132,19 @@ HRESULT WINAPI UiaNodeFromProvider(IRawElementProviderSimple *elprov, HUIANODE *
return hr; } + +/*********************************************************************** + * UiaNodeRelease (uiautomationcore.@) + */ +BOOL WINAPI UiaNodeRelease(HUIANODE huianode) +{ + struct uia_node *node = unsafe_impl_from_IWineUiaNode((IWineUiaNode *)huianode); + + TRACE("(%p)\n", huianode); + + if (!node) + return FALSE; + + IWineUiaNode_Release(&node->IWineUiaNode_iface); + return TRUE; +} diff --git a/dlls/uiautomationcore/uiautomationcore.spec b/dlls/uiautomationcore/uiautomationcore.spec index 887741fa43b..4315abf7433 100644 --- a/dlls/uiautomationcore/uiautomationcore.spec +++ b/dlls/uiautomationcore/uiautomationcore.spec @@ -80,7 +80,7 @@ @ stub UiaNodeFromHandle @ stub UiaNodeFromPoint @ stdcall UiaNodeFromProvider(ptr ptr) -@ stub UiaNodeRelease +@ stdcall UiaNodeRelease(ptr) @ stub UiaPatternRelease #@ stub UiaProviderForNonClient @ stdcall UiaProviderFromIAccessible(ptr long long ptr) diff --git a/include/uiautomationcoreapi.h b/include/uiautomationcoreapi.h index 353547c4ad6..e74271007fe 100644 --- a/include/uiautomationcoreapi.h +++ b/include/uiautomationcoreapi.h @@ -257,6 +257,7 @@ HRESULT WINAPI UiaHostProviderFromHwnd(HWND hwnd, IRawElementProviderSimple **el HRESULT WINAPI UiaProviderFromIAccessible(IAccessible *acc, long child_id, DWORD flags, IRawElementProviderSimple **elprov); HRESULT WINAPI UiaGetPropertyValue(HUIANODE huianode, PROPERTYID prop_id, VARIANT *out_val); HRESULT WINAPI UiaNodeFromProvider(IRawElementProviderSimple *elprov, HUIANODE *huianode); +BOOL WINAPI UiaNodeRelease(HUIANODE huianode);
#ifdef __cplusplus }
Huw Davies (@huw) commented about dlls/uiautomationcore/Makefile.in:
C_SRCS = \ uia_main.c \
- uia_provider.c
- uia_provider.c \
uia_ids.c
This should start with a tab rather than eight spaces. Also order alphabetically. Similarly for the fourth commit.
Huw Davies (@huw) commented about dlls/uiautomationcore/uia_classes.idl:
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
This is missing the appropriate `#pragma makedep` lines. Running `tools/make_makefiles` will then generate the correct `Makefile.in`.