diff --git a/rostests/winetests/ole32/marshal.c b/rostests/winetests/ole32/marshal.c index ae82e378723..c7f79961bcf 100644 --- a/rostests/winetests/ole32/marshal.c +++ b/rostests/winetests/ole32/marshal.c @@ -1831,15 +1831,19 @@ static LRESULT CALLBACK window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM l } } -static void test_message_reentrancy(void) +static void register_test_window(void) { WNDCLASS wndclass; - MSG msg; memset(&wndclass, 0, sizeof(wndclass)); wndclass.lpfnWndProc = window_proc; wndclass.lpszClassName = "WineCOMTest"; RegisterClass(&wndclass); +} + +static void test_message_reentrancy(void) +{ + MSG msg; hwnd_app = CreateWindow("WineCOMTest", NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, 0); ok(hwnd_app != NULL, "Window creation failed\n"); @@ -1852,6 +1856,7 @@ static void test_message_reentrancy(void) TranslateMessage(&msg); DispatchMessage(&msg); } + DestroyWindow(hwnd_app); } static HRESULT WINAPI TestMsg_IClassFactory_CreateInstance( @@ -1917,6 +1922,7 @@ static void test_call_from_message(void) TranslateMessage(&msg); DispatchMessage(&msg); } + DestroyWindow(hwnd_app); } static void test_WM_QUIT_handling(void) @@ -2569,7 +2575,7 @@ static void test_local_server(void) quit_event = CreateEvent(NULL, FALSE, FALSE, "Wine COM Test Quit Event"); SetEvent(quit_event); - WaitForSingleObject(process, INFINITE); + winetest_wait_child_process( process ); CloseHandle(quit_event); CloseHandle(process); } @@ -2873,7 +2879,6 @@ static void test_channel_hook(void) START_TEST(marshal) { - WNDCLASS wndclass; HMODULE hOle32 = GetModuleHandle("ole32"); int argc; char **argv; @@ -2890,11 +2895,7 @@ START_TEST(marshal) return; } - /* register a window class used in several tests */ - memset(&wndclass, 0, sizeof(wndclass)); - wndclass.lpfnWndProc = window_proc; - wndclass.lpszClassName = "WineCOMTest"; - RegisterClass(&wndclass); + register_test_window(); test_cocreateinstance_proxy(); diff --git a/rostests/winetests/ole32/moniker.c b/rostests/winetests/ole32/moniker.c index a5a1e8fcae8..3f3579ae765 100644 --- a/rostests/winetests/ole32/moniker.c +++ b/rostests/winetests/ole32/moniker.c @@ -1311,7 +1311,7 @@ static void test_class_moniker(void) ok(hr == MK_E_UNAVAILABLE, "IMoniker_GetTimeOfLastChange should return MK_E_UNAVAILABLE, not 0x%08x\n", hr); hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown); - ok_ole_success(hr, IMoniker_BindToStorage); + ok_ole_success(hr, IMoniker_BindToObject); IUnknown_Release(unknown); hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown); @@ -1589,6 +1589,113 @@ static void test_generic_composite_moniker(void) IMoniker_Release(moniker); } +static void test_pointer_moniker(void) +{ + HRESULT hr; + IMoniker *moniker; + DWORD moniker_type; + DWORD hash; + IBindCtx *bindctx; + FILETIME filetime; + IMoniker *inverse; + IUnknown *unknown; + IStream *stream; + IROTData *rotdata; + LPOLESTR display_name; + + cLocks = 0; + + hr = CreatePointerMoniker((IUnknown *)&Test_ClassFactory, NULL); + ok(hr == E_INVALIDARG, "CreatePointerMoniker(x, NULL) should have returned E_INVALIDARG instead of 0x%08x\n", hr); + + hr = CreatePointerMoniker((IUnknown *)&Test_ClassFactory, &moniker); + ok_ole_success(hr, CreatePointerMoniker); + if (!moniker) return; + + ok_more_than_one_lock(); + + /* Display Name */ + + hr = CreateBindCtx(0, &bindctx); + ok_ole_success(hr, CreateBindCtx); + + hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, &display_name); + ok(hr == E_NOTIMPL, "IMoniker_GetDisplayName should have returned E_NOTIMPL instead of 0x%08x\n", hr); + + IBindCtx_Release(bindctx); + + hr = IMoniker_IsDirty(moniker); + ok(hr == S_FALSE, "IMoniker_IsDirty should return S_FALSE, not 0x%08x\n", hr); + + /* IROTData::GetComparisonData test */ + + hr = IMoniker_QueryInterface(moniker, &IID_IROTData, (void **)&rotdata); + ok(hr == E_NOINTERFACE, "IMoniker_QueryInterface(IID_IROTData) should have returned E_NOINTERFACE instead of 0x%08x\n", hr); + + /* Saving */ + + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok_ole_success(hr, CreateStreamOnHGlobal); + + hr = IMoniker_Save(moniker, stream, TRUE); + ok(hr == E_NOTIMPL, "IMoniker_Save should have returned E_NOTIMPL instead of 0x%08x\n", hr); + + IStream_Release(stream); + + /* Hashing */ + hr = IMoniker_Hash(moniker, &hash); + ok_ole_success(hr, IMoniker_Hash); + ok(hash == (DWORD)&Test_ClassFactory, + "Hash value should have been 0x%08x, instead of 0x%08x\n", + (DWORD)&Test_ClassFactory, hash); + + /* IsSystemMoniker test */ + hr = IMoniker_IsSystemMoniker(moniker, &moniker_type); + ok_ole_success(hr, IMoniker_IsSystemMoniker); + ok(moniker_type == MKSYS_POINTERMONIKER, + "dwMkSys != MKSYS_POINTERMONIKER, instead was 0x%08x\n", + moniker_type); + + hr = IMoniker_Inverse(moniker, &inverse); + ok_ole_success(hr, IMoniker_Inverse); + IMoniker_Release(inverse); + + hr = CreateBindCtx(0, &bindctx); + ok_ole_success(hr, CreateBindCtx); + + /* IsRunning test */ + hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL); + ok(hr == S_OK, "IMoniker_IsRunning should return S_OK, not 0x%08x\n", hr); + + hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &filetime); + ok(hr == E_NOTIMPL, "IMoniker_GetTimeOfLastChange should return E_NOTIMPL, not 0x%08x\n", hr); + + hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown); + ok_ole_success(hr, IMoniker_BindToObject); + IUnknown_Release(unknown); + + hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown); + ok_ole_success(hr, IMoniker_BindToStorage); + IUnknown_Release(unknown); + + IMoniker_Release(moniker); + + ok_no_locks(); + + hr = CreatePointerMoniker(NULL, &moniker); + ok_ole_success(hr, CreatePointerMoniker); + + hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown); + ok(hr == E_UNEXPECTED, "IMoniker_BindToObject should have returned E_UNEXPECTED instead of 0x%08x\n", hr); + + hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown); + ok(hr == E_UNEXPECTED, "IMoniker_BindToStorage should have returned E_UNEXPECTED instead of 0x%08x\n", hr); + + IBindCtx_Release(bindctx); + + IMoniker_Release(moniker); +} + static void test_bind_context(void) { HRESULT hr; @@ -1700,6 +1807,7 @@ START_TEST(moniker) test_item_moniker(); test_anti_moniker(); test_generic_composite_moniker(); + test_pointer_moniker(); /* FIXME: test moniker creation funcs and parsing other moniker formats */ diff --git a/rostests/winetests/ole32/ole32.rbuild b/rostests/winetests/ole32/ole32.rbuild index 526c15fb5ac..27202e575e9 100644 --- a/rostests/winetests/ole32/ole32.rbuild +++ b/rostests/winetests/ole32/ole32.rbuild @@ -1,18 +1,10 @@ + . 0x600 0x600 - wine - oleaut32 - ole32 - user32 - gdi32 - advapi32 - kernel32 - uuid - ntdll clipboard.c compobj.c dragdrop.c @@ -26,4 +18,14 @@ storage32.c usrmarshal.c testlist.c + wine + oleaut32 + ole32 + user32 + gdi32 + advapi32 + kernel32 + uuid + ntdll + diff --git a/rostests/winetests/ole32/usrmarshal.c b/rostests/winetests/ole32/usrmarshal.c index 281f9a01045..60e85cf5544 100644 --- a/rostests/winetests/ole32/usrmarshal.c +++ b/rostests/winetests/ole32/usrmarshal.c @@ -441,31 +441,31 @@ static void test_marshal_WdtpInterfacePointer(void) unk = &Test_Unknown; size = WdtpInterfacePointer_UserSize(&umcb.Flags, umcb.Flags, 0, unk, &IID_IUnknown); todo_wine - ok(size == 108, "size should be 108 bytes, not %d\n", size); + ok(size > 28, "size should be > 28 bytes, not %d\n", size); + trace("WdtpInterfacePointer_UserSize returned %d\n", size); buffer = HeapAlloc(GetProcessHeap(), 0, size); buffer_end = WdtpInterfacePointer_UserMarshal(&umcb.Flags, umcb.Flags, buffer, unk, &IID_IUnknown); wireip = buffer; if (size >= 28) { - ok(*(DWORD *)wireip == 0x44, "wireip + 0x0 should be 0x4c instead of 0x%08x\n", *(DWORD *)wireip); + ok(*(DWORD *)wireip == 0x44, "wireip + 0x0 should be 0x44 instead of 0x%08x\n", *(DWORD *)wireip); wireip += sizeof(DWORD); - ok(*(DWORD *)wireip == 0x44, "wireip + 0x8 should be 0x4c instead of 0x%08x\n", *(DWORD *)wireip); + ok(*(DWORD *)wireip == 0x44, "wireip + 0x4 should be 0x44 instead of 0x%08x\n", *(DWORD *)wireip); wireip += sizeof(DWORD); - ok(*(DWORD *)wireip == 0x574f454d /* 'MEOW' */, "wireip + 0xc should be 0x574f454d instead of 0x%08x\n", *(DWORD *)wireip); + ok(*(DWORD *)wireip == 0x574f454d /* 'MEOW' */, "wireip + 0x8 should be 0x574f454d instead of 0x%08x\n", *(DWORD *)wireip); wireip += sizeof(DWORD); - ok(*(DWORD *)wireip == 0x1, "wireip + 0x10 should be 0x1 instead of 0x%08x\n", *(DWORD *)wireip); + ok(*(DWORD *)wireip == 0x1, "wireip + 0xc should be 0x1 instead of 0x%08x\n", *(DWORD *)wireip); wireip += sizeof(DWORD); - iid = (const IID *)buffer; - ok(!IsEqualIID(iid, &IID_IUnknown), - "wireip + 0x14 should be IID_IUnknown instead of {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", + iid = (const IID *)wireip; + ok(IsEqualIID(iid, &IID_IUnknown), + "wireip + 0x10 should be IID_IUnknown instead of {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", iid->Data1, iid->Data2, iid->Data3, iid->Data4[0], iid->Data4[1], iid->Data4[2], iid->Data4[3], iid->Data4[4], iid->Data4[5], iid->Data4[6], iid->Data4[7]); - ok(*(DWORD *)wireip == 0, "wireip + 0x14 should be 0 instead of 0x%08x\n", *(DWORD *)wireip); wireip += sizeof(IID); - ok(*(DWORD *)wireip == 0, "wireip + 0x20 should be 0 instead of 0x%08x\n", *(DWORD *)wireip); + ok(*(DWORD *)wireip == 0, "wireip + 0x1c should be 0 instead of 0x%08x\n", *(DWORD *)wireip); wireip += sizeof(DWORD); - ok(*(DWORD *)wireip == 5, "wireip + 0x24 should be 5 instead of %d\n", *(DWORD *)wireip); + ok(*(DWORD *)wireip == 5, "wireip + 0x20 should be 5 instead of %d\n", *(DWORD *)wireip); wireip += sizeof(DWORD); /* the rest is dynamic so can't really be tested */ }