2 * Copyright 2007 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "wine/test.h"
27 static BOOL (WINAPI *pActivateActCtx)(HANDLE,ULONG_PTR*);
28 static HANDLE (WINAPI *pCreateActCtxW)(PCACTCTXW);
29 static BOOL (WINAPI *pDeactivateActCtx)(DWORD,ULONG_PTR);
30 static BOOL (WINAPI *pFindActCtxSectionStringW)(DWORD,const GUID *,ULONG,LPCWSTR,PACTCTX_SECTION_KEYED_DATA);
31 static BOOL (WINAPI *pGetCurrentActCtx)(HANDLE *);
32 static BOOL (WINAPI *pQueryActCtxW)(DWORD,HANDLE,PVOID,ULONG,PVOID,SIZE_T,SIZE_T*);
33 static VOID (WINAPI *pReleaseActCtx)(HANDLE);
35 static const char* strw(LPCWSTR x)
37 static char buffer[1024];
40 if (!x) return "(nil)";
41 else while ((*p++ = *x++));
45 static const char manifest1[] =
46 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
47 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
50 static const char manifest2[] =
51 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
52 "<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\">"
56 "<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"x86\">"
58 "</dependentAssembly>"
62 static const char manifest3[] =
63 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
64 "<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\""
65 " publicKeyToken=\"6595b6414666f1df\" />"
66 "<file name=\"testlib.dll\">"
67 "<windowClass>wndClass</windowClass>"
71 static const char manifest4[] =
72 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
73 "<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\">"
77 "<assemblyIdentity type=\"win32\" name=\"Microsoft.Windows.Common-Controls\" "
78 "version=\"6.0.0.0\" processorArchitecture=\"x86\" publicKeyToken=\"6595b64144ccf1df\">"
80 "</dependentAssembly>"
84 static const char testdep_manifest1[] =
85 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
86 "<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"x86\"/>"
89 static const char testdep_manifest2[] =
90 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
91 "<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"x86\" />"
92 "<file name=\"testlib.dll\"></file>"
93 "<file name=\"testlib2.dll\" hash=\"63c978c2b53d6cf72b42fb7308f9af12ab19ec53\" hashalg=\"SHA1\" />"
96 static const char testdep_manifest3[] =
97 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\"> "
98 "<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"x86\"/>"
99 "<file name=\"testlib.dll\"/>"
100 "<file name=\"testlib2.dll\" hash=\"63c978c2b53d6cf72b42fb7308f9af12ab19ec53\" hashalg=\"SHA1\">"
101 "<windowClass>wndClass</windowClass>"
102 "<windowClass>wndClass2</windowClass>"
106 static const char wrong_manifest1[] =
107 "<assembly manifestVersion=\"1.0\">"
108 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
111 static const char wrong_manifest2[] =
112 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\">"
113 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
116 static const char wrong_manifest3[] =
117 "<assembly test=\"test\" xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
118 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
121 static const char wrong_manifest4[] =
122 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
123 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
127 static const char wrong_manifest5[] =
128 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
129 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
133 static const char wrong_manifest6[] =
134 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v5\" manifestVersion=\"1.0\">"
135 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
138 static const char wrong_manifest7[] =
139 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
140 "<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"x86\" />"
141 "<file name=\"testlib.dll\" hash=\"63c978c2b53d6cf72b42fb7308f9af12ab19ec5\" hashalg=\"SHA1\" />"
144 static const char wrong_manifest8[] =
145 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
146 "<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
150 static const char wrong_depmanifest1[] =
151 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
152 "<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.4\" processorArchitecture=\"x86\" />"
155 static const WCHAR testlib_dll[] =
156 {'t','e','s','t','l','i','b','.','d','l','l',0};
157 static const WCHAR testlib2_dll[] =
158 {'t','e','s','t','l','i','b','2','.','d','l','l',0};
159 static const WCHAR wndClassW[] =
160 {'w','n','d','C','l','a','s','s',0};
161 static const WCHAR wndClass2W[] =
162 {'w','n','d','C','l','a','s','s','2',0};
163 static const WCHAR acr_manifest[] =
164 {'a','c','r','.','m','a','n','i','f','e','s','t',0};
166 static WCHAR app_dir[MAX_PATH], exe_path[MAX_PATH], work_dir[MAX_PATH], work_dir_subdir[MAX_PATH];
167 static WCHAR app_manifest_path[MAX_PATH], manifest_path[MAX_PATH], depmanifest_path[MAX_PATH];
169 static int strcmp_aw(LPCWSTR strw, const char *stra)
174 MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, sizeof(buf)/sizeof(WCHAR));
175 return lstrcmpW(strw, buf);
178 static DWORD strlen_aw(const char *str)
180 return MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0) - 1;
183 static BOOL create_manifest_file(const char *filename, const char *manifest, int manifest_len,
184 const char *depfile, const char *depmanifest)
188 WCHAR path[MAX_PATH];
190 MultiByteToWideChar( CP_ACP, 0, filename, -1, path, MAX_PATH );
191 GetFullPathNameW(path, sizeof(manifest_path)/sizeof(WCHAR), manifest_path, NULL);
193 if (manifest_len == -1)
194 manifest_len = strlen(manifest);
196 file = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
197 FILE_ATTRIBUTE_NORMAL, NULL);
198 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
199 if(file == INVALID_HANDLE_VALUE)
201 WriteFile(file, manifest, manifest_len, &size, NULL);
206 MultiByteToWideChar( CP_ACP, 0, depfile, -1, path, MAX_PATH );
207 GetFullPathNameW(path, sizeof(depmanifest_path)/sizeof(WCHAR), depmanifest_path, NULL);
208 file = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
209 FILE_ATTRIBUTE_NORMAL, NULL);
210 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
211 if(file == INVALID_HANDLE_VALUE)
213 WriteFile(file, depmanifest, strlen(depmanifest), &size, NULL);
219 static BOOL create_wide_manifest(const char *filename, const char *manifest, BOOL fBOM)
221 WCHAR *wmanifest = HeapAlloc(GetProcessHeap(), 0, (strlen(manifest)+2) * sizeof(WCHAR));
223 int offset = (fBOM ? 0 : 1);
225 MultiByteToWideChar(CP_ACP, 0, manifest, -1, &wmanifest[1], (strlen(manifest)+1) * sizeof(WCHAR));
226 wmanifest[0] = 0xfeff;
227 ret = create_manifest_file(filename, (char *)&wmanifest[offset], (strlen(manifest)+1-offset) * sizeof(WCHAR), NULL, NULL);
228 HeapFree(GetProcessHeap(), 0, wmanifest);
233 ULONG format_version;
235 ULONG root_manifest_type;
236 LPWSTR root_manifest_path;
237 ULONG root_config_type;
242 static const detailed_info_t detailed_info0 = {
243 0, 0, 0, NULL, 0, 0, NULL
246 static const detailed_info_t detailed_info1 = {
247 1, 1, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, manifest_path,
248 ACTIVATION_CONTEXT_PATH_TYPE_NONE, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE,
252 static const detailed_info_t detailed_info1_child = {
253 1, 1, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, app_manifest_path,
254 ACTIVATION_CONTEXT_PATH_TYPE_NONE, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE,
258 static const detailed_info_t detailed_info2 = {
259 1, 2, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, manifest_path,
260 ACTIVATION_CONTEXT_PATH_TYPE_NONE, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE,
264 static void test_detailed_info(HANDLE handle, const detailed_info_t *exinfo)
266 ACTIVATION_CONTEXT_DETAILED_INFORMATION detailed_info_tmp, *detailed_info;
267 SIZE_T size, exsize, retsize;
270 exsize = sizeof(ACTIVATION_CONTEXT_DETAILED_INFORMATION)
271 + (exinfo->root_manifest_path ? (lstrlenW(exinfo->root_manifest_path)+1)*sizeof(WCHAR):0)
272 + (exinfo->app_dir ? (lstrlenW(exinfo->app_dir)+1)*sizeof(WCHAR) : 0);
274 if(exsize != sizeof(ACTIVATION_CONTEXT_DETAILED_INFORMATION)) {
276 b = pQueryActCtxW(0, handle, NULL,
277 ActivationContextDetailedInformation, &detailed_info_tmp,
278 sizeof(detailed_info_tmp), &size);
279 ok(!b, "QueryActCtx succeeded\n");
280 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() = %u\n", GetLastError());
281 ok(size == exsize, "size=%ld, expected %ld\n", size, exsize);
283 size = sizeof(ACTIVATION_CONTEXT_DETAILED_INFORMATION);
286 detailed_info = HeapAlloc(GetProcessHeap(), 0, size);
287 memset(detailed_info, 0xfe, size);
288 b = pQueryActCtxW(0, handle, NULL,
289 ActivationContextDetailedInformation, detailed_info,
291 ok(b, "QueryActCtx failed: %u\n", GetLastError());
292 ok(retsize == exsize, "size=%ld, expected %ld\n", retsize, exsize);
294 ok(detailed_info->dwFlags == 0, "detailed_info->dwFlags=%x\n", detailed_info->dwFlags);
295 ok(detailed_info->ulFormatVersion == exinfo->format_version,
296 "detailed_info->ulFormatVersion=%u, expected %u\n", detailed_info->ulFormatVersion,
297 exinfo->format_version);
298 ok(detailed_info->ulAssemblyCount == exinfo->assembly_cnt,
299 "detailed_info->ulAssemblyCount=%u, expected %u\n", detailed_info->ulAssemblyCount,
300 exinfo->assembly_cnt);
301 ok(detailed_info->ulRootManifestPathType == exinfo->root_manifest_type,
302 "detailed_info->ulRootManifestPathType=%u, expected %u\n",
303 detailed_info->ulRootManifestPathType, exinfo->root_manifest_type);
304 ok(detailed_info->ulRootManifestPathChars ==
305 (exinfo->root_manifest_path ? lstrlenW(exinfo->root_manifest_path) : 0),
306 "detailed_info->ulRootManifestPathChars=%u, expected %u\n",
307 detailed_info->ulRootManifestPathChars,
308 exinfo->root_manifest_path ?lstrlenW(exinfo->root_manifest_path) : 0);
309 ok(detailed_info->ulRootConfigurationPathType == exinfo->root_config_type,
310 "detailed_info->ulRootConfigurationPathType=%u, expected %u\n",
311 detailed_info->ulRootConfigurationPathType, exinfo->root_config_type);
312 ok(detailed_info->ulRootConfigurationPathChars == 0,
313 "detailed_info->ulRootConfigurationPathChars=%d\n", detailed_info->ulRootConfigurationPathChars);
314 ok(detailed_info->ulAppDirPathType == exinfo->app_dir_type,
315 "detailed_info->ulAppDirPathType=%u, expected %u\n", detailed_info->ulAppDirPathType,
316 exinfo->app_dir_type);
317 ok(detailed_info->ulAppDirPathChars == (exinfo->app_dir ? lstrlenW(exinfo->app_dir) : 0),
318 "detailed_info->ulAppDirPathChars=%u, expected %u\n",
319 detailed_info->ulAppDirPathChars, exinfo->app_dir ? lstrlenW(exinfo->app_dir) : 0);
320 if(exinfo->root_manifest_path) {
321 ok(detailed_info->lpRootManifestPath != NULL, "detailed_info->lpRootManifestPath == NULL\n");
322 if(detailed_info->lpRootManifestPath)
323 ok(!lstrcmpiW(detailed_info->lpRootManifestPath, exinfo->root_manifest_path),
324 "unexpected detailed_info->lpRootManifestPath\n");
326 ok(detailed_info->lpRootManifestPath == NULL, "detailed_info->lpRootManifestPath != NULL\n");
328 ok(detailed_info->lpRootConfigurationPath == NULL,
329 "detailed_info->lpRootConfigurationPath=%p\n", detailed_info->lpRootConfigurationPath);
330 if(exinfo->app_dir) {
331 ok(detailed_info->lpAppDirPath != NULL, "detailed_info->lpAppDirPath == NULL\n");
332 if(detailed_info->lpAppDirPath)
333 ok(!lstrcmpiW(exinfo->app_dir, detailed_info->lpAppDirPath),
334 "unexpected detailed_info->lpAppDirPath\n%s\n",strw(detailed_info->lpAppDirPath));
336 ok(detailed_info->lpAppDirPath == NULL, "detailed_info->lpAppDirPath != NULL\n");
339 HeapFree(GetProcessHeap(), 0, detailed_info);
344 /* ULONG manifest_path_type; FIXME */
345 LPCWSTR manifest_path;
346 LPCSTR encoded_assembly_id;
347 BOOL has_assembly_dir;
350 static const info_in_assembly manifest1_info = {
352 "Wine.Test,type=\"win32\",version=\"1.0.0.0\"",
356 static const info_in_assembly manifest1_child_info = {
357 1, app_manifest_path,
358 "Wine.Test,type=\"win32\",version=\"1.0.0.0\"",
362 static const info_in_assembly manifest2_info = {
364 "Wine.Test,type=\"win32\",version=\"1.2.3.4\"",
368 static const info_in_assembly manifest3_info = {
370 "Wine.Test,publicKeyToken=\"6595b6414666f1df\",type=\"win32\",version=\"1.2.3.4\"",
374 static const info_in_assembly manifest4_info = {
376 "Wine.Test,type=\"win32\",version=\"1.2.3.4\"",
380 static const info_in_assembly depmanifest1_info = {
381 0x10, depmanifest_path,
382 "testdep,processorArchitecture=\"x86\","
383 "type=\"win32\",version=\"6.5.4.3\"",
387 static const info_in_assembly depmanifest2_info = {
388 0x10, depmanifest_path,
389 "testdep,processorArchitecture=\"x86\","
390 "type=\"win32\",version=\"6.5.4.3\"",
394 static const info_in_assembly depmanifest3_info = {
395 0x10, depmanifest_path,
396 "testdep,processorArchitecture=\"x86\",type=\"win32\",version=\"6.5.4.3\"",
400 static const info_in_assembly manifest_comctrl_info = {
401 0, NULL, NULL, TRUE /* These values may differ between Windows installations */
404 static void test_info_in_assembly(HANDLE handle, DWORD id, const info_in_assembly *exinfo)
406 ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *info, info_tmp;
411 exsize = sizeof(ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION);
412 if (exinfo->manifest_path) exsize += (lstrlenW(exinfo->manifest_path)+1) * sizeof(WCHAR);
413 if (exinfo->encoded_assembly_id) exsize += (strlen_aw(exinfo->encoded_assembly_id) + 1) * sizeof(WCHAR);
416 b = pQueryActCtxW(0, handle, &id,
417 AssemblyDetailedInformationInActivationContext, &info_tmp,
418 sizeof(info_tmp), &size);
419 ok(!b, "QueryActCtx succeeded\n");
420 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() = %u\n", GetLastError());
422 ok(size >= exsize, "size=%lu, expected %lu\n", size, exsize);
424 if (size == 0xdeadbeef)
430 info = HeapAlloc(GetProcessHeap(), 0, size);
431 memset(info, 0xfe, size);
434 b = pQueryActCtxW(0, handle, &id,
435 AssemblyDetailedInformationInActivationContext, info, size, &size);
436 ok(b, "QueryActCtx failed: %u\n", GetLastError());
437 if (!exinfo->manifest_path)
438 exsize += info->ulManifestPathLength + sizeof(WCHAR);
439 if (!exinfo->encoded_assembly_id)
440 exsize += info->ulEncodedAssemblyIdentityLength + sizeof(WCHAR);
441 if (exinfo->has_assembly_dir)
442 exsize += info->ulAssemblyDirectoryNameLength + sizeof(WCHAR);
443 ok(size == exsize, "size=%lu, expected %lu\n", size, exsize);
445 if (0) /* FIXME: flags meaning unknown */
447 ok((info->ulFlags) == exinfo->flags, "info->ulFlags = %x, expected %x\n",
448 info->ulFlags, exinfo->flags);
450 if(exinfo->encoded_assembly_id) {
451 len = strlen_aw(exinfo->encoded_assembly_id)*sizeof(WCHAR);
452 ok(info->ulEncodedAssemblyIdentityLength == len,
453 "info->ulEncodedAssemblyIdentityLength = %u, expected %u\n",
454 info->ulEncodedAssemblyIdentityLength, len);
456 ok(info->ulEncodedAssemblyIdentityLength != 0,
457 "info->ulEncodedAssemblyIdentityLength == 0\n");
459 ok(info->ulManifestPathType == ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE,
460 "info->ulManifestPathType = %x\n", info->ulManifestPathType);
461 if(exinfo->manifest_path) {
462 len = lstrlenW(exinfo->manifest_path)*sizeof(WCHAR);
463 ok(info->ulManifestPathLength == len, "info->ulManifestPathLength = %u, expected %u\n",
464 info->ulManifestPathLength, len);
466 ok(info->ulManifestPathLength != 0, "info->ulManifestPathLength == 0\n");
469 ok(info->ulPolicyPathType == ACTIVATION_CONTEXT_PATH_TYPE_NONE,
470 "info->ulPolicyPathType = %x\n", info->ulPolicyPathType);
471 ok(info->ulPolicyPathLength == 0,
472 "info->ulPolicyPathLength = %u, expected 0\n", info->ulPolicyPathLength);
473 ok(info->ulMetadataSatelliteRosterIndex == 0, "info->ulMetadataSatelliteRosterIndex = %x\n",
474 info->ulMetadataSatelliteRosterIndex);
475 ok(info->ulManifestVersionMajor == 1,"info->ulManifestVersionMajor = %x\n",
476 info->ulManifestVersionMajor);
477 ok(info->ulManifestVersionMinor == 0, "info->ulManifestVersionMinor = %x\n",
478 info->ulManifestVersionMinor);
479 ok(info->ulPolicyVersionMajor == 0, "info->ulPolicyVersionMajor = %x\n",
480 info->ulPolicyVersionMajor);
481 ok(info->ulPolicyVersionMinor == 0, "info->ulPolicyVersionMinor = %x\n",
482 info->ulPolicyVersionMinor);
483 if(exinfo->has_assembly_dir)
484 ok(info->ulAssemblyDirectoryNameLength != 0,
485 "info->ulAssemblyDirectoryNameLength == 0\n");
487 ok(info->ulAssemblyDirectoryNameLength == 0,
488 "info->ulAssemblyDirectoryNameLength != 0\n");
490 ok(info->lpAssemblyEncodedAssemblyIdentity != NULL,
491 "info->lpAssemblyEncodedAssemblyIdentity == NULL\n");
492 if(info->lpAssemblyEncodedAssemblyIdentity && exinfo->encoded_assembly_id) {
493 ok(!strcmp_aw(info->lpAssemblyEncodedAssemblyIdentity, exinfo->encoded_assembly_id),
494 "unexpected info->lpAssemblyEncodedAssemblyIdentity %s / %s\n",
495 strw(info->lpAssemblyEncodedAssemblyIdentity), exinfo->encoded_assembly_id);
497 if(exinfo->manifest_path) {
498 ok(info->lpAssemblyManifestPath != NULL, "info->lpAssemblyManifestPath == NULL\n");
499 if(info->lpAssemblyManifestPath)
500 ok(!lstrcmpiW(info->lpAssemblyManifestPath, exinfo->manifest_path),
501 "unexpected info->lpAssemblyManifestPath\n");
503 ok(info->lpAssemblyManifestPath != NULL, "info->lpAssemblyManifestPath == NULL\n");
506 ok(info->lpAssemblyPolicyPath == NULL, "info->lpAssemblyPolicyPath != NULL\n");
507 if(info->lpAssemblyPolicyPath)
508 ok(*(WORD*)info->lpAssemblyPolicyPath == 0, "info->lpAssemblyPolicyPath is not empty\n");
509 if(exinfo->has_assembly_dir)
510 ok(info->lpAssemblyDirectoryName != NULL, "info->lpAssemblyDirectoryName == NULL\n");
512 ok(info->lpAssemblyDirectoryName == NULL, "info->lpAssemblyDirectoryName = %s\n",
513 strw(info->lpAssemblyDirectoryName));
516 static void test_file_info(HANDLE handle, ULONG assid, ULONG fileid, LPCWSTR filename)
518 ASSEMBLY_FILE_DETAILED_INFORMATION *info, info_tmp;
519 ACTIVATION_CONTEXT_QUERY_INDEX index = {assid, fileid};
523 exsize = sizeof(ASSEMBLY_FILE_DETAILED_INFORMATION)
524 +(lstrlenW(filename)+1)*sizeof(WCHAR);
527 b = pQueryActCtxW(0, handle, &index,
528 FileInformationInAssemblyOfAssemblyInActivationContext, &info_tmp,
529 sizeof(info_tmp), &size);
530 ok(!b, "QueryActCtx succeeded\n");
531 ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() = %u\n", GetLastError());
532 ok(size == exsize, "size=%lu, expected %lu\n", size, exsize);
534 if(size == 0xdeadbeef)
540 info = HeapAlloc(GetProcessHeap(), 0, size);
541 memset(info, 0xfe, size);
543 b = pQueryActCtxW(0, handle, &index,
544 FileInformationInAssemblyOfAssemblyInActivationContext, info, size, &size);
545 ok(b, "QueryActCtx failed: %u\n", GetLastError());
546 ok(!size, "size=%lu, expected 0\n", size);
548 ok(info->ulFlags == 2, "info->ulFlags=%x, expected 2\n", info->ulFlags);
549 ok(info->ulFilenameLength == lstrlenW(filename)*sizeof(WCHAR),
550 "info->ulFilenameLength=%u, expected %u\n",
551 info->ulFilenameLength, lstrlenW(filename)*sizeof(WCHAR));
552 ok(info->ulPathLength == 0, "info->ulPathLength=%u\n", info->ulPathLength);
553 ok(info->lpFileName != NULL, "info->lpFileName == NULL\n");
555 ok(!lstrcmpiW(info->lpFileName, filename), "unexpected info->lpFileName\n");
556 ok(info->lpFilePath == NULL, "info->lpFilePath != NULL\n");
559 static HANDLE test_create(const char *file, const char *manifest)
563 WCHAR path[MAX_PATH];
565 MultiByteToWideChar( CP_ACP, 0, file, -1, path, MAX_PATH );
566 memset(&actctx, 0, sizeof(ACTCTXW));
567 actctx.cbSize = sizeof(ACTCTXW);
568 actctx.lpSource = path;
570 handle = pCreateActCtxW(&actctx);
571 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
573 ok(actctx.cbSize == sizeof(actctx), "actctx.cbSize=%d\n", actctx.cbSize);
574 ok(actctx.dwFlags == 0, "actctx.=%d\n", actctx.dwFlags);
575 ok(actctx.lpSource == path, "actctx.lpSource=%p\n", actctx.lpSource);
576 ok(actctx.wProcessorArchitecture == 0,
577 "actctx.wProcessorArchitecture=%d\n", actctx.wProcessorArchitecture);
578 ok(actctx.wLangId == 0, "actctx.wLangId=%d\n", actctx.wLangId);
579 ok(actctx.lpAssemblyDirectory == NULL,
580 "actctx.lpAssemblyDirectory=%p\n", actctx.lpAssemblyDirectory);
581 ok(actctx.lpResourceName == NULL, "actctx.lpResourceName=%p\n", actctx.lpResourceName);
582 ok(actctx.lpApplicationName == NULL, "actctx.lpApplocationName=%p\n",
583 actctx.lpApplicationName);
584 ok(actctx.hModule == NULL, "actctx.hModule=%p\n", actctx.hModule);
589 static void test_create_and_fail(const char *manifest, const char *depmanifest, int todo)
593 WCHAR path[MAX_PATH];
595 MultiByteToWideChar( CP_ACP, 0, "bad.manifest", -1, path, MAX_PATH );
596 memset(&actctx, 0, sizeof(ACTCTXW));
597 actctx.cbSize = sizeof(ACTCTXW);
598 actctx.lpSource = path;
600 create_manifest_file("bad.manifest", manifest, -1, "testdep.manifest", depmanifest);
601 handle = pCreateActCtxW(&actctx);
604 ok(handle == INVALID_HANDLE_VALUE, "handle != INVALID_HANDLE_VALUE\n");
605 ok(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX, "GetLastError == %u\n", GetLastError());
609 ok(handle == INVALID_HANDLE_VALUE, "handle != INVALID_HANDLE_VALUE\n");
610 ok(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX, "GetLastError == %u\n", GetLastError());
612 if (handle != INVALID_HANDLE_VALUE) pReleaseActCtx( handle );
613 DeleteFileA("bad.manifest");
614 DeleteFileA("testdep.manifest");
617 static void test_create_wide_and_fail(const char *manifest, BOOL fBOM)
621 WCHAR path[MAX_PATH];
623 MultiByteToWideChar( CP_ACP, 0, "bad.manifest", -1, path, MAX_PATH );
624 memset(&actctx, 0, sizeof(ACTCTXW));
625 actctx.cbSize = sizeof(ACTCTXW);
626 actctx.lpSource = path;
628 create_wide_manifest("bad.manifest", manifest, fBOM);
629 handle = pCreateActCtxW(&actctx);
630 ok(handle == INVALID_HANDLE_VALUE, "handle != INVALID_HANDLE_VALUE\n");
631 ok(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX, "GetLastError == %u\n", GetLastError());
633 if (handle != INVALID_HANDLE_VALUE) pReleaseActCtx( handle );
634 DeleteFileA("bad.manifest");
637 static void test_create_fail(void)
641 WCHAR path[MAX_PATH];
643 MultiByteToWideChar( CP_ACP, 0, "nonexistent.manifest", -1, path, MAX_PATH );
644 memset(&actctx, 0, sizeof(ACTCTXW));
645 actctx.cbSize = sizeof(ACTCTXW);
646 actctx.lpSource = path;
648 handle = pCreateActCtxW(&actctx);
649 ok(handle == INVALID_HANDLE_VALUE, "handle != INVALID_HANDLE_VALUE\n");
650 ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError == %u\n", GetLastError());
652 trace("wrong_manifest1\n");
653 test_create_and_fail(wrong_manifest1, NULL, 0 );
654 trace("wrong_manifest2\n");
655 test_create_and_fail(wrong_manifest2, NULL, 0 );
656 trace("wrong_manifest3\n");
657 test_create_and_fail(wrong_manifest3, NULL, 1 );
658 trace("wrong_manifest4\n");
659 test_create_and_fail(wrong_manifest4, NULL, 1 );
660 trace("wrong_manifest5\n");
661 test_create_and_fail(wrong_manifest5, NULL, 0 );
662 trace("wrong_manifest6\n");
663 test_create_and_fail(wrong_manifest6, NULL, 0 );
664 trace("wrong_manifest7\n");
665 test_create_and_fail(wrong_manifest7, NULL, 1 );
666 trace("wrong_manifest8\n");
667 test_create_and_fail(wrong_manifest8, NULL, 0 );
668 trace("UTF-16 manifest1 without BOM\n");
669 test_create_wide_and_fail(manifest1, FALSE );
670 trace("manifest2\n");
671 test_create_and_fail(manifest2, NULL, 0 );
672 trace("manifest2+depmanifest1\n");
673 test_create_and_fail(manifest2, wrong_depmanifest1, 0 );
676 static void test_find_dll_redirection(HANDLE handle, LPCWSTR libname, ULONG exid)
678 ACTCTX_SECTION_KEYED_DATA data;
682 memset(&data, 0xfe, sizeof(data));
683 data.cbSize = sizeof(data);
685 ret = pFindActCtxSectionStringW(0, NULL,
686 ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
688 ok(ret, "FindActCtxSectionStringW failed: %u\n", GetLastError());
691 skip("couldn't find %s\n",strw(libname));
695 ok(data.cbSize == sizeof(data), "data.cbSize=%u\n", data.cbSize);
696 ok(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%u\n", data.ulDataFormatVersion);
697 ok(data.lpData != NULL, "data.lpData == NULL\n");
698 ok(data.ulLength == 20, "data.ulLength=%u\n", data.ulLength);
701 if(ret && p) todo_wine {
702 ok(p[0] == 20 && p[1] == 2 && p[2] == 0 && p[3] == 0 && p[4] == 0,
703 "wrong data %u,%u,%u,%u,%u\n",p[0], p[1], p[2], p[3], p[4]);
706 ok(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
707 ok(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%u\n",
708 data.ulSectionGlobalDataLength);
709 ok(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
710 /* ok(data.ulSectionTotalLength == ??, "data.ulSectionTotalLength=%u\n",
711 data.ulSectionTotalLength); */
712 ok(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx);
713 ok(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%u, expected %u\n",
714 data.ulAssemblyRosterIndex, exid);
716 memset(&data, 0xfe, sizeof(data));
717 data.cbSize = sizeof(data);
719 ret = pFindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL,
720 ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
722 ok(ret, "FindActCtxSectionStringW failed: %u\n", GetLastError());
725 skip("couldn't find\n");
729 ok(data.cbSize == sizeof(data), "data.cbSize=%u\n", data.cbSize);
730 ok(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%u\n", data.ulDataFormatVersion);
731 ok(data.lpData != NULL, "data.lpData == NULL\n");
732 ok(data.ulLength == 20, "data.ulLength=%u\n", data.ulLength);
733 ok(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
734 ok(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%u\n",
735 data.ulSectionGlobalDataLength);
736 ok(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
737 /* ok(data.ulSectionTotalLength == ?? , "data.ulSectionTotalLength=%u\n",
738 data.ulSectionTotalLength); */
739 ok(data.hActCtx == handle, "data.hActCtx=%p\n", data.hActCtx);
740 ok(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%u, expected %u\n",
741 data.ulAssemblyRosterIndex, exid);
743 pReleaseActCtx(handle);
746 static void test_find_window_class(HANDLE handle, LPCWSTR clsname, ULONG exid)
748 ACTCTX_SECTION_KEYED_DATA data;
751 memset(&data, 0xfe, sizeof(data));
752 data.cbSize = sizeof(data);
754 ret = pFindActCtxSectionStringW(0, NULL,
755 ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION,
757 ok(ret, "FindActCtxSectionStringW failed: %u\n", GetLastError());
760 skip("couldn't find\n");
764 ok(data.cbSize == sizeof(data), "data.cbSize=%u\n", data.cbSize);
765 ok(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%u\n", data.ulDataFormatVersion);
766 ok(data.lpData != NULL, "data.lpData == NULL\n");
767 /* ok(data.ulLength == ??, "data.ulLength=%u\n", data.ulLength); */
768 ok(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
769 ok(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%u\n",
770 data.ulSectionGlobalDataLength);
771 ok(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
772 /* ok(data.ulSectionTotalLength == 0, "data.ulSectionTotalLength=%u\n",
773 data.ulSectionTotalLength); FIXME */
774 ok(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx);
775 ok(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%u, expected %u\n",
776 data.ulAssemblyRosterIndex, exid);
778 memset(&data, 0xfe, sizeof(data));
779 data.cbSize = sizeof(data);
781 ret = pFindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL,
782 ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION,
784 ok(ret, "FindActCtxSectionStringW failed: %u\n", GetLastError());
787 skip("couldn't find\n");
791 ok(data.cbSize == sizeof(data), "data.cbSize=%u\n", data.cbSize);
792 ok(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%u\n", data.ulDataFormatVersion);
793 ok(data.lpData != NULL, "data.lpData == NULL\n");
794 /* ok(data.ulLength == ??, "data.ulLength=%u\n", data.ulLength); FIXME */
795 ok(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
796 ok(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%u\n",
797 data.ulSectionGlobalDataLength);
798 ok(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
799 /* ok(data.ulSectionTotalLength == 0, "data.ulSectionTotalLength=%u\n",
800 data.ulSectionTotalLength); FIXME */
801 ok(data.hActCtx == handle, "data.hActCtx=%p\n", data.hActCtx);
802 ok(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%u, expected %u\n",
803 data.ulAssemblyRosterIndex, exid);
805 pReleaseActCtx(handle);
808 static void test_find_string_fail(void)
810 ACTCTX_SECTION_KEYED_DATA data = {sizeof(data)};
813 ret = pFindActCtxSectionStringW(0, NULL, 100, testlib_dll, &data);
814 ok(!ret, "FindActCtxSectionStringW succeeded\n");
815 ok(GetLastError() == ERROR_SXS_SECTION_NOT_FOUND, "GetLastError()=%u\n", GetLastError());
817 ret = pFindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
818 testlib2_dll, &data);
819 ok(!ret, "FindActCtxSectionStringW succeeded\n");
820 ok(GetLastError() == ERROR_SXS_KEY_NOT_FOUND, "GetLastError()=%u\n", GetLastError());
822 ret = pFindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
824 ok(!ret, "FindActCtxSectionStringW succeeded\n");
825 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()=%u\n", GetLastError());
827 ret = pFindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
829 ok(!ret, "FindActCtxSectionStringW succeeded\n");
830 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()=%u\n", GetLastError());
833 ret = pFindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
835 ok(!ret, "FindActCtxSectionStringW succeeded\n");
836 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()=%u\n", GetLastError());
839 ret = pFindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
841 ok(!ret, "FindActCtxSectionStringW succeeded\n");
842 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()=%u\n", GetLastError());
845 static void test_actctx(void)
853 trace("default actctx\n");
855 b = pGetCurrentActCtx(&handle);
856 ok(handle == NULL, "handle = %p, expected NULL\n", handle);
857 ok(b, "GetCurrentActCtx failed: %u\n", GetLastError());
859 test_detailed_info(handle, &detailed_info0);
860 pReleaseActCtx(handle);
863 if(!create_manifest_file("test1.manifest", manifest1, -1, NULL, NULL)) {
864 skip("Could not create manifest file\n");
868 trace("manifest1\n");
870 handle = test_create("test1.manifest", manifest1);
871 DeleteFileA("test1.manifest");
872 if(handle != INVALID_HANDLE_VALUE) {
873 test_detailed_info(handle, &detailed_info1);
874 test_info_in_assembly(handle, 1, &manifest1_info);
876 if (!IsDebuggerPresent()) /* CloseHandle will generate an exception if a debugger is present */
878 b = CloseHandle(handle);
879 ok(!b, "CloseHandle succeeded\n");
880 ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() == %u\n", GetLastError());
883 pReleaseActCtx(handle);
886 if(!create_manifest_file("test2.manifest", manifest2, -1, "testdep.manifest", testdep_manifest1)) {
887 skip("Could not create manifest file\n");
891 trace("manifest2 depmanifest1\n");
893 handle = test_create("test2.manifest", manifest2);
894 DeleteFileA("test2.manifest");
895 DeleteFileA("testdep.manifest");
896 if(handle != INVALID_HANDLE_VALUE) {
897 test_detailed_info(handle, &detailed_info2);
898 test_info_in_assembly(handle, 1, &manifest2_info);
899 test_info_in_assembly(handle, 2, &depmanifest1_info);
900 pReleaseActCtx(handle);
903 if(!create_manifest_file("test3.manifest", manifest2, -1, "testdep.manifest", testdep_manifest2)) {
904 skip("Could not create manifest file\n");
908 trace("manifest2 depmanifest2\n");
910 handle = test_create("test3.manifest", manifest2);
911 DeleteFileA("test3.manifest");
912 DeleteFileA("testdep.manifest");
913 if(handle != INVALID_HANDLE_VALUE) {
914 test_detailed_info(handle, &detailed_info2);
915 test_info_in_assembly(handle, 1, &manifest2_info);
916 test_info_in_assembly(handle, 2, &depmanifest2_info);
917 test_file_info(handle, 1, 0, testlib_dll);
918 test_file_info(handle, 1, 1, testlib2_dll);
920 b = pActivateActCtx(handle, &cookie);
921 ok(b, "ActivateActCtx failed: %u\n", GetLastError());
922 test_find_dll_redirection(handle, testlib_dll, 2);
923 test_find_dll_redirection(handle, testlib2_dll, 2);
924 b = pDeactivateActCtx(0, cookie);
925 ok(b, "DeactivateActCtx failed: %u\n", GetLastError());
927 pReleaseActCtx(handle);
930 trace("manifest2 depmanifest3\n");
932 if(!create_manifest_file("test2-3.manifest", manifest2, -1, "testdep.manifest", testdep_manifest3)) {
933 skip("Could not create manifest file\n");
937 handle = test_create("test2-3.manifest", manifest2);
938 DeleteFileA("test2-3.manifest");
939 DeleteFileA("testdep.manifest");
940 if(handle != INVALID_HANDLE_VALUE) {
941 test_detailed_info(handle, &detailed_info2);
942 test_info_in_assembly(handle, 1, &manifest2_info);
943 test_info_in_assembly(handle, 2, &depmanifest3_info);
944 test_file_info(handle, 1, 0, testlib_dll);
945 test_file_info(handle, 1, 1, testlib2_dll);
947 b = pActivateActCtx(handle, &cookie);
948 ok(b, "ActivateActCtx failed: %u\n", GetLastError());
949 test_find_dll_redirection(handle, testlib_dll, 2);
950 test_find_dll_redirection(handle, testlib2_dll, 2);
951 test_find_window_class(handle, wndClassW, 2);
952 test_find_window_class(handle, wndClass2W, 2);
953 b = pDeactivateActCtx(0, cookie);
954 ok(b, "DeactivateActCtx failed: %u\n", GetLastError());
956 pReleaseActCtx(handle);
959 trace("manifest3\n");
961 if(!create_manifest_file("test3.manifest", manifest3, -1, NULL, NULL)) {
962 skip("Could not create manifest file\n");
966 handle = test_create("test3.manifest", manifest3);
967 DeleteFileA("test3.manifest");
968 if(handle != INVALID_HANDLE_VALUE) {
969 test_detailed_info(handle, &detailed_info1);
970 test_info_in_assembly(handle, 1, &manifest3_info);
971 test_file_info(handle, 0, 0, testlib_dll);
973 b = pActivateActCtx(handle, &cookie);
974 ok(b, "ActivateActCtx failed: %u\n", GetLastError());
975 test_find_dll_redirection(handle, testlib_dll, 1);
976 test_find_dll_redirection(handle, testlib_dll, 1);
977 test_find_string_fail();
978 b = pDeactivateActCtx(0, cookie);
979 ok(b, "DeactivateActCtx failed: %u\n", GetLastError());
981 pReleaseActCtx(handle);
984 trace("manifest4\n");
986 if(!create_manifest_file("test4.manifest", manifest4, -1, NULL, NULL)) {
987 skip("Could not create manifest file\n");
991 handle = test_create("test4.manifest", manifest4);
992 DeleteFileA("test4.manifest");
993 DeleteFileA("testdep.manifest");
994 if(handle != INVALID_HANDLE_VALUE) {
995 test_detailed_info(handle, &detailed_info2);
996 test_info_in_assembly(handle, 1, &manifest4_info);
997 test_info_in_assembly(handle, 2, &manifest_comctrl_info);
998 pReleaseActCtx(handle);
1001 trace("manifest1 in subdir\n");
1003 CreateDirectoryW(work_dir_subdir, NULL);
1004 if (SetCurrentDirectoryW(work_dir_subdir))
1006 if(!create_manifest_file("..\\test1.manifest", manifest1, -1, NULL, NULL)) {
1007 skip("Could not create manifest file\n");
1010 handle = test_create("..\\test1.manifest", manifest1);
1011 DeleteFileA("..\\test1.manifest");
1012 if(handle != INVALID_HANDLE_VALUE) {
1013 test_detailed_info(handle, &detailed_info1);
1014 test_info_in_assembly(handle, 1, &manifest1_info);
1015 pReleaseActCtx(handle);
1017 SetCurrentDirectoryW(work_dir);
1020 skip("Couldn't change directory\n");
1021 RemoveDirectoryW(work_dir_subdir);
1023 trace("UTF-16 manifest1, with BOM\n");
1024 if(!create_wide_manifest("test1.manifest", manifest1, TRUE)) {
1025 skip("Could not create manifest file\n");
1029 handle = test_create("test1.manifest", manifest1);
1030 DeleteFileA("test1.manifest");
1031 if (handle != INVALID_HANDLE_VALUE) {
1032 test_detailed_info(handle, &detailed_info1);
1033 test_info_in_assembly(handle, 1, &manifest1_info);
1034 pReleaseActCtx(handle);
1039 static void test_app_manifest(void)
1044 trace("child process manifest1\n");
1046 b = pGetCurrentActCtx(&handle);
1047 ok(handle == NULL, "handle != NULL\n");
1048 ok(b, "GetCurrentActCtx failed: %u\n", GetLastError());
1050 test_detailed_info(handle, &detailed_info1_child);
1051 test_info_in_assembly(handle, 1, &manifest1_child_info);
1052 pReleaseActCtx(handle);
1056 static void run_child_process(void)
1058 char cmdline[MAX_PATH];
1059 char path[MAX_PATH];
1061 PROCESS_INFORMATION pi;
1062 STARTUPINFO si = { 0 };
1064 GetModuleFileNameA(NULL, path, MAX_PATH);
1065 strcat(path, ".manifest");
1066 if(!create_manifest_file(path, manifest1, -1, NULL, NULL)) {
1067 skip("Could not create manifest file\n");
1072 winetest_get_mainargs( &argv );
1073 sprintf(cmdline, "\"%s\" %s manifest1", argv[0], argv[1]);
1074 ok(CreateProcess(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL,
1075 &si, &pi) != 0, "Could not create process: %u\n", GetLastError());
1076 CloseHandle(pi.hThread);
1078 WaitForSingleObject(pi.hProcess, INFINITE);
1079 CloseHandle(pi.hProcess);
1083 static void init_paths(void)
1088 static const WCHAR dot_manifest[] = {'.','M','a','n','i','f','e','s','t',0};
1089 static const WCHAR backslash[] = {'\\',0};
1090 static const WCHAR subdir[] = {'T','e','s','t','S','u','b','d','i','r','\\',0};
1092 GetModuleFileNameW(NULL, exe_path, sizeof(exe_path)/sizeof(WCHAR));
1093 lstrcpyW(app_dir, exe_path);
1094 for(ptr=app_dir+lstrlenW(app_dir); *ptr != '\\' && *ptr != '/'; ptr--);
1097 GetCurrentDirectoryW(MAX_PATH, work_dir);
1098 last = work_dir[lstrlenW(work_dir) - 1];
1099 if (last != '\\' && last != '/')
1100 lstrcatW(work_dir, backslash);
1101 lstrcpyW(work_dir_subdir, work_dir);
1102 lstrcatW(work_dir_subdir, subdir);
1104 GetModuleFileNameW(NULL, app_manifest_path, sizeof(app_manifest_path)/sizeof(WCHAR));
1105 lstrcpyW(app_manifest_path+lstrlenW(app_manifest_path), dot_manifest);
1108 static BOOL init_funcs(void)
1110 HMODULE hKernel32 = GetModuleHandle("kernel32");
1112 #define X(f) if (!(p##f = (void*)GetProcAddress(hKernel32, #f))) return FALSE;
1115 X(DeactivateActCtx);
1116 X(FindActCtxSectionStringW);
1117 X(GetCurrentActCtx);
1130 argc = winetest_get_mainargs(&argv);
1134 skip("Needed functions are not available\n");
1139 if(argc > 2 && !strcmp(argv[2], "manifest1")) {
1140 test_app_manifest();
1145 run_child_process();