ReactOS 0.4.16-dev-117-g38f21f9
v6util.h
Go to the documentation of this file.
1/*
2 * Utility routines for comctl32 v6 tests
3 *
4 * Copyright 2006 Mike McCormack for CodeWeavers
5 * Copyright 2007 George Gov
6 * Copyright 2009 Owen Rudge for CodeWeavers
7 *
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.
12 *
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.
17 *
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
21 */
22
23#ifdef __REACTOS__
24#pragma once
25#endif
26
27#ifdef __i386__
28#define ARCH "x86"
29#elif defined __x86_64__
30#define ARCH "amd64"
31#elif defined __arm__
32#define ARCH "arm"
33#elif defined __aarch64__
34#define ARCH "arm64"
35#else
36#define ARCH "none"
37#endif
38
39static const CHAR manifest_name[] = "cc6.manifest";
40
41static const CHAR manifest[] =
42 "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
43 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n"
44 " <assemblyIdentity\n"
45 " type=\"win32\"\n"
46 " name=\"Wine.ComCtl32.Tests\"\n"
47 " version=\"1.0.0.0\"\n"
48 " processorArchitecture=\"" ARCH "\"\n"
49 " />\n"
50 "<description>Wine comctl32 test suite</description>\n"
51 "<dependency>\n"
52 " <dependentAssembly>\n"
53 " <assemblyIdentity\n"
54 " type=\"win32\"\n"
55 " name=\"microsoft.windows.common-controls\"\n"
56 " version=\"6.0.0.0\"\n"
57 " processorArchitecture=\"" ARCH "\"\n"
58 " publicKeyToken=\"6595b64144ccf1df\"\n"
59 " language=\"*\"\n"
60 " />\n"
61 "</dependentAssembly>\n"
62 "</dependency>\n"
63 "</assembly>\n";
64
66{
68 ReleaseActCtx(hCtx);
69
71}
72
73static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
74{
75 ACTCTX_SECTION_KEYED_DATA data;
76 DWORD written;
78 ACTCTXA ctx;
80 BOOL ret;
81
82 /* create manifest */
85 {
86 ret = (WriteFile( file, manifest, sizeof(manifest)-1, &written, NULL ) &&
87 written == sizeof(manifest)-1);
89 if (!ret)
90 {
92 skip("Failed to fill manifest file. Skipping comctl32 V6 tests.\n");
93 return FALSE;
94 }
95 else
96 trace("created %s\n", manifest_name);
97 }
98 else
99 {
100 skip("Failed to create manifest file. Skipping comctl32 V6 tests.\n");
101 return FALSE;
102 }
103
104 memset(&ctx, 0, sizeof(ctx));
105 ctx.cbSize = sizeof(ctx);
106 ctx.lpSource = manifest_name;
107
108 *hCtx = CreateActCtxA(&ctx);
109 ok(*hCtx != 0, "Expected context handle\n");
110
111 hmod = GetModuleHandleA("comctl32.dll");
112
113 ret = ActivateActCtx(*hCtx, pcookie);
114 ok(ret, "Failed to activate context, error %d.\n", GetLastError());
115
116 if (!ret)
117 {
118 win_skip("A problem during context activation occurred.\n");
120 }
121
122 data.cbSize = sizeof(data);
123 ret = FindActCtxSectionStringA(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
124 "comctl32.dll", &data);
125 ok(ret, "failed to find comctl32.dll in active context, %u\n", GetLastError());
126 if (ret)
127 {
129 LoadLibraryA("comctl32.dll");
130 }
131
132 return ret;
133}
134
135#undef ARCH
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define FreeLibrary(x)
Definition: compat.h:748
VOID WINAPI ReleaseActCtx(IN HANDLE hActCtx)
Definition: actctx.c:208
BOOL WINAPI DeactivateActCtx(IN DWORD dwFlags, IN ULONG_PTR ulCookie)
Definition: actctx.c:268
BOOL WINAPI ActivateActCtx(IN HANDLE hActCtx, OUT PULONG_PTR ulCookie)
Definition: actctx.c:237
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
HANDLE WINAPI CreateActCtxA(PCACTCTXA pActCtx)
Definition: actctx.c:26
BOOL WINAPI FindActCtxSectionStringA(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, LPCSTR lpSearchStr, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define CREATE_ALWAYS
Definition: disk.h:72
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143
#define GENERIC_WRITE
Definition: nt_native.h:90
#define win_skip
Definition: test.h:163
#define memset(x, y, z)
Definition: compat.h:39
Definition: cookie.c:34
Definition: fci.c:127
uint32_t ULONG_PTR
Definition: typedefs.h:65
static BOOL load_v6_module(ULONG_PTR *pcookie, HANDLE *hCtx)
Definition: v6util.h:73
#define ARCH
Definition: v6util.h:36
static const CHAR manifest[]
Definition: v6util.h:41
static const CHAR manifest_name[]
Definition: v6util.h:39
static void unload_v6_module(ULONG_PTR cookie, HANDLE hCtx)
Definition: v6util.h:65
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
char CHAR
Definition: xmlstorage.h:175