Commit d8467aee authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

oleacc: Add GetProcessHandleFromHwnd implementation.

parent 8192f549
......@@ -332,6 +332,18 @@ void WINAPI GetOleaccVersionInfo(DWORD* pVersion, DWORD* pBuild)
*pBuild = MAKELONG(0,0);
}
HANDLE WINAPI GetProcessHandleFromHwnd(HWND hwnd)
{
DWORD proc_id;
TRACE("%p\n", hwnd);
if(!GetWindowThreadProcessId(hwnd, &proc_id))
return NULL;
return OpenProcess(PROCESS_DUP_HANDLE | PROCESS_VM_OPERATION |
PROCESS_VM_READ | PROCESS_VM_WRITE | SYNCHRONIZE, TRUE, proc_id);
}
UINT WINAPI GetRoleTextW(DWORD role, LPWSTR lpRole, UINT rolemax)
{
INT ret;
......
......@@ -9,6 +9,7 @@
@ stdcall -private DllRegisterServer()
@ stdcall -private DllUnregisterServer()
@ stdcall GetOleaccVersionInfo(ptr ptr)
@ stdcall GetProcessHandleFromHwnd(ptr)
@ stdcall GetRoleTextA(long ptr long)
@ stdcall GetRoleTextW(long ptr long)
@ stub GetStateTextA
......
......@@ -279,6 +279,32 @@ static void test_AccessibleObjectFromWindow(void)
DestroyWindow(hwnd);
}
static void test_GetProcessHandleFromHwnd(void)
{
HANDLE (WINAPI *pGetProcessHandleFromHwnd)(HWND);
HANDLE proc;
HWND hwnd;
pGetProcessHandleFromHwnd = (void*)GetProcAddress(
GetModuleHandleA("oleacc.dll"), "GetProcessHandleFromHwnd");
if(!pGetProcessHandleFromHwnd) {
win_skip("GetProcessHandleFromHwnd not available\n");
return;
}
proc = pGetProcessHandleFromHwnd(NULL);
ok(!proc, "proc = %p\n", proc);
hwnd = CreateWindowA("static", "", 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
ok(hwnd != NULL, "CreateWindow failed\n");
proc = pGetProcessHandleFromHwnd(hwnd);
ok(proc != NULL, "proc == NULL\n");
CloseHandle(proc);
DestroyWindow(hwnd);
}
static void test_default_client_accessible_object(void)
{
static const WCHAR testW[] = {'t','e','s','t',' ','t',' ','&','j','u','n','k',0};
......@@ -417,6 +443,7 @@ START_TEST(main)
test_getroletext();
test_LresultFromObject(argv[0]);
test_AccessibleObjectFromWindow();
test_GetProcessHandleFromHwnd();
test_default_client_accessible_object();
unregister_window_class();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment