comctl32/tests: Release activation context handle when we're done with tests.
This commit is contained in:
parent
57577fb20b
commit
ebea81f131
|
@ -1814,6 +1814,7 @@ START_TEST(header)
|
|||
{
|
||||
HWND parent_hwnd;
|
||||
ULONG_PTR ctx_cookie;
|
||||
HANDLE hCtx;
|
||||
HWND hwnd;
|
||||
|
||||
if (!init())
|
||||
|
@ -1841,7 +1842,7 @@ START_TEST(header)
|
|||
test_hdm_unicodeformatMessages(parent_hwnd);
|
||||
test_hdm_bitmapmarginMessages(parent_hwnd);
|
||||
|
||||
if (!load_v6_module(&ctx_cookie))
|
||||
if (!load_v6_module(&ctx_cookie, &hCtx))
|
||||
{
|
||||
DestroyWindow(parent_hwnd);
|
||||
return;
|
||||
|
@ -1856,7 +1857,7 @@ START_TEST(header)
|
|||
if (!IsWindow(hwnd))
|
||||
{
|
||||
win_skip("FIXME: failed to create Header window.\n");
|
||||
unload_v6_module(ctx_cookie);
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
DestroyWindow(parent_hwnd);
|
||||
return;
|
||||
}
|
||||
|
@ -1867,7 +1868,7 @@ START_TEST(header)
|
|||
test_hdf_fixedwidth(parent_hwnd);
|
||||
test_hds_nosizing(parent_hwnd);
|
||||
|
||||
unload_v6_module(ctx_cookie);
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
|
||||
DestroyWindow(parent_hwnd);
|
||||
}
|
||||
|
|
|
@ -1247,6 +1247,7 @@ cleanup:
|
|||
START_TEST(imagelist)
|
||||
{
|
||||
ULONG_PTR ctx_cookie;
|
||||
HANDLE hCtx;
|
||||
|
||||
HMODULE hComCtl32 = GetModuleHandle("comctl32.dll");
|
||||
pImageList_Create = NULL; /* These are not needed for non-v6.0 tests*/
|
||||
|
@ -1270,7 +1271,7 @@ START_TEST(imagelist)
|
|||
|
||||
/* Now perform v6 tests */
|
||||
|
||||
if (!load_v6_module(&ctx_cookie))
|
||||
if (!load_v6_module(&ctx_cookie, &hCtx))
|
||||
return;
|
||||
|
||||
/* Reload comctl32 */
|
||||
|
@ -1284,5 +1285,5 @@ START_TEST(imagelist)
|
|||
test_ImageList_DrawIndirect();
|
||||
test_shell_imagelist();
|
||||
|
||||
unload_v6_module(ctx_cookie);
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
}
|
||||
|
|
|
@ -4064,6 +4064,7 @@ START_TEST(listview)
|
|||
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
|
||||
|
||||
ULONG_PTR ctx_cookie;
|
||||
HANDLE hCtx;
|
||||
HWND hwnd;
|
||||
|
||||
hComctl32 = GetModuleHandleA("comctl32.dll");
|
||||
|
@ -4116,7 +4117,7 @@ START_TEST(listview)
|
|||
test_getcolumnwidth();
|
||||
test_ApproximateViewRect();
|
||||
|
||||
if (!load_v6_module(&ctx_cookie))
|
||||
if (!load_v6_module(&ctx_cookie, &hCtx))
|
||||
{
|
||||
DestroyWindow(hwndparent);
|
||||
return;
|
||||
|
@ -4130,7 +4131,7 @@ START_TEST(listview)
|
|||
if (!IsWindow(hwnd))
|
||||
{
|
||||
win_skip("FIXME: failed to create ListView window.\n");
|
||||
unload_v6_module(ctx_cookie);
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
DestroyWindow(hwndparent);
|
||||
return;
|
||||
}
|
||||
|
@ -4144,7 +4145,7 @@ START_TEST(listview)
|
|||
test_scrollnotify();
|
||||
test_LVS_EX_TRANSPARENTBKGND();
|
||||
|
||||
unload_v6_module(ctx_cookie);
|
||||
unload_v6_module(ctx_cookie, hCtx);
|
||||
|
||||
DestroyWindow(hwndparent);
|
||||
}
|
||||
|
|
|
@ -56,32 +56,34 @@ static const CHAR manifest[] =
|
|||
"</dependency>\n"
|
||||
"</assembly>\n";
|
||||
|
||||
static void unload_v6_module(ULONG_PTR cookie)
|
||||
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");
|
||||
if (!pDeactivateActCtx)
|
||||
pReleaseActCtx = (void*)GetProcAddress(hKernel32, "ReleaseActCtx");
|
||||
if (!pDeactivateActCtx || !pReleaseActCtx)
|
||||
{
|
||||
win_skip("Activation contexts unsupported\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pDeactivateActCtx(0, cookie);
|
||||
pReleaseActCtx(hCtx);
|
||||
|
||||
DeleteFileA(manifest_name);
|
||||
}
|
||||
|
||||
static BOOL load_v6_module(ULONG_PTR *pcookie)
|
||||
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
|
||||
{
|
||||
HANDLE hKernel32;
|
||||
HANDLE (WINAPI *pCreateActCtxA)(ACTCTXA*);
|
||||
BOOL (WINAPI *pActivateActCtx)(HANDLE, ULONG_PTR*);
|
||||
|
||||
ACTCTXA ctx;
|
||||
HANDLE hCtx;
|
||||
BOOL ret;
|
||||
HANDLE file;
|
||||
DWORD written;
|
||||
|
@ -121,10 +123,10 @@ static BOOL load_v6_module(ULONG_PTR *pcookie)
|
|||
ctx.cbSize = sizeof(ctx);
|
||||
ctx.lpSource = manifest_name;
|
||||
|
||||
hCtx = pCreateActCtxA(&ctx);
|
||||
ok(hCtx != 0, "Expected context handle\n");
|
||||
*hCtx = pCreateActCtxA(&ctx);
|
||||
ok(*hCtx != 0, "Expected context handle\n");
|
||||
|
||||
ret = pActivateActCtx(hCtx, pcookie);
|
||||
ret = pActivateActCtx(*hCtx, pcookie);
|
||||
expect(TRUE, ret);
|
||||
|
||||
if (!ret)
|
||||
|
|
Loading…
Reference in New Issue