comctl32/tests: Add ARM and ARM64 arch strings.
[wine/multimedia.git] / dlls / comctl32 / tests / v6util.h
blob9f5a9c48da761e476fe9b40a0d2cf210ffa1051d
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 #define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
25 #ifdef __i386__
26 #define ARCH "x86"
27 #elif defined __x86_64__
28 #define ARCH "amd64"
29 #elif defined __arm__
30 #define ARCH "arm"
31 #elif defined __aarch64__
32 #define ARCH "arm64"
33 #else
34 #define ARCH "none"
35 #endif
37 static const CHAR manifest_name[] = "cc6.manifest";
39 static const CHAR manifest[] =
40 "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
41 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n"
42 " <assemblyIdentity\n"
43 " type=\"win32\"\n"
44 " name=\"Wine.ComCtl32.Tests\"\n"
45 " version=\"1.0.0.0\"\n"
46 " processorArchitecture=\"" ARCH "\"\n"
47 " />\n"
48 "<description>Wine comctl32 test suite</description>\n"
49 "<dependency>\n"
50 " <dependentAssembly>\n"
51 " <assemblyIdentity\n"
52 " type=\"win32\"\n"
53 " name=\"microsoft.windows.common-controls\"\n"
54 " version=\"6.0.0.0\"\n"
55 " processorArchitecture=\"" ARCH "\"\n"
56 " publicKeyToken=\"6595b64144ccf1df\"\n"
57 " language=\"*\"\n"
58 " />\n"
59 "</dependentAssembly>\n"
60 "</dependency>\n"
61 "</assembly>\n";
63 static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
65 HANDLE hKernel32;
66 BOOL (WINAPI *pDeactivateActCtx)(DWORD, ULONG_PTR);
67 VOID (WINAPI *pReleaseActCtx)(HANDLE);
69 hKernel32 = GetModuleHandleA("kernel32.dll");
70 pDeactivateActCtx = (void*)GetProcAddress(hKernel32, "DeactivateActCtx");
71 pReleaseActCtx = (void*)GetProcAddress(hKernel32, "ReleaseActCtx");
72 if (!pDeactivateActCtx || !pReleaseActCtx)
74 win_skip("Activation contexts unsupported\n");
75 return;
78 pDeactivateActCtx(0, cookie);
79 pReleaseActCtx(hCtx);
81 DeleteFileA(manifest_name);
84 static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
86 HANDLE hKernel32;
87 HANDLE (WINAPI *pCreateActCtxA)(ACTCTXA*);
88 BOOL (WINAPI *pActivateActCtx)(HANDLE, ULONG_PTR*);
89 BOOL (WINAPI *pFindActCtxSectionStringA)(DWORD,const GUID *,ULONG,LPCSTR,PACTCTX_SECTION_KEYED_DATA);
91 ACTCTX_SECTION_KEYED_DATA data;
93 ACTCTXA ctx;
94 BOOL ret;
95 HANDLE file;
96 DWORD written;
98 hKernel32 = GetModuleHandleA("kernel32.dll");
99 pCreateActCtxA = (void*)GetProcAddress(hKernel32, "CreateActCtxA");
100 pActivateActCtx = (void*)GetProcAddress(hKernel32, "ActivateActCtx");
101 pFindActCtxSectionStringA = (void*)GetProcAddress(hKernel32, "FindActCtxSectionStringA");
102 if (!(pCreateActCtxA && pActivateActCtx))
104 win_skip("Activation contexts unsupported. No version 6 tests possible.\n");
105 return FALSE;
108 /* create manifest */
109 file = CreateFileA( manifest_name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
110 if (file != INVALID_HANDLE_VALUE)
112 ret = (WriteFile( file, manifest, sizeof(manifest)-1, &written, NULL ) &&
113 written == sizeof(manifest)-1);
114 CloseHandle( file );
115 if (!ret)
117 DeleteFileA( manifest_name );
118 skip("Failed to fill manifest file. Skipping comctl32 V6 tests.\n");
119 return FALSE;
121 else
122 trace("created %s\n", manifest_name);
124 else
126 skip("Failed to create manifest file. Skipping comctl32 V6 tests.\n");
127 return FALSE;
130 memset(&ctx, 0, sizeof(ctx));
131 ctx.cbSize = sizeof(ctx);
132 ctx.lpSource = manifest_name;
134 *hCtx = pCreateActCtxA(&ctx);
135 ok(*hCtx != 0, "Expected context handle\n");
137 ret = pActivateActCtx(*hCtx, pcookie);
138 expect(TRUE, ret);
140 if (!ret)
142 win_skip("A problem during context activation occurred.\n");
143 DeleteFileA(manifest_name);
146 data.cbSize = sizeof(data);
147 ret = pFindActCtxSectionStringA(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
148 "comctl32.dll", &data);
149 ok(ret, "failed to find comctl32.dll in active context, %u\n", GetLastError());
150 if (ret)
151 LoadLibraryA("comctl32.dll");
153 return ret;
156 #undef expect
157 #undef ARCH