comctl32/tests: Link to activation context API directly.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-01-23 14:44:18 +03:00 committed by Alexandre Julliard
parent 8cf375de35
commit 08a68a9fbe
2 changed files with 10 additions and 45 deletions

View File

@ -54,20 +54,14 @@ struct wndclass_redirect_data
/* returned pointer is valid as long as activation context is alive */
static WCHAR* get_versioned_classname(const WCHAR *name)
{
BOOL (WINAPI *pFindActCtxSectionStringW)(DWORD,const GUID *,ULONG,LPCWSTR,PACTCTX_SECTION_KEYED_DATA);
struct wndclass_redirect_data *wnddata;
ACTCTX_SECTION_KEYED_DATA data;
BOOL ret;
pFindActCtxSectionStringW = (void*)GetProcAddress(GetModuleHandleA("kernel32"), "FindActCtxSectionStringW");
memset(&data, 0, sizeof(data));
data.cbSize = sizeof(data);
ret = pFindActCtxSectionStringW(0, NULL,
ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION,
name, &data);
ok(ret, "got %d, error %u\n", ret, GetLastError());
ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, name, &data);
ok(ret, "Failed to find class redirection section, error %u\n", GetLastError());
wnddata = (struct wndclass_redirect_data*)data.lpData;
return (WCHAR*)((BYTE*)wnddata + wnddata->name_offset);
}

View File

@ -62,48 +62,19 @@ static const CHAR manifest[] =
static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
{
HANDLE hKernel32;
BOOL (WINAPI *pDeactivateActCtx)(DWORD, ULONG_PTR);
VOID (WINAPI *pReleaseActCtx)(HANDLE);
hKernel32 = GetModuleHandleA("kernel32.dll");
pDeactivateActCtx = (void*)GetProcAddress(hKernel32, "DeactivateActCtx");
pReleaseActCtx = (void*)GetProcAddress(hKernel32, "ReleaseActCtx");
if (!pDeactivateActCtx || !pReleaseActCtx)
{
win_skip("Activation contexts unsupported\n");
return;
}
pDeactivateActCtx(0, cookie);
pReleaseActCtx(hCtx);
DeactivateActCtx(0, cookie);
ReleaseActCtx(hCtx);
DeleteFileA(manifest_name);
}
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
{
HANDLE hKernel32;
HANDLE (WINAPI *pCreateActCtxA)(ACTCTXA*);
BOOL (WINAPI *pActivateActCtx)(HANDLE, ULONG_PTR*);
BOOL (WINAPI *pFindActCtxSectionStringA)(DWORD,const GUID *,ULONG,LPCSTR,PACTCTX_SECTION_KEYED_DATA);
ACTCTX_SECTION_KEYED_DATA data;
ACTCTXA ctx;
BOOL ret;
HANDLE file;
DWORD written;
hKernel32 = GetModuleHandleA("kernel32.dll");
pCreateActCtxA = (void*)GetProcAddress(hKernel32, "CreateActCtxA");
pActivateActCtx = (void*)GetProcAddress(hKernel32, "ActivateActCtx");
pFindActCtxSectionStringA = (void*)GetProcAddress(hKernel32, "FindActCtxSectionStringA");
if (!(pCreateActCtxA && pActivateActCtx))
{
win_skip("Activation contexts unsupported. No version 6 tests possible.\n");
return FALSE;
}
ACTCTXA ctx;
HANDLE file;
BOOL ret;
/* create manifest */
file = CreateFileA( manifest_name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
@ -131,10 +102,10 @@ static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
ctx.cbSize = sizeof(ctx);
ctx.lpSource = manifest_name;
*hCtx = pCreateActCtxA(&ctx);
*hCtx = CreateActCtxA(&ctx);
ok(*hCtx != 0, "Expected context handle\n");
ret = pActivateActCtx(*hCtx, pcookie);
ret = ActivateActCtx(*hCtx, pcookie);
expect(TRUE, ret);
if (!ret)
@ -144,7 +115,7 @@ static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
}
data.cbSize = sizeof(data);
ret = pFindActCtxSectionStringA(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
ret = FindActCtxSectionStringA(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
"comctl32.dll", &data);
ok(ret, "failed to find comctl32.dll in active context, %u\n", GetLastError());
if (ret)