ole32/tests: Add some more tests for interface redirection handling.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5b66442bc9
commit
1e6b130b85
|
@ -1,7 +1,7 @@
|
|||
TESTDLL = ole32.dll
|
||||
IMPORTS = oleaut32 ole32 user32 uuid gdi32 advapi32
|
||||
|
||||
C_SRCS = \
|
||||
SOURCES = \
|
||||
clipboard.c \
|
||||
compobj.c \
|
||||
defaulthandler.c \
|
||||
|
@ -15,4 +15,6 @@ C_SRCS = \
|
|||
propvariant.c \
|
||||
stg_prop.c \
|
||||
storage32.c \
|
||||
testlib.c \
|
||||
testlib.spec \
|
||||
usrmarshal.c
|
||||
|
|
|
@ -82,9 +82,7 @@ static LONG (WINAPI * pRegOverridePredefKey)(HKEY key, HKEY override);
|
|||
|
||||
static BOOL (WINAPI *pActivateActCtx)(HANDLE,ULONG_PTR*);
|
||||
static HANDLE (WINAPI *pCreateActCtxW)(PCACTCTXW);
|
||||
static BOOL (WINAPI *pDeactivateActCtx)(DWORD,ULONG_PTR);
|
||||
static BOOL (WINAPI *pIsWow64Process)(HANDLE, LPBOOL);
|
||||
static void (WINAPI *pReleaseActCtx)(HANDLE);
|
||||
|
||||
#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
|
||||
#define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks)
|
||||
|
@ -98,6 +96,8 @@ static const GUID IID_Testiface3 = { 0x42222222, 0x1234, 0x1234, { 0x12, 0x34, 0
|
|||
static const GUID IID_Testiface4 = { 0x52222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
|
||||
static const GUID IID_Testiface5 = { 0x62222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
|
||||
static const GUID IID_Testiface6 = { 0x72222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
|
||||
static const GUID IID_Testiface7 = { 0x82222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
|
||||
static const GUID IID_Testiface8 = { 0x92222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
|
||||
static const GUID IID_TestPS = { 0x66666666, 0x8888, 0x7777, { 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 } };
|
||||
|
||||
DEFINE_GUID(CLSID_testclsid, 0xacd014c7,0x9535,0x4fac,0x8b,0x53,0xa4,0x8c,0xa7,0xf4,0xd7,0x26);
|
||||
|
@ -214,6 +214,26 @@ static BOOL create_manifest_file(const char *filename, const char *manifest)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void extract_resource(const char *name, const char *type, const char *path)
|
||||
{
|
||||
DWORD written;
|
||||
HANDLE file;
|
||||
HRSRC res;
|
||||
void *ptr;
|
||||
|
||||
file = CreateFileA(path, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
|
||||
ok(file != INVALID_HANDLE_VALUE, "Failed to create a file at %s, error %d.\n", path, GetLastError());
|
||||
|
||||
res = FindResourceA(NULL, name, type);
|
||||
ok(res != 0, "Failed to find resource.\n");
|
||||
ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res));
|
||||
WriteFile(file, ptr, SizeofResource(GetModuleHandleA(NULL), res), &written, NULL);
|
||||
ok(written == SizeofResource(GetModuleHandleA(NULL), res), "Failed to write file.\n" );
|
||||
CloseHandle(file);
|
||||
}
|
||||
|
||||
static char testlib[MAX_PATH];
|
||||
|
||||
static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
|
||||
{
|
||||
WCHAR path[MAX_PATH];
|
||||
|
@ -235,7 +255,7 @@ static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
|
|||
"handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
win_skip("activation context generation failed, some tests will be skipped\n");
|
||||
win_skip("activation context generation failed, some tests will be skipped. Error %d\n", GetLastError());
|
||||
handle = NULL;
|
||||
}
|
||||
|
||||
|
@ -260,6 +280,15 @@ static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
|
|||
return handle;
|
||||
}
|
||||
|
||||
static void deactivate_context(HANDLE handle, ULONG_PTR cookie)
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
ret = DeactivateActCtx(0, cookie);
|
||||
ok(ret, "Failed to deactivate context, error %d.\n", GetLastError());
|
||||
ReleaseActCtx(handle);
|
||||
}
|
||||
|
||||
static const char actctx_manifest[] =
|
||||
"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
|
||||
"<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\""
|
||||
|
@ -294,6 +323,10 @@ static const char actctx_manifest[] =
|
|||
" iid=\"{22222222-1234-1234-1234-56789abcdef0}\""
|
||||
" proxyStubClsid32=\"{66666666-8888-7777-6666-555555555555}\""
|
||||
" />"
|
||||
" <comInterfaceProxyStub "
|
||||
" name=\"Iifaceps5\""
|
||||
" iid=\"{82222222-1234-1234-1234-56789abcdef0}\""
|
||||
" />"
|
||||
"</file>"
|
||||
" <comInterfaceExternalProxyStub "
|
||||
" name=\"Iifaceps2\""
|
||||
|
@ -367,8 +400,7 @@ static void test_ProgIDFromCLSID(void)
|
|||
hr = ProgIDFromCLSID(&IID_Testiface6, &progid);
|
||||
ok(hr == REGDB_E_CLASSNOTREG && progid == NULL, "got 0x%08x, progid %p\n", hr, progid);
|
||||
|
||||
pDeactivateActCtx(0, cookie);
|
||||
pReleaseActCtx(handle);
|
||||
deactivate_context(handle, cookie);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,8 +466,7 @@ static void test_CLSIDFromProgID(void)
|
|||
ok(!IsEqualCLSID(&clsid, &CLSID_StdFont) && !IsEqualCLSID(&clsid, &CLSID_NULL) && !IsEqualCLSID(&clsid, &clsid1),
|
||||
"got %s\n", wine_dbgstr_guid(&clsid));
|
||||
|
||||
pDeactivateActCtx(0, cookie);
|
||||
pReleaseActCtx(handle);
|
||||
deactivate_context(handle, cookie);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -725,8 +756,14 @@ static void test_CoGetClassObject(void)
|
|||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
IUnknown_Release(pUnk);
|
||||
|
||||
pDeactivateActCtx(0, cookie);
|
||||
pReleaseActCtx(handle);
|
||||
hr = CoGetClassObject(&IID_Testiface7, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
|
||||
todo_wine
|
||||
ok(hr == 0x80001235, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = CoGetClassObject(&IID_Testiface8, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
|
||||
ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
deactivate_context(handle, cookie);
|
||||
}
|
||||
|
||||
CoUninitialize();
|
||||
|
@ -1267,6 +1304,11 @@ static void test_CoGetPSClsid(void)
|
|||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(IsEqualGUID(&clsid, &GUID_NULL), "got clsid %s\n", wine_dbgstr_guid(&clsid));
|
||||
|
||||
memset(&clsid, 0xaa, sizeof(clsid));
|
||||
hr = CoGetPSClsid(&IID_Testiface7, &clsid);
|
||||
ok(hr == S_OK, "Failed to get PS CLSID, hr %#x.\n", hr);
|
||||
ok(IsEqualGUID(&clsid, &IID_Testiface7), "Unexpected CLSID %s.\n", wine_dbgstr_guid(&clsid));
|
||||
|
||||
/* register same interface and try to get CLSID back */
|
||||
hr = CoRegisterPSClsid(&IID_Testiface, &IID_Testiface4);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
@ -1275,8 +1317,7 @@ static void test_CoGetPSClsid(void)
|
|||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(IsEqualGUID(&clsid, &IID_Testiface4), "got clsid %s\n", wine_dbgstr_guid(&clsid));
|
||||
|
||||
pDeactivateActCtx(0, cookie);
|
||||
pReleaseActCtx(handle);
|
||||
deactivate_context(handle, cookie);
|
||||
}
|
||||
|
||||
if (pRegDeleteKeyExA &&
|
||||
|
@ -1533,11 +1574,9 @@ static void test_CoRegisterClassObject(void)
|
|||
if ((handle = activate_context(actctx_manifest, &ctxcookie)))
|
||||
{
|
||||
hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
|
||||
todo_wine
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND), "got 0x%08x\n", hr);
|
||||
ok(hr == 0x80001234, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
pDeactivateActCtx(0, ctxcookie);
|
||||
pReleaseActCtx(handle);
|
||||
deactivate_context(handle, ctxcookie);
|
||||
}
|
||||
|
||||
hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
|
||||
|
@ -2264,8 +2303,7 @@ static void test_OleRegGetMiscStatus(void)
|
|||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(status == 0, "got 0x%08x\n", status);
|
||||
|
||||
pDeactivateActCtx(0, cookie);
|
||||
pReleaseActCtx(handle);
|
||||
deactivate_context(handle, cookie);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2332,8 +2370,7 @@ static void test_OleRegGetUserType(void)
|
|||
CoTaskMemFree(str);
|
||||
}
|
||||
|
||||
pDeactivateActCtx(0, cookie);
|
||||
pReleaseActCtx(handle);
|
||||
deactivate_context(handle, cookie);
|
||||
}
|
||||
|
||||
/* test using registered CLSID */
|
||||
|
@ -3789,9 +3826,7 @@ static void init_funcs(void)
|
|||
|
||||
pActivateActCtx = (void*)GetProcAddress(hkernel32, "ActivateActCtx");
|
||||
pCreateActCtxW = (void*)GetProcAddress(hkernel32, "CreateActCtxW");
|
||||
pDeactivateActCtx = (void*)GetProcAddress(hkernel32, "DeactivateActCtx");
|
||||
pIsWow64Process = (void*)GetProcAddress(hkernel32, "IsWow64Process");
|
||||
pReleaseActCtx = (void*)GetProcAddress(hkernel32, "ReleaseActCtx");
|
||||
}
|
||||
|
||||
static DWORD CALLBACK implicit_mta_proc(void *param)
|
||||
|
@ -3869,6 +3904,11 @@ START_TEST(compobj)
|
|||
return;
|
||||
}
|
||||
|
||||
GetTempPathA(ARRAY_SIZE(testlib), testlib);
|
||||
SetCurrentDirectoryA(testlib);
|
||||
lstrcatA(testlib, "\\testlib.dll");
|
||||
extract_resource("testlib.dll", "TESTDLL", testlib);
|
||||
|
||||
if (!pCreateActCtxW)
|
||||
win_skip("Activation contexts are not supported, some tests will be skipped.\n");
|
||||
|
||||
|
@ -3910,4 +3950,5 @@ START_TEST(compobj)
|
|||
test_CoGetInstanceFromFile();
|
||||
test_GlobalOptions();
|
||||
test_implicit_mta();
|
||||
DeleteFileA( testlib );
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Test library
|
||||
*
|
||||
* Copyright 2019 Nikolay Sivov
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <initguid.h>
|
||||
|
||||
DEFINE_GUID(CLSID_WineOOPTest, 0x5201163f, 0x8164, 0x4fd0, 0xa1, 0xa2, 0x5d, 0x5a, 0x36, 0x54, 0xd3, 0xbd);
|
||||
DEFINE_GUID(IID_Testiface7, 0x82222222, 0x1234, 0x1234, 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0);
|
||||
|
||||
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **obj)
|
||||
{
|
||||
if (IsEqualGUID(clsid, &CLSID_WineOOPTest))
|
||||
return 0x80001234;
|
||||
|
||||
if (IsEqualGUID(clsid, &IID_Testiface7))
|
||||
return 0x80001235;
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
@ stdcall DllGetClassObject(ptr ptr ptr)
|
Loading…
Reference in New Issue