dinput: Implement device creation using product GUID.
[wine/zf.git] / dlls / comctl32 / tests / v6util.h
blob626f6e61255c998ba0b10bd794d67fbc18161a65
1 /*
2 * Utility routines for comctl32 v6 tests
4 * Copyright 2006 Mike McCormack for CodeWeavers
5 * Copyright 2007 George Gov
6 * Copyright 2009 Owen Rudge for CodeWeavers
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #ifdef __i386__
24 #define ARCH "x86"
25 #elif defined __x86_64__
26 #define ARCH "amd64"
27 #elif defined __arm__
28 #define ARCH "arm"
29 #elif defined __aarch64__
30 #define ARCH "arm64"
31 #else
32 #define ARCH "none"
33 #endif
35 static const CHAR manifest_name[] = "cc6.manifest";
37 static const CHAR manifest[] =
38 "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
39 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n"
40 " <assemblyIdentity\n"
41 " type=\"win32\"\n"
42 " name=\"Wine.ComCtl32.Tests\"\n"
43 " version=\"1.0.0.0\"\n"
44 " processorArchitecture=\"" ARCH "\"\n"
45 " />\n"
46 "<description>Wine comctl32 test suite</description>\n"
47 "<dependency>\n"
48 " <dependentAssembly>\n"
49 " <assemblyIdentity\n"
50 " type=\"win32\"\n"
51 " name=\"microsoft.windows.common-controls\"\n"
52 " version=\"6.0.0.0\"\n"
53 " processorArchitecture=\"" ARCH "\"\n"
54 " publicKeyToken=\"6595b64144ccf1df\"\n"
55 " language=\"*\"\n"
56 " />\n"
57 "</dependentAssembly>\n"
58 "</dependency>\n"
59 "</assembly>\n";
61 static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
63 DeactivateActCtx(0, cookie);
64 ReleaseActCtx(hCtx);
66 DeleteFileA(manifest_name);
69 static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
71 ACTCTX_SECTION_KEYED_DATA data;
72 DWORD written;
73 HMODULE hmod;
74 ACTCTXA ctx;
75 HANDLE file;
76 BOOL ret;
78 /* create manifest */
79 file = CreateFileA( manifest_name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
80 if (file != INVALID_HANDLE_VALUE)
82 ret = (WriteFile( file, manifest, sizeof(manifest)-1, &written, NULL ) &&
83 written == sizeof(manifest)-1);
84 CloseHandle( file );
85 if (!ret)
87 DeleteFileA( manifest_name );
88 skip("Failed to fill manifest file. Skipping comctl32 V6 tests.\n");
89 return FALSE;
91 else
92 trace("created %s\n", manifest_name);
94 else
96 skip("Failed to create manifest file. Skipping comctl32 V6 tests.\n");
97 return FALSE;
100 memset(&ctx, 0, sizeof(ctx));
101 ctx.cbSize = sizeof(ctx);
102 ctx.lpSource = manifest_name;
104 *hCtx = CreateActCtxA(&ctx);
105 ok(*hCtx != 0, "Expected context handle\n");
107 hmod = GetModuleHandleA("comctl32.dll");
109 ret = ActivateActCtx(*hCtx, pcookie);
110 ok(ret, "Failed to activate context, error %d.\n", GetLastError());
112 if (!ret)
114 win_skip("A problem during context activation occurred.\n");
115 DeleteFileA(manifest_name);
118 data.cbSize = sizeof(data);
119 ret = FindActCtxSectionStringA(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
120 "comctl32.dll", &data);
121 ok(ret, "failed to find comctl32.dll in active context, %u\n", GetLastError());
122 if (ret)
124 FreeLibrary(hmod);
125 LoadLibraryA("comctl32.dll");
128 return ret;
131 #undef ARCH