Esme Povirk (@madewokherd) commented about dlls/uiautomationcore/uia_client.c:
&IID_IWineUiaProvider, &node->git_cookie);
+exit:
- if (FAILED(hr))
IWineUiaProvider_Release(&prov->IWineUiaProvider_iface);
- return hr;
+}
+static HRESULT uia_get_provider_from_hwnd(struct uia_node *node) +{
- LRESULT lr;
- lr = SendMessageW(node->hwnd, WM_GETOBJECT, 0, UiaRootObjectId);
- if (!lr)
- {
if (!IsWindow(node->hwnd) && GetLastError() == ERROR_INVALID_WINDOW_HANDLE)
Unsure what the best way to handle this is. AFAICT SendMessage will set the last error to ERROR_INVALID_WINDOW_HANDLE if the window doesn't exist, but it may not set the last error if it succeeds and returns 0. Thus you would either have to call IsWindow or set last error beforehand.