Module: wine Branch: master Commit: ebea81f13135a01ca09f2beecddfdeeb2a43a5b2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=ebea81f13135a01ca09f2beecd...
Author: Nikolay Sivov bunglehead@gmail.com Date: Tue Oct 20 21:57:48 2009 +0400
comctl32/tests: Release activation context handle when we're done with tests.
---
dlls/comctl32/tests/header.c | 7 ++++--- dlls/comctl32/tests/imagelist.c | 5 +++-- dlls/comctl32/tests/listview.c | 7 ++++--- dlls/comctl32/tests/v6util.h | 16 +++++++++------- 4 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/dlls/comctl32/tests/header.c b/dlls/comctl32/tests/header.c index 3039a91..b7fe8e5 100644 --- a/dlls/comctl32/tests/header.c +++ b/dlls/comctl32/tests/header.c @@ -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); } diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index da3da42..944e4ec 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -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); } diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index f6c5bf9..44c5eb2 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -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); } diff --git a/dlls/comctl32/tests/v6util.h b/dlls/comctl32/tests/v6util.h index 21a8e4f..848e95b 100644 --- a/dlls/comctl32/tests/v6util.h +++ b/dlls/comctl32/tests/v6util.h @@ -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)