Commit 08a68a9f authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/tests: Link to activation context API directly.

parent 8cf375de
...@@ -54,20 +54,14 @@ struct wndclass_redirect_data ...@@ -54,20 +54,14 @@ struct wndclass_redirect_data
/* returned pointer is valid as long as activation context is alive */ /* returned pointer is valid as long as activation context is alive */
static WCHAR* get_versioned_classname(const WCHAR *name) 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; struct wndclass_redirect_data *wnddata;
ACTCTX_SECTION_KEYED_DATA data; ACTCTX_SECTION_KEYED_DATA data;
BOOL ret; BOOL ret;
pFindActCtxSectionStringW = (void*)GetProcAddress(GetModuleHandleA("kernel32"), "FindActCtxSectionStringW");
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
data.cbSize = sizeof(data); data.cbSize = sizeof(data);
ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, name, &data);
ret = pFindActCtxSectionStringW(0, NULL, ok(ret, "Failed to find class redirection section, error %u\n", GetLastError());
ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION,
name, &data);
ok(ret, "got %d, error %u\n", ret, GetLastError());
wnddata = (struct wndclass_redirect_data*)data.lpData; wnddata = (struct wndclass_redirect_data*)data.lpData;
return (WCHAR*)((BYTE*)wnddata + wnddata->name_offset); return (WCHAR*)((BYTE*)wnddata + wnddata->name_offset);
} }
......
...@@ -62,48 +62,19 @@ static const CHAR manifest[] = ...@@ -62,48 +62,19 @@ static const CHAR manifest[] =
static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx) static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
{ {
HANDLE hKernel32; DeactivateActCtx(0, cookie);
BOOL (WINAPI *pDeactivateActCtx)(DWORD, ULONG_PTR); ReleaseActCtx(hCtx);
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);
DeleteFileA(manifest_name); DeleteFileA(manifest_name);
} }
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx) 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; ACTCTX_SECTION_KEYED_DATA data;
DWORD written;
ACTCTXA ctx; ACTCTXA ctx;
BOOL ret;
HANDLE file; HANDLE file;
DWORD written; BOOL ret;
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;
}
/* create manifest */ /* create manifest */
file = CreateFileA( manifest_name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL ); 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) ...@@ -131,10 +102,10 @@ static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
ctx.cbSize = sizeof(ctx); ctx.cbSize = sizeof(ctx);
ctx.lpSource = manifest_name; ctx.lpSource = manifest_name;
*hCtx = pCreateActCtxA(&ctx); *hCtx = CreateActCtxA(&ctx);
ok(*hCtx != 0, "Expected context handle\n"); ok(*hCtx != 0, "Expected context handle\n");
ret = pActivateActCtx(*hCtx, pcookie); ret = ActivateActCtx(*hCtx, pcookie);
expect(TRUE, ret); expect(TRUE, ret);
if (!ret) if (!ret)
...@@ -144,7 +115,7 @@ static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx) ...@@ -144,7 +115,7 @@ static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
} }
data.cbSize = sizeof(data); 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); "comctl32.dll", &data);
ok(ret, "failed to find comctl32.dll in active context, %u\n", GetLastError()); ok(ret, "failed to find comctl32.dll in active context, %u\n", GetLastError());
if (ret) if (ret)
......
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