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
20 #define WIN32_NO_STATUS
21 #include "wine/test.h"
32 static BOOL (WINAPI
*pActivateActCtx
)(HANDLE
,ULONG_PTR
*);
33 static HANDLE (WINAPI
*pCreateActCtxA
)(PCACTCTXA
);
34 static HANDLE (WINAPI
*pCreateActCtxW
)(PCACTCTXW
);
35 static BOOL (WINAPI
*pDeactivateActCtx
)(DWORD
,ULONG_PTR
);
36 static BOOL (WINAPI
*pFindActCtxSectionStringA
)(DWORD
,const GUID
*,ULONG
,LPCSTR
,PACTCTX_SECTION_KEYED_DATA
);
37 static BOOL (WINAPI
*pFindActCtxSectionStringW
)(DWORD
,const GUID
*,ULONG
,LPCWSTR
,PACTCTX_SECTION_KEYED_DATA
);
38 static BOOL (WINAPI
*pGetCurrentActCtx
)(HANDLE
*);
39 static BOOL (WINAPI
*pIsDebuggerPresent
)(void);
40 static BOOL (WINAPI
*pQueryActCtxW
)(DWORD
,HANDLE
,PVOID
,ULONG
,PVOID
,SIZE_T
,SIZE_T
*);
41 static BOOL (WINAPI
*pQueryActCtxSettingsW
)(DWORD
,HANDLE
,LPCWSTR
,LPCWSTR
,LPWSTR
,SIZE_T
,SIZE_T
*);
42 static VOID (WINAPI
*pReleaseActCtx
)(HANDLE
);
43 static BOOL (WINAPI
*pFindActCtxSectionGuid
)(DWORD
,const GUID
*,ULONG
,const GUID
*,PACTCTX_SECTION_KEYED_DATA
);
44 static BOOL (WINAPI
*pZombifyActCtx
)(HANDLE
);
46 static NTSTATUS(NTAPI
*pRtlFindActivationContextSectionString
)(DWORD
,const GUID
*,ULONG
,PUNICODE_STRING
,PACTCTX_SECTION_KEYED_DATA
);
47 static BOOLEAN (NTAPI
*pRtlCreateUnicodeStringFromAsciiz
)(PUNICODE_STRING
, PCSZ
);
48 static VOID (NTAPI
*pRtlFreeUnicodeString
)(PUNICODE_STRING
);
50 static const char* strw(LPCWSTR x
)
52 static char buffer
[1024];
55 if (!x
) return "(nil)";
56 else while ((*p
++ = *x
++));
62 #elif defined __x86_64__
66 #elif defined __aarch64__
72 static const char manifest1
[] =
73 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
74 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
77 static const char manifest1_1
[] =
78 "<assembly xmlns = \"urn:schemas-microsoft-com:asm.v1\" manifestVersion = \"1.0\">"
79 "<assemblyIdentity version = \"1.0.0.0\" name = \"Wine.Test\" type = \"win32\"></assemblyIdentity>"
82 static const char manifest2
[] =
83 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
84 "<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\">"
88 "<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"" ARCH
"\">"
90 "</dependentAssembly>"
94 DEFINE_GUID(IID_CoTest
, 0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x11, 0x11, 0x22, 0x22, 0x33, 0x33);
95 DEFINE_GUID(IID_CoTest2
, 0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x11, 0x11, 0x22, 0x22, 0x33, 0x34);
96 DEFINE_GUID(CLSID_clrclass
,0x22345678, 0x1234, 0x5678, 0x12, 0x34, 0x11, 0x11, 0x22, 0x22, 0x33, 0x33);
97 DEFINE_GUID(IID_TlibTest
, 0x99999999, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55);
98 DEFINE_GUID(IID_TlibTest2
, 0x99999999, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x56);
99 DEFINE_GUID(IID_TlibTest3
, 0x99999999, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x57);
100 DEFINE_GUID(IID_TlibTest4
, 0x99999999, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x58);
101 DEFINE_GUID(IID_Iifaceps
, 0x66666666, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55);
102 DEFINE_GUID(IID_Ibifaceps
, 0x66666666, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x57);
103 DEFINE_GUID(IID_Iifaceps2
, 0x76666666, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55);
104 DEFINE_GUID(IID_Iifaceps3
, 0x86666666, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55);
105 DEFINE_GUID(IID_Iiface
, 0x96666666, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55);
106 DEFINE_GUID(IID_PS32
, 0x66666666, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x56);
108 static const char manifest3
[] =
109 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
110 "<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\""
111 " publicKeyToken=\"6595b6414666f1df\" />"
113 "<file name=\"testlib.dll\">"
114 "<windowClass>wndClass</windowClass>"
115 " <comClass description=\"Test com class\""
116 " clsid=\"{12345678-1234-5678-1234-111122223333}\""
117 " tlbid=\"{99999999-8888-7777-6666-555555555555}\""
118 " threadingModel=\"Neutral\""
119 " progid=\"ProgId.ProgId\""
120 " miscStatus=\"cantlinkinside\""
121 " miscStatusIcon=\"recomposeonresize\""
122 " miscStatusContent=\"insideout\""
123 " miscStatusThumbnail=\"alignable\""
124 " miscStatusDocPrint=\"simpleframe,setclientsitefirst\""
126 " <progid>ProgId.ProgId.1</progid>"
127 " <progid>ProgId.ProgId.2</progid>"
128 " <progid>ProgId.ProgId.3</progid>"
129 " <progid>ProgId.ProgId.4</progid>"
130 " <progid>ProgId.ProgId.5</progid>"
131 " <progid>ProgId.ProgId.6</progid>"
133 " <comClass clsid=\"{12345678-1234-5678-1234-111122223334}\" threadingModel=\"Neutral\" >"
134 " <progid>ProgId.ProgId.7</progid>"
136 " <comInterfaceProxyStub "
138 " tlbid=\"{99999999-8888-7777-6666-555555555558}\""
139 " iid=\"{66666666-8888-7777-6666-555555555555}\""
140 " proxyStubClsid32=\"{66666666-8888-7777-6666-555555555556}\""
141 " threadingModel=\"Free\""
143 " baseInterface=\"{66666666-8888-7777-6666-555555555557}\""
146 " <comInterfaceExternalProxyStub "
147 " name=\"Iifaceps2\""
148 " tlbid=\"{99999999-8888-7777-6666-555555555558}\""
149 " iid=\"{76666666-8888-7777-6666-555555555555}\""
150 " proxyStubClsid32=\"{66666666-8888-7777-6666-555555555556}\""
152 " baseInterface=\"{66666666-8888-7777-6666-555555555557}\""
154 " <comInterfaceExternalProxyStub "
155 " name=\"Iifaceps3\""
156 " tlbid=\"{99999999-8888-7777-6666-555555555558}\""
157 " iid=\"{86666666-8888-7777-6666-555555555555}\""
159 " baseInterface=\"{66666666-8888-7777-6666-555555555557}\""
162 " clsid=\"{96666666-8888-7777-6666-555555555555}\""
163 " name=\"testsurrogate\""
164 " runtimeVersion=\"v2.0.50727\""
167 " clsid=\"{22345678-1234-5678-1234-111122223333}\""
169 " progid=\"clrprogid\""
170 " description=\"test description\""
171 " tlbid=\"{99999999-8888-7777-6666-555555555555}\""
172 " runtimeVersion=\"1.2.3.4\""
173 " threadingModel=\"Neutral\""
175 " <progid>clrprogid.1</progid>"
176 " <progid>clrprogid.2</progid>"
177 " <progid>clrprogid.3</progid>"
178 " <progid>clrprogid.4</progid>"
179 " <progid>clrprogid.5</progid>"
180 " <progid>clrprogid.6</progid>"
184 static const char manifest_wndcls1
[] =
185 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
186 "<assemblyIdentity version=\"1.2.3.4\" name=\"testdep1\" type=\"win32\" processorArchitecture=\"" ARCH
"\"/>"
187 "<file name=\"testlib1.dll\">"
188 "<windowClass versioned=\"yes\">wndClass1</windowClass>"
189 "<windowClass>wndClass2</windowClass>"
190 " <typelib tlbid=\"{99999999-8888-7777-6666-555555555558}\" version=\"1.0\" helpdir=\"\" />"
192 "<file name=\"testlib1_2.dll\" />"
195 static const char manifest_wndcls2
[] =
196 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
197 "<assemblyIdentity version=\"4.3.2.1\" name=\"testdep2\" type=\"win32\" processorArchitecture=\"" ARCH
"\" />"
198 "<file name=\"testlib2.dll\">"
199 " <windowClass versioned=\"no\">wndClass3</windowClass>"
200 " <windowClass>wndClass4</windowClass>"
201 " <typelib tlbid=\"{99999999-8888-7777-6666-555555555555}\" version=\"1.0\" helpdir=\"help\" resourceid=\"409\""
202 " flags=\"HiddeN,CoNTROL,rESTRICTED\" />"
203 " <typelib tlbid=\"{99999999-8888-7777-6666-555555555556}\" version=\"1.0\" helpdir=\"help1\" resourceid=\"409\" />"
204 " <typelib tlbid=\"{99999999-8888-7777-6666-555555555557}\" version=\"1.0\" helpdir=\"\" />"
206 "<file name=\"testlib2_2.dll\" />"
209 static const char manifest_wndcls_main
[] =
210 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
211 "<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\" />"
213 " <dependentAssembly>"
214 " <assemblyIdentity type=\"win32\" name=\"testdep1\" version=\"1.2.3.4\" processorArchitecture=\"" ARCH
"\" />"
215 " </dependentAssembly>"
218 " <dependentAssembly>"
219 " <assemblyIdentity type=\"win32\" name=\"testdep2\" version=\"4.3.2.1\" processorArchitecture=\"" ARCH
"\" />"
220 " </dependentAssembly>"
224 static const char manifest4
[] =
225 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
226 "<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\">"
227 "</assemblyIdentity>"
229 "<dependentAssembly>"
230 "<assemblyIdentity type=\"win32\" name=\"Microsoft.Windows.Common-Controls\" "
231 "version=\"6.0.1.0\" processorArchitecture=\"" ARCH
"\" publicKeyToken=\"6595b64144ccf1df\">"
232 "</assemblyIdentity>"
233 "</dependentAssembly>"
237 static const char manifest5
[] =
238 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
239 "<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\">"
240 "</assemblyIdentity>"
242 " <dependentAssembly dependencyType=\"preRequisite\" allowDelayedBinding=\"true\">"
243 " <assemblyIdentity name=\"Missing.Assembly\" version=\"1.0.0.0\" />"
244 " </dependentAssembly>"
248 static const char manifest6
[] =
249 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
250 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
251 "<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v1\">"
253 " <requestedPrivileges>"
254 " <requestedExecutionLevel level=\"ASINVOKER\" uiAccess=\"false\"/>"
255 " </requestedPrivileges>"
260 static const char manifest7
[] =
261 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
262 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
263 "<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">"
265 " <requestedPrivileges>"
266 " <requestedExecutionLevel level=\"requireAdministrator\" uiAccess=\"TRUE\"/>"
267 " </requestedPrivileges>"
272 static const char manifest8
[] =
273 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
274 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
275 "<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">"
277 " <requestedPrivileges>"
278 " <requestedExecutionLevel level=\"requireAdministrator\" uiAccess=\"true\">"
279 " </requestedExecutionLevel>"
280 " </requestedPrivileges>"
285 static const char manifest9
[] =
286 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
287 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
288 "<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">"
290 " <requestedPrivileges>"
291 " <requestedExecutionLevel level=\"requireAdministrator\"/>"
292 " </requestedPrivileges>"
295 "<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">"
297 " <requestedPrivileges>"
298 " </requestedPrivileges>"
303 static const char manifest10
[] =
304 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" xmlns:asmv2=\"urn:schemas-microsoft-com:asm.v2\" manifestVersion=\"1.0\">"
305 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
308 " <asmv2:requestedPrivileges>"
309 " <asmv2:requestedExecutionLevel level=\"requireAdministrator\" uiAccess=\"true\"></asmv2:requestedExecutionLevel>"
310 " </asmv2:requestedPrivileges>"
315 static const char testdep_manifest1
[] =
316 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
317 "<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"" ARCH
"\"/>"
320 static const char testdep_manifest2
[] =
321 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
322 "<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"" ARCH
"\" />"
323 "<file name=\"testlib.dll\"></file>"
324 "<file name=\"testlib2.dll\" hash=\"63c978c2b53d6cf72b42fb7308f9af12ab19ec53\" hashalg=\"SHA1\" />"
327 static const char testdep_manifest3
[] =
328 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\"> "
329 "<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"" ARCH
"\"/>"
330 "<file name=\"testlib.dll\"/>"
331 "<file name=\"testlib2.dll\" hash=\"63c978c2b53d6cf72b42fb7308f9af12ab19ec53\" hashalg=\"SHA1\">"
332 "<windowClass>wndClass</windowClass>"
333 "<windowClass>wndClass2</windowClass>"
337 static const char wrong_manifest1
[] =
338 "<assembly manifestVersion=\"1.0\">"
339 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
342 static const char wrong_manifest2
[] =
343 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\">"
344 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
347 static const char wrong_manifest3
[] =
348 "<assembly test=\"test\" xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
349 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
352 static const char wrong_manifest4
[] =
353 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
354 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
358 static const char wrong_manifest5
[] =
359 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
360 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
364 static const char wrong_manifest6
[] =
365 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v5\" manifestVersion=\"1.0\">"
366 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
369 static const char wrong_manifest7
[] =
370 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
371 "<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"" ARCH
"\" />"
372 "<file name=\"testlib.dll\" hash=\"63c978c2b53d6cf72b42fb7308f9af12ab19ec5\" hashalg=\"SHA1\" />"
375 static const char wrong_manifest8
[] =
376 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
377 "<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
381 static const char wrong_manifest9
[] =
382 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
383 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
384 "<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">"
386 " <requestedPrivileges>"
387 " <requestedExecutionLevel level=\"requireAdministrator\"/>"
388 " <requestedExecutionLevel uiAccess=\"true\"/>"
389 " </requestedPrivileges>"
394 static const char wrong_manifest10
[] =
395 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
396 "<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
397 "<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">"
399 " <requestedPrivileges>"
400 " <requestedExecutionLevel level=\"requireAdministrator\"/>"
401 " </requestedPrivileges>"
404 "<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">"
406 " <requestedPrivileges>"
407 " <requestedExecutionLevel uiAccess=\"true\"/>"
408 " </requestedPrivileges>"
413 static const char wrong_depmanifest1
[] =
414 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
415 "<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.4\" processorArchitecture=\"" ARCH
"\" />"
418 static const char compat_manifest_no_supportedOs
[] =
419 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
420 " <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
421 " <compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\">"
427 static const char compat_manifest_vista
[] =
428 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
429 " <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
430 " <compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\">"
432 " <supportedOS Id=\"{e2011457-1546-43c5-a5fe-008deee3d3f0}\" />" /* Windows Vista */
437 static const char compat_manifest_vista_7_8_10_81
[] =
438 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
439 " <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
440 " <compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\">"
442 " <supportedOS Id=\"{e2011457-1546-43c5-a5fe-008deee3d3f0}\" ></supportedOS>" /* Windows Vista */
443 " <supportedOS Id=\"{35138b9a-5d96-4fbd-8e2d-a2440225f93a}\" />" /* Windows 7 */
444 " <supportedOS Id=\"{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}\" ></supportedOS>" /* Windows 8 */
445 " <supportedOS Id=\"{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}\" />" /* Windows 10 */
446 " <supportedOS Id=\"{1f676c76-80e1-4239-95bb-83d0f6d0da78}\" />" /* Windows 8.1 */
451 static const char compat_manifest_other_guid
[] =
452 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
453 " <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
454 " <compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\">"
456 " <supportedOS Id=\"{12345566-1111-2222-3333-444444444444}\" />"
461 static const char settings_manifest
[] =
462 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
463 " <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
464 " <application xmlns=\"urn:schemas-microsoft-com:asm.v3\">"
466 " <dpiAware xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">true</dpiAware>"
467 " <dpiAwareness xmlns=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\">true</dpiAwareness>"
468 " </windowsSettings>"
472 static const char settings_manifest2
[] =
473 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
474 " <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
475 " <application xmlns=\"urn:schemas-microsoft-com:asm.v3\""
476 " xmlns:ws05=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\""
477 " xmlns:ws11=\"http://schemas.microsoft.com/SMI/2011/WindowsSettings\""
478 " xmlns:ws16=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\""
479 " xmlns:ws17=\"http://schemas.microsoft.com/SMI/2017/WindowsSettings\">"
481 " <ws05:autoElevate>true</ws05:autoElevate>"
482 " <ws05:disableTheming>true</ws05:disableTheming>"
483 " <ws11:disableWindowFiltering>true</ws11:disableWindowFiltering>"
484 " <ws05:dpiAware>true</ws05:dpiAware>"
485 " <ws16:dpiAwareness>true</ws16:dpiAwareness>"
486 " <ws17:gdiScaling>true</ws17:gdiScaling>"
487 " <ws17:highResolutionScrollingAware>true</ws17:highResolutionScrollingAware>"
488 " <ws16:longPathAware>true</ws16:longPathAware>"
489 " <ws17:magicFutureSetting>true</ws17:magicFutureSetting>"
490 " <ws11:printerDriverIsolation>true</ws11:printerDriverIsolation>"
491 " <ws17:ultraHighResolutionScrollingAware>true</ws17:ultraHighResolutionScrollingAware>"
492 " </windowsSettings>"
496 /* broken manifest found in some binaries: asmv3 namespace is used but not declared */
497 static const char settings_manifest3
[] =
498 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
499 " <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
500 " <asmv3:application>"
501 " <asmv3:windowsSettings xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">"
502 " <dpiAware>true</dpiAware>"
503 " </asmv3:windowsSettings>"
504 " </asmv3:application>"
507 DEFINE_GUID(VISTA_COMPAT_GUID
, 0xe2011457, 0x1546, 0x43c5, 0xa5, 0xfe, 0x00, 0x8d, 0xee, 0xe3, 0xd3, 0xf0);
508 DEFINE_GUID(WIN7_COMPAT_GUID
, 0x35138b9a, 0x5d96, 0x4fbd, 0x8e, 0x2d, 0xa2, 0x44, 0x02, 0x25, 0xf9, 0x3a);
509 DEFINE_GUID(WIN8_COMPAT_GUID
, 0x4a2f28e3, 0x53b9, 0x4441, 0xba, 0x9c, 0xd6, 0x9d, 0x4a, 0x4a, 0x6e, 0x38);
510 DEFINE_GUID(WIN81_COMPAT_GUID
, 0x1f676c76, 0x80e1, 0x4239, 0x95, 0xbb, 0x83, 0xd0, 0xf6, 0xd0, 0xda, 0x78);
511 DEFINE_GUID(WIN10_COMPAT_GUID
, 0x8e0f7a12, 0xbfb3, 0x4fe8, 0xb9, 0xa5, 0x48, 0xfd, 0x50, 0xa1, 0x5a, 0x9a);
512 DEFINE_GUID(OTHER_COMPAT_GUID
, 0x12345566, 0x1111, 0x2222, 0x33, 0x33, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44);
515 static const WCHAR testlib_dll
[] =
516 {'t','e','s','t','l','i','b','.','d','l','l',0};
517 static const WCHAR testlib2_dll
[] =
518 {'t','e','s','t','l','i','b','2','.','d','l','l',0};
519 static const WCHAR wndClassW
[] =
520 {'w','n','d','C','l','a','s','s',0};
521 static const WCHAR wndClass1W
[] =
522 {'w','n','d','C','l','a','s','s','1',0};
523 static const WCHAR wndClass2W
[] =
524 {'w','n','d','C','l','a','s','s','2',0};
525 static const WCHAR wndClass3W
[] =
526 {'w','n','d','C','l','a','s','s','3',0};
528 static WCHAR app_dir
[MAX_PATH
], exe_path
[MAX_PATH
], work_dir
[MAX_PATH
], work_dir_subdir
[MAX_PATH
];
529 static WCHAR app_manifest_path
[MAX_PATH
], manifest_path
[MAX_PATH
], depmanifest_path
[MAX_PATH
];
531 static int strcmp_aw(LPCWSTR strw
, const char *stra
)
536 MultiByteToWideChar(CP_ACP
, 0, stra
, -1, buf
, ARRAY_SIZE(buf
));
537 return lstrcmpW(strw
, buf
);
540 static DWORD
strlen_aw(const char *str
)
542 return MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0) - 1;
545 static BOOL
create_manifest_file(const char *filename
, const char *manifest
, int manifest_len
,
546 const char *depfile
, const char *depmanifest
)
550 WCHAR path
[MAX_PATH
];
552 MultiByteToWideChar( CP_ACP
, 0, filename
, -1, path
, MAX_PATH
);
553 GetFullPathNameW(path
, ARRAY_SIZE(manifest_path
), manifest_path
, NULL
);
555 if (manifest_len
== -1)
556 manifest_len
= strlen(manifest
);
558 file
= CreateFileW(path
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
,
559 FILE_ATTRIBUTE_NORMAL
, NULL
);
560 ok(file
!= INVALID_HANDLE_VALUE
, "CreateFile failed: %u\n", GetLastError());
561 if(file
== INVALID_HANDLE_VALUE
)
563 WriteFile(file
, manifest
, manifest_len
, &size
, NULL
);
568 MultiByteToWideChar( CP_ACP
, 0, depfile
, -1, path
, MAX_PATH
);
569 GetFullPathNameW(path
, ARRAY_SIZE(depmanifest_path
), depmanifest_path
, NULL
);
570 file
= CreateFileW(path
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
,
571 FILE_ATTRIBUTE_NORMAL
, NULL
);
572 ok(file
!= INVALID_HANDLE_VALUE
, "CreateFile failed: %u\n", GetLastError());
573 if(file
== INVALID_HANDLE_VALUE
)
575 WriteFile(file
, depmanifest
, strlen(depmanifest
), &size
, NULL
);
581 static BOOL
create_wide_manifest(const char *filename
, const char *manifest
, BOOL fBOM
, BOOL fReverse
)
583 WCHAR
*wmanifest
= HeapAlloc(GetProcessHeap(), 0, (strlen(manifest
)+2) * sizeof(WCHAR
));
585 int offset
= (fBOM
? 0 : 1);
587 MultiByteToWideChar(CP_ACP
, 0, manifest
, -1, &wmanifest
[1], (strlen(manifest
)+1));
588 wmanifest
[0] = 0xfeff;
592 for (i
= 0; i
< strlen(manifest
)+1; i
++)
593 wmanifest
[i
] = (wmanifest
[i
] << 8) | ((wmanifest
[i
] >> 8) & 0xff);
595 ret
= create_manifest_file(filename
, (char *)&wmanifest
[offset
], (strlen(manifest
)+1-offset
) * sizeof(WCHAR
), NULL
, NULL
);
596 HeapFree(GetProcessHeap(), 0, wmanifest
);
601 ULONG format_version
;
602 ULONG assembly_cnt_min
;
603 ULONG assembly_cnt_max
;
604 ULONG root_manifest_type
;
605 LPWSTR root_manifest_path
;
606 ULONG root_config_type
;
611 static const detailed_info_t detailed_info0
= {
612 0, 0, 0, 0, NULL
, 0, 0, NULL
615 static const detailed_info_t detailed_info1
= {
616 1, 1, 1, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE
, manifest_path
,
617 ACTIVATION_CONTEXT_PATH_TYPE_NONE
, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE
,
621 static const detailed_info_t detailed_info1_child
= {
622 1, 1, 1, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE
, app_manifest_path
,
623 ACTIVATION_CONTEXT_PATH_TYPE_NONE
, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE
,
627 /* On Vista+, there's an extra assembly for Microsoft.Windows.Common-Controls.Resources */
628 static const detailed_info_t detailed_info2
= {
629 1, 2, 3, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE
, manifest_path
,
630 ACTIVATION_CONTEXT_PATH_TYPE_NONE
, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE
,
634 static void test_detailed_info(HANDLE handle
, const detailed_info_t
*exinfo
, int line
)
636 ACTIVATION_CONTEXT_DETAILED_INFORMATION detailed_info_tmp
, *detailed_info
;
637 SIZE_T size
, exsize
, retsize
;
640 exsize
= sizeof(ACTIVATION_CONTEXT_DETAILED_INFORMATION
)
641 + (exinfo
->root_manifest_path
? (lstrlenW(exinfo
->root_manifest_path
)+1)*sizeof(WCHAR
):0)
642 + (exinfo
->app_dir
? (lstrlenW(exinfo
->app_dir
)+1)*sizeof(WCHAR
) : 0);
644 if(exsize
!= sizeof(ACTIVATION_CONTEXT_DETAILED_INFORMATION
)) {
646 b
= pQueryActCtxW(0, handle
, NULL
,
647 ActivationContextDetailedInformation
, &detailed_info_tmp
,
648 sizeof(detailed_info_tmp
), &size
);
649 ok_(__FILE__
, line
)(!b
, "QueryActCtx succeeded\n");
650 ok_(__FILE__
, line
)(GetLastError() == ERROR_INSUFFICIENT_BUFFER
, "GetLastError() = %u\n", GetLastError());
651 ok_(__FILE__
, line
)(size
== exsize
, "size=%ld, expected %ld\n", size
, exsize
);
653 size
= sizeof(ACTIVATION_CONTEXT_DETAILED_INFORMATION
);
656 detailed_info
= HeapAlloc(GetProcessHeap(), 0, size
);
657 memset(detailed_info
, 0xfe, size
);
658 b
= pQueryActCtxW(0, handle
, NULL
,
659 ActivationContextDetailedInformation
, detailed_info
,
661 ok_(__FILE__
, line
)(b
, "QueryActCtx failed: %u\n", GetLastError());
662 ok_(__FILE__
, line
)(retsize
== exsize
, "size=%ld, expected %ld\n", retsize
, exsize
);
664 ok_(__FILE__
, line
)(detailed_info
->dwFlags
== 0, "detailed_info->dwFlags=%x\n", detailed_info
->dwFlags
);
665 ok_(__FILE__
, line
)(detailed_info
->ulFormatVersion
== exinfo
->format_version
,
666 "detailed_info->ulFormatVersion=%u, expected %u\n", detailed_info
->ulFormatVersion
,
667 exinfo
->format_version
);
668 ok_(__FILE__
, line
)(exinfo
->assembly_cnt_min
<= detailed_info
->ulAssemblyCount
&&
669 detailed_info
->ulAssemblyCount
<= exinfo
->assembly_cnt_max
,
670 "detailed_info->ulAssemblyCount=%u, expected between %u and %u\n", detailed_info
->ulAssemblyCount
,
671 exinfo
->assembly_cnt_min
, exinfo
->assembly_cnt_max
);
672 ok_(__FILE__
, line
)(detailed_info
->ulRootManifestPathType
== exinfo
->root_manifest_type
,
673 "detailed_info->ulRootManifestPathType=%u, expected %u\n",
674 detailed_info
->ulRootManifestPathType
, exinfo
->root_manifest_type
);
675 ok_(__FILE__
, line
)(detailed_info
->ulRootManifestPathChars
==
676 (exinfo
->root_manifest_path
? lstrlenW(exinfo
->root_manifest_path
) : 0),
677 "detailed_info->ulRootManifestPathChars=%u, expected %u\n",
678 detailed_info
->ulRootManifestPathChars
,
679 exinfo
->root_manifest_path
?lstrlenW(exinfo
->root_manifest_path
) : 0);
680 ok_(__FILE__
, line
)(detailed_info
->ulRootConfigurationPathType
== exinfo
->root_config_type
,
681 "detailed_info->ulRootConfigurationPathType=%u, expected %u\n",
682 detailed_info
->ulRootConfigurationPathType
, exinfo
->root_config_type
);
683 ok_(__FILE__
, line
)(detailed_info
->ulRootConfigurationPathChars
== 0,
684 "detailed_info->ulRootConfigurationPathChars=%d\n", detailed_info
->ulRootConfigurationPathChars
);
685 ok_(__FILE__
, line
)(detailed_info
->ulAppDirPathType
== exinfo
->app_dir_type
,
686 "detailed_info->ulAppDirPathType=%u, expected %u\n", detailed_info
->ulAppDirPathType
,
687 exinfo
->app_dir_type
);
688 ok_(__FILE__
, line
)(detailed_info
->ulAppDirPathChars
== (exinfo
->app_dir
? lstrlenW(exinfo
->app_dir
) : 0),
689 "detailed_info->ulAppDirPathChars=%u, expected %u\n",
690 detailed_info
->ulAppDirPathChars
, exinfo
->app_dir
? lstrlenW(exinfo
->app_dir
) : 0);
691 if(exinfo
->root_manifest_path
) {
692 ok_(__FILE__
, line
)(detailed_info
->lpRootManifestPath
!= NULL
, "detailed_info->lpRootManifestPath == NULL\n");
693 if(detailed_info
->lpRootManifestPath
)
694 ok_(__FILE__
, line
)(!lstrcmpiW(detailed_info
->lpRootManifestPath
, exinfo
->root_manifest_path
),
695 "unexpected detailed_info->lpRootManifestPath\n");
697 ok_(__FILE__
, line
)(detailed_info
->lpRootManifestPath
== NULL
, "detailed_info->lpRootManifestPath != NULL\n");
699 ok_(__FILE__
, line
)(detailed_info
->lpRootConfigurationPath
== NULL
,
700 "detailed_info->lpRootConfigurationPath=%p\n", detailed_info
->lpRootConfigurationPath
);
701 if(exinfo
->app_dir
) {
702 ok_(__FILE__
, line
)(detailed_info
->lpAppDirPath
!= NULL
, "detailed_info->lpAppDirPath == NULL\n");
703 if(detailed_info
->lpAppDirPath
)
704 ok_(__FILE__
, line
)(!lstrcmpiW(exinfo
->app_dir
, detailed_info
->lpAppDirPath
),
705 "unexpected detailed_info->lpAppDirPath\n%s\n",strw(detailed_info
->lpAppDirPath
));
707 ok_(__FILE__
, line
)(detailed_info
->lpAppDirPath
== NULL
, "detailed_info->lpAppDirPath != NULL\n");
710 HeapFree(GetProcessHeap(), 0, detailed_info
);
715 /* ULONG manifest_path_type; FIXME */
716 LPCWSTR manifest_path
;
717 LPCSTR encoded_assembly_id
;
718 BOOL has_assembly_dir
;
721 static const info_in_assembly manifest1_info
= {
723 "Wine.Test,type=\"win32\",version=\"1.0.0.0\"",
727 static const info_in_assembly manifest1_child_info
= {
728 1, app_manifest_path
,
729 "Wine.Test,type=\"win32\",version=\"1.0.0.0\"",
733 static const info_in_assembly manifest2_info
= {
735 "Wine.Test,type=\"win32\",version=\"1.2.3.4\"",
739 static const info_in_assembly manifest3_info
= {
741 "Wine.Test,publicKeyToken=\"6595b6414666f1df\",type=\"win32\",version=\"1.2.3.4\"",
745 static const info_in_assembly manifest4_info
= {
747 "Wine.Test,type=\"win32\",version=\"1.2.3.4\"",
751 static const info_in_assembly depmanifest1_info
= {
752 0x10, depmanifest_path
,
753 "testdep,processorArchitecture=\"" ARCH
"\","
754 "type=\"win32\",version=\"6.5.4.3\"",
758 static const info_in_assembly depmanifest2_info
= {
759 0x10, depmanifest_path
,
760 "testdep,processorArchitecture=\"" ARCH
"\","
761 "type=\"win32\",version=\"6.5.4.3\"",
765 static const info_in_assembly depmanifest3_info
= {
766 0x10, depmanifest_path
,
767 "testdep,processorArchitecture=\"" ARCH
"\",type=\"win32\",version=\"6.5.4.3\"",
771 static const info_in_assembly manifest_comctrl_info
= {
772 0, NULL
, NULL
, TRUE
/* These values may differ between Windows installations */
775 static void test_info_in_assembly(HANDLE handle
, DWORD id
, const info_in_assembly
*exinfo
, int line
)
777 ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
*info
, info_tmp
;
782 exsize
= sizeof(ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
);
783 if (exinfo
->manifest_path
) exsize
+= (lstrlenW(exinfo
->manifest_path
)+1) * sizeof(WCHAR
);
784 if (exinfo
->encoded_assembly_id
) exsize
+= (strlen_aw(exinfo
->encoded_assembly_id
) + 1) * sizeof(WCHAR
);
787 b
= pQueryActCtxW(0, handle
, &id
,
788 AssemblyDetailedInformationInActivationContext
, &info_tmp
,
789 sizeof(info_tmp
), &size
);
790 ok_(__FILE__
, line
)(!b
, "QueryActCtx succeeded\n");
791 ok_(__FILE__
, line
)(GetLastError() == ERROR_INSUFFICIENT_BUFFER
, "GetLastError() = %u\n", GetLastError());
793 ok_(__FILE__
, line
)(size
>= exsize
, "size=%lu, expected %lu\n", size
, exsize
);
795 if (size
== 0xdeadbeef)
801 info
= HeapAlloc(GetProcessHeap(), 0, size
);
802 memset(info
, 0xfe, size
);
805 b
= pQueryActCtxW(0, handle
, &id
,
806 AssemblyDetailedInformationInActivationContext
, info
, size
, &size
);
807 ok_(__FILE__
, line
)(b
, "QueryActCtx failed: %u\n", GetLastError());
808 if (!exinfo
->manifest_path
)
809 exsize
+= info
->ulManifestPathLength
+ sizeof(WCHAR
);
810 if (!exinfo
->encoded_assembly_id
)
811 exsize
+= info
->ulEncodedAssemblyIdentityLength
+ sizeof(WCHAR
);
812 if (exinfo
->has_assembly_dir
)
813 exsize
+= info
->ulAssemblyDirectoryNameLength
+ sizeof(WCHAR
);
814 ok_(__FILE__
, line
)(size
== exsize
, "size=%lu, expected %lu\n", size
, exsize
);
816 if (0) /* FIXME: flags meaning unknown */
818 ok_(__FILE__
, line
)((info
->ulFlags
) == exinfo
->flags
, "info->ulFlags = %x, expected %x\n",
819 info
->ulFlags
, exinfo
->flags
);
821 if(exinfo
->encoded_assembly_id
) {
822 len
= strlen_aw(exinfo
->encoded_assembly_id
)*sizeof(WCHAR
);
823 ok_(__FILE__
, line
)(info
->ulEncodedAssemblyIdentityLength
== len
,
824 "info->ulEncodedAssemblyIdentityLength = %u, expected %u\n",
825 info
->ulEncodedAssemblyIdentityLength
, len
);
827 ok_(__FILE__
, line
)(info
->ulEncodedAssemblyIdentityLength
!= 0,
828 "info->ulEncodedAssemblyIdentityLength == 0\n");
830 ok_(__FILE__
, line
)(info
->ulManifestPathType
== ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE
,
831 "info->ulManifestPathType = %x\n", info
->ulManifestPathType
);
832 if(exinfo
->manifest_path
) {
833 len
= lstrlenW(exinfo
->manifest_path
)*sizeof(WCHAR
);
834 ok_(__FILE__
, line
)(info
->ulManifestPathLength
== len
, "info->ulManifestPathLength = %u, expected %u\n",
835 info
->ulManifestPathLength
, len
);
837 ok_(__FILE__
, line
)(info
->ulManifestPathLength
!= 0, "info->ulManifestPathLength == 0\n");
840 ok_(__FILE__
, line
)(info
->ulPolicyPathType
== ACTIVATION_CONTEXT_PATH_TYPE_NONE
,
841 "info->ulPolicyPathType = %x\n", info
->ulPolicyPathType
);
842 ok_(__FILE__
, line
)(info
->ulPolicyPathLength
== 0,
843 "info->ulPolicyPathLength = %u, expected 0\n", info
->ulPolicyPathLength
);
844 ok_(__FILE__
, line
)(info
->ulMetadataSatelliteRosterIndex
== 0, "info->ulMetadataSatelliteRosterIndex = %x\n",
845 info
->ulMetadataSatelliteRosterIndex
);
846 ok_(__FILE__
, line
)(info
->ulManifestVersionMajor
== 1,"info->ulManifestVersionMajor = %x\n",
847 info
->ulManifestVersionMajor
);
848 ok_(__FILE__
, line
)(info
->ulManifestVersionMinor
== 0, "info->ulManifestVersionMinor = %x\n",
849 info
->ulManifestVersionMinor
);
850 ok_(__FILE__
, line
)(info
->ulPolicyVersionMajor
== 0, "info->ulPolicyVersionMajor = %x\n",
851 info
->ulPolicyVersionMajor
);
852 ok_(__FILE__
, line
)(info
->ulPolicyVersionMinor
== 0, "info->ulPolicyVersionMinor = %x\n",
853 info
->ulPolicyVersionMinor
);
854 if(exinfo
->has_assembly_dir
)
855 ok_(__FILE__
, line
)(info
->ulAssemblyDirectoryNameLength
!= 0,
856 "info->ulAssemblyDirectoryNameLength == 0\n");
858 ok_(__FILE__
, line
)(info
->ulAssemblyDirectoryNameLength
== 0,
859 "info->ulAssemblyDirectoryNameLength != 0\n");
861 ok_(__FILE__
, line
)(info
->lpAssemblyEncodedAssemblyIdentity
!= NULL
,
862 "info->lpAssemblyEncodedAssemblyIdentity == NULL\n");
863 if(info
->lpAssemblyEncodedAssemblyIdentity
&& exinfo
->encoded_assembly_id
) {
864 ok_(__FILE__
, line
)(!strcmp_aw(info
->lpAssemblyEncodedAssemblyIdentity
, exinfo
->encoded_assembly_id
),
865 "unexpected info->lpAssemblyEncodedAssemblyIdentity %s / %s\n",
866 strw(info
->lpAssemblyEncodedAssemblyIdentity
), exinfo
->encoded_assembly_id
);
868 if(exinfo
->manifest_path
) {
869 ok_(__FILE__
, line
)(info
->lpAssemblyManifestPath
!= NULL
, "info->lpAssemblyManifestPath == NULL\n");
870 if(info
->lpAssemblyManifestPath
)
871 ok_(__FILE__
, line
)(!lstrcmpiW(info
->lpAssemblyManifestPath
, exinfo
->manifest_path
),
872 "unexpected info->lpAssemblyManifestPath\n");
874 ok_(__FILE__
, line
)(info
->lpAssemblyManifestPath
!= NULL
, "info->lpAssemblyManifestPath == NULL\n");
877 ok_(__FILE__
, line
)(info
->lpAssemblyPolicyPath
== NULL
, "info->lpAssemblyPolicyPath != NULL\n");
878 if(info
->lpAssemblyPolicyPath
)
879 ok_(__FILE__
, line
)(*(WORD
*)info
->lpAssemblyPolicyPath
== 0, "info->lpAssemblyPolicyPath is not empty\n");
880 if(exinfo
->has_assembly_dir
)
881 ok_(__FILE__
, line
)(info
->lpAssemblyDirectoryName
!= NULL
, "info->lpAssemblyDirectoryName == NULL\n");
883 ok_(__FILE__
, line
)(info
->lpAssemblyDirectoryName
== NULL
, "info->lpAssemblyDirectoryName = %s\n",
884 strw(info
->lpAssemblyDirectoryName
));
885 HeapFree(GetProcessHeap(), 0, info
);
888 static void test_file_info(HANDLE handle
, ULONG assid
, ULONG fileid
, LPCWSTR filename
, int line
)
890 ASSEMBLY_FILE_DETAILED_INFORMATION
*info
, info_tmp
;
891 ACTIVATION_CONTEXT_QUERY_INDEX index
= {assid
, fileid
};
895 exsize
= sizeof(ASSEMBLY_FILE_DETAILED_INFORMATION
)
896 +(lstrlenW(filename
)+1)*sizeof(WCHAR
);
899 b
= pQueryActCtxW(0, handle
, &index
,
900 FileInformationInAssemblyOfAssemblyInActivationContext
, &info_tmp
,
901 sizeof(info_tmp
), &size
);
902 ok_(__FILE__
, line
)(!b
, "QueryActCtx succeeded\n");
903 ok_(__FILE__
, line
)(GetLastError() == ERROR_INSUFFICIENT_BUFFER
, "GetLastError() = %u\n", GetLastError());
904 ok_(__FILE__
, line
)(size
== exsize
, "size=%lu, expected %lu\n", size
, exsize
);
906 if(size
== 0xdeadbeef)
912 info
= HeapAlloc(GetProcessHeap(), 0, size
);
913 memset(info
, 0xfe, size
);
915 b
= pQueryActCtxW(0, handle
, &index
,
916 FileInformationInAssemblyOfAssemblyInActivationContext
, info
, size
, &size
);
917 ok_(__FILE__
, line
)(b
, "QueryActCtx failed: %u\n", GetLastError());
918 ok_(__FILE__
, line
)(!size
, "size=%lu, expected 0\n", size
);
920 ok_(__FILE__
, line
)(info
->ulFlags
== 2, "info->ulFlags=%x, expected 2\n", info
->ulFlags
);
921 ok_(__FILE__
, line
)(info
->ulFilenameLength
== lstrlenW(filename
)*sizeof(WCHAR
),
922 "info->ulFilenameLength=%u, expected %u*sizeof(WCHAR)\n",
923 info
->ulFilenameLength
, lstrlenW(filename
));
924 ok_(__FILE__
, line
)(info
->ulPathLength
== 0, "info->ulPathLength=%u\n", info
->ulPathLength
);
925 ok_(__FILE__
, line
)(info
->lpFileName
!= NULL
, "info->lpFileName == NULL\n");
927 ok_(__FILE__
, line
)(!lstrcmpiW(info
->lpFileName
, filename
), "unexpected info->lpFileName\n");
928 ok_(__FILE__
, line
)(info
->lpFilePath
== NULL
, "info->lpFilePath != NULL\n");
929 HeapFree(GetProcessHeap(), 0, info
);
933 ACTCTX_REQUESTED_RUN_LEVEL run_level
;
937 static const runlevel_info_t runlevel_info0
= {
938 ACTCTX_RUN_LEVEL_UNSPECIFIED
, FALSE
,
941 static const runlevel_info_t runlevel_info6
= {
942 ACTCTX_RUN_LEVEL_AS_INVOKER
, FALSE
,
945 static const runlevel_info_t runlevel_info7
= {
946 ACTCTX_RUN_LEVEL_REQUIRE_ADMIN
, TRUE
,
949 static const runlevel_info_t runlevel_info8
= {
950 ACTCTX_RUN_LEVEL_REQUIRE_ADMIN
, TRUE
,
953 static const runlevel_info_t runlevel_info9
= {
954 ACTCTX_RUN_LEVEL_REQUIRE_ADMIN
, FALSE
,
957 static void test_runlevel_info(HANDLE handle
, const runlevel_info_t
*exinfo
, int line
)
959 ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION runlevel_info
;
960 SIZE_T size
, retsize
;
963 size
= sizeof(runlevel_info
);
964 b
= pQueryActCtxW(0, handle
, NULL
,
965 RunlevelInformationInActivationContext
, &runlevel_info
,
966 sizeof(runlevel_info
), &retsize
);
967 if (!b
&& GetLastError() == ERROR_INVALID_PARAMETER
)
969 win_skip("RunlevelInformationInActivationContext not supported.\n");
973 ok_(__FILE__
, line
)(b
, "QueryActCtx failed: %u\n", GetLastError());
974 ok_(__FILE__
, line
)(retsize
== size
, "size=%ld, expected %ld\n", retsize
, size
);
976 ok_(__FILE__
, line
)(runlevel_info
.ulFlags
== 0, "runlevel_info.ulFlags=%x\n", runlevel_info
.ulFlags
);
977 ok_(__FILE__
, line
)(runlevel_info
.RunLevel
== exinfo
->run_level
,
978 "runlevel_info.RunLevel=%u, expected %u\n", runlevel_info
.RunLevel
, exinfo
->run_level
);
979 ok_(__FILE__
, line
)(runlevel_info
.UiAccess
== exinfo
->ui_access
,
980 "runlevel_info.UiAccess=%u, expected %u\n", runlevel_info
.UiAccess
, exinfo
->ui_access
);
983 static HANDLE
test_create(const char *file
)
987 WCHAR path
[MAX_PATH
];
989 MultiByteToWideChar( CP_ACP
, 0, file
, -1, path
, MAX_PATH
);
990 memset(&actctx
, 0, sizeof(ACTCTXW
));
991 actctx
.cbSize
= sizeof(ACTCTXW
);
992 actctx
.lpSource
= path
;
994 handle
= pCreateActCtxW(&actctx
);
995 /* to be tested outside of this helper, including last error */
996 if (handle
== INVALID_HANDLE_VALUE
) return handle
;
998 ok(actctx
.cbSize
== sizeof(actctx
), "actctx.cbSize=%d\n", actctx
.cbSize
);
999 ok(actctx
.dwFlags
== 0, "actctx.dwFlags=%d\n", actctx
.dwFlags
);
1000 ok(actctx
.lpSource
== path
, "actctx.lpSource=%p\n", actctx
.lpSource
);
1001 ok(actctx
.wProcessorArchitecture
== 0,
1002 "actctx.wProcessorArchitecture=%d\n", actctx
.wProcessorArchitecture
);
1003 ok(actctx
.wLangId
== 0, "actctx.wLangId=%d\n", actctx
.wLangId
);
1004 ok(actctx
.lpAssemblyDirectory
== NULL
,
1005 "actctx.lpAssemblyDirectory=%p\n", actctx
.lpAssemblyDirectory
);
1006 ok(actctx
.lpResourceName
== NULL
, "actctx.lpResourceName=%p\n", actctx
.lpResourceName
);
1007 ok(actctx
.lpApplicationName
== NULL
, "actctx.lpApplicationName=%p\n",
1008 actctx
.lpApplicationName
);
1009 ok(actctx
.hModule
== NULL
, "actctx.hModule=%p\n", actctx
.hModule
);
1014 static void test_create_and_fail(const char *manifest
, const char *depmanifest
, int todo
, BOOL is_broken
)
1018 WCHAR path
[MAX_PATH
];
1020 MultiByteToWideChar( CP_ACP
, 0, "bad.manifest", -1, path
, MAX_PATH
);
1021 memset(&actctx
, 0, sizeof(ACTCTXW
));
1022 actctx
.cbSize
= sizeof(ACTCTXW
);
1023 actctx
.lpSource
= path
;
1025 create_manifest_file("bad.manifest", manifest
, -1, "testdep.manifest", depmanifest
);
1026 handle
= pCreateActCtxW(&actctx
);
1030 ok(broken(handle
!= INVALID_HANDLE_VALUE
) || handle
== INVALID_HANDLE_VALUE
,
1031 "Unexpected context handle %p.\n", handle
);
1033 ok(handle
== INVALID_HANDLE_VALUE
, "Unexpected context handle %p.\n", handle
);
1035 if (handle
== INVALID_HANDLE_VALUE
)
1036 ok(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX
, "Unexpected error %d.\n", GetLastError());
1038 if (handle
!= INVALID_HANDLE_VALUE
) pReleaseActCtx( handle
);
1039 DeleteFileA("bad.manifest");
1040 DeleteFileA("testdep.manifest");
1043 static void test_create_wide_and_fail(const char *manifest
, BOOL fBOM
)
1047 WCHAR path
[MAX_PATH
];
1049 MultiByteToWideChar( CP_ACP
, 0, "bad.manifest", -1, path
, MAX_PATH
);
1050 memset(&actctx
, 0, sizeof(ACTCTXW
));
1051 actctx
.cbSize
= sizeof(ACTCTXW
);
1052 actctx
.lpSource
= path
;
1054 create_wide_manifest("bad.manifest", manifest
, fBOM
, FALSE
);
1055 handle
= pCreateActCtxW(&actctx
);
1056 ok(handle
== INVALID_HANDLE_VALUE
, "handle != INVALID_HANDLE_VALUE\n");
1057 ok(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX
, "GetLastError == %u\n", GetLastError());
1059 if (handle
!= INVALID_HANDLE_VALUE
) pReleaseActCtx( handle
);
1060 DeleteFileA("bad.manifest");
1063 static void test_create_fail(void)
1067 WCHAR path
[MAX_PATH
];
1069 MultiByteToWideChar( CP_ACP
, 0, "nonexistent.manifest", -1, path
, MAX_PATH
);
1070 memset(&actctx
, 0, sizeof(ACTCTXW
));
1071 actctx
.cbSize
= sizeof(ACTCTXW
);
1072 actctx
.lpSource
= path
;
1074 handle
= pCreateActCtxW(&actctx
);
1075 ok(handle
== INVALID_HANDLE_VALUE
, "handle != INVALID_HANDLE_VALUE\n");
1076 ok(GetLastError() == ERROR_FILE_NOT_FOUND
, "GetLastError == %u\n", GetLastError());
1078 trace("wrong_manifest1\n");
1079 test_create_and_fail(wrong_manifest1
, NULL
, 0, FALSE
);
1080 trace("wrong_manifest2\n");
1081 test_create_and_fail(wrong_manifest2
, NULL
, 0, FALSE
);
1082 trace("wrong_manifest3\n");
1083 test_create_and_fail(wrong_manifest3
, NULL
, 1, FALSE
);
1084 trace("wrong_manifest4\n");
1085 test_create_and_fail(wrong_manifest4
, NULL
, 1, FALSE
);
1086 trace("wrong_manifest5\n");
1087 test_create_and_fail(wrong_manifest5
, NULL
, 0, FALSE
);
1088 trace("wrong_manifest6\n");
1089 test_create_and_fail(wrong_manifest6
, NULL
, 0, FALSE
);
1090 trace("wrong_manifest7\n");
1091 test_create_and_fail(wrong_manifest7
, NULL
, 1, FALSE
);
1092 trace("wrong_manifest8\n");
1093 test_create_and_fail(wrong_manifest8
, NULL
, 0, FALSE
);
1094 trace("wrong_manifest9\n");
1095 test_create_and_fail(wrong_manifest9
, NULL
, 0, TRUE
/* WinXP */);
1096 trace("wrong_manifest10\n");
1097 test_create_and_fail(wrong_manifest10
, NULL
, 0, TRUE
/* WinXP */);
1098 trace("UTF-16 manifest1 without BOM\n");
1099 test_create_wide_and_fail(manifest1
, FALSE
);
1100 trace("manifest2\n");
1101 test_create_and_fail(manifest2
, NULL
, 0, FALSE
);
1102 trace("manifest2+depmanifest1\n");
1103 test_create_and_fail(manifest2
, wrong_depmanifest1
, 0, FALSE
);
1106 struct strsection_header
1114 ULONG global_offset
;
1128 struct guidsection_header
1148 struct wndclass_redirect_data
1153 ULONG name_offset
; /* versioned name offset */
1155 ULONG module_offset
;/* container name offset */
1158 struct dllredirect_data
1165 struct tlibredirect_data
1179 struct progidredirect_data
1186 static void test_find_dll_redirection(HANDLE handle
, LPCWSTR libname
, ULONG exid
, int line
)
1188 ACTCTX_SECTION_KEYED_DATA data
;
1191 memset(&data
, 0xfe, sizeof(data
));
1192 data
.cbSize
= sizeof(data
);
1194 ret
= pFindActCtxSectionStringW(0, NULL
,
1195 ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
,
1197 ok_(__FILE__
, line
)(ret
, "FindActCtxSectionStringW failed: %u\n", GetLastError());
1200 ok_(__FILE__
, line
)(data
.cbSize
== sizeof(data
), "data.cbSize=%u\n", data
.cbSize
);
1201 ok_(__FILE__
, line
)(data
.ulDataFormatVersion
== 1, "data.ulDataFormatVersion=%u\n", data
.ulDataFormatVersion
);
1202 ok_(__FILE__
, line
)(data
.lpData
!= NULL
, "data.lpData == NULL\n");
1203 ok_(__FILE__
, line
)(data
.ulLength
== 20, "data.ulLength=%u\n", data
.ulLength
);
1207 struct dllredirect_data
*dlldata
= (struct dllredirect_data
*)data
.lpData
;
1208 ok_(__FILE__
, line
)(dlldata
->size
== data
.ulLength
, "got wrong size %d\n", dlldata
->size
);
1209 ok_(__FILE__
, line
)(dlldata
->unk
== 2, "got wrong field value %d\n", dlldata
->unk
);
1210 ok_(__FILE__
, line
)(dlldata
->res
[0] == 0, "got wrong res[0] value %d\n", dlldata
->res
[0]);
1211 ok_(__FILE__
, line
)(dlldata
->res
[1] == 0, "got wrong res[1] value %d\n", dlldata
->res
[1]);
1212 ok_(__FILE__
, line
)(dlldata
->res
[2] == 0, "got wrong res[2] value %d\n", dlldata
->res
[2]);
1215 ok_(__FILE__
, line
)(data
.lpSectionGlobalData
== NULL
, "data.lpSectionGlobalData != NULL\n");
1216 ok_(__FILE__
, line
)(data
.ulSectionGlobalDataLength
== 0, "data.ulSectionGlobalDataLength=%u\n",
1217 data
.ulSectionGlobalDataLength
);
1218 ok_(__FILE__
, line
)(data
.lpSectionBase
!= NULL
, "data.lpSectionBase == NULL\n");
1219 ok_(__FILE__
, line
)(data
.ulSectionTotalLength
> 0, "data.ulSectionTotalLength=%u\n",
1220 data
.ulSectionTotalLength
);
1221 ok_(__FILE__
, line
)(data
.hActCtx
== NULL
, "data.hActCtx=%p\n", data
.hActCtx
);
1222 ok_(__FILE__
, line
)(data
.ulAssemblyRosterIndex
== exid
, "data.ulAssemblyRosterIndex=%u, expected %u\n",
1223 data
.ulAssemblyRosterIndex
, exid
);
1225 memset(&data
, 0xfe, sizeof(data
));
1226 data
.cbSize
= sizeof(data
);
1228 ret
= pFindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX
, NULL
,
1229 ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
,
1231 ok_(__FILE__
, line
)(ret
, "FindActCtxSectionStringW failed: %u\n", GetLastError());
1234 ok_(__FILE__
, line
)(data
.cbSize
== sizeof(data
), "data.cbSize=%u\n", data
.cbSize
);
1235 ok_(__FILE__
, line
)(data
.ulDataFormatVersion
== 1, "data.ulDataFormatVersion=%u\n", data
.ulDataFormatVersion
);
1236 ok_(__FILE__
, line
)(data
.lpData
!= NULL
, "data.lpData == NULL\n");
1237 ok_(__FILE__
, line
)(data
.ulLength
== 20, "data.ulLength=%u\n", data
.ulLength
);
1238 ok_(__FILE__
, line
)(data
.lpSectionGlobalData
== NULL
, "data.lpSectionGlobalData != NULL\n");
1239 ok_(__FILE__
, line
)(data
.ulSectionGlobalDataLength
== 0, "data.ulSectionGlobalDataLength=%u\n",
1240 data
.ulSectionGlobalDataLength
);
1241 ok_(__FILE__
, line
)(data
.lpSectionBase
!= NULL
, "data.lpSectionBase == NULL\n");
1242 ok_(__FILE__
, line
)(data
.ulSectionTotalLength
> 0, "data.ulSectionTotalLength=%u\n",
1243 data
.ulSectionTotalLength
);
1244 ok_(__FILE__
, line
)(data
.hActCtx
== handle
, "data.hActCtx=%p\n", data
.hActCtx
);
1245 ok_(__FILE__
, line
)(data
.ulAssemblyRosterIndex
== exid
, "data.ulAssemblyRosterIndex=%u, expected %u\n",
1246 data
.ulAssemblyRosterIndex
, exid
);
1248 pReleaseActCtx(handle
);
1251 static void test_find_window_class(HANDLE handle
, LPCWSTR clsname
, ULONG exid
, int line
)
1253 struct wndclass_redirect_data
*wnddata
;
1254 struct strsection_header
*header
;
1255 ACTCTX_SECTION_KEYED_DATA data
;
1258 memset(&data
, 0xfe, sizeof(data
));
1259 data
.cbSize
= sizeof(data
);
1261 ret
= pFindActCtxSectionStringW(0, NULL
,
1262 ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION
,
1264 ok_(__FILE__
, line
)(ret
, "FindActCtxSectionStringW failed: %u, class %s\n", GetLastError(),
1265 wine_dbgstr_w(clsname
));
1268 header
= (struct strsection_header
*)data
.lpSectionBase
;
1269 wnddata
= (struct wndclass_redirect_data
*)data
.lpData
;
1271 ok_(__FILE__
, line
)(header
->magic
== 0x64487353, "got wrong magic 0x%08x\n", header
->magic
);
1272 ok_(__FILE__
, line
)(header
->count
> 0, "got count %d\n", header
->count
);
1273 ok_(__FILE__
, line
)(data
.cbSize
== sizeof(data
), "data.cbSize=%u\n", data
.cbSize
);
1274 ok_(__FILE__
, line
)(data
.ulDataFormatVersion
== 1, "data.ulDataFormatVersion=%u\n", data
.ulDataFormatVersion
);
1275 ok_(__FILE__
, line
)(data
.lpData
!= NULL
, "data.lpData == NULL\n");
1276 ok_(__FILE__
, line
)(wnddata
->size
== sizeof(*wnddata
), "got %d for header size\n", wnddata
->size
);
1277 if (data
.lpData
&& wnddata
->size
== sizeof(*wnddata
))
1279 static const WCHAR verW
[] = {'6','.','5','.','4','.','3','!',0};
1284 ok_(__FILE__
, line
)(wnddata
->res
== 0, "got reserved as %d\n", wnddata
->res
);
1285 /* redirect class name (versioned or not) is stored just after header data */
1286 ok_(__FILE__
, line
)(wnddata
->name_offset
== wnddata
->size
, "got name offset as %d\n", wnddata
->name_offset
);
1287 ok_(__FILE__
, line
)(wnddata
->module_len
> 0, "got module name length as %d\n", wnddata
->module_len
);
1289 /* expected versioned name */
1290 lstrcpyW(buff
, verW
);
1291 lstrcatW(buff
, clsname
);
1292 ptr
= (WCHAR
*)((BYTE
*)wnddata
+ wnddata
->name_offset
);
1293 ok_(__FILE__
, line
)(!lstrcmpW(ptr
, buff
), "got wrong class name %s, expected %s\n", wine_dbgstr_w(ptr
), wine_dbgstr_w(buff
));
1294 ok_(__FILE__
, line
)(lstrlenW(ptr
)*sizeof(WCHAR
) == wnddata
->name_len
,
1295 "got wrong class name length %d, expected %d\n", wnddata
->name_len
, lstrlenW(ptr
));
1297 /* data length is simply header length + string data length including nulls */
1298 len
= wnddata
->size
+ wnddata
->name_len
+ wnddata
->module_len
+ 2*sizeof(WCHAR
);
1299 ok_(__FILE__
, line
)(data
.ulLength
== len
, "got wrong data length %d, expected %d\n", data
.ulLength
, len
);
1301 if (data
.ulSectionTotalLength
> wnddata
->module_offset
)
1303 WCHAR
*modulename
, *sectionptr
;
1305 /* just compare pointers */
1306 modulename
= (WCHAR
*)((BYTE
*)wnddata
+ wnddata
->size
+ wnddata
->name_len
+ sizeof(WCHAR
));
1307 sectionptr
= (WCHAR
*)((BYTE
*)data
.lpSectionBase
+ wnddata
->module_offset
);
1308 ok_(__FILE__
, line
)(modulename
== sectionptr
, "got wrong name offset %p, expected %p\n", sectionptr
, modulename
);
1312 ok_(__FILE__
, line
)(data
.lpSectionGlobalData
== NULL
, "data.lpSectionGlobalData != NULL\n");
1313 ok_(__FILE__
, line
)(data
.ulSectionGlobalDataLength
== 0, "data.ulSectionGlobalDataLength=%u\n",
1314 data
.ulSectionGlobalDataLength
);
1315 ok_(__FILE__
, line
)(data
.lpSectionBase
!= NULL
, "data.lpSectionBase == NULL\n");
1316 ok_(__FILE__
, line
)(data
.ulSectionTotalLength
> 0, "data.ulSectionTotalLength=%u\n",
1317 data
.ulSectionTotalLength
);
1318 ok_(__FILE__
, line
)(data
.hActCtx
== NULL
, "data.hActCtx=%p\n", data
.hActCtx
);
1319 ok_(__FILE__
, line
)(data
.ulAssemblyRosterIndex
== exid
, "data.ulAssemblyRosterIndex=%u, expected %u\n",
1320 data
.ulAssemblyRosterIndex
, exid
);
1322 memset(&data
, 0xfe, sizeof(data
));
1323 data
.cbSize
= sizeof(data
);
1325 ret
= pFindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX
, NULL
,
1326 ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION
,
1328 ok_(__FILE__
, line
)(ret
, "FindActCtxSectionStringW failed: %u, class %s\n", GetLastError(),
1329 wine_dbgstr_w(clsname
));
1332 ok_(__FILE__
, line
)(data
.cbSize
== sizeof(data
), "data.cbSize=%u\n", data
.cbSize
);
1333 ok_(__FILE__
, line
)(data
.ulDataFormatVersion
== 1, "data.ulDataFormatVersion=%u\n", data
.ulDataFormatVersion
);
1334 ok_(__FILE__
, line
)(data
.lpData
!= NULL
, "data.lpData == NULL\n");
1335 ok_(__FILE__
, line
)(data
.ulLength
> 0, "data.ulLength=%u\n", data
.ulLength
);
1336 ok_(__FILE__
, line
)(data
.lpSectionGlobalData
== NULL
, "data.lpSectionGlobalData != NULL\n");
1337 ok_(__FILE__
, line
)(data
.ulSectionGlobalDataLength
== 0, "data.ulSectionGlobalDataLength=%u\n",
1338 data
.ulSectionGlobalDataLength
);
1339 ok_(__FILE__
, line
)(data
.lpSectionBase
!= NULL
, "data.lpSectionBase == NULL\n");
1340 ok_(__FILE__
, line
)(data
.ulSectionTotalLength
> 0, "data.ulSectionTotalLength=%u\n", data
.ulSectionTotalLength
);
1341 ok_(__FILE__
, line
)(data
.hActCtx
== handle
, "data.hActCtx=%p\n", data
.hActCtx
);
1342 ok_(__FILE__
, line
)(data
.ulAssemblyRosterIndex
== exid
, "data.ulAssemblyRosterIndex=%u, expected %u\n",
1343 data
.ulAssemblyRosterIndex
, exid
);
1345 pReleaseActCtx(handle
);
1348 static void test_find_string_fail(void)
1350 ACTCTX_SECTION_KEYED_DATA data
= {sizeof(data
)};
1353 ret
= pFindActCtxSectionStringW(0, NULL
, 100, testlib_dll
, &data
);
1354 ok(!ret
, "FindActCtxSectionStringW succeeded\n");
1355 ok(GetLastError() == ERROR_SXS_SECTION_NOT_FOUND
, "GetLastError()=%u\n", GetLastError());
1357 ret
= pFindActCtxSectionStringW(0, NULL
, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
,
1358 testlib2_dll
, &data
);
1359 ok(!ret
, "FindActCtxSectionStringW succeeded\n");
1360 ok(GetLastError() == ERROR_SXS_KEY_NOT_FOUND
, "GetLastError()=%u\n", GetLastError());
1362 ret
= pFindActCtxSectionStringW(0, NULL
, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
,
1364 ok(!ret
, "FindActCtxSectionStringW succeeded\n");
1365 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError()=%u\n", GetLastError());
1367 ret
= pFindActCtxSectionStringW(0, NULL
, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
,
1369 ok(!ret
, "FindActCtxSectionStringW succeeded\n");
1370 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError()=%u\n", GetLastError());
1373 ret
= pFindActCtxSectionStringW(0, NULL
, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
,
1374 testlib_dll
, &data
);
1375 ok(!ret
, "FindActCtxSectionStringW succeeded\n");
1376 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError()=%u\n", GetLastError());
1379 ret
= pFindActCtxSectionStringW(0, NULL
, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
,
1380 testlib_dll
, &data
);
1381 ok(!ret
, "FindActCtxSectionStringW succeeded\n");
1382 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError()=%u\n", GetLastError());
1386 static void test_basic_info(HANDLE handle
, int line
)
1388 ACTIVATION_CONTEXT_BASIC_INFORMATION basic
;
1392 b
= pQueryActCtxW(QUERY_ACTCTX_FLAG_NO_ADDREF
, handle
, NULL
,
1393 ActivationContextBasicInformation
, &basic
,
1394 sizeof(basic
), &size
);
1396 ok_(__FILE__
, line
) (b
,"ActivationContextBasicInformation failed\n");
1397 ok_(__FILE__
, line
) (size
== sizeof(ACTIVATION_CONTEXT_BASIC_INFORMATION
),"size mismatch\n");
1398 ok_(__FILE__
, line
) (basic
.dwFlags
== 0, "unexpected flags %x\n",basic
.dwFlags
);
1399 ok_(__FILE__
, line
) (basic
.hActCtx
== handle
, "unexpected handle\n");
1401 b
= pQueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX
|
1402 QUERY_ACTCTX_FLAG_NO_ADDREF
, handle
, NULL
,
1403 ActivationContextBasicInformation
, &basic
,
1404 sizeof(basic
), &size
);
1407 ok_(__FILE__
, line
) (!b
,"ActivationContextBasicInformation succeeded\n");
1408 ok_(__FILE__
, line
) (size
== 0,"size mismatch\n");
1409 ok_(__FILE__
, line
) (GetLastError() == ERROR_INVALID_PARAMETER
, "Wrong last error\n");
1410 ok_(__FILE__
, line
) (basic
.dwFlags
== 0, "unexpected flags %x\n",basic
.dwFlags
);
1411 ok_(__FILE__
, line
) (basic
.hActCtx
== handle
, "unexpected handle\n");
1415 ok_(__FILE__
, line
) (b
,"ActivationContextBasicInformation failed\n");
1416 ok_(__FILE__
, line
) (size
== sizeof(ACTIVATION_CONTEXT_BASIC_INFORMATION
),"size mismatch\n");
1417 ok_(__FILE__
, line
) (basic
.dwFlags
== 0, "unexpected flags %x\n",basic
.dwFlags
);
1418 ok_(__FILE__
, line
) (basic
.hActCtx
== handle
, "unexpected handle\n");
1422 enum comclass_threadingmodel
{
1423 ThreadingModel_Apartment
= 1,
1424 ThreadingModel_Free
= 2,
1425 ThreadingModel_No
= 3,
1426 ThreadingModel_Both
= 4,
1427 ThreadingModel_Neutral
= 5
1430 enum comclass_miscfields
{
1433 MiscStatusContent
= 4,
1434 MiscStatusThumbnail
= 8,
1435 MiscStatusDocPrint
= 16
1438 struct comclassredirect_data
{
1451 ULONG progid_offset
;
1453 ULONG clrdata_offset
;
1455 DWORD miscstatuscontent
;
1456 DWORD miscstatusthumbnail
;
1457 DWORD miscstatusicon
;
1458 DWORD miscstatusdocprint
;
1461 struct clrclass_data
{
1465 ULONG module_offset
;
1469 ULONG version_offset
;
1473 static void test_find_com_redirection(HANDLE handle
, const GUID
*clsid
, const GUID
*tlid
, const WCHAR
*progid
, ULONG exid
, int line
)
1475 struct comclassredirect_data
*comclass
, *comclass2
;
1476 ACTCTX_SECTION_KEYED_DATA data
, data2
;
1477 struct guidsection_header
*header
;
1480 memset(&data
, 0xfe, sizeof(data
));
1481 data
.cbSize
= sizeof(data
);
1483 ret
= pFindActCtxSectionGuid(0, NULL
,
1484 ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION
,
1488 skip("failed for guid %s\n", wine_dbgstr_guid(clsid
));
1491 ok_(__FILE__
, line
)(ret
, "FindActCtxSectionGuid failed: %u\n", GetLastError());
1493 comclass
= (struct comclassredirect_data
*)data
.lpData
;
1495 ok_(__FILE__
, line
)(data
.cbSize
== sizeof(data
), "data.cbSize=%u\n", data
.cbSize
);
1496 ok_(__FILE__
, line
)(data
.ulDataFormatVersion
== 1, "data.ulDataFormatVersion=%u\n", data
.ulDataFormatVersion
);
1497 ok_(__FILE__
, line
)(data
.lpData
!= NULL
, "data.lpData == NULL\n");
1498 ok_(__FILE__
, line
)(comclass
->size
== sizeof(*comclass
), "got %d for header size\n", comclass
->size
);
1499 if (data
.lpData
&& comclass
->size
== sizeof(*comclass
))
1504 ok_(__FILE__
, line
)(comclass
->res
== 0, "got res as %d\n", comclass
->res
);
1505 ok_(__FILE__
, line
)(comclass
->res1
[0] == 0, "got res1[0] as %02x\n", comclass
->res1
[0]);
1506 ok_(__FILE__
, line
)(comclass
->res1
[1] == 0, "got res1[1] as %02x\n", comclass
->res1
[1]);
1507 ok_(__FILE__
, line
)(comclass
->model
== ThreadingModel_Neutral
, "got model %d\n", comclass
->model
);
1508 ok_(__FILE__
, line
)(IsEqualGUID(&comclass
->clsid
, clsid
), "got wrong clsid %s\n", wine_dbgstr_guid(&comclass
->clsid
));
1509 ok_(__FILE__
, line
)(IsEqualGUID(&comclass
->clsid2
, clsid
), "got wrong clsid2 %s\n", wine_dbgstr_guid(&comclass
->clsid2
));
1511 ok_(__FILE__
, line
)(IsEqualGUID(&comclass
->tlid
, tlid
), "got wrong tlid %s\n", wine_dbgstr_guid(&comclass
->tlid
));
1512 ok_(__FILE__
, line
)(comclass
->name_len
> 0, "got modulename len %d\n", comclass
->name_len
);
1516 len
= comclass
->size
+ comclass
->clrdata_len
;
1517 ok_(__FILE__
, line
)(comclass
->progid_offset
== len
, "got progid offset %d, expected %d\n", comclass
->progid_offset
, len
);
1520 ok_(__FILE__
, line
)(comclass
->progid_offset
== 0, "got progid offset %d, expected 0\n", comclass
->progid_offset
);
1522 if (comclass
->progid_offset
)
1524 ptr
= (WCHAR
*)((BYTE
*)comclass
+ comclass
->progid_offset
);
1525 ok_(__FILE__
, line
)(!lstrcmpW(ptr
, progid
), "got wrong progid %s, expected %s\n", wine_dbgstr_w(ptr
), wine_dbgstr_w(progid
));
1526 ok_(__FILE__
, line
)(lstrlenW(progid
)*sizeof(WCHAR
) == comclass
->progid_len
,
1527 "got progid name length %d\n", comclass
->progid_len
);
1530 /* data length is simply header length + string data length including nulls */
1531 len
= comclass
->size
+ comclass
->clrdata_len
;
1532 if (comclass
->progid_len
) len
+= comclass
->progid_len
+ sizeof(WCHAR
);
1533 ok_(__FILE__
, line
)(data
.ulLength
== len
, "got wrong data length %d, expected %d\n", data
.ulLength
, len
);
1535 /* keyed data structure doesn't include module name, it's available from section data */
1536 ok_(__FILE__
, line
)(data
.ulSectionTotalLength
> comclass
->name_offset
, "got wrong offset %d\n", comclass
->name_offset
);
1538 /* check misc fields are set */
1539 if (comclass
->miscmask
)
1541 if (comclass
->miscmask
& MiscStatus
)
1542 ok_(__FILE__
, line
)(comclass
->miscstatus
!= 0, "got miscstatus 0x%08x\n", comclass
->miscstatus
);
1543 if (comclass
->miscmask
& MiscStatusIcon
)
1544 ok_(__FILE__
, line
)(comclass
->miscstatusicon
!= 0, "got miscstatusicon 0x%08x\n", comclass
->miscstatusicon
);
1545 if (comclass
->miscmask
& MiscStatusContent
)
1546 ok_(__FILE__
, line
)(comclass
->miscstatuscontent
!= 0, "got miscstatuscontent 0x%08x\n", comclass
->miscstatuscontent
);
1547 if (comclass
->miscmask
& MiscStatusThumbnail
)
1548 ok_(__FILE__
, line
)(comclass
->miscstatusthumbnail
!= 0, "got miscstatusthumbnail 0x%08x\n", comclass
->miscstatusthumbnail
);
1549 if (comclass
->miscmask
& MiscStatusDocPrint
)
1550 ok_(__FILE__
, line
)(comclass
->miscstatusdocprint
!= 0, "got miscstatusdocprint 0x%08x\n", comclass
->miscstatusdocprint
);
1553 /* part used for clrClass only */
1554 if (comclass
->clrdata_len
)
1556 static const WCHAR mscoreeW
[] = {'M','S','C','O','R','E','E','.','D','L','L',0};
1557 static const WCHAR mscoree2W
[] = {'m','s','c','o','r','e','e','.','d','l','l',0};
1558 struct clrclass_data
*clrclass
;
1561 clrclass
= (struct clrclass_data
*)((BYTE
*)data
.lpData
+ comclass
->clrdata_offset
);
1562 ok_(__FILE__
, line
)(clrclass
->size
== sizeof(*clrclass
), "clrclass: got size %d\n", clrclass
->size
);
1563 ok_(__FILE__
, line
)(clrclass
->res
[0] == 0, "clrclass: got res[0]=0x%08x\n", clrclass
->res
[0]);
1564 ok_(__FILE__
, line
)(clrclass
->res
[1] == 2, "clrclass: got res[1]=0x%08x\n", clrclass
->res
[1]);
1565 ok_(__FILE__
, line
)(clrclass
->module_len
== lstrlenW(mscoreeW
)*sizeof(WCHAR
), "clrclass: got module len %d\n", clrclass
->module_len
);
1566 ok_(__FILE__
, line
)(clrclass
->module_offset
> 0, "clrclass: got module offset %d\n", clrclass
->module_offset
);
1568 ok_(__FILE__
, line
)(clrclass
->name_len
> 0, "clrclass: got name len %d\n", clrclass
->name_len
);
1569 ok_(__FILE__
, line
)(clrclass
->name_offset
== clrclass
->size
, "clrclass: got name offset %d\n", clrclass
->name_offset
);
1570 ok_(__FILE__
, line
)(clrclass
->version_len
> 0, "clrclass: got version len %d\n", clrclass
->version_len
);
1571 ok_(__FILE__
, line
)(clrclass
->version_offset
> 0, "clrclass: got version offset %d\n", clrclass
->version_offset
);
1573 ok_(__FILE__
, line
)(clrclass
->res2
[0] == 0, "clrclass: got res2[0]=0x%08x\n", clrclass
->res2
[0]);
1574 ok_(__FILE__
, line
)(clrclass
->res2
[1] == 0, "clrclass: got res2[1]=0x%08x\n", clrclass
->res2
[1]);
1576 /* clrClass uses mscoree.dll as module name, but in two variants - comclass data points to module name
1577 in lower case, clsclass subsection - in upper case */
1578 ok_(__FILE__
, line
)(comclass
->name_len
== lstrlenW(mscoree2W
)*sizeof(WCHAR
), "clrclass: got com name len %d\n", comclass
->name_len
);
1579 ok_(__FILE__
, line
)(comclass
->name_offset
> 0, "clrclass: got name offset %d\n", clrclass
->name_offset
);
1581 ptrW
= (WCHAR
*)((BYTE
*)data
.lpSectionBase
+ comclass
->name_offset
);
1582 ok_(__FILE__
, line
)(!lstrcmpW(ptrW
, mscoreeW
), "clrclass: module name %s\n", wine_dbgstr_w(ptrW
));
1584 ptrW
= (WCHAR
*)((BYTE
*)data
.lpSectionBase
+ clrclass
->module_offset
);
1585 ok_(__FILE__
, line
)(!lstrcmpW(ptrW
, mscoree2W
), "clrclass: module name2 %s\n", wine_dbgstr_w(ptrW
));
1589 header
= (struct guidsection_header
*)data
.lpSectionBase
;
1590 ok_(__FILE__
, line
)(data
.lpSectionGlobalData
== ((BYTE
*)header
+ header
->names_offset
), "data.lpSectionGlobalData == NULL\n");
1591 ok_(__FILE__
, line
)(data
.ulSectionGlobalDataLength
== header
->names_len
, "data.ulSectionGlobalDataLength=%u\n",
1592 data
.ulSectionGlobalDataLength
);
1593 ok_(__FILE__
, line
)(data
.lpSectionBase
!= NULL
, "data.lpSectionBase == NULL\n");
1594 ok_(__FILE__
, line
)(data
.ulSectionTotalLength
> 0, "data.ulSectionTotalLength=%u\n",
1595 data
.ulSectionTotalLength
);
1596 ok_(__FILE__
, line
)(data
.hActCtx
== NULL
, "data.hActCtx=%p\n", data
.hActCtx
);
1597 ok_(__FILE__
, line
)(data
.ulAssemblyRosterIndex
== exid
, "data.ulAssemblyRosterIndex=%u, expected %u\n",
1598 data
.ulAssemblyRosterIndex
, exid
);
1600 /* generated guid for this class works as key guid in search */
1601 memset(&data2
, 0xfe, sizeof(data2
));
1602 data2
.cbSize
= sizeof(data2
);
1603 ret
= pFindActCtxSectionGuid(0, NULL
,
1604 ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION
,
1605 &comclass
->alias
, &data2
);
1606 ok_(__FILE__
, line
)(ret
, "FindActCtxSectionGuid failed: %u\n", GetLastError());
1608 comclass2
= (struct comclassredirect_data
*)data2
.lpData
;
1609 ok_(__FILE__
, line
)(comclass
->size
== comclass2
->size
, "got wrong data length %d, expected %d\n", comclass2
->size
, comclass
->size
);
1610 ok_(__FILE__
, line
)(!memcmp(comclass
, comclass2
, comclass
->size
), "got wrong data\n");
1619 struct ifacepsredirect_data
1631 static void test_find_ifaceps_redirection(HANDLE handle
, const GUID
*iid
, const GUID
*tlbid
, const GUID
*base
,
1632 const GUID
*ps32
, ULONG exid
, int line
)
1634 struct ifacepsredirect_data
*ifaceps
;
1635 ACTCTX_SECTION_KEYED_DATA data
;
1638 memset(&data
, 0xfe, sizeof(data
));
1639 data
.cbSize
= sizeof(data
);
1641 ret
= pFindActCtxSectionGuid(0, NULL
,
1642 ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION
,
1644 ok_(__FILE__
, line
)(ret
, "FindActCtxSectionGuid failed: %u\n", GetLastError());
1646 ifaceps
= (struct ifacepsredirect_data
*)data
.lpData
;
1648 ok_(__FILE__
, line
)(data
.cbSize
== sizeof(data
), "data.cbSize=%u\n", data
.cbSize
);
1649 ok_(__FILE__
, line
)(data
.ulDataFormatVersion
== 1, "data.ulDataFormatVersion=%u\n", data
.ulDataFormatVersion
);
1650 ok_(__FILE__
, line
)(data
.lpData
!= NULL
, "data.lpData == NULL\n");
1651 ok_(__FILE__
, line
)(ifaceps
->size
== sizeof(*ifaceps
), "got %d for header size\n", ifaceps
->size
);
1652 if (data
.lpData
&& ifaceps
->size
== sizeof(*ifaceps
))
1656 /* for external proxy stubs it contains a value from 'proxyStubClsid32' */
1659 ok_(__FILE__
, line
)(IsEqualGUID(&ifaceps
->iid
, ps32
), "got wrong iid %s\n", wine_dbgstr_guid(&ifaceps
->iid
));
1662 ok_(__FILE__
, line
)(IsEqualGUID(&ifaceps
->iid
, iid
), "got wrong iid %s\n", wine_dbgstr_guid(&ifaceps
->iid
));
1664 ok_(__FILE__
, line
)(IsEqualGUID(&ifaceps
->tlbid
, tlbid
), "got wrong tlid %s\n", wine_dbgstr_guid(&ifaceps
->tlbid
));
1665 ok_(__FILE__
, line
)(ifaceps
->name_len
> 0, "got modulename len %d\n", ifaceps
->name_len
);
1666 ok_(__FILE__
, line
)(ifaceps
->name_offset
== ifaceps
->size
, "got progid offset %d\n", ifaceps
->name_offset
);
1668 /* data length is simply header length + string data length including nulls */
1669 len
= ifaceps
->size
+ ifaceps
->name_len
+ sizeof(WCHAR
);
1670 ok_(__FILE__
, line
)(data
.ulLength
== len
, "got wrong data length %d, expected %d\n", data
.ulLength
, len
);
1672 /* mask purpose is to indicate if attribute was specified, for testing purposes assume that manifest
1673 always has non-zero value for it */
1674 if (ifaceps
->mask
& NumMethods
)
1675 ok_(__FILE__
, line
)(ifaceps
->nummethods
!= 0, "got nummethods %d\n", ifaceps
->nummethods
);
1676 if (ifaceps
->mask
& BaseIface
)
1677 ok_(__FILE__
, line
)(IsEqualGUID(&ifaceps
->base
, base
), "got base %s\n", wine_dbgstr_guid(&ifaceps
->base
));
1680 ok_(__FILE__
, line
)(data
.lpSectionGlobalData
== NULL
, "data.lpSectionGlobalData != NULL\n");
1681 ok_(__FILE__
, line
)(data
.ulSectionGlobalDataLength
== 0, "data.ulSectionGlobalDataLength=%u\n",
1682 data
.ulSectionGlobalDataLength
);
1683 ok_(__FILE__
, line
)(data
.lpSectionBase
!= NULL
, "data.lpSectionBase == NULL\n");
1684 ok_(__FILE__
, line
)(data
.ulSectionTotalLength
> 0, "data.ulSectionTotalLength=%u\n",
1685 data
.ulSectionTotalLength
);
1686 ok_(__FILE__
, line
)(data
.hActCtx
== NULL
, "data.hActCtx=%p\n", data
.hActCtx
);
1687 ok_(__FILE__
, line
)(data
.ulAssemblyRosterIndex
== exid
, "data.ulAssemblyRosterIndex=%u, expected %u\n",
1688 data
.ulAssemblyRosterIndex
, exid
);
1691 struct clrsurrogate_data
1696 ULONG version_offset
;
1702 static void test_find_surrogate(HANDLE handle
, const GUID
*clsid
, const WCHAR
*name
, const WCHAR
*version
,
1703 ULONG exid
, int line
)
1705 struct clrsurrogate_data
*surrogate
;
1706 ACTCTX_SECTION_KEYED_DATA data
;
1709 memset(&data
, 0xfe, sizeof(data
));
1710 data
.cbSize
= sizeof(data
);
1712 ret
= pFindActCtxSectionGuid(0, NULL
,
1713 ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES
,
1717 skip("surrogate sections are not supported\n");
1720 ok_(__FILE__
, line
)(ret
, "FindActCtxSectionGuid failed: %u\n", GetLastError());
1722 surrogate
= (struct clrsurrogate_data
*)data
.lpData
;
1724 ok_(__FILE__
, line
)(data
.cbSize
== sizeof(data
), "data.cbSize=%u\n", data
.cbSize
);
1725 ok_(__FILE__
, line
)(data
.ulDataFormatVersion
== 1, "data.ulDataFormatVersion=%u\n", data
.ulDataFormatVersion
);
1726 ok_(__FILE__
, line
)(data
.lpData
!= NULL
, "data.lpData == NULL\n");
1727 ok_(__FILE__
, line
)(surrogate
->size
== sizeof(*surrogate
), "got %d for header size\n", surrogate
->size
);
1728 if (data
.lpData
&& surrogate
->size
== sizeof(*surrogate
))
1733 ok_(__FILE__
, line
)(surrogate
->res
== 0, "invalid res value %d\n", surrogate
->res
);
1734 ok_(__FILE__
, line
)(IsEqualGUID(&surrogate
->clsid
, clsid
), "got wrong clsid %s\n", wine_dbgstr_guid(&surrogate
->clsid
));
1736 ok_(__FILE__
, line
)(surrogate
->version_len
== lstrlenW(version
)*sizeof(WCHAR
), "got version len %d\n", surrogate
->version_len
);
1737 ok_(__FILE__
, line
)(surrogate
->version_offset
== surrogate
->size
, "got version offset %d\n", surrogate
->version_offset
);
1739 ok_(__FILE__
, line
)(surrogate
->name_len
== lstrlenW(name
)*sizeof(WCHAR
), "got name len %d\n", surrogate
->name_len
);
1740 ok_(__FILE__
, line
)(surrogate
->name_offset
> surrogate
->version_offset
, "got name offset %d\n", surrogate
->name_offset
);
1742 len
= surrogate
->size
+ surrogate
->name_len
+ surrogate
->version_len
+ 2*sizeof(WCHAR
);
1743 ok_(__FILE__
, line
)(data
.ulLength
== len
, "got wrong data length %d, expected %d\n", data
.ulLength
, len
);
1745 ptrW
= (WCHAR
*)((BYTE
*)surrogate
+ surrogate
->name_offset
);
1746 ok(!lstrcmpW(ptrW
, name
), "got wrong name %s\n", wine_dbgstr_w(ptrW
));
1748 ptrW
= (WCHAR
*)((BYTE
*)surrogate
+ surrogate
->version_offset
);
1749 ok(!lstrcmpW(ptrW
, version
), "got wrong name %s\n", wine_dbgstr_w(ptrW
));
1752 ok_(__FILE__
, line
)(data
.lpSectionGlobalData
== NULL
, "data.lpSectionGlobalData != NULL\n");
1753 ok_(__FILE__
, line
)(data
.ulSectionGlobalDataLength
== 0, "data.ulSectionGlobalDataLength=%u\n",
1754 data
.ulSectionGlobalDataLength
);
1755 ok_(__FILE__
, line
)(data
.lpSectionBase
!= NULL
, "data.lpSectionBase == NULL\n");
1756 ok_(__FILE__
, line
)(data
.ulSectionTotalLength
> 0, "data.ulSectionTotalLength=%u\n",
1757 data
.ulSectionTotalLength
);
1758 ok_(__FILE__
, line
)(data
.hActCtx
== NULL
, "data.hActCtx=%p\n", data
.hActCtx
);
1759 ok_(__FILE__
, line
)(data
.ulAssemblyRosterIndex
== exid
, "data.ulAssemblyRosterIndex=%u, expected %u\n",
1760 data
.ulAssemblyRosterIndex
, exid
);
1763 static void test_find_progid_redirection(HANDLE handle
, const GUID
*clsid
, const char *progid
, ULONG exid
, int line
)
1765 struct progidredirect_data
*progiddata
;
1766 struct comclassredirect_data
*comclass
;
1767 ACTCTX_SECTION_KEYED_DATA data
, data2
;
1768 struct strsection_header
*header
;
1771 memset(&data
, 0xfe, sizeof(data
));
1772 data
.cbSize
= sizeof(data
);
1774 ret
= pFindActCtxSectionStringA(0, NULL
,
1775 ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION
,
1777 ok_(__FILE__
, line
)(ret
, "FindActCtxSectionStringA failed: %u\n", GetLastError());
1779 progiddata
= (struct progidredirect_data
*)data
.lpData
;
1781 ok_(__FILE__
, line
)(data
.cbSize
== sizeof(data
), "data.cbSize=%u\n", data
.cbSize
);
1782 ok_(__FILE__
, line
)(data
.ulDataFormatVersion
== 1, "data.ulDataFormatVersion=%u\n", data
.ulDataFormatVersion
);
1783 ok_(__FILE__
, line
)(data
.lpData
!= NULL
, "data.lpData == NULL\n");
1784 ok_(__FILE__
, line
)(progiddata
->size
== sizeof(*progiddata
), "got %d for header size\n", progiddata
->size
);
1785 if (data
.lpData
&& progiddata
->size
== sizeof(*progiddata
))
1789 ok_(__FILE__
, line
)(progiddata
->reserved
== 0, "got reserved as %d\n", progiddata
->reserved
);
1790 ok_(__FILE__
, line
)(progiddata
->clsid_offset
> 0, "got clsid_offset as %d\n", progiddata
->clsid_offset
);
1792 /* progid data points to generated alias guid */
1793 guid
= (GUID
*)((BYTE
*)data
.lpSectionBase
+ progiddata
->clsid_offset
);
1795 memset(&data2
, 0, sizeof(data2
));
1796 data2
.cbSize
= sizeof(data2
);
1797 ret
= pFindActCtxSectionGuid(0, NULL
,
1798 ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION
,
1800 ok_(__FILE__
, line
)(ret
, "FindActCtxSectionGuid failed: %u\n", GetLastError());
1802 comclass
= (struct comclassredirect_data
*)data2
.lpData
;
1803 ok_(__FILE__
, line
)(IsEqualGUID(guid
, &comclass
->alias
), "got wrong alias referenced from progid %s, %s\n", progid
, wine_dbgstr_guid(guid
));
1804 ok_(__FILE__
, line
)(IsEqualGUID(clsid
, &comclass
->clsid
), "got wrong class referenced from progid %s, %s\n", progid
, wine_dbgstr_guid(clsid
));
1807 header
= (struct strsection_header
*)data
.lpSectionBase
;
1808 ok_(__FILE__
, line
)(data
.lpSectionGlobalData
== (BYTE
*)header
+ header
->global_offset
, "data.lpSectionGlobalData == NULL\n");
1809 ok_(__FILE__
, line
)(data
.ulSectionGlobalDataLength
== header
->global_len
, "data.ulSectionGlobalDataLength=%u\n", data
.ulSectionGlobalDataLength
);
1810 ok_(__FILE__
, line
)(data
.lpSectionBase
!= NULL
, "data.lpSectionBase == NULL\n");
1811 ok_(__FILE__
, line
)(data
.ulSectionTotalLength
> 0, "data.ulSectionTotalLength=%u\n", data
.ulSectionTotalLength
);
1812 ok_(__FILE__
, line
)(data
.hActCtx
== NULL
, "data.hActCtx=%p\n", data
.hActCtx
);
1813 ok_(__FILE__
, line
)(data
.ulAssemblyRosterIndex
== exid
, "data.ulAssemblyRosterIndex=%u, expected %u\n",
1814 data
.ulAssemblyRosterIndex
, exid
);
1817 static void test_wndclass_section(void)
1819 static const WCHAR cls1W
[] = {'1','.','2','.','3','.','4','!','w','n','d','C','l','a','s','s','1',0};
1820 ACTCTX_SECTION_KEYED_DATA data
, data2
;
1821 struct wndclass_redirect_data
*classdata
;
1822 struct strsection_header
*section
;
1828 /* use two dependent manifests, each defines 2 window class redirects */
1829 create_manifest_file("testdep1.manifest", manifest_wndcls1
, -1, NULL
, NULL
);
1830 create_manifest_file("testdep2.manifest", manifest_wndcls2
, -1, NULL
, NULL
);
1831 create_manifest_file("main_wndcls.manifest", manifest_wndcls_main
, -1, NULL
, NULL
);
1833 handle
= test_create("main_wndcls.manifest");
1834 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
1836 DeleteFileA("testdep1.manifest");
1837 DeleteFileA("testdep2.manifest");
1838 DeleteFileA("main_wndcls.manifest");
1840 ret
= pActivateActCtx(handle
, &cookie
);
1841 ok(ret
, "ActivateActCtx failed: %u\n", GetLastError());
1843 memset(&data
, 0, sizeof(data
));
1844 memset(&data2
, 0, sizeof(data2
));
1845 data
.cbSize
= sizeof(data
);
1846 data2
.cbSize
= sizeof(data2
);
1848 /* get data for two classes from different assemblies */
1849 ret
= pFindActCtxSectionStringW(0, NULL
,
1850 ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION
,
1852 ok(ret
, "got %d\n", ret
);
1853 ret
= pFindActCtxSectionStringW(0, NULL
,
1854 ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION
,
1855 wndClass3W
, &data2
);
1856 ok(ret
, "got %d\n", ret
);
1858 section
= (struct strsection_header
*)data
.lpSectionBase
;
1859 ok(section
->count
== 4, "got %d\n", section
->count
);
1860 ok(section
->size
== sizeof(*section
), "got %d\n", section
->size
);
1862 /* For both string same section is returned, meaning it's one wndclass section per context */
1863 ok(data
.lpSectionBase
== data2
.lpSectionBase
, "got %p, %p\n", data
.lpSectionBase
, data2
.lpSectionBase
);
1864 ok(data
.ulSectionTotalLength
== data2
.ulSectionTotalLength
, "got %u, %u\n", data
.ulSectionTotalLength
,
1865 data2
.ulSectionTotalLength
);
1867 /* wndClass1 is versioned, wndClass3 is not */
1868 classdata
= (struct wndclass_redirect_data
*)data
.lpData
;
1869 ptrW
= (WCHAR
*)((BYTE
*)data
.lpData
+ classdata
->name_offset
);
1870 ok(!lstrcmpW(ptrW
, cls1W
), "got %s\n", wine_dbgstr_w(ptrW
));
1872 classdata
= (struct wndclass_redirect_data
*)data2
.lpData
;
1873 ptrW
= (WCHAR
*)((BYTE
*)data2
.lpData
+ classdata
->name_offset
);
1874 ok(!lstrcmpW(ptrW
, wndClass3W
), "got %s\n", wine_dbgstr_w(ptrW
));
1876 ret
= pDeactivateActCtx(0, cookie
);
1877 ok(ret
, "DeactivateActCtx failed: %u\n", GetLastError());
1879 pReleaseActCtx(handle
);
1882 static void test_dllredirect_section(void)
1884 static const WCHAR testlib1W
[] = {'t','e','s','t','l','i','b','1','.','d','l','l',0};
1885 static const WCHAR testlib2W
[] = {'t','e','s','t','l','i','b','2','.','d','l','l',0};
1886 ACTCTX_SECTION_KEYED_DATA data
, data2
;
1887 struct strsection_header
*section
;
1892 /* use two dependent manifests, 4 'files' total */
1893 create_manifest_file("testdep1.manifest", manifest_wndcls1
, -1, NULL
, NULL
);
1894 create_manifest_file("testdep2.manifest", manifest_wndcls2
, -1, NULL
, NULL
);
1895 create_manifest_file("main_wndcls.manifest", manifest_wndcls_main
, -1, NULL
, NULL
);
1897 handle
= test_create("main_wndcls.manifest");
1898 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
1900 DeleteFileA("testdep1.manifest");
1901 DeleteFileA("testdep2.manifest");
1902 DeleteFileA("main_wndcls.manifest");
1904 ret
= pActivateActCtx(handle
, &cookie
);
1905 ok(ret
, "ActivateActCtx failed: %u\n", GetLastError());
1907 memset(&data
, 0, sizeof(data
));
1908 memset(&data2
, 0, sizeof(data2
));
1909 data
.cbSize
= sizeof(data
);
1910 data2
.cbSize
= sizeof(data2
);
1912 /* get data for two files from different assemblies */
1913 ret
= pFindActCtxSectionStringW(0, NULL
,
1914 ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
,
1916 ok(ret
, "got %d\n", ret
);
1917 ret
= pFindActCtxSectionStringW(0, NULL
,
1918 ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
,
1920 ok(ret
, "got %d\n", ret
);
1922 section
= (struct strsection_header
*)data
.lpSectionBase
;
1923 ok(section
->count
== 4, "got %d\n", section
->count
);
1924 ok(section
->size
== sizeof(*section
), "got %d\n", section
->size
);
1926 /* For both string same section is returned, meaning it's one dll redirect section per context */
1927 ok(data
.lpSectionBase
== data2
.lpSectionBase
, "got %p, %p\n", data
.lpSectionBase
, data2
.lpSectionBase
);
1928 ok(data
.ulSectionTotalLength
== data2
.ulSectionTotalLength
, "got %u, %u\n", data
.ulSectionTotalLength
,
1929 data2
.ulSectionTotalLength
);
1931 ret
= pDeactivateActCtx(0, cookie
);
1932 ok(ret
, "DeactivateActCtx failed: %u\n", GetLastError());
1934 pReleaseActCtx(handle
);
1937 static void test_typelib_section(void)
1939 static const WCHAR helpW
[] = {'h','e','l','p'};
1940 ACTCTX_SECTION_KEYED_DATA data
, data2
;
1941 struct guidsection_header
*section
;
1942 struct tlibredirect_data
*tlib
;
1947 /* use two dependent manifests, 4 'files' total */
1948 create_manifest_file("testdep1.manifest", manifest_wndcls1
, -1, NULL
, NULL
);
1949 create_manifest_file("testdep2.manifest", manifest_wndcls2
, -1, NULL
, NULL
);
1950 create_manifest_file("main_wndcls.manifest", manifest_wndcls_main
, -1, NULL
, NULL
);
1952 handle
= test_create("main_wndcls.manifest");
1953 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
1955 DeleteFileA("testdep1.manifest");
1956 DeleteFileA("testdep2.manifest");
1957 DeleteFileA("main_wndcls.manifest");
1959 ret
= pActivateActCtx(handle
, &cookie
);
1960 ok(ret
, "ActivateActCtx failed: %u\n", GetLastError());
1962 memset(&data
, 0, sizeof(data
));
1963 memset(&data2
, 0, sizeof(data2
));
1964 data
.cbSize
= sizeof(data
);
1965 data2
.cbSize
= sizeof(data2
);
1967 /* get data for two typelibs from different assemblies */
1968 ret
= pFindActCtxSectionGuid(0, NULL
,
1969 ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION
,
1970 &IID_TlibTest
, &data
);
1971 ok(ret
, "got %d\n", ret
);
1973 ret
= pFindActCtxSectionGuid(0, NULL
,
1974 ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION
,
1975 &IID_TlibTest4
, &data2
);
1976 ok(ret
, "got %d\n", ret
);
1978 section
= (struct guidsection_header
*)data
.lpSectionBase
;
1979 ok(section
->count
== 4, "got %d\n", section
->count
);
1980 ok(section
->size
== sizeof(*section
), "got %d\n", section
->size
);
1982 /* For both GUIDs same section is returned */
1983 ok(data
.lpSectionBase
== data2
.lpSectionBase
, "got %p, %p\n", data
.lpSectionBase
, data2
.lpSectionBase
);
1984 ok(data
.ulSectionTotalLength
== data2
.ulSectionTotalLength
, "got %u, %u\n", data
.ulSectionTotalLength
,
1985 data2
.ulSectionTotalLength
);
1987 ok(data
.lpSectionGlobalData
== ((BYTE
*)section
+ section
->names_offset
), "data.lpSectionGlobalData == NULL\n");
1988 ok(data
.ulSectionGlobalDataLength
== section
->names_len
, "data.ulSectionGlobalDataLength=%u\n",
1989 data
.ulSectionGlobalDataLength
);
1991 /* test some actual data */
1992 tlib
= (struct tlibredirect_data
*)data
.lpData
;
1993 ok(tlib
->size
== sizeof(*tlib
), "got %d\n", tlib
->size
);
1994 ok(tlib
->major_version
== 1, "got %d\n", tlib
->major_version
);
1995 ok(tlib
->minor_version
== 0, "got %d\n", tlib
->minor_version
);
1996 ok(tlib
->help_offset
> 0, "got %d\n", tlib
->help_offset
);
1997 ok(tlib
->help_len
== sizeof(helpW
), "got %d\n", tlib
->help_len
);
1998 ok(tlib
->flags
== (LIBFLAG_FHIDDEN
|LIBFLAG_FCONTROL
|LIBFLAG_FRESTRICTED
), "got %x\n", tlib
->flags
);
2000 ret
= pDeactivateActCtx(0, cookie
);
2001 ok(ret
, "DeactivateActCtx failed: %u\n", GetLastError());
2003 pReleaseActCtx(handle
);
2006 static void test_allowDelayedBinding(void)
2010 if (!create_manifest_file("test5.manifest", manifest5
, -1, NULL
, NULL
)) {
2011 skip("Could not create manifest file\n");
2015 handle
= test_create("test5.manifest");
2016 if (handle
== INVALID_HANDLE_VALUE
) {
2017 win_skip("allowDelayedBinding attribute is not supported.\n");
2021 DeleteFileA("test5.manifest");
2022 DeleteFileA("testdep.manifest");
2023 if (handle
!= INVALID_HANDLE_VALUE
) {
2024 test_basic_info(handle
, __LINE__
);
2025 pReleaseActCtx(handle
);
2029 static void test_actctx(void)
2035 trace("default actctx\n");
2037 b
= pGetCurrentActCtx(&handle
);
2038 ok(handle
== NULL
, "handle = %p, expected NULL\n", handle
);
2039 ok(b
, "GetCurrentActCtx failed: %u\n", GetLastError());
2041 test_basic_info(handle
, __LINE__
);
2042 test_detailed_info(handle
, &detailed_info0
, __LINE__
);
2043 test_runlevel_info(handle
, &runlevel_info0
, __LINE__
);
2044 pReleaseActCtx(handle
);
2047 /* test for whitespace handling in Eq ::= S? '=' S? */
2048 create_manifest_file("test1_1.manifest", manifest1_1
, -1, NULL
, NULL
);
2049 handle
= test_create("test1_1.manifest");
2050 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2051 DeleteFileA("test1_1.manifest");
2052 pReleaseActCtx(handle
);
2054 if(!create_manifest_file("test1.manifest", manifest1
, -1, NULL
, NULL
)) {
2055 skip("Could not create manifest file\n");
2059 trace("manifest1\n");
2061 handle
= test_create("test1.manifest");
2062 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2063 DeleteFileA("test1.manifest");
2064 if(handle
!= INVALID_HANDLE_VALUE
) {
2065 test_basic_info(handle
, __LINE__
);
2066 test_detailed_info(handle
, &detailed_info1
, __LINE__
);
2067 test_info_in_assembly(handle
, 1, &manifest1_info
, __LINE__
);
2069 if (pIsDebuggerPresent
&& !pIsDebuggerPresent())
2071 /* CloseHandle will generate an exception if a debugger is present */
2072 b
= CloseHandle(handle
);
2073 ok(!b
, "CloseHandle succeeded\n");
2074 ok(GetLastError() == ERROR_INVALID_HANDLE
, "GetLastError() == %u\n", GetLastError());
2077 pReleaseActCtx(handle
);
2080 if(!create_manifest_file("test2.manifest", manifest2
, -1, "testdep.manifest", testdep_manifest1
)) {
2081 skip("Could not create manifest file\n");
2085 trace("manifest2 depmanifest1\n");
2087 handle
= test_create("test2.manifest");
2088 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2089 DeleteFileA("test2.manifest");
2090 DeleteFileA("testdep.manifest");
2091 if(handle
!= INVALID_HANDLE_VALUE
) {
2092 test_basic_info(handle
, __LINE__
);
2093 test_detailed_info(handle
, &detailed_info2
, __LINE__
);
2094 test_info_in_assembly(handle
, 1, &manifest2_info
, __LINE__
);
2095 test_info_in_assembly(handle
, 2, &depmanifest1_info
, __LINE__
);
2096 pReleaseActCtx(handle
);
2099 if(!create_manifest_file("test2-2.manifest", manifest2
, -1, "testdep.manifest", testdep_manifest2
)) {
2100 skip("Could not create manifest file\n");
2104 trace("manifest2 depmanifest2\n");
2106 handle
= test_create("test2-2.manifest");
2107 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2108 DeleteFileA("test2-2.manifest");
2109 DeleteFileA("testdep.manifest");
2110 if(handle
!= INVALID_HANDLE_VALUE
) {
2111 test_basic_info(handle
, __LINE__
);
2112 test_detailed_info(handle
, &detailed_info2
, __LINE__
);
2113 test_info_in_assembly(handle
, 1, &manifest2_info
, __LINE__
);
2114 test_info_in_assembly(handle
, 2, &depmanifest2_info
, __LINE__
);
2115 test_file_info(handle
, 1, 0, testlib_dll
, __LINE__
);
2116 test_file_info(handle
, 1, 1, testlib2_dll
, __LINE__
);
2118 b
= pActivateActCtx(handle
, &cookie
);
2119 ok(b
, "ActivateActCtx failed: %u\n", GetLastError());
2120 test_find_dll_redirection(handle
, testlib_dll
, 2, __LINE__
);
2121 test_find_dll_redirection(handle
, testlib2_dll
, 2, __LINE__
);
2122 b
= pDeactivateActCtx(0, cookie
);
2123 ok(b
, "DeactivateActCtx failed: %u\n", GetLastError());
2125 pReleaseActCtx(handle
);
2128 trace("manifest2 depmanifest3\n");
2130 if(!create_manifest_file("test2-3.manifest", manifest2
, -1, "testdep.manifest", testdep_manifest3
)) {
2131 skip("Could not create manifest file\n");
2135 handle
= test_create("test2-3.manifest");
2136 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2137 DeleteFileA("test2-3.manifest");
2138 DeleteFileA("testdep.manifest");
2139 if(handle
!= INVALID_HANDLE_VALUE
) {
2140 test_basic_info(handle
, __LINE__
);
2141 test_detailed_info(handle
, &detailed_info2
, __LINE__
);
2142 test_info_in_assembly(handle
, 1, &manifest2_info
, __LINE__
);
2143 test_info_in_assembly(handle
, 2, &depmanifest3_info
, __LINE__
);
2144 test_file_info(handle
, 1, 0, testlib_dll
, __LINE__
);
2145 test_file_info(handle
, 1, 1, testlib2_dll
, __LINE__
);
2147 b
= pActivateActCtx(handle
, &cookie
);
2148 ok(b
, "ActivateActCtx failed: %u\n", GetLastError());
2149 test_find_dll_redirection(handle
, testlib_dll
, 2, __LINE__
);
2150 test_find_dll_redirection(handle
, testlib2_dll
, 2, __LINE__
);
2151 test_find_window_class(handle
, wndClassW
, 2, __LINE__
);
2152 test_find_window_class(handle
, wndClass2W
, 2, __LINE__
);
2153 b
= pDeactivateActCtx(0, cookie
);
2154 ok(b
, "DeactivateActCtx failed: %u\n", GetLastError());
2156 pReleaseActCtx(handle
);
2159 trace("manifest3\n");
2161 if(!create_manifest_file("test3.manifest", manifest3
, -1, NULL
, NULL
)) {
2162 skip("Could not create manifest file\n");
2166 handle
= test_create("test3.manifest");
2167 ok(handle
!= INVALID_HANDLE_VALUE
|| broken(handle
== INVALID_HANDLE_VALUE
) /* XP pre-SP2, win2k3 w/o SP */,
2168 "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2169 if (handle
== INVALID_HANDLE_VALUE
)
2170 win_skip("Some activation context features not supported, skipping a test (possibly old XP/Win2k3 system\n");
2171 DeleteFileA("test3.manifest");
2172 if(handle
!= INVALID_HANDLE_VALUE
) {
2173 static const WCHAR nameW
[] = {'t','e','s','t','s','u','r','r','o','g','a','t','e',0};
2174 static const WCHAR versionW
[] = {'v','2','.','0','.','5','0','7','2','7',0};
2175 static const WCHAR progidW
[] = {'P','r','o','g','I','d','.','P','r','o','g','I','d',0};
2176 static const WCHAR clrprogidW
[] = {'c','l','r','p','r','o','g','i','d',0};
2178 test_basic_info(handle
, __LINE__
);
2179 test_detailed_info(handle
, &detailed_info1
, __LINE__
);
2180 test_info_in_assembly(handle
, 1, &manifest3_info
, __LINE__
);
2181 test_file_info(handle
, 0, 0, testlib_dll
, __LINE__
);
2183 b
= pActivateActCtx(handle
, &cookie
);
2184 ok(b
, "ActivateActCtx failed: %u\n", GetLastError());
2185 test_find_dll_redirection(handle
, testlib_dll
, 1, __LINE__
);
2186 test_find_dll_redirection(handle
, testlib_dll
, 1, __LINE__
);
2187 test_find_com_redirection(handle
, &IID_CoTest
, &IID_TlibTest
, progidW
, 1, __LINE__
);
2188 test_find_com_redirection(handle
, &IID_CoTest2
, NULL
, NULL
, 1, __LINE__
);
2189 test_find_com_redirection(handle
, &CLSID_clrclass
, &IID_TlibTest
, clrprogidW
, 1, __LINE__
);
2190 test_find_progid_redirection(handle
, &IID_CoTest
, "ProgId.ProgId", 1, __LINE__
);
2191 test_find_progid_redirection(handle
, &IID_CoTest
, "ProgId.ProgId.1", 1, __LINE__
);
2192 test_find_progid_redirection(handle
, &IID_CoTest
, "ProgId.ProgId.2", 1, __LINE__
);
2193 test_find_progid_redirection(handle
, &IID_CoTest
, "ProgId.ProgId.3", 1, __LINE__
);
2194 test_find_progid_redirection(handle
, &IID_CoTest
, "ProgId.ProgId.4", 1, __LINE__
);
2195 test_find_progid_redirection(handle
, &IID_CoTest
, "ProgId.ProgId.5", 1, __LINE__
);
2196 test_find_progid_redirection(handle
, &IID_CoTest
, "ProgId.ProgId.6", 1, __LINE__
);
2197 test_find_progid_redirection(handle
, &CLSID_clrclass
, "clrprogid", 1, __LINE__
);
2198 test_find_progid_redirection(handle
, &CLSID_clrclass
, "clrprogid.1", 1, __LINE__
);
2199 test_find_progid_redirection(handle
, &CLSID_clrclass
, "clrprogid.2", 1, __LINE__
);
2200 test_find_progid_redirection(handle
, &CLSID_clrclass
, "clrprogid.3", 1, __LINE__
);
2201 test_find_progid_redirection(handle
, &CLSID_clrclass
, "clrprogid.4", 1, __LINE__
);
2202 test_find_progid_redirection(handle
, &CLSID_clrclass
, "clrprogid.5", 1, __LINE__
);
2203 test_find_progid_redirection(handle
, &CLSID_clrclass
, "clrprogid.6", 1, __LINE__
);
2204 test_find_surrogate(handle
, &IID_Iiface
, nameW
, versionW
, 1, __LINE__
);
2205 test_find_ifaceps_redirection(handle
, &IID_Iifaceps
, &IID_TlibTest4
, &IID_Ibifaceps
, NULL
, 1, __LINE__
);
2206 test_find_ifaceps_redirection(handle
, &IID_Iifaceps2
, &IID_TlibTest4
, &IID_Ibifaceps
, &IID_PS32
, 1, __LINE__
);
2207 test_find_ifaceps_redirection(handle
, &IID_Iifaceps3
, &IID_TlibTest4
, &IID_Ibifaceps
, NULL
, 1, __LINE__
);
2208 test_find_string_fail();
2210 b
= pDeactivateActCtx(0, cookie
);
2211 ok(b
, "DeactivateActCtx failed: %u\n", GetLastError());
2212 pReleaseActCtx(handle
);
2215 trace("manifest6\n");
2217 if(create_manifest_file("test6.manifest", manifest6
, -1, NULL
, NULL
)) {
2218 handle
= test_create("test6.manifest");
2219 ok(handle
!= INVALID_HANDLE_VALUE
|| broken(handle
== INVALID_HANDLE_VALUE
) /* WinXP */,
2220 "Unexpected context handle %p.\n", handle
);
2221 DeleteFileA("test6.manifest");
2222 DeleteFileA("testdep.manifest");
2223 if(handle
!= INVALID_HANDLE_VALUE
)
2225 test_runlevel_info(handle
, &runlevel_info6
, __LINE__
);
2226 pReleaseActCtx(handle
);
2230 skip("Could not create manifest file 6\n");
2232 trace("manifest7\n");
2234 if(create_manifest_file("test7.manifest", manifest7
, -1, NULL
, NULL
)) {
2235 handle
= test_create("test7.manifest");
2236 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2237 DeleteFileA("test7.manifest");
2238 DeleteFileA("testdep.manifest");
2239 if(handle
!= INVALID_HANDLE_VALUE
)
2241 test_runlevel_info(handle
, &runlevel_info7
, __LINE__
);
2242 pReleaseActCtx(handle
);
2246 skip("Could not create manifest file 7\n");
2248 trace("manifest8\n");
2250 if(create_manifest_file("test8.manifest", manifest8
, -1, NULL
, NULL
)) {
2251 handle
= test_create("test8.manifest");
2252 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2253 DeleteFileA("test8.manifest");
2254 DeleteFileA("testdep.manifest");
2255 if(handle
!= INVALID_HANDLE_VALUE
)
2257 test_runlevel_info(handle
, &runlevel_info8
, __LINE__
);
2258 pReleaseActCtx(handle
);
2262 skip("Could not create manifest file 8\n");
2264 trace("manifest9\n");
2266 if(create_manifest_file("test9.manifest", manifest9
, -1, NULL
, NULL
)) {
2267 handle
= test_create("test9.manifest");
2268 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2269 DeleteFileA("test9.manifest");
2270 DeleteFileA("testdep.manifest");
2271 if(handle
!= INVALID_HANDLE_VALUE
)
2273 test_runlevel_info(handle
, &runlevel_info9
, __LINE__
);
2274 pReleaseActCtx(handle
);
2278 skip("Could not create manifest file 9\n");
2280 if(create_manifest_file("test10.manifest", manifest10
, -1, NULL
, NULL
)) {
2281 handle
= test_create("test10.manifest");
2282 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2283 DeleteFileA("test10.manifest");
2284 DeleteFileA("testdep.manifest");
2285 if(handle
!= INVALID_HANDLE_VALUE
)
2287 test_runlevel_info(handle
, &runlevel_info8
, __LINE__
);
2288 pReleaseActCtx(handle
);
2292 skip("Could not create manifest file 10\n");
2294 trace("manifest4\n");
2296 if(!create_manifest_file("test4.manifest", manifest4
, -1, NULL
, NULL
)) {
2297 skip("Could not create manifest file\n");
2301 handle
= test_create("test4.manifest");
2302 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2303 DeleteFileA("test4.manifest");
2304 DeleteFileA("testdep.manifest");
2305 if(handle
!= INVALID_HANDLE_VALUE
) {
2306 test_basic_info(handle
, __LINE__
);
2307 test_detailed_info(handle
, &detailed_info2
, __LINE__
);
2308 test_info_in_assembly(handle
, 1, &manifest4_info
, __LINE__
);
2309 test_info_in_assembly(handle
, 2, &manifest_comctrl_info
, __LINE__
);
2310 pReleaseActCtx(handle
);
2313 trace("manifest1 in subdir\n");
2315 CreateDirectoryW(work_dir_subdir
, NULL
);
2316 if (SetCurrentDirectoryW(work_dir_subdir
))
2318 if(!create_manifest_file("..\\test1.manifest", manifest1
, -1, NULL
, NULL
)) {
2319 skip("Could not create manifest file\n");
2322 handle
= test_create("..\\test1.manifest");
2323 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2324 DeleteFileA("..\\test1.manifest");
2325 if(handle
!= INVALID_HANDLE_VALUE
) {
2326 test_basic_info(handle
, __LINE__
);
2327 test_detailed_info(handle
, &detailed_info1
, __LINE__
);
2328 test_info_in_assembly(handle
, 1, &manifest1_info
, __LINE__
);
2329 pReleaseActCtx(handle
);
2331 SetCurrentDirectoryW(work_dir
);
2334 skip("Couldn't change directory\n");
2335 RemoveDirectoryW(work_dir_subdir
);
2337 trace("UTF-16 manifest1, with BOM\n");
2338 if(!create_wide_manifest("test1.manifest", manifest1
, TRUE
, FALSE
)) {
2339 skip("Could not create manifest file\n");
2343 handle
= test_create("test1.manifest");
2344 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2345 DeleteFileA("test1.manifest");
2346 if (handle
!= INVALID_HANDLE_VALUE
) {
2347 test_basic_info(handle
, __LINE__
);
2348 test_detailed_info(handle
, &detailed_info1
, __LINE__
);
2349 test_info_in_assembly(handle
, 1, &manifest1_info
, __LINE__
);
2350 pReleaseActCtx(handle
);
2353 trace("UTF-16 manifest1, reverse endian, with BOM\n");
2354 if(!create_wide_manifest("test1.manifest", manifest1
, TRUE
, TRUE
)) {
2355 skip("Could not create manifest file\n");
2359 handle
= test_create("test1.manifest");
2360 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2361 DeleteFileA("test1.manifest");
2362 if (handle
!= INVALID_HANDLE_VALUE
) {
2363 test_basic_info(handle
, __LINE__
);
2364 test_detailed_info(handle
, &detailed_info1
, __LINE__
);
2365 test_info_in_assembly(handle
, 1, &manifest1_info
, __LINE__
);
2366 pReleaseActCtx(handle
);
2369 test_wndclass_section();
2370 test_dllredirect_section();
2371 test_typelib_section();
2372 test_allowDelayedBinding();
2375 static void test_app_manifest(void)
2380 trace("child process manifest1\n");
2382 b
= pGetCurrentActCtx(&handle
);
2383 ok(handle
== NULL
, "handle != NULL\n");
2384 ok(b
, "GetCurrentActCtx failed: %u\n", GetLastError());
2386 test_basic_info(handle
, __LINE__
);
2387 test_detailed_info(handle
, &detailed_info1_child
, __LINE__
);
2388 test_info_in_assembly(handle
, 1, &manifest1_child_info
, __LINE__
);
2389 pReleaseActCtx(handle
);
2393 static HANDLE
create_manifest(const char *filename
, const char *data
, int line
)
2396 create_manifest_file(filename
, data
, -1, NULL
, NULL
);
2398 handle
= test_create(filename
);
2399 ok_(__FILE__
, line
)(handle
!= INVALID_HANDLE_VALUE
,
2400 "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2402 DeleteFileA(filename
);
2406 static void kernel32_find(ULONG section
, const char *string_to_find
, BOOL should_find
, BOOL todo
, int line
)
2408 UNICODE_STRING string_to_findW
;
2409 ACTCTX_SECTION_KEYED_DATA data
;
2413 pRtlCreateUnicodeStringFromAsciiz(&string_to_findW
, string_to_find
);
2415 memset(&data
, 0xfe, sizeof(data
));
2416 data
.cbSize
= sizeof(data
);
2419 ret
= pFindActCtxSectionStringA(0, NULL
, section
, string_to_find
, &data
);
2420 err
= GetLastError();
2421 ok_(__FILE__
, line
)(ret
== should_find
,
2422 "FindActCtxSectionStringA: expected ret = %u, got %u\n", should_find
, ret
);
2424 ok_(__FILE__
, line
)(err
== (should_find
? ERROR_SUCCESS
: ERROR_SXS_KEY_NOT_FOUND
),
2425 "FindActCtxSectionStringA: unexpected error %u\n", err
);
2427 memset(&data
, 0xfe, sizeof(data
));
2428 data
.cbSize
= sizeof(data
);
2431 ret
= pFindActCtxSectionStringW(0, NULL
, section
, string_to_findW
.Buffer
, &data
);
2432 err
= GetLastError();
2433 ok_(__FILE__
, line
)(ret
== should_find
,
2434 "FindActCtxSectionStringW: expected ret = %u, got %u\n", should_find
, ret
);
2436 ok_(__FILE__
, line
)(err
== (should_find
? ERROR_SUCCESS
: ERROR_SXS_KEY_NOT_FOUND
),
2437 "FindActCtxSectionStringW: unexpected error %u\n", err
);
2440 ret
= pFindActCtxSectionStringA(0, NULL
, section
, string_to_find
, NULL
);
2441 err
= GetLastError();
2442 ok_(__FILE__
, line
)(!ret
,
2443 "FindActCtxSectionStringA: expected failure, got %u\n", ret
);
2444 ok_(__FILE__
, line
)(err
== ERROR_INVALID_PARAMETER
,
2445 "FindActCtxSectionStringA: unexpected error %u\n", err
);
2448 ret
= pFindActCtxSectionStringW(0, NULL
, section
, string_to_findW
.Buffer
, NULL
);
2449 err
= GetLastError();
2450 ok_(__FILE__
, line
)(!ret
,
2451 "FindActCtxSectionStringW: expected failure, got %u\n", ret
);
2452 ok_(__FILE__
, line
)(err
== ERROR_INVALID_PARAMETER
,
2453 "FindActCtxSectionStringW: unexpected error %u\n", err
);
2455 pRtlFreeUnicodeString(&string_to_findW
);
2458 static void ntdll_find(ULONG section
, const char *string_to_find
, BOOL should_find
, BOOL todo
, int line
)
2460 UNICODE_STRING string_to_findW
;
2461 ACTCTX_SECTION_KEYED_DATA data
;
2464 pRtlCreateUnicodeStringFromAsciiz(&string_to_findW
, string_to_find
);
2466 memset(&data
, 0xfe, sizeof(data
));
2467 data
.cbSize
= sizeof(data
);
2469 ret
= pRtlFindActivationContextSectionString(0, NULL
, section
, &string_to_findW
, &data
);
2471 ok_(__FILE__
, line
)(ret
== (should_find
? STATUS_SUCCESS
: STATUS_SXS_KEY_NOT_FOUND
),
2472 "RtlFindActivationContextSectionString: unexpected status 0x%x\n", ret
);
2474 ret
= pRtlFindActivationContextSectionString(0, NULL
, section
, &string_to_findW
, NULL
);
2476 ok_(__FILE__
, line
)(ret
== (should_find
? STATUS_SUCCESS
: STATUS_SXS_KEY_NOT_FOUND
),
2477 "RtlFindActivationContextSectionString: unexpected status 0x%x\n", ret
);
2479 pRtlFreeUnicodeString(&string_to_findW
);
2482 static void test_findsectionstring(void)
2488 handle
= create_manifest("test.manifest", testdep_manifest3
, __LINE__
);
2489 ret
= pActivateActCtx(handle
, &cookie
);
2490 ok(ret
, "ActivateActCtx failed: %u\n", GetLastError());
2492 /* first we show the parameter validation from kernel32 */
2493 kernel32_find(ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION
, "testdep", FALSE
, TRUE
, __LINE__
);
2494 kernel32_find(ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
, "testlib.dll", TRUE
, FALSE
, __LINE__
);
2495 kernel32_find(ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
, "testlib2.dll", TRUE
, FALSE
, __LINE__
);
2496 kernel32_find(ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
, "testlib3.dll", FALSE
, FALSE
, __LINE__
);
2497 kernel32_find(ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION
, "wndClass", TRUE
, FALSE
, __LINE__
);
2498 kernel32_find(ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION
, "wndClass2", TRUE
, FALSE
, __LINE__
);
2499 kernel32_find(ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION
, "wndClass3", FALSE
, FALSE
, __LINE__
);
2501 /* then we show that ntdll plays by different rules */
2502 ntdll_find(ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION
, "testdep", FALSE
, TRUE
, __LINE__
);
2503 ntdll_find(ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
, "testlib.dll", TRUE
, FALSE
, __LINE__
);
2504 ntdll_find(ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
, "testlib2.dll", TRUE
, FALSE
, __LINE__
);
2505 ntdll_find(ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION
, "testlib3.dll", FALSE
, FALSE
, __LINE__
);
2506 ntdll_find(ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION
, "wndClass", TRUE
, FALSE
, __LINE__
);
2507 ntdll_find(ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION
, "wndClass2", TRUE
, FALSE
, __LINE__
);
2508 ntdll_find(ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION
, "wndClass3", FALSE
, FALSE
, __LINE__
);
2510 ret
= pDeactivateActCtx(0, cookie
);
2511 ok(ret
, "DeactivateActCtx failed: %u\n", GetLastError());
2512 pReleaseActCtx(handle
);
2515 static void run_child_process(void)
2517 char cmdline
[MAX_PATH
];
2518 char path
[MAX_PATH
];
2520 PROCESS_INFORMATION pi
;
2521 STARTUPINFOA si
= { 0 };
2526 GetModuleFileNameA(NULL
, path
, MAX_PATH
);
2527 strcat(path
, ".manifest");
2528 if(!create_manifest_file(path
, manifest1
, -1, NULL
, NULL
)) {
2529 skip("Could not create manifest file\n");
2534 winetest_get_mainargs( &argv
);
2535 /* Vista+ seems to cache presence of .manifest files. Change last modified
2536 date to defeat the cache */
2537 file
= CreateFileA(argv
[0], FILE_WRITE_ATTRIBUTES
, FILE_SHARE_READ
| FILE_SHARE_WRITE
,
2538 NULL
, OPEN_EXISTING
, 0, NULL
);
2539 if (file
!= INVALID_HANDLE_VALUE
) {
2540 GetSystemTimeAsFileTime(&now
);
2541 SetFileTime(file
, NULL
, NULL
, &now
);
2544 sprintf(cmdline
, "\"%s\" %s manifest1", argv
[0], argv
[1]);
2545 ret
= CreateProcessA(argv
[0], cmdline
, NULL
, NULL
, FALSE
, 0, NULL
, NULL
, &si
, &pi
);
2546 ok(ret
, "Could not create process: %u\n", GetLastError());
2547 winetest_wait_child_process( pi
.hProcess
);
2548 CloseHandle(pi
.hThread
);
2549 CloseHandle(pi
.hProcess
);
2553 static void init_paths(void)
2557 static const WCHAR dot_manifest
[] = {'.','M','a','n','i','f','e','s','t',0};
2558 static const WCHAR backslash
[] = {'\\',0};
2559 static const WCHAR subdir
[] = {'T','e','s','t','S','u','b','d','i','r','\\',0};
2561 GetModuleFileNameW(NULL
, exe_path
, ARRAY_SIZE(exe_path
));
2562 lstrcpyW(app_dir
, exe_path
);
2563 for(ptr
=app_dir
+lstrlenW(app_dir
); *ptr
!= '\\' && *ptr
!= '/'; ptr
--);
2566 GetCurrentDirectoryW(MAX_PATH
, work_dir
);
2567 ptr
= work_dir
+ lstrlenW( work_dir
) - 1;
2568 if (*ptr
!= '\\' && *ptr
!= '/')
2569 lstrcatW(work_dir
, backslash
);
2570 lstrcpyW(work_dir_subdir
, work_dir
);
2571 lstrcatW(work_dir_subdir
, subdir
);
2573 GetModuleFileNameW(NULL
, app_manifest_path
, ARRAY_SIZE(app_manifest_path
));
2574 lstrcpyW(app_manifest_path
+lstrlenW(app_manifest_path
), dot_manifest
);
2577 static void write_manifest(const char *filename
, const char *manifest
)
2581 CHAR path
[MAX_PATH
];
2583 GetTempPathA(ARRAY_SIZE(path
), path
);
2584 strcat(path
, filename
);
2586 file
= CreateFileA(path
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, NULL
);
2587 ok(file
!= INVALID_HANDLE_VALUE
, "CreateFile failed: %u\n", GetLastError());
2588 WriteFile(file
, manifest
, strlen(manifest
), &size
, NULL
);
2592 static void delete_manifest_file(const char *filename
)
2594 CHAR path
[MAX_PATH
];
2596 GetTempPathA(ARRAY_SIZE(path
), path
);
2597 strcat(path
, filename
);
2601 static void extract_resource(const char *name
, const char *type
, const char *path
)
2608 file
= CreateFileA(path
, GENERIC_READ
|GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, 0);
2609 ok(file
!= INVALID_HANDLE_VALUE
, "file creation failed, at %s, error %d\n", path
, GetLastError());
2611 res
= FindResourceA(NULL
, name
, type
);
2612 ok( res
!= 0, "couldn't find resource\n" );
2613 ptr
= LockResource( LoadResource( GetModuleHandleA(NULL
), res
));
2614 WriteFile( file
, ptr
, SizeofResource( GetModuleHandleA(NULL
), res
), &written
, NULL
);
2615 ok( written
== SizeofResource( GetModuleHandleA(NULL
), res
), "couldn't write resource\n" );
2616 CloseHandle( file
);
2619 static void test_CreateActCtx(void)
2621 CHAR path
[MAX_PATH
], dir
[MAX_PATH
], dll
[MAX_PATH
];
2625 GetTempPathA(ARRAY_SIZE(path
), path
);
2626 strcat(path
, "main_wndcls.manifest");
2628 write_manifest("testdep1.manifest", manifest_wndcls1
);
2629 write_manifest("testdep2.manifest", manifest_wndcls2
);
2630 write_manifest("main_wndcls.manifest", manifest_wndcls_main
);
2632 memset(&actctx
, 0, sizeof(ACTCTXA
));
2633 actctx
.cbSize
= sizeof(ACTCTXA
);
2634 actctx
.lpSource
= path
;
2636 /* create using lpSource without specified directory */
2637 handle
= pCreateActCtxA(&actctx
);
2638 ok(handle
!= INVALID_HANDLE_VALUE
, "failed to generate context, error %u\n", GetLastError());
2639 pReleaseActCtx(handle
);
2641 /* with specified directory, that doesn't contain dependent assembly */
2642 GetWindowsDirectoryA(dir
, ARRAY_SIZE(dir
));
2644 memset(&actctx
, 0, sizeof(ACTCTXA
));
2645 actctx
.cbSize
= sizeof(ACTCTXA
);
2646 actctx
.dwFlags
= ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID
;
2647 actctx
.lpAssemblyDirectory
= dir
;
2648 actctx
.lpSource
= path
;
2650 SetLastError(0xdeadbeef);
2651 handle
= pCreateActCtxA(&actctx
);
2653 ok(handle
== INVALID_HANDLE_VALUE
, "got handle %p\n", handle
);
2654 ok(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX
, "got error %d\n", GetLastError());
2656 if (handle
!= INVALID_HANDLE_VALUE
) pReleaseActCtx(handle
);
2658 /* with specified directory, that does contain dependent assembly */
2659 GetTempPathA(ARRAY_SIZE(dir
), dir
);
2660 actctx
.lpAssemblyDirectory
= dir
;
2661 handle
= pCreateActCtxA(&actctx
);
2662 ok(handle
!= INVALID_HANDLE_VALUE
, "got handle %p\n", handle
);
2663 pReleaseActCtx(handle
);
2665 /* Should still work if we add a dll with the same name, but without manifest */
2667 strcat(dll
, "testdep1.dll");
2668 extract_resource("dummy.dll", "TESTDLL", dll
);
2669 handle
= pCreateActCtxA(&actctx
);
2670 ok(handle
!= INVALID_HANDLE_VALUE
|| broken(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX
) , "got error %d\n", GetLastError());
2671 pReleaseActCtx(handle
);
2674 delete_manifest_file("main_wndcls.manifest");
2675 delete_manifest_file("testdep1.manifest");
2676 delete_manifest_file("testdep2.manifest");
2678 /* ACTCTX_FLAG_HMODULE_VALID but hModule is not set */
2679 memset(&actctx
, 0, sizeof(ACTCTXA
));
2680 actctx
.cbSize
= sizeof(ACTCTXA
);
2681 actctx
.dwFlags
= ACTCTX_FLAG_HMODULE_VALID
;
2682 SetLastError(0xdeadbeef);
2683 handle
= pCreateActCtxA(&actctx
);
2684 ok(handle
== INVALID_HANDLE_VALUE
, "got handle %p\n", handle
);
2686 ok(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX
|| broken(GetLastError() == ERROR_NOT_ENOUGH_MEMORY
) /* XP, win2k3 */,
2687 "got error %d\n", GetLastError());
2689 /* create from HMODULE - resource doesn't exist, lpSource is set */
2690 memset(&actctx
, 0, sizeof(ACTCTXA
));
2691 actctx
.cbSize
= sizeof(ACTCTXA
);
2692 actctx
.dwFlags
= ACTCTX_FLAG_RESOURCE_NAME_VALID
| ACTCTX_FLAG_HMODULE_VALID
;
2693 actctx
.lpSource
= "dummyfile.dll";
2694 actctx
.lpResourceName
= MAKEINTRESOURCEA(20);
2695 actctx
.hModule
= GetModuleHandleA(NULL
);
2697 SetLastError(0xdeadbeef);
2698 handle
= pCreateActCtxA(&actctx
);
2699 ok(handle
== INVALID_HANDLE_VALUE
, "got handle %p\n", handle
);
2700 ok(GetLastError() == ERROR_RESOURCE_TYPE_NOT_FOUND
, "got error %d\n", GetLastError());
2702 /* load manifest from lpAssemblyDirectory directory */
2703 write_manifest("testdir.manifest", manifest1
);
2704 GetTempPathA(ARRAY_SIZE(path
), path
);
2705 SetCurrentDirectoryA(path
);
2706 strcat(path
, "assembly_dir");
2708 strcat(path
, "\\testdir.manifest");
2710 memset(&actctx
, 0, sizeof(actctx
));
2711 actctx
.cbSize
= sizeof(actctx
);
2712 actctx
.dwFlags
= ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID
;
2713 actctx
.lpSource
= "testdir.manifest";
2714 actctx
.lpAssemblyDirectory
= dir
;
2716 SetLastError(0xdeadbeef);
2717 handle
= pCreateActCtxA(&actctx
);
2718 ok(handle
== INVALID_HANDLE_VALUE
, "got handle %p\n", handle
);
2719 ok(GetLastError()==ERROR_PATH_NOT_FOUND
||
2720 broken(GetLastError()==ERROR_FILE_NOT_FOUND
) /* WinXP */,
2721 "got error %d\n", GetLastError());
2723 CreateDirectoryA(dir
, NULL
);
2724 memset(&actctx
, 0, sizeof(actctx
));
2725 actctx
.cbSize
= sizeof(actctx
);
2726 actctx
.dwFlags
= ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID
;
2727 actctx
.lpSource
= "testdir.manifest";
2728 actctx
.lpAssemblyDirectory
= dir
;
2730 SetLastError(0xdeadbeef);
2731 handle
= pCreateActCtxA(&actctx
);
2732 ok(handle
== INVALID_HANDLE_VALUE
, "got handle %p\n", handle
);
2733 ok(GetLastError() == ERROR_FILE_NOT_FOUND
, "got error %d\n", GetLastError());
2734 SetCurrentDirectoryW(work_dir
);
2736 write_manifest("assembly_dir\\testdir.manifest", manifest1
);
2737 memset(&actctx
, 0, sizeof(actctx
));
2738 actctx
.cbSize
= sizeof(actctx
);
2739 actctx
.dwFlags
= ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID
;
2740 actctx
.lpSource
= "testdir.manifest";
2741 actctx
.lpAssemblyDirectory
= dir
;
2743 handle
= pCreateActCtxA(&actctx
);
2744 ok(handle
!= INVALID_HANDLE_VALUE
, "got handle %p\n", handle
);
2745 pReleaseActCtx(handle
);
2747 memset(&actctx
, 0, sizeof(actctx
));
2748 actctx
.cbSize
= sizeof(actctx
);
2749 actctx
.dwFlags
= ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID
;
2750 actctx
.lpSource
= path
;
2751 actctx
.lpAssemblyDirectory
= dir
;
2753 handle
= pCreateActCtxA(&actctx
);
2754 ok(handle
!= INVALID_HANDLE_VALUE
, "got handle %p\n", handle
);
2755 pReleaseActCtx(handle
);
2757 delete_manifest_file("testdir.manifest");
2758 delete_manifest_file("assembly_dir\\testdir.manifest");
2759 RemoveDirectoryA(dir
);
2762 static BOOL
init_funcs(void)
2764 HMODULE hLibrary
= GetModuleHandleA("kernel32.dll");
2766 #define X(f) if (!(p##f = (void*)GetProcAddress(hLibrary, #f))) return FALSE;
2770 X(DeactivateActCtx
);
2771 X(FindActCtxSectionStringA
);
2772 X(FindActCtxSectionStringW
);
2773 X(GetCurrentActCtx
);
2774 X(IsDebuggerPresent
);
2777 X(FindActCtxSectionGuid
);
2779 pQueryActCtxSettingsW
= (void *)GetProcAddress( hLibrary
, "QueryActCtxSettingsW" );
2781 hLibrary
= GetModuleHandleA("ntdll.dll");
2782 X(RtlFindActivationContextSectionString
);
2783 X(RtlCreateUnicodeStringFromAsciiz
);
2784 X(RtlFreeUnicodeString
);
2790 static void test_ZombifyActCtx(void)
2792 ACTIVATION_CONTEXT_BASIC_INFORMATION basicinfo
;
2794 HANDLE handle
, current
;
2797 SetLastError(0xdeadbeef);
2798 ret
= pZombifyActCtx(NULL
);
2800 ok(!ret
&& GetLastError() == ERROR_INVALID_PARAMETER
, "got %d, error %d\n", ret
, GetLastError());
2802 handle
= create_manifest("test.manifest", testdep_manifest3
, __LINE__
);
2804 ret
= pGetCurrentActCtx(¤t
);
2805 ok(ret
, "got %d, error %d\n", ret
, GetLastError());
2806 ok(current
== NULL
, "got %p\n", current
);
2808 ret
= pActivateActCtx(handle
, &cookie
);
2809 ok(ret
, "ActivateActCtx failed: %u\n", GetLastError());
2811 ret
= pGetCurrentActCtx(¤t
);
2812 ok(ret
, "got %d, error %d\n", ret
, GetLastError());
2813 ok(handle
== current
, "got %p, %p\n", current
, handle
);
2815 memset(&basicinfo
, 0xff, sizeof(basicinfo
));
2816 ret
= pQueryActCtxW(0, handle
, 0, ActivationContextBasicInformation
,
2817 &basicinfo
, sizeof(basicinfo
), NULL
);
2818 ok(ret
, "got %d, error %d\n", ret
, GetLastError());
2819 ok(basicinfo
.hActCtx
== handle
, "got %p\n", basicinfo
.hActCtx
);
2820 ok(basicinfo
.dwFlags
== 0, "got %x\n", basicinfo
.dwFlags
);
2822 memset(&basicinfo
, 0xff, sizeof(basicinfo
));
2823 ret
= pQueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX
, NULL
, 0, ActivationContextBasicInformation
,
2824 &basicinfo
, sizeof(basicinfo
), NULL
);
2825 ok(ret
, "got %d, error %d\n", ret
, GetLastError());
2826 ok(basicinfo
.hActCtx
== handle
, "got %p\n", basicinfo
.hActCtx
);
2827 ok(basicinfo
.dwFlags
== 0, "got %x\n", basicinfo
.dwFlags
);
2829 ret
= pZombifyActCtx(handle
);
2831 ok(ret
, "got %d\n", ret
);
2833 memset(&basicinfo
, 0xff, sizeof(basicinfo
));
2834 ret
= pQueryActCtxW(0, handle
, 0, ActivationContextBasicInformation
,
2835 &basicinfo
, sizeof(basicinfo
), NULL
);
2836 ok(ret
, "got %d, error %d\n", ret
, GetLastError());
2837 ok(basicinfo
.hActCtx
== handle
, "got %p\n", basicinfo
.hActCtx
);
2838 ok(basicinfo
.dwFlags
== 0, "got %x\n", basicinfo
.dwFlags
);
2840 memset(&basicinfo
, 0xff, sizeof(basicinfo
));
2841 ret
= pQueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX
, NULL
, 0, ActivationContextBasicInformation
,
2842 &basicinfo
, sizeof(basicinfo
), NULL
);
2843 ok(ret
, "got %d, error %d\n", ret
, GetLastError());
2844 ok(basicinfo
.hActCtx
== handle
, "got %p\n", basicinfo
.hActCtx
);
2845 ok(basicinfo
.dwFlags
== 0, "got %x\n", basicinfo
.dwFlags
);
2847 ret
= pGetCurrentActCtx(¤t
);
2848 ok(ret
, "got %d, error %d\n", ret
, GetLastError());
2849 ok(current
== handle
, "got %p\n", current
);
2852 ret
= pZombifyActCtx(handle
);
2854 ok(ret
, "got %d\n", ret
);
2856 ret
= pDeactivateActCtx(0, cookie
);
2857 ok(ret
, "DeactivateActCtx failed: %u\n", GetLastError());
2858 pReleaseActCtx(handle
);
2861 /* Test structure to verify alignment */
2862 typedef struct _test_act_ctx_compat_info
{
2864 COMPATIBILITY_CONTEXT_ELEMENT Elements
[10];
2865 } test_act_ctx_compat_info
;
2867 static void test_no_compat(HANDLE handle
, int line
)
2869 test_act_ctx_compat_info compat_info
;
2873 memset(&compat_info
, 0, sizeof(compat_info
));
2874 b
= pQueryActCtxW(QUERY_ACTCTX_FLAG_NO_ADDREF
, handle
, NULL
,
2875 CompatibilityInformationInActivationContext
, &compat_info
,
2876 sizeof(compat_info
), &size
);
2878 ok_(__FILE__
, line
)(b
, "CompatibilityInformationInActivationContext failed\n");
2879 ok_(__FILE__
, line
)(size
== sizeof(DWORD
), "size mismatch (got %lu, expected 4)\n", size
);
2880 ok_(__FILE__
, line
)(compat_info
.ElementCount
== 0, "unexpected ElementCount %u\n", compat_info
.ElementCount
);
2883 static void test_with_compat(HANDLE handle
, DWORD num_compat
, const GUID
* expected_compat
[], int line
)
2885 test_act_ctx_compat_info compat_info
;
2887 SIZE_T expected
= sizeof(COMPATIBILITY_CONTEXT_ELEMENT
) * num_compat
+ sizeof(DWORD
);
2891 memset(&compat_info
, 0, sizeof(compat_info
));
2892 b
= pQueryActCtxW(QUERY_ACTCTX_FLAG_NO_ADDREF
, handle
, NULL
,
2893 CompatibilityInformationInActivationContext
, &compat_info
,
2894 sizeof(compat_info
), &size
);
2896 ok_(__FILE__
, line
)(b
, "CompatibilityInformationInActivationContext failed\n");
2897 ok_(__FILE__
, line
)(size
== expected
, "size mismatch (got %lu, expected %lu)\n", size
, expected
);
2898 ok_(__FILE__
, line
)(compat_info
.ElementCount
== num_compat
, "unexpected ElementCount %u\n", compat_info
.ElementCount
);
2900 for (n
= 0; n
< num_compat
; ++n
)
2902 ok_(__FILE__
, line
)(IsEqualGUID(&compat_info
.Elements
[n
].Id
, expected_compat
[n
]),
2903 "got wrong clsid %s, expected %s for %u\n",
2904 wine_dbgstr_guid(&compat_info
.Elements
[n
].Id
),
2905 wine_dbgstr_guid(expected_compat
[n
]),
2907 ok_(__FILE__
, line
)(compat_info
.Elements
[n
].Type
== ACTCX_COMPATIBILITY_ELEMENT_TYPE_OS
,
2908 "Wrong type, got %u for %u\n", (DWORD
)compat_info
.Elements
[n
].Type
, n
);
2912 static void test_compatibility(void)
2916 /* No compat results returned */
2917 trace("manifest1\n");
2918 if(!create_manifest_file("test1.manifest", manifest1
, -1, NULL
, NULL
))
2920 skip("Could not create manifest file\n");
2923 handle
= test_create("test1.manifest");
2924 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2925 DeleteFileA("test1.manifest");
2926 if(handle
!= INVALID_HANDLE_VALUE
)
2928 char buffer
[sizeof(COMPATIBILITY_CONTEXT_ELEMENT
) * 2 + sizeof(DWORD
)];
2932 memset(buffer
, 0, sizeof(buffer
));
2933 b
= pQueryActCtxW(QUERY_ACTCTX_FLAG_NO_ADDREF
, handle
, NULL
,
2934 CompatibilityInformationInActivationContext
, buffer
,
2935 sizeof(buffer
), &size
);
2937 if (!b
&& GetLastError() == ERROR_INVALID_PARAMETER
)
2939 win_skip("CompatibilityInformationInActivationContext not supported.\n");
2940 pReleaseActCtx(handle
);
2944 test_basic_info(handle
, __LINE__
);
2945 test_no_compat(handle
, __LINE__
);
2946 pReleaseActCtx(handle
);
2949 /* Still no compat results returned */
2950 trace("no_supportedOs\n");
2951 if(!create_manifest_file("no_supportedOs.manifest", compat_manifest_no_supportedOs
, -1, NULL
, NULL
))
2953 skip("Could not create manifest file\n");
2956 handle
= test_create("no_supportedOs.manifest");
2957 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2958 DeleteFileA("no_supportedOs.manifest");
2959 if(handle
!= INVALID_HANDLE_VALUE
)
2961 test_basic_info(handle
, __LINE__
);
2962 test_no_compat(handle
, __LINE__
);
2963 pReleaseActCtx(handle
);
2966 /* Just one result returned */
2967 trace("manifest_vista\n");
2968 if(!create_manifest_file("manifest_vista.manifest", compat_manifest_vista
, -1, NULL
, NULL
))
2970 skip("Could not create manifest file\n");
2973 handle
= test_create("manifest_vista.manifest");
2974 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2975 DeleteFileA("manifest_vista.manifest");
2976 if(handle
!= INVALID_HANDLE_VALUE
)
2978 static const GUID
* expect_manifest
[] =
2982 test_basic_info(handle
, __LINE__
);
2983 test_with_compat(handle
, 1, expect_manifest
, __LINE__
);
2984 pReleaseActCtx(handle
);
2987 /* Show that the order is retained */
2988 trace("manifest_vista_7_8_10_81\n");
2989 if(!create_manifest_file("manifest_vista_7_8_10_81.manifest", compat_manifest_vista_7_8_10_81
, -1, NULL
, NULL
))
2991 skip("Could not create manifest file\n");
2994 handle
= test_create("manifest_vista_7_8_10_81.manifest");
2995 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
2996 DeleteFileA("manifest_vista_7_8_10_81.manifest");
2997 if(handle
!= INVALID_HANDLE_VALUE
)
2999 static const GUID
* expect_manifest
[] =
3007 test_basic_info(handle
, __LINE__
);
3008 test_with_compat(handle
, 5, expect_manifest
, __LINE__
);
3009 pReleaseActCtx(handle
);
3012 /* Show that even unknown GUID's are stored */
3013 trace("manifest_other_guid\n");
3014 if(!create_manifest_file("manifest_other_guid.manifest", compat_manifest_other_guid
, -1, NULL
, NULL
))
3016 skip("Could not create manifest file\n");
3019 handle
= test_create("manifest_other_guid.manifest");
3020 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
3021 DeleteFileA("manifest_other_guid.manifest");
3022 if(handle
!= INVALID_HANDLE_VALUE
)
3024 static const GUID
* expect_manifest
[] =
3028 test_basic_info(handle
, __LINE__
);
3029 test_with_compat(handle
, 1, expect_manifest
, __LINE__
);
3030 pReleaseActCtx(handle
);
3034 static void test_settings(void)
3036 static const WCHAR dpiAwareW
[] = {'d','p','i','A','w','a','r','e',0};
3037 static const WCHAR dpiAwarenessW
[] = {'d','p','i','A','w','a','r','e','n','e','s','s',0};
3038 static const WCHAR dummyW
[] = {'d','u','m','m','y',0};
3039 static const WCHAR trueW
[] = {'t','r','u','e',0};
3040 static const WCHAR namespace2005W
[] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','S','M','I','/','2','0','0','5','/','W','i','n','d','o','w','s','S','e','t','t','i','n','g','s',0};
3041 static const WCHAR namespace2016W
[] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','S','M','I','/','2','0','1','6','/','W','i','n','d','o','w','s','S','e','t','t','i','n','g','s',0};
3047 if (!pQueryActCtxSettingsW
)
3049 win_skip( "QueryActCtxSettingsW is missing\n" );
3052 create_manifest_file( "manifest_settings.manifest", settings_manifest
, -1, NULL
, NULL
);
3053 handle
= test_create("manifest_settings.manifest");
3054 ok( handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError() );
3055 DeleteFileA( "manifest_settings.manifest" );
3057 SetLastError( 0xdeadbeef );
3058 ret
= pQueryActCtxSettingsW( 1, handle
, NULL
, dpiAwareW
, buffer
, 80, &size
);
3059 ok( !ret
, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
3060 ok( GetLastError() == ERROR_INVALID_PARAMETER
, "wrong error %u\n", GetLastError() );
3061 SetLastError( 0xdeadbeef );
3062 ret
= pQueryActCtxSettingsW( 0, handle
, dummyW
, dpiAwareW
, buffer
, 80, &size
);
3063 ok( !ret
, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
3064 ok( GetLastError() == ERROR_INVALID_PARAMETER
, "wrong error %u\n", GetLastError() );
3065 SetLastError( 0xdeadbeef );
3067 memset( buffer
, 0xcc, sizeof(buffer
) );
3068 ret
= pQueryActCtxSettingsW( 0, handle
, NULL
, dpiAwareW
, buffer
, 80, &size
);
3069 ok( ret
, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
3070 ok( !lstrcmpW( buffer
, trueW
), "got %s\n", wine_dbgstr_w(buffer
) );
3071 ok( size
== lstrlenW( buffer
) + 1, "wrong len %lu\n", size
);
3072 SetLastError( 0xdeadbeef );
3074 memset( buffer
, 0xcc, sizeof(buffer
) );
3075 ret
= pQueryActCtxSettingsW( 0, handle
, NULL
, dummyW
, buffer
, 80, &size
);
3076 ok( !ret
, "QueryActCtxSettingsW succeeded\n" );
3077 ok( GetLastError() == ERROR_SXS_KEY_NOT_FOUND
, "wrong error %u\n", GetLastError() );
3078 ok( buffer
[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer
) );
3079 SetLastError( 0xdeadbeef );
3081 memset( buffer
, 0xcc, sizeof(buffer
) );
3082 ret
= pQueryActCtxSettingsW( 0, handle
, namespace2005W
, dpiAwareW
, buffer
, 80, &size
);
3083 ok( ret
, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
3084 ok( !lstrcmpW( buffer
, trueW
), "got %s\n", wine_dbgstr_w(buffer
) );
3085 ok( size
== ARRAY_SIZE(trueW
), "wrong len %lu\n", size
);
3086 SetLastError( 0xdeadbeef );
3088 memset( buffer
, 0xcc, sizeof(buffer
) );
3089 ret
= pQueryActCtxSettingsW( 0, handle
, namespace2005W
, dpiAwareW
, buffer
, lstrlenW(trueW
) + 1, &size
);
3090 ok( ret
, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
3091 ok( !lstrcmpW( buffer
, trueW
), "got %s\n", wine_dbgstr_w(buffer
) );
3092 ok( size
== ARRAY_SIZE(trueW
), "wrong len %lu\n", size
);
3093 SetLastError( 0xdeadbeef );
3095 memset( buffer
, 0xcc, sizeof(buffer
) );
3096 ret
= pQueryActCtxSettingsW( 0, handle
, namespace2016W
, dpiAwareW
, buffer
, lstrlenW(trueW
) + 1, &size
);
3097 ok( !ret
, "QueryActCtxSettingsW succeeded\n" );
3098 ok( GetLastError() == ERROR_SXS_KEY_NOT_FOUND
|| broken( GetLastError() == ERROR_INVALID_PARAMETER
),
3099 "wrong error %u\n", GetLastError() );
3100 ok( buffer
[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer
) );
3101 SetLastError( 0xdeadbeef );
3103 memset( buffer
, 0xcc, sizeof(buffer
) );
3104 ret
= pQueryActCtxSettingsW( 0, handle
, NULL
, dpiAwarenessW
, buffer
, lstrlenW(trueW
) + 1, &size
);
3105 ok( !ret
, "QueryActCtxSettingsW succeeded\n" );
3106 ok( GetLastError() == ERROR_SXS_KEY_NOT_FOUND
, "wrong error %u\n", GetLastError() );
3107 ok( buffer
[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer
) );
3108 SetLastError( 0xdeadbeef );
3110 memset( buffer
, 0xcc, sizeof(buffer
) );
3111 ret
= pQueryActCtxSettingsW( 0, handle
, namespace2005W
, dpiAwarenessW
, buffer
, lstrlenW(trueW
) + 1, &size
);
3112 ok( !ret
, "QueryActCtxSettingsW succeeded\n" );
3113 ok( GetLastError() == ERROR_SXS_KEY_NOT_FOUND
, "wrong error %u\n", GetLastError() );
3114 ok( buffer
[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer
) );
3115 SetLastError( 0xdeadbeef );
3117 memset( buffer
, 0xcc, sizeof(buffer
) );
3118 ret
= pQueryActCtxSettingsW( 0, handle
, namespace2016W
, dpiAwarenessW
, buffer
, lstrlenW(trueW
) + 1, &size
);
3119 ok( ret
|| broken( GetLastError() == ERROR_INVALID_PARAMETER
),
3120 "QueryActCtxSettingsW failed err %u\n", GetLastError() );
3123 ok( !lstrcmpW( buffer
, trueW
), "got %s\n", wine_dbgstr_w(buffer
) );
3124 ok( size
== ARRAY_SIZE(trueW
), "wrong len %lu\n", size
);
3126 else ok( buffer
[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer
) );
3127 SetLastError( 0xdeadbeef );
3129 memset( buffer
, 0xcc, sizeof(buffer
) );
3130 ret
= pQueryActCtxSettingsW( 0, handle
, NULL
, dpiAwareW
, buffer
, lstrlenW(trueW
), &size
);
3131 ok( ret
, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
3132 ok( !lstrcmpW( buffer
, trueW
), "got %s\n", wine_dbgstr_w(buffer
) );
3133 ok( size
== ARRAY_SIZE(trueW
), "wrong len %lu\n", size
);
3134 SetLastError( 0xdeadbeef );
3136 memset( buffer
, 0xcc, sizeof(buffer
) );
3137 ret
= pQueryActCtxSettingsW( 0, handle
, NULL
, dpiAwareW
, buffer
, lstrlenW(trueW
) - 1, &size
);
3138 ok( !ret
, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
3139 ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER
, "wrong error %u\n", GetLastError() );
3140 ok( buffer
[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer
) );
3141 ok( size
== ARRAY_SIZE(trueW
), "wrong len %lu\n", size
);
3142 pReleaseActCtx(handle
);
3144 create_manifest_file( "manifest_settings2.manifest", settings_manifest2
, -1, NULL
, NULL
);
3145 handle
= test_create("manifest_settings2.manifest");
3146 ok( handle
!= INVALID_HANDLE_VALUE
|| broken( handle
== INVALID_HANDLE_VALUE
), /* <= vista */
3147 "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError() );
3148 DeleteFileA( "manifest_settings2.manifest" );
3149 if (handle
!= INVALID_HANDLE_VALUE
)
3151 SetLastError( 0xdeadbeef );
3153 memset( buffer
, 0xcc, sizeof(buffer
) );
3154 ret
= pQueryActCtxSettingsW( 0, handle
, NULL
, dpiAwareW
, buffer
, 80, &size
);
3155 ok( ret
, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
3156 ok( !lstrcmpW( buffer
, trueW
), "got %s\n", wine_dbgstr_w(buffer
) );
3157 ok( size
== lstrlenW( buffer
) + 1, "wrong len %lu\n", size
);
3158 pReleaseActCtx(handle
);
3161 create_manifest_file( "manifest_settings3.manifest", settings_manifest3
, -1, NULL
, NULL
);
3162 handle
= test_create("manifest_settings3.manifest");
3163 ok( handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError() );
3164 DeleteFileA( "manifest_settings3.manifest" );
3165 SetLastError( 0xdeadbeef );
3167 memset( buffer
, 0xcc, sizeof(buffer
) );
3168 ret
= pQueryActCtxSettingsW( 0, handle
, NULL
, dpiAwareW
, buffer
, 80, &size
);
3169 ok( !ret
, "QueryActCtxSettingsW succeeded\n" );
3170 ok( GetLastError() == ERROR_SXS_KEY_NOT_FOUND
, "wrong error %u\n", GetLastError() );
3171 pReleaseActCtx(handle
);
3179 argc
= winetest_get_mainargs(&argv
);
3183 win_skip("Needed functions are not available\n");
3188 if(argc
> 2 && !strcmp(argv
[2], "manifest1")) {
3189 test_app_manifest();
3195 test_CreateActCtx();
3196 test_findsectionstring();
3197 test_ZombifyActCtx();
3198 run_child_process();
3199 test_compatibility();