ReactOS 0.4.16-dev-2206-gc56950d
actctx.c
Go to the documentation of this file.
1/*
2 * Copyright 2007 Jacek Caban for CodeWeavers
3 *
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.
8 *
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.
13 *
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
17 */
18
19#include "ntstatus.h"
20#define WIN32_NO_STATUS
21#include "wine/test.h"
22#include <winbase.h>
23#include <windef.h>
24#include <winnt.h>
25#include <winternl.h>
26#include <winnls.h>
27#include <stdio.h>
28
29#include "oaidl.h"
30#include "initguid.h"
31
32static BOOL (WINAPI *pQueryActCtxSettingsW)(DWORD,HANDLE,LPCWSTR,LPCWSTR,LPWSTR,SIZE_T,SIZE_T*);
33
34static NTSTATUS(NTAPI *pRtlFindActivationContextSectionString)(DWORD,const GUID *,ULONG,PUNICODE_STRING,PACTCTX_SECTION_KEYED_DATA);
35static BOOLEAN (NTAPI *pRtlCreateUnicodeStringFromAsciiz)(PUNICODE_STRING, PCSZ);
36static VOID (NTAPI *pRtlFreeUnicodeString)(PUNICODE_STRING);
37
38#ifdef __i386__
39#define ARCH "x86"
40#elif defined __aarch64__ || defined__arm64ec__
41#define ARCH "arm64"
42#elif defined __x86_64__
43#define ARCH "amd64"
44#elif defined __arm__
45#define ARCH "arm"
46#else
47#define ARCH "none"
48#endif
49
50static const char manifest1[] =
51"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
52"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
53"</assembly>";
54
55static const char manifest1_1[] =
56"<assembly xmlns = \"urn:schemas-microsoft-com:asm.v1\" manifestVersion = \"1.0\">"
57"<assemblyIdentity version = \"1.0.0.0\" name = \"Wine.Test\" type = \"win32\"></assemblyIdentity>"
58"</assembly>";
59
60static const char manifest2[] =
61"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
62"<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\">"
63"</assemblyIdentity>"
64"<dependency>"
65"<dependentAssembly>"
66"<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"" ARCH "\">"
67"</assemblyIdentity>"
68"</dependentAssembly>"
69"</dependency>"
70"</assembly>";
71
72DEFINE_GUID(IID_CoTest, 0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x11, 0x11, 0x22, 0x22, 0x33, 0x33);
73DEFINE_GUID(IID_CoTest2, 0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x11, 0x11, 0x22, 0x22, 0x33, 0x34);
74DEFINE_GUID(CLSID_clrclass,0x22345678, 0x1234, 0x5678, 0x12, 0x34, 0x11, 0x11, 0x22, 0x22, 0x33, 0x33);
75DEFINE_GUID(IID_TlibTest, 0x99999999, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55);
76DEFINE_GUID(IID_TlibTest2, 0x99999999, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x56);
77DEFINE_GUID(IID_TlibTest3, 0x99999999, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x57);
78DEFINE_GUID(IID_TlibTest4, 0x99999999, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x58);
79DEFINE_GUID(IID_Iifaceps, 0x66666666, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55);
80DEFINE_GUID(IID_Ibifaceps, 0x66666666, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x57);
81DEFINE_GUID(IID_Iifaceps2, 0x76666666, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55);
82DEFINE_GUID(IID_Iifaceps3, 0x86666666, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55);
83DEFINE_GUID(IID_Iiface, 0x96666666, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55);
84DEFINE_GUID(IID_PS32, 0x66666666, 0x8888, 0x7777, 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x56);
85
86static const char manifest3[] =
87"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
88"<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\""
89" publicKeyToken=\"6595b6414666f1df\" />"
90"<description />"
91"<file name=\"testlib.dll\">"
92"<windowClass>wndClass</windowClass>"
93" <comClass description=\"Test com class\""
94" clsid=\"{12345678-1234-5678-1234-111122223333}\""
95" tlbid=\"{99999999-8888-7777-6666-555555555555}\""
96" threadingModel=\"Neutral\""
97" progid=\"ProgId.ProgId\""
98" miscStatus=\"cantlinkinside\""
99" miscStatusIcon=\"recomposeonresize\""
100" miscStatusContent=\"insideout\""
101" miscStatusThumbnail=\"alignable\""
102" miscStatusDocPrint=\"simpleframe,setclientsitefirst\""
103" >"
104" <progid>ProgId.ProgId.1</progid>"
105" <progid>ProgId.ProgId.2</progid>"
106" <progid>ProgId.ProgId.3</progid>"
107" <progid>ProgId.ProgId.4</progid>"
108" <progid>ProgId.ProgId.5</progid>"
109" <progid>ProgId.ProgId.6</progid>"
110" </comClass>"
111" <comClass clsid=\"{12345678-1234-5678-1234-111122223334}\" threadingModel=\"Neutral\" >"
112" <progid>ProgId.ProgId.7</progid>"
113" </comClass>"
114" <comInterfaceProxyStub "
115" name=\"Iifaceps\""
116" tlbid=\"{99999999-8888-7777-6666-555555555558}\""
117" iid=\"{66666666-8888-7777-6666-555555555555}\""
118" proxyStubClsid32=\"{66666666-8888-7777-6666-555555555556}\""
119" threadingModel=\"Free\""
120" numMethods=\"10\""
121" baseInterface=\"{66666666-8888-7777-6666-555555555557}\""
122" />"
123" <activatableClass name=\"Wine.Test.Class1\" threadingModel=\"mta\" xmlns=\"urn:schemas-microsoft-com:winrt.v1\"/>"
124" <activatableClass name=\"Wine.Test.Class2\" threadingModel=\"both\" xmlns=\"urn:schemas-microsoft-com:winrt.v1\"/>"
125" <activatableClass name=\"Wine.Test.Class3\" threadingModel=\"sta\" xmlns=\"urn:schemas-microsoft-com:winrt.v1\"/>"
126"</file>"
127"<file name=\"Wine.Test.dll\">"
128" <activatableClass name=\"Wine.Test.Class4\" threadingModel=\"sta\" xmlns=\"urn:schemas-microsoft-com:winrt.v1\"/>"
129"</file>"
130" <comInterfaceExternalProxyStub "
131" name=\"Iifaceps2\""
132" tlbid=\"{99999999-8888-7777-6666-555555555558}\""
133" iid=\"{76666666-8888-7777-6666-555555555555}\""
134" proxyStubClsid32=\"{66666666-8888-7777-6666-555555555556}\""
135" numMethods=\"10\""
136" baseInterface=\"{66666666-8888-7777-6666-555555555557}\""
137" />"
138" <comInterfaceExternalProxyStub "
139" name=\"Iifaceps3\""
140" tlbid=\"{99999999-8888-7777-6666-555555555558}\""
141" iid=\"{86666666-8888-7777-6666-555555555555}\""
142" numMethods=\"10\""
143" baseInterface=\"{66666666-8888-7777-6666-555555555557}\""
144" />"
145" <clrSurrogate "
146" clsid=\"{96666666-8888-7777-6666-555555555555}\""
147" name=\"testsurrogate\""
148" runtimeVersion=\"v2.0.50727\""
149" />"
150" <clrSurrogate "
151" clsid=\"{96666666-8888-7777-6666-555555555556}\""
152" name=\"testsurrogate\""
153" runtimeVersion=\"v2.0.50728\""
154" />"
155" <clrClass "
156" clsid=\"{22345678-1234-5678-1234-111122223333}\""
157" name=\"clrclass\""
158" progid=\"clrprogid\""
159" description=\"test description\""
160" tlbid=\"{99999999-8888-7777-6666-555555555555}\""
161" runtimeVersion=\"1.2.3.4\""
162" threadingModel=\"Neutral\""
163" >"
164" <progid>clrprogid.1</progid>"
165" <progid>clrprogid.2</progid>"
166" <progid>clrprogid.3</progid>"
167" <progid>clrprogid.4</progid>"
168" <progid>clrprogid.5</progid>"
169" <progid>clrprogid.6</progid>"
170" </clrClass>"
171"</assembly>";
172
173static const char manifest_wndcls1[] =
174"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
175"<assemblyIdentity version=\"1.2.3.4\" name=\"testdep1\" type=\"win32\" processorArchitecture=\"" ARCH "\"/>"
176"<file name=\"testlib1.dll\">"
177"<windowClass versioned=\"yes\">wndClass1</windowClass>"
178"<windowClass>wndClass2</windowClass>"
179" <typelib tlbid=\"{99999999-8888-7777-6666-555555555558}\" version=\"1.0\" helpdir=\"\" />"
180"</file>"
181"<file name=\"testlib1_2.dll\" />"
182"</assembly>";
183
184static const char manifest_wndcls2[] =
185"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
186"<assemblyIdentity version=\"4.3.2.1\" name=\"testdep2\" type=\"win32\" processorArchitecture=\"" ARCH "\" />"
187"<file name=\"testlib2.dll\">"
188" <windowClass versioned=\"no\">wndClass3</windowClass>"
189" <windowClass>wndClass4</windowClass>"
190" <typelib tlbid=\"{99999999-8888-7777-6666-555555555555}\" version=\"1.0\" helpdir=\"help\" resourceid=\"409\""
191" flags=\"HiddeN,CoNTROL,rESTRICTED\" />"
192" <typelib tlbid=\"{99999999-8888-7777-6666-555555555556}\" version=\"1.0\" helpdir=\"help1\" resourceid=\"409\" />"
193" <typelib tlbid=\"{99999999-8888-7777-6666-555555555557}\" version=\"1.0\" helpdir=\"\" />"
194"</file>"
195"<file name=\"testlib2_2.dll\" />"
196"</assembly>";
197
198static const char manifest_wndcls_main[] =
199"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
200"<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\" />"
201"<dependency>"
202" <dependentAssembly>"
203" <assemblyIdentity type=\"win32\" name=\"testdep1\" version=\"1.2.3.4\" processorArchitecture=\"" ARCH "\" />"
204" </dependentAssembly>"
205"</dependency>"
206"<dependency>"
207" <dependentAssembly>"
208" <assemblyIdentity type=\"win32\" name=\"testdep2\" version=\"4.3.2.1\" processorArchitecture=\"" ARCH "\" />"
209" </dependentAssembly>"
210"</dependency>"
211"</assembly>";
212
213static const char manifest4[] =
214"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
215"<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\">"
216"</assemblyIdentity>"
217"<dependency>"
218"<dependentAssembly>"
219"<assemblyIdentity type=\"win32\" name=\"Microsoft.Windows.Common-Controls\" "
220 "version=\"6.0.1.0\" processorArchitecture=\"" ARCH "\" publicKeyToken=\"6595b64144ccf1df\">"
221"</assemblyIdentity>"
222"</dependentAssembly>"
223"</dependency>"
224"</assembly>";
225
226static const char manifest5[] =
227"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
228"<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\">"
229"</assemblyIdentity>"
230"<dependency>"
231" <dependentAssembly dependencyType=\"preRequisite\" allowDelayedBinding=\"true\">"
232" <assemblyIdentity name=\"Missing.Assembly\" version=\"1.0.0.0\" />"
233" </dependentAssembly>"
234"</dependency>"
235"</assembly>";
236
237static const char manifest6[] =
238"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
239"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
240"<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v1\">"
241" <security>"
242" <requestedPrivileges>"
243" <requestedExecutionLevel level=\"ASINVOKER\" uiAccess=\"false\"/>"
244" </requestedPrivileges>"
245" </security>"
246"</trustInfo>"
247"</assembly>";
248
249static const char manifest7[] =
250"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
251"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
252"<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">"
253" <security>"
254" <requestedPrivileges>"
255" <requestedExecutionLevel level=\"requireAdministrator\" uiAccess=\"TRUE\"/>"
256" </requestedPrivileges>"
257" </security>"
258"</trustInfo>"
259"</assembly>";
260
261static const char manifest8[] =
262"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
263"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
264"<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">"
265" <security>"
266" <requestedPrivileges>"
267" <requestedExecutionLevel level=\"requireAdministrator\" uiAccess=\"true\">"
268" </requestedExecutionLevel>"
269" </requestedPrivileges>"
270" </security>"
271"</trustInfo>"
272"</assembly>";
273
274static const char manifest9[] =
275"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
276"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
277"<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">"
278" <security>"
279" <requestedPrivileges>"
280" <requestedExecutionLevel level=\"requireAdministrator\"/>"
281" </requestedPrivileges>"
282" </security>"
283"</trustInfo>"
284"<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">"
285" <security>"
286" <requestedPrivileges>"
287" </requestedPrivileges>"
288" </security>"
289"</trustInfo>"
290"</assembly>";
291
292static const char manifest10[] =
293"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" xmlns:asmv2=\"urn:schemas-microsoft-com:asm.v2\" manifestVersion=\"1.0\">"
294"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
295"<asmv2:trustInfo>"
296" <asmv2:security>"
297" <asmv2:requestedPrivileges>"
298" <asmv2:requestedExecutionLevel level=\"requireAdministrator\" uiAccess=\"true\"></asmv2:requestedExecutionLevel>"
299" </asmv2:requestedPrivileges>"
300" </asmv2:security>"
301"</asmv2:trustInfo>"
302"</assembly>";
303
304/* Empty <dependency> element */
305static const char manifest11[] =
306"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" xmlns:asmv2=\"urn:schemas-microsoft-com:asm.v2\" manifestVersion=\"1.0\">"
307"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
308"<dependency />"
309"</assembly>";
310
311static const char testdep_manifest1[] =
312"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
313"<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"" ARCH "\"/>"
314"</assembly>";
315
316static const char testdep_manifest2[] =
317"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
318"<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"" ARCH "\" />"
319"<file name=\"testlib.dll\"></file>"
320"<file name=\"testlib2.dll\" hash=\"63c978c2b53d6cf72b42fb7308f9af12ab19ec53\" hashalg=\"SHA1\" />"
321"</assembly>";
322
323static const char testdep_manifest3[] =
324"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\"> "
325"<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"" ARCH "\"/>"
326"<file name=\"testlib.dll\"/>"
327"<file name=\"testlib2.dll\" hash=\"63c978c2b53d6cf72b42fb7308f9af12ab19ec53\" hashalg=\"SHA1\">"
328"<windowClass>wndClass</windowClass>"
329"<windowClass>wndClass2</windowClass>"
330"</file>"
331"</assembly>";
332
333static const char wrong_manifest1[] =
334"<assembly manifestVersion=\"1.0\">"
335"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
336"</assembly>";
337
338static const char wrong_manifest2[] =
339"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\">"
340"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
341"</assembly>";
342
343static const char wrong_manifest3[] =
344"<assembly test=\"test\" xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
345"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
346"</assembly>";
347
348static const char wrong_manifest4[] =
349"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
350"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
351"<test></test>"
352"</assembly>";
353
354static const char wrong_manifest5[] =
355"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
356"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
357"</assembly>"
358"<test></test>";
359
360static const char wrong_manifest6[] =
361"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v5\" manifestVersion=\"1.0\">"
362"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
363"</assembly>";
364
365static const char wrong_manifest7[] =
366"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
367"<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.3\" processorArchitecture=\"" ARCH "\" />"
368"<file name=\"testlib.dll\" hash=\"63c978c2b53d6cf72b42fb7308f9af12ab19ec5\" hashalg=\"SHA1\" />"
369"</assembly>";
370
371static const char wrong_manifest8[] =
372"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
373"<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
374"<file></file>"
375"</assembly>";
376
377static const char wrong_manifest9[] =
378"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
379"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
380"<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">"
381" <security>"
382" <requestedPrivileges>"
383" <requestedExecutionLevel level=\"requireAdministrator\"/>"
384" <requestedExecutionLevel uiAccess=\"true\"/>"
385" </requestedPrivileges>"
386" </security>"
387"</trustInfo>"
388"</assembly>";
389
390static const char wrong_manifest10[] =
391"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
392"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
393"<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">"
394" <security>"
395" <requestedPrivileges>"
396" <requestedExecutionLevel level=\"requireAdministrator\"/>"
397" </requestedPrivileges>"
398" </security>"
399"</trustInfo>"
400"<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v2\">"
401" <security>"
402" <requestedPrivileges>"
403" <requestedExecutionLevel uiAccess=\"true\"/>"
404" </requestedPrivileges>"
405" </security>"
406"</trustInfo>"
407"</assembly>";
408
409/* activatableClass with the wrong xmlns is invalid */
410static const char wrong_manifest11[] =
411"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
412"<assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\" />"
413"<file name=\"testlib.dll\">"
414" <activatableClass name=\"Wine.Test.Class1\" threadingModel=\"both\" />"
415"</file>"
416"</assembly>";
417
418static const char wrong_depmanifest1[] =
419"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
420"<assemblyIdentity type=\"win32\" name=\"testdep\" version=\"6.5.4.4\" processorArchitecture=\"" ARCH "\" />"
421"</assembly>";
422
424"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
425" <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
426" <compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\">"
427" <application>"
428" </application>"
429" </compatibility>"
430"</assembly>";
431
432static const char compat_manifest_vista[] =
433"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
434" <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
435" <compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\">"
436" <application>"
437" <supportedOS Id=\"{e2011457-1546-43c5-a5fe-008deee3d3f0}\" />" /* Windows Vista */
438" </application>"
439" </compatibility>"
440"</assembly>";
441
443"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
444" <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
445" <compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\">"
446" <application>"
447" <supportedOS Id=\"{e2011457-1546-43c5-a5fe-008deee3d3f0}\" ></supportedOS>" /* Windows Vista */
448" <supportedOS Id=\"{35138b9a-5d96-4fbd-8e2d-a2440225f93a}\" />" /* Windows 7 */
449" <supportedOS Id=\"{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}\" ></supportedOS>" /* Windows 8 */
450" <supportedOS Id=\"{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}\" />" /* Windows 10 */
451" <supportedOS Id=\"{1f676c76-80e1-4239-95bb-83d0f6d0da78}\" />" /* Windows 8.1 */
452" <maxversiontested Id=\"10.0.18358\" />"
453" <maxversiontested Id=\"2.3.4.5\" />"
454" </application>"
455" </compatibility>"
456"</assembly>";
457
458static const char compat_manifest_other_guid[] =
459"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
460" <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
461" <compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\">"
462" <application>"
463" <supportedOS Id=\"{12345566-1111-2222-3333-444444444444}\" />"
464" </application>"
465" </compatibility>"
466"</assembly>";
467
468static const char settings_manifest[] =
469"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
470" <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
471" <application xmlns=\"urn:schemas-microsoft-com:asm.v3\">"
472" <windowsSettings>"
473" <dpiAware xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">true</dpiAware>"
474" <dpiAwareness xmlns=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\">true</dpiAwareness>"
475" </windowsSettings>"
476" </application>"
477"</assembly>";
478
479static const char settings_manifest2[] =
480"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
481" <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
482" <application xmlns=\"urn:schemas-microsoft-com:asm.v3\""
483" xmlns:ws05=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\""
484" xmlns:ws11=\"http://schemas.microsoft.com/SMI/2011/WindowsSettings\""
485" xmlns:ws16=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\""
486" xmlns:ws17=\"http://schemas.microsoft.com/SMI/2017/WindowsSettings\">"
487" <windowsSettings>"
488" <ws05:autoElevate>true</ws05:autoElevate>"
489" <ws05:disableTheming>true</ws05:disableTheming>"
490" <ws11:disableWindowFiltering>true</ws11:disableWindowFiltering>"
491" <ws05:dpiAware>true</ws05:dpiAware>"
492" <ws16:dpiAwareness>true</ws16:dpiAwareness>"
493" <ws17:gdiScaling>true</ws17:gdiScaling>"
494" <ws17:highResolutionScrollingAware>true</ws17:highResolutionScrollingAware>"
495" <ws16:longPathAware>true</ws16:longPathAware>"
496" <ws17:magicFutureSetting>true</ws17:magicFutureSetting>"
497" <ws11:printerDriverIsolation>true</ws11:printerDriverIsolation>"
498" <ws17:ultraHighResolutionScrollingAware>true</ws17:ultraHighResolutionScrollingAware>"
499" </windowsSettings>"
500" </application>"
501"</assembly>";
502
503/* broken manifest found in some binaries: asmv3 namespace is used but not declared */
504static const char settings_manifest3[] =
505"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
506" <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
507" <asmv3:application>"
508" <asmv3:windowsSettings xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">"
509" <dpiAware>true</dpiAware>"
510" </asmv3:windowsSettings>"
511" </asmv3:application>"
512"</assembly>";
513
514static const char settings_manifest4[] =
515"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
516" <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
517" <application/>"
518" <application xmlns=\"urn:schemas-microsoft-com:asm.v3\">"
519" <windowsSettings>"
520" <dpiAware xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">true</dpiAware>"
521" </windowsSettings>"
522" </application>"
523" <application/>"
524" <application xmlns=\"urn:schemas-microsoft-com:asm.v3\">"
525" <windowsSettings>"
526" <dpiAwareness xmlns=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\">true</dpiAwareness>"
527" </windowsSettings>"
528" </application>"
529"</assembly>";
530
531static const char two_dll_manifest_dll[] =
532"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v3\" manifestVersion=\"1.0\">"
533" <assemblyIdentity type=\"win32\" name=\"sxs_dll\" version=\"1.0.0.0\" processorArchitecture=\"x86\" publicKeyToken=\"0000000000000000\"/>"
534" <file name=\"sxs_dll.dll\"></file>"
535"</assembly>";
536
537static const char two_dll_manifest_exe[] =
538"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
539" <dependency>"
540" <dependentAssembly>"
541" <assemblyIdentity type=\"win32\" name=\"sxs_dll\" version=\"1.0.0.0\" processorArchitecture=\"x86\" publicKeyToken=\"0000000000000000\" language=\"*\"/>"
542" </dependentAssembly>"
543" </dependency>"
544"</assembly>";
545
546static const char builtin_dll_manifest[] =
547"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
548" <dependency>"
549" <dependentAssembly>"
550" <assemblyIdentity"
551" type=\"win32\""
552" name=\"microsoft.vc90.crt\""
553" version=\"9.0.20718.0\""
554" processorArchitecture=\"*\""
555" publicKeyToken=\"1fc8b3b9a1e18e3b\""
556" language=\"*\""
557" />"
558" </dependentAssembly>"
559" </dependency>"
560"</assembly>";
561
562static const char empty_assembly_manifest[] =
563"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\" />";
564
565DEFINE_GUID(VISTA_COMPAT_GUID, 0xe2011457, 0x1546, 0x43c5, 0xa5, 0xfe, 0x00, 0x8d, 0xee, 0xe3, 0xd3, 0xf0);
566DEFINE_GUID(WIN7_COMPAT_GUID, 0x35138b9a, 0x5d96, 0x4fbd, 0x8e, 0x2d, 0xa2, 0x44, 0x02, 0x25, 0xf9, 0x3a);
567DEFINE_GUID(WIN8_COMPAT_GUID, 0x4a2f28e3, 0x53b9, 0x4441, 0xba, 0x9c, 0xd6, 0x9d, 0x4a, 0x4a, 0x6e, 0x38);
568DEFINE_GUID(WIN81_COMPAT_GUID, 0x1f676c76, 0x80e1, 0x4239, 0x95, 0xbb, 0x83, 0xd0, 0xf6, 0xd0, 0xda, 0x78);
569DEFINE_GUID(WIN10_COMPAT_GUID, 0x8e0f7a12, 0xbfb3, 0x4fe8, 0xb9, 0xa5, 0x48, 0xfd, 0x50, 0xa1, 0x5a, 0x9a);
570DEFINE_GUID(OTHER_COMPAT_GUID, 0x12345566, 0x1111, 0x2222, 0x33, 0x33, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44);
571
572
573static const WCHAR testlib_dll[] =
574 {'t','e','s','t','l','i','b','.','d','l','l',0};
575static const WCHAR testlib2_dll[] =
576 {'t','e','s','t','l','i','b','2','.','d','l','l',0};
577static const WCHAR wndClassW[] =
578 {'w','n','d','C','l','a','s','s',0};
579static const WCHAR wndClass1W[] =
580 {'w','n','d','C','l','a','s','s','1',0};
581static const WCHAR wndClass2W[] =
582 {'w','n','d','C','l','a','s','s','2',0};
583static const WCHAR wndClass3W[] =
584 {'w','n','d','C','l','a','s','s','3',0};
585
588
589static BOOL create_manifest_file(const char *filename, const char *manifest, int manifest_len,
590 const char *depfile, const char *depmanifest)
591{
592 DWORD size;
593 HANDLE file;
595
598
599 if (manifest_len == -1)
600 manifest_len = strlen(manifest);
601
604 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
606 return FALSE;
607 WriteFile(file, manifest, manifest_len, &size, NULL);
609
610 if (depmanifest)
611 {
612 MultiByteToWideChar( CP_ACP, 0, depfile, -1, path, MAX_PATH );
616 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
618 return FALSE;
619 WriteFile(file, depmanifest, strlen(depmanifest), &size, NULL);
621 }
622 return TRUE;
623}
624
625static BOOL create_wide_manifest(const char *filename, const char *manifest, BOOL fBOM, BOOL fReverse)
626{
627 WCHAR *wmanifest = HeapAlloc(GetProcessHeap(), 0, (strlen(manifest)+2) * sizeof(WCHAR));
628 BOOL ret;
629 int offset = (fBOM ? 0 : 1);
630
631 MultiByteToWideChar(CP_ACP, 0, manifest, -1, &wmanifest[1], (strlen(manifest)+1));
632 wmanifest[0] = 0xfeff;
633 if (fReverse)
634 {
635 size_t i;
636 for (i = 0; i < strlen(manifest)+1; i++)
637 wmanifest[i] = (wmanifest[i] << 8) | ((wmanifest[i] >> 8) & 0xff);
638 }
639 ret = create_manifest_file(filename, (char *)&wmanifest[offset], (strlen(manifest)+1-offset) * sizeof(WCHAR), NULL, NULL);
640 HeapFree(GetProcessHeap(), 0, wmanifest);
641 return ret;
642}
643
645{
646 WCHAR tmp_path[MAX_PATH];
647 DWORD size, tmp_path_len;
648 HANDLE file, file_w;
649 UINT unique;
650
651 tmp_path_len = GetTempPathW(ARRAY_SIZE(tmp_path), tmp_path);
652 ok(tmp_path_len != 0, "GetTempPathW returned error %lu\n", GetLastError());
653 ok(tmp_path_len < ARRAY_SIZE(tmp_path), "GetTempPathW return value %lu should be less than %Iu\n",
654 tmp_path_len, ARRAY_SIZE(tmp_path));
655
656 memset(pathname, 0, MAX_PATH * sizeof(WCHAR));
657 unique = GetTempFileNameW(tmp_path, L"tst", 0, pathname);
658 ok(unique != 0, "GetTempFileNameW returned error %lu\n", GetLastError());
659
660 /* Open file handle that will be deleted on close or process termination */
664 NULL,
667 NULL);
668 ok(file != INVALID_HANDLE_VALUE, "CreateFile returned error %lu\n", GetLastError());
669
670 /* Re-open file with write access */
671 file_w = CreateFileW(pathname,
674 NULL,
677 NULL);
678 ok(file_w != INVALID_HANDLE_VALUE, "CreateFile returned error %lu\n", GetLastError());
679
681
682 /* Close file handle that was open for write to avoid sharing violation */
683 CloseHandle(file_w);
684
685 return file;
686}
687
688typedef struct {
698
700 0, 0, 0, 0, NULL, 0, 0, NULL
701};
702
704 1, 1, 1, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, manifest_path,
705 ACTIVATION_CONTEXT_PATH_TYPE_NONE, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE,
706 app_dir,
707};
708
710 1, 1, 1, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, app_manifest_path,
711 ACTIVATION_CONTEXT_PATH_TYPE_NONE, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE,
712 app_dir,
713};
714
715/* On Vista+, there's an extra assembly for Microsoft.Windows.Common-Controls.Resources */
717 1, 2, 3, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, manifest_path,
718 ACTIVATION_CONTEXT_PATH_TYPE_NONE, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE,
719 app_dir,
720};
721
722static void test_detailed_info(HANDLE handle, const detailed_info_t *exinfo, int line)
723{
724 ACTIVATION_CONTEXT_DETAILED_INFORMATION detailed_info_tmp, *detailed_info;
725 SIZE_T size, exsize, retsize;
726 BOOL b;
727
728 exsize = sizeof(ACTIVATION_CONTEXT_DETAILED_INFORMATION)
729 + (exinfo->root_manifest_path ? (lstrlenW(exinfo->root_manifest_path)+1)*sizeof(WCHAR):0)
730 + (exinfo->app_dir ? (lstrlenW(exinfo->app_dir)+1)*sizeof(WCHAR) : 0);
731
732 if(exsize != sizeof(ACTIVATION_CONTEXT_DETAILED_INFORMATION)) {
733 size = 0xdeadbeef;
734 b = QueryActCtxW(0, handle, NULL, ActivationContextDetailedInformation, &detailed_info_tmp,
735 sizeof(detailed_info_tmp), &size);
736 ok_(__FILE__, line)(!b, "QueryActCtx succeeded\n");
737 ok_(__FILE__, line)(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() = %lu\n", GetLastError());
738 ok_(__FILE__, line)(size == exsize, "size=%Id, expected %Id\n", size, exsize);
739 }else {
740 size = sizeof(ACTIVATION_CONTEXT_DETAILED_INFORMATION);
741 }
742
743 detailed_info = HeapAlloc(GetProcessHeap(), 0, size);
744 memset(detailed_info, 0xfe, size);
745 b = QueryActCtxW(0, handle, NULL, ActivationContextDetailedInformation, detailed_info, size, &retsize);
746 ok_(__FILE__, line)(b, "QueryActCtx failed: %lu\n", GetLastError());
747 ok_(__FILE__, line)(retsize == exsize, "size=%Id, expected %Id\n", retsize, exsize);
748
749 ok_(__FILE__, line)(detailed_info->dwFlags == 0, "detailed_info->dwFlags=%lx\n", detailed_info->dwFlags);
750 ok_(__FILE__, line)(detailed_info->ulFormatVersion == exinfo->format_version,
751 "detailed_info->ulFormatVersion=%lu, expected %lu\n", detailed_info->ulFormatVersion,
752 exinfo->format_version);
753 ok_(__FILE__, line)(exinfo->assembly_cnt_min <= detailed_info->ulAssemblyCount &&
754 detailed_info->ulAssemblyCount <= exinfo->assembly_cnt_max,
755 "detailed_info->ulAssemblyCount=%lu, expected between %lu and %lu\n", detailed_info->ulAssemblyCount,
756 exinfo->assembly_cnt_min, exinfo->assembly_cnt_max);
757 ok_(__FILE__, line)(detailed_info->ulRootManifestPathType == exinfo->root_manifest_type,
758 "detailed_info->ulRootManifestPathType=%lu, expected %lu\n",
759 detailed_info->ulRootManifestPathType, exinfo->root_manifest_type);
760 ok_(__FILE__, line)(detailed_info->ulRootManifestPathChars ==
761 (exinfo->root_manifest_path ? lstrlenW(exinfo->root_manifest_path) : 0),
762 "detailed_info->ulRootManifestPathChars=%lu, expected %u\n",
763 detailed_info->ulRootManifestPathChars,
764 exinfo->root_manifest_path ?lstrlenW(exinfo->root_manifest_path) : 0);
765 ok_(__FILE__, line)(detailed_info->ulRootConfigurationPathType == exinfo->root_config_type,
766 "detailed_info->ulRootConfigurationPathType=%lu, expected %lu\n",
767 detailed_info->ulRootConfigurationPathType, exinfo->root_config_type);
768 ok_(__FILE__, line)(detailed_info->ulRootConfigurationPathChars == 0,
769 "detailed_info->ulRootConfigurationPathChars=%ld\n", detailed_info->ulRootConfigurationPathChars);
770 ok_(__FILE__, line)(detailed_info->ulAppDirPathType == exinfo->app_dir_type,
771 "detailed_info->ulAppDirPathType=%lu, expected %lu\n", detailed_info->ulAppDirPathType,
772 exinfo->app_dir_type);
773 ok_(__FILE__, line)(detailed_info->ulAppDirPathChars == (exinfo->app_dir ? lstrlenW(exinfo->app_dir) : 0),
774 "detailed_info->ulAppDirPathChars=%lu, expected %u\n",
775 detailed_info->ulAppDirPathChars, exinfo->app_dir ? lstrlenW(exinfo->app_dir) : 0);
776 if(exinfo->root_manifest_path) {
777 ok_(__FILE__, line)(detailed_info->lpRootManifestPath != NULL, "detailed_info->lpRootManifestPath == NULL\n");
778 if(detailed_info->lpRootManifestPath)
779 ok_(__FILE__, line)(!lstrcmpiW(detailed_info->lpRootManifestPath, exinfo->root_manifest_path),
780 "unexpected detailed_info->lpRootManifestPath %s\n", wine_dbgstr_w(detailed_info->lpRootManifestPath));
781 }else {
782 ok_(__FILE__, line)(detailed_info->lpRootManifestPath == NULL, "detailed_info->lpRootManifestPath != NULL\n");
783 }
784 ok_(__FILE__, line)(detailed_info->lpRootConfigurationPath == NULL,
785 "detailed_info->lpRootConfigurationPath=%p\n", detailed_info->lpRootConfigurationPath);
786 if(exinfo->app_dir) {
787 ok_(__FILE__, line)(detailed_info->lpAppDirPath != NULL, "detailed_info->lpAppDirPath == NULL\n");
788 if(detailed_info->lpAppDirPath)
789 ok_(__FILE__, line)(!lstrcmpiW(exinfo->app_dir, detailed_info->lpAppDirPath),
790 "unexpected detailed_info->lpAppDirPath %s / %s\n",
791 wine_dbgstr_w(detailed_info->lpAppDirPath), wine_dbgstr_w( exinfo->app_dir ));
792 }else {
793 ok_(__FILE__, line)(detailed_info->lpAppDirPath == NULL, "detailed_info->lpAppDirPath != NULL\n");
794 }
795
796 HeapFree(GetProcessHeap(), 0, detailed_info);
797}
798
799typedef struct {
801/* ULONG manifest_path_type; FIXME */
806
808 1, manifest_path,
809 L"Wine.Test,type=\"win32\",version=\"1.0.0.0\"",
810 FALSE
811};
812
815 L"Wine.Test,type=\"win32\",version=\"1.0.0.0\"",
816 FALSE
817};
818
820 1, manifest_path,
821 L"Wine.Test,type=\"win32\",version=\"1.2.3.4\"",
822 FALSE
823};
824
826 1, manifest_path,
827 L"Wine.Test,publicKeyToken=\"6595b6414666f1df\",type=\"win32\",version=\"1.2.3.4\"",
828 FALSE
829};
830
832 1, manifest_path,
833 L"Wine.Test,type=\"win32\",version=\"1.2.3.4\"",
834 FALSE
835};
836
838 0x10, depmanifest_path,
839 L"testdep,processorArchitecture=\"" ARCH "\","
840 "type=\"win32\",version=\"6.5.4.3\"",
841 TRUE
842};
843
845 0x10, depmanifest_path,
846 L"testdep,processorArchitecture=\"" ARCH "\","
847 "type=\"win32\",version=\"6.5.4.3\"",
848 TRUE
849};
850
852 0x10, depmanifest_path,
853 L"testdep,processorArchitecture=\"" ARCH "\",type=\"win32\",version=\"6.5.4.3\"",
854 TRUE
855};
856
858 0, NULL, NULL, TRUE /* These values may differ between Windows installations */
859};
860
861static void test_info_in_assembly(HANDLE handle, DWORD id, const info_in_assembly *exinfo, int line)
862{
863 ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *info, info_tmp;
864 SIZE_T size, exsize;
865 ULONG len;
866 BOOL b;
867
868 exsize = sizeof(ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION);
869 if (exinfo->manifest_path) exsize += (lstrlenW(exinfo->manifest_path)+1) * sizeof(WCHAR);
870 if (exinfo->encoded_assembly_id) exsize += (lstrlenW(exinfo->encoded_assembly_id) + 1) * sizeof(WCHAR);
871
872 size = 0xdeadbeef;
873 b = QueryActCtxW(0, handle, &id, AssemblyDetailedInformationInActivationContext, &info_tmp, sizeof(info_tmp), &size);
874 ok_(__FILE__, line)(!b, "QueryActCtx succeeded\n");
875 ok_(__FILE__, line)(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() = %lu\n", GetLastError());
876
877 ok_(__FILE__, line)(size >= exsize, "size=%Iu, expected %Iu\n", size, exsize);
878
879 if (size == 0xdeadbeef)
880 {
881 skip("bad size\n");
882 return;
883 }
884
886 memset(info, 0xfe, size);
887
888 size = 0xdeadbeef;
889 b = QueryActCtxW(0, handle, &id, AssemblyDetailedInformationInActivationContext, info, size, &size);
890 ok_(__FILE__, line)(b, "QueryActCtx failed: %lu\n", GetLastError());
891 if (!exinfo->manifest_path)
892 exsize += info->ulManifestPathLength + sizeof(WCHAR);
893 if (!exinfo->encoded_assembly_id)
894 exsize += info->ulEncodedAssemblyIdentityLength + sizeof(WCHAR);
895 if (exinfo->has_assembly_dir)
896 exsize += info->ulAssemblyDirectoryNameLength + sizeof(WCHAR);
897 ok_(__FILE__, line)(size == exsize, "size=%Iu, expected %Iu\n", size, exsize);
898
899 if (0) /* FIXME: flags meaning unknown */
900 {
901 ok_(__FILE__, line)((info->ulFlags) == exinfo->flags, "info->ulFlags = %lx, expected %lx\n",
902 info->ulFlags, exinfo->flags);
903 }
904 if(exinfo->encoded_assembly_id) {
905 len = lstrlenW(exinfo->encoded_assembly_id)*sizeof(WCHAR);
906 ok_(__FILE__, line)(info->ulEncodedAssemblyIdentityLength == len,
907 "info->ulEncodedAssemblyIdentityLength = %lu, expected %lu\n",
908 info->ulEncodedAssemblyIdentityLength, len);
909 } else {
910 ok_(__FILE__, line)(info->ulEncodedAssemblyIdentityLength != 0,
911 "info->ulEncodedAssemblyIdentityLength == 0\n");
912 }
913 ok_(__FILE__, line)(info->ulManifestPathType == ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE,
914 "info->ulManifestPathType = %lx\n", info->ulManifestPathType);
915 if(exinfo->manifest_path) {
916 len = lstrlenW(exinfo->manifest_path)*sizeof(WCHAR);
917 ok_(__FILE__, line)(info->ulManifestPathLength == len, "info->ulManifestPathLength = %lu, expected %lu\n",
918 info->ulManifestPathLength, len);
919 } else {
920 ok_(__FILE__, line)(info->ulManifestPathLength != 0, "info->ulManifestPathLength == 0\n");
921 }
922
923 ok_(__FILE__, line)(info->ulPolicyPathType == ACTIVATION_CONTEXT_PATH_TYPE_NONE,
924 "info->ulPolicyPathType = %lx\n", info->ulPolicyPathType);
925 ok_(__FILE__, line)(info->ulPolicyPathLength == 0,
926 "info->ulPolicyPathLength = %lu, expected 0\n", info->ulPolicyPathLength);
927 ok_(__FILE__, line)(info->ulMetadataSatelliteRosterIndex == 0, "info->ulMetadataSatelliteRosterIndex = %lx\n",
928 info->ulMetadataSatelliteRosterIndex);
929 ok_(__FILE__, line)(info->ulManifestVersionMajor == 1,"info->ulManifestVersionMajor = %lx\n",
930 info->ulManifestVersionMajor);
931 ok_(__FILE__, line)(info->ulManifestVersionMinor == 0, "info->ulManifestVersionMinor = %lx\n",
932 info->ulManifestVersionMinor);
933 ok_(__FILE__, line)(info->ulPolicyVersionMajor == 0, "info->ulPolicyVersionMajor = %lx\n",
934 info->ulPolicyVersionMajor);
935 ok_(__FILE__, line)(info->ulPolicyVersionMinor == 0, "info->ulPolicyVersionMinor = %lx\n",
936 info->ulPolicyVersionMinor);
937 if(exinfo->has_assembly_dir)
938 ok_(__FILE__, line)(info->ulAssemblyDirectoryNameLength != 0,
939 "info->ulAssemblyDirectoryNameLength == 0\n");
940 else
941 ok_(__FILE__, line)(info->ulAssemblyDirectoryNameLength == 0,
942 "info->ulAssemblyDirectoryNameLength != 0\n");
943
944 ok_(__FILE__, line)(info->lpAssemblyEncodedAssemblyIdentity != NULL,
945 "info->lpAssemblyEncodedAssemblyIdentity == NULL\n");
946 if(info->lpAssemblyEncodedAssemblyIdentity && exinfo->encoded_assembly_id) {
947 ok_(__FILE__, line)(!lstrcmpW(info->lpAssemblyEncodedAssemblyIdentity, exinfo->encoded_assembly_id),
948 "unexpected info->lpAssemblyEncodedAssemblyIdentity %s / %s\n",
949 wine_dbgstr_w(info->lpAssemblyEncodedAssemblyIdentity), wine_dbgstr_w(exinfo->encoded_assembly_id));
950 }
951 if(exinfo->manifest_path) {
952 ok_(__FILE__, line)(info->lpAssemblyManifestPath != NULL, "info->lpAssemblyManifestPath == NULL\n");
953 if(info->lpAssemblyManifestPath)
954 ok_(__FILE__, line)(!lstrcmpiW(info->lpAssemblyManifestPath, exinfo->manifest_path),
955 "unexpected info->lpAssemblyManifestPath\n");
956 }else {
957 ok_(__FILE__, line)(info->lpAssemblyManifestPath != NULL, "info->lpAssemblyManifestPath == NULL\n");
958 }
959
960 ok_(__FILE__, line)(info->lpAssemblyPolicyPath == NULL, "info->lpAssemblyPolicyPath != NULL\n");
961 if(info->lpAssemblyPolicyPath)
962 ok_(__FILE__, line)(*(WORD*)info->lpAssemblyPolicyPath == 0, "info->lpAssemblyPolicyPath is not empty\n");
963 if(exinfo->has_assembly_dir)
964 ok_(__FILE__, line)(info->lpAssemblyDirectoryName != NULL, "info->lpAssemblyDirectoryName == NULL\n");
965 else
966 ok_(__FILE__, line)(info->lpAssemblyDirectoryName == NULL, "info->lpAssemblyDirectoryName = %s\n",
967 wine_dbgstr_w(info->lpAssemblyDirectoryName));
969}
970
971static void test_file_info(HANDLE handle, ULONG assid, ULONG fileid, LPCWSTR filename, int line)
972{
973 ASSEMBLY_FILE_DETAILED_INFORMATION *info, info_tmp;
974 ACTIVATION_CONTEXT_QUERY_INDEX index = {assid, fileid};
975 SIZE_T size, exsize;
976 BOOL b;
977
978 exsize = sizeof(ASSEMBLY_FILE_DETAILED_INFORMATION)
979 +(lstrlenW(filename)+1)*sizeof(WCHAR);
980
981 size = 0xdeadbeef;
982 b = QueryActCtxW(0, handle, &index, FileInformationInAssemblyOfAssemblyInActivationContext, &info_tmp,
983 sizeof(info_tmp), &size);
984 ok_(__FILE__, line)(!b, "QueryActCtx succeeded\n");
985 ok_(__FILE__, line)(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() = %lu\n", GetLastError());
986 ok_(__FILE__, line)(size == exsize, "size=%Iu, expected %Iu\n", size, exsize);
987
988 if(size == 0xdeadbeef)
989 {
990 skip("bad size\n");
991 return;
992 }
993
995 memset(info, 0xfe, size);
996
997 b = QueryActCtxW(0, handle, &index, FileInformationInAssemblyOfAssemblyInActivationContext, info, size, &size);
998 ok_(__FILE__, line)(b, "QueryActCtx failed: %lu\n", GetLastError());
999 ok_(__FILE__, line)(!size, "size=%Iu, expected 0\n", size);
1000
1001 ok_(__FILE__, line)(info->ulFlags == 2, "info->ulFlags=%lx, expected 2\n", info->ulFlags);
1002 ok_(__FILE__, line)(info->ulFilenameLength == lstrlenW(filename)*sizeof(WCHAR),
1003 "info->ulFilenameLength=%lu, expected %u*sizeof(WCHAR)\n",
1004 info->ulFilenameLength, lstrlenW(filename));
1005 ok_(__FILE__, line)(info->ulPathLength == 0, "info->ulPathLength=%lu\n", info->ulPathLength);
1006 ok_(__FILE__, line)(info->lpFileName != NULL, "info->lpFileName == NULL\n");
1007 if(info->lpFileName)
1008 ok_(__FILE__, line)(!lstrcmpiW(info->lpFileName, filename), "unexpected info->lpFileName\n");
1009 ok_(__FILE__, line)(info->lpFilePath == NULL, "info->lpFilePath != NULL\n");
1011}
1012
1013typedef struct {
1014 ACTCTX_REQUESTED_RUN_LEVEL run_level;
1017
1019 ACTCTX_RUN_LEVEL_UNSPECIFIED, FALSE,
1020};
1021
1023 ACTCTX_RUN_LEVEL_AS_INVOKER, FALSE,
1024};
1025
1027 ACTCTX_RUN_LEVEL_REQUIRE_ADMIN, TRUE,
1028};
1029
1031 ACTCTX_RUN_LEVEL_REQUIRE_ADMIN, TRUE,
1032};
1033
1035 ACTCTX_RUN_LEVEL_REQUIRE_ADMIN, FALSE,
1036};
1037
1038static void test_runlevel_info(HANDLE handle, const runlevel_info_t *exinfo, int line)
1039{
1040 ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION runlevel_info;
1041 SIZE_T size, retsize;
1042 BOOL b;
1043
1044 size = sizeof(runlevel_info);
1045 b = QueryActCtxW(0, handle, NULL, RunlevelInformationInActivationContext, &runlevel_info,
1046 sizeof(runlevel_info), &retsize);
1048 {
1049 win_skip("RunlevelInformationInActivationContext not supported.\n");
1050 return;
1051 }
1052
1053 ok_(__FILE__, line)(b, "QueryActCtx failed: %lu\n", GetLastError());
1054 ok_(__FILE__, line)(retsize == size, "size=%Id, expected %Id\n", retsize, size);
1055
1056 ok_(__FILE__, line)(runlevel_info.ulFlags == 0, "runlevel_info.ulFlags=%lx\n", runlevel_info.ulFlags);
1057 ok_(__FILE__, line)(runlevel_info.RunLevel == exinfo->run_level,
1058 "runlevel_info.RunLevel=%u, expected %u\n", runlevel_info.RunLevel, exinfo->run_level);
1059 ok_(__FILE__, line)(runlevel_info.UiAccess == exinfo->ui_access,
1060 "runlevel_info.UiAccess=%lu, expected %lu\n", runlevel_info.UiAccess, exinfo->ui_access);
1061}
1062
1063static HANDLE test_create(const char *file)
1064{
1065 ACTCTXW actctx;
1066 HANDLE handle;
1068
1070 memset(&actctx, 0, sizeof(ACTCTXW));
1071 actctx.cbSize = sizeof(ACTCTXW);
1072 actctx.lpSource = path;
1073
1075 /* to be tested outside of this helper, including last error */
1076 if (handle == INVALID_HANDLE_VALUE) return handle;
1077
1078 ok(actctx.cbSize == sizeof(actctx), "actctx.cbSize=%ld\n", actctx.cbSize);
1079 ok(actctx.dwFlags == 0, "actctx.dwFlags=%ld\n", actctx.dwFlags);
1080 ok(actctx.lpSource == path, "actctx.lpSource=%p\n", actctx.lpSource);
1081 ok(actctx.wProcessorArchitecture == 0,
1082 "actctx.wProcessorArchitecture=%d\n", actctx.wProcessorArchitecture);
1083 ok(actctx.wLangId == 0, "actctx.wLangId=%d\n", actctx.wLangId);
1084 ok(actctx.lpAssemblyDirectory == NULL,
1085 "actctx.lpAssemblyDirectory=%p\n", actctx.lpAssemblyDirectory);
1086 ok(actctx.lpResourceName == NULL, "actctx.lpResourceName=%p\n", actctx.lpResourceName);
1087 ok(actctx.lpApplicationName == NULL, "actctx.lpApplicationName=%p\n",
1088 actctx.lpApplicationName);
1089 ok(actctx.hModule == NULL, "actctx.hModule=%p\n", actctx.hModule);
1090
1091 return handle;
1092}
1093
1094static void test_create_and_fail(const char *manifest, const char *depmanifest, int todo, BOOL is_broken)
1095{
1096 ACTCTXW actctx;
1097 HANDLE handle;
1099
1100 MultiByteToWideChar( CP_ACP, 0, "bad.manifest", -1, path, MAX_PATH );
1101 memset(&actctx, 0, sizeof(ACTCTXW));
1102 actctx.cbSize = sizeof(ACTCTXW);
1103 actctx.lpSource = path;
1104
1105 create_manifest_file("bad.manifest", manifest, -1, "testdep.manifest", depmanifest);
1108 {
1109 if (is_broken)
1111 "Unexpected context handle %p.\n", handle);
1112 else
1113 ok(handle == INVALID_HANDLE_VALUE, "Unexpected context handle %p.\n", handle);
1114
1116 ok(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX, "Unexpected error %ld.\n", GetLastError());
1117 }
1119 DeleteFileA("bad.manifest");
1120 DeleteFileA("testdep.manifest");
1121}
1122
1123static void test_create_wide_and_fail(const char *manifest, BOOL fBOM)
1124{
1125 ACTCTXW actctx;
1126 HANDLE handle;
1128
1129 MultiByteToWideChar( CP_ACP, 0, "bad.manifest", -1, path, MAX_PATH );
1130 memset(&actctx, 0, sizeof(ACTCTXW));
1131 actctx.cbSize = sizeof(ACTCTXW);
1132 actctx.lpSource = path;
1133
1134 create_wide_manifest("bad.manifest", manifest, fBOM, FALSE);
1136 ok(handle == INVALID_HANDLE_VALUE, "handle != INVALID_HANDLE_VALUE\n");
1137 ok(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX, "GetLastError == %lu\n", GetLastError());
1138
1140 DeleteFileA("bad.manifest");
1141}
1142
1143static void test_create_fail(void)
1144{
1145 ACTCTXW actctx;
1146 HANDLE handle;
1148
1149 MultiByteToWideChar( CP_ACP, 0, "nonexistent.manifest", -1, path, MAX_PATH );
1150 memset(&actctx, 0, sizeof(ACTCTXW));
1151 actctx.cbSize = sizeof(ACTCTXW);
1152 actctx.lpSource = path;
1153
1155 ok(handle == INVALID_HANDLE_VALUE, "handle != INVALID_HANDLE_VALUE\n");
1156 ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError == %lu\n", GetLastError());
1157
1158 trace("wrong_manifest1\n");
1160 trace("wrong_manifest2\n");
1162 trace("wrong_manifest3\n");
1164 trace("wrong_manifest4\n");
1166 trace("wrong_manifest5\n");
1168 trace("wrong_manifest6\n");
1170 trace("wrong_manifest7\n");
1172 trace("wrong_manifest8\n");
1174 trace("wrong_manifest9\n");
1176 trace("wrong_manifest10\n");
1178 trace("wrong_manifest11\n");
1179 test_create_and_fail(wrong_manifest11, NULL, 1, TRUE /* w1064v1909 */);
1180 trace("UTF-16 manifest1 without BOM\n");
1182 trace("manifest2\n");
1184 trace("manifest2+depmanifest1\n");
1186}
1187
1188struct strsection_header
1189{
1190 DWORD magic;
1191 ULONG size;
1192 DWORD unk1[3];
1193 ULONG count;
1195 DWORD unk2[2];
1198};
1199
1201{
1208};
1209
1211{
1220};
1221
1223{
1228};
1229
1231{
1232 ULONG size;
1233 DWORD res;
1235 ULONG name_offset; /* versioned name offset */
1237 ULONG module_offset;/* container name offset */
1238};
1239
1241{
1244};
1245
1246struct dllredirect_data
1247{
1248 ULONG size;
1254};
1255
1256#define DLL_REDIRECT_PATH_INCLUDES_BASE_NAME 1
1257#define DLL_REDIRECT_PATH_OMITS_ASSEMBLY_ROOT 2
1258#define DLL_REDIRECT_PATH_EXPAND 4
1259#define DLL_REDIRECT_PATH_SYSTEM_DEFAULT_REDIRECTED_SYSTEM32_DLL 8
1260
1261struct tlibredirect_data
1262{
1263 ULONG size;
1264 DWORD res;
1267 LANGID langid;
1268 WORD flags;
1273};
1274
1276{
1277 ULONG size;
1280};
1281
1283{
1284 ACTCTX_SECTION_KEYED_DATA data;
1285 BOOL ret;
1286
1287 memset(&data, 0xfe, sizeof(data));
1288 data.cbSize = sizeof(data);
1289
1290 ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, libname, &data);
1291 ok_(__FILE__, line)(ret, "FindActCtxSectionStringW failed: %lu\n", GetLastError());
1292 if (!ret) return;
1293
1294 ok_(__FILE__, line)(data.cbSize == sizeof(data), "data.cbSize=%lu\n", data.cbSize);
1295 ok_(__FILE__, line)(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%lu\n", data.ulDataFormatVersion);
1296 ok_(__FILE__, line)(data.lpData != NULL, "data.lpData == NULL\n");
1297 ok_(__FILE__, line)(data.ulLength == offsetof( struct dllredirect_data, paths[0]), "data.ulLength=%lu\n", data.ulLength);
1298
1299 if (data.lpData)
1300 {
1301 struct dllredirect_data *dlldata = (struct dllredirect_data*)data.lpData;
1302 ok_(__FILE__, line)(dlldata->size == offsetof( struct dllredirect_data, paths[dlldata->paths_count]),
1303 "got wrong size %ld\n", dlldata->size);
1304 ok_(__FILE__, line)(dlldata->flags == DLL_REDIRECT_PATH_OMITS_ASSEMBLY_ROOT,
1305 "got wrong flags value %lx\n", dlldata->flags);
1306 ok_(__FILE__, line)(dlldata->total_len == 0, "got wrong total len value %ld\n", dlldata->total_len);
1307 ok_(__FILE__, line)(dlldata->paths_count == 0, "got wrong paths count value %ld\n", dlldata->paths_count);
1308 ok_(__FILE__, line)(dlldata->paths_offset == 0, "got wrong paths offset value %ld\n", dlldata->paths_offset);
1309 }
1310
1311 ok_(__FILE__, line)(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
1312 ok_(__FILE__, line)(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%lu\n",
1313 data.ulSectionGlobalDataLength);
1314 ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
1315 ok_(__FILE__, line)(data.ulSectionTotalLength > 0, "data.ulSectionTotalLength=%lu\n",
1316 data.ulSectionTotalLength);
1317 ok_(__FILE__, line)(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx);
1318 ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%lu, expected %lu\n",
1319 data.ulAssemblyRosterIndex, exid);
1320
1321 memset(&data, 0xfe, sizeof(data));
1322 data.cbSize = sizeof(data);
1323
1324 ret = FindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL,
1325 ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, libname, &data);
1326 ok_(__FILE__, line)(ret, "FindActCtxSectionStringW failed: %lu\n", GetLastError());
1327 if (!ret) return;
1328
1329 ok_(__FILE__, line)(data.cbSize == sizeof(data), "data.cbSize=%lu\n", data.cbSize);
1330 ok_(__FILE__, line)(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%lu\n", data.ulDataFormatVersion);
1331 ok_(__FILE__, line)(data.lpData != NULL, "data.lpData == NULL\n");
1332 ok_(__FILE__, line)(data.ulLength == 20, "data.ulLength=%lu\n", data.ulLength);
1333 ok_(__FILE__, line)(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
1334 ok_(__FILE__, line)(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%lu\n",
1335 data.ulSectionGlobalDataLength);
1336 ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
1337 ok_(__FILE__, line)(data.ulSectionTotalLength > 0, "data.ulSectionTotalLength=%lu\n",
1338 data.ulSectionTotalLength);
1339 ok_(__FILE__, line)(data.hActCtx == handle, "data.hActCtx=%p\n", data.hActCtx);
1340 ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%lu, expected %lu\n",
1341 data.ulAssemblyRosterIndex, exid);
1342
1344}
1345
1346static void test_find_window_class(HANDLE handle, LPCWSTR clsname, ULONG exid, int line)
1347{
1348 struct wndclass_redirect_data *wnddata;
1349 struct strsection_header *header;
1350 ACTCTX_SECTION_KEYED_DATA data;
1351 BOOL ret;
1352
1353 memset(&data, 0xfe, sizeof(data));
1354 data.cbSize = sizeof(data);
1355
1356 ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, clsname, &data);
1357 ok_(__FILE__, line)(ret, "FindActCtxSectionStringW failed: %lu, class %s\n", GetLastError(),
1358 wine_dbgstr_w(clsname));
1359 if (!ret) return;
1360
1361 header = (struct strsection_header*)data.lpSectionBase;
1362 wnddata = (struct wndclass_redirect_data*)data.lpData;
1363
1364 ok_(__FILE__, line)(header->magic == 0x64487353, "got wrong magic 0x%08lx\n", header->magic);
1365 ok_(__FILE__, line)(header->count > 0, "got count %ld\n", header->count);
1366 ok_(__FILE__, line)(data.cbSize == sizeof(data), "data.cbSize=%lu\n", data.cbSize);
1367 ok_(__FILE__, line)(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%lu\n", data.ulDataFormatVersion);
1368 ok_(__FILE__, line)(data.lpData != NULL, "data.lpData == NULL\n");
1369 ok_(__FILE__, line)(wnddata->size == sizeof(*wnddata), "got %ld for header size\n", wnddata->size);
1370 if (data.lpData && wnddata->size == sizeof(*wnddata))
1371 {
1372 static const WCHAR verW[] = {'6','.','5','.','4','.','3','!',0};
1373 WCHAR buff[50];
1374 WCHAR *ptr;
1375 ULONG len;
1376
1377 ok_(__FILE__, line)(wnddata->res == 0, "got reserved as %ld\n", wnddata->res);
1378 /* redirect class name (versioned or not) is stored just after header data */
1379 ok_(__FILE__, line)(wnddata->name_offset == wnddata->size, "got name offset as %ld\n", wnddata->name_offset);
1380 ok_(__FILE__, line)(wnddata->module_len > 0, "got module name length as %ld\n", wnddata->module_len);
1381
1382 /* expected versioned name */
1383 lstrcpyW(buff, verW);
1384 lstrcatW(buff, clsname);
1385 ptr = (WCHAR*)((BYTE*)wnddata + wnddata->name_offset);
1386 ok_(__FILE__, line)(!lstrcmpW(ptr, buff), "got wrong class name %s, expected %s\n", wine_dbgstr_w(ptr), wine_dbgstr_w(buff));
1387 ok_(__FILE__, line)(lstrlenW(ptr)*sizeof(WCHAR) == wnddata->name_len,
1388 "got wrong class name length %ld, expected %d\n", wnddata->name_len, lstrlenW(ptr));
1389
1390 /* data length is simply header length + string data length including nulls */
1391 len = wnddata->size + wnddata->name_len + wnddata->module_len + 2*sizeof(WCHAR);
1392 ok_(__FILE__, line)(data.ulLength == len, "got wrong data length %ld, expected %ld\n", data.ulLength, len);
1393
1394 if (data.ulSectionTotalLength > wnddata->module_offset)
1395 {
1396 WCHAR *modulename, *sectionptr;
1397
1398 /* just compare pointers */
1399 modulename = (WCHAR*)((BYTE*)wnddata + wnddata->size + wnddata->name_len + sizeof(WCHAR));
1400 sectionptr = (WCHAR*)((BYTE*)data.lpSectionBase + wnddata->module_offset);
1401 ok_(__FILE__, line)(modulename == sectionptr, "got wrong name offset %p, expected %p\n", sectionptr, modulename);
1402 }
1403 }
1404
1405 ok_(__FILE__, line)(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
1406 ok_(__FILE__, line)(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%lu\n",
1407 data.ulSectionGlobalDataLength);
1408 ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
1409 ok_(__FILE__, line)(data.ulSectionTotalLength > 0, "data.ulSectionTotalLength=%lu\n",
1410 data.ulSectionTotalLength);
1411 ok_(__FILE__, line)(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx);
1412 ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%lu, expected %lu\n",
1413 data.ulAssemblyRosterIndex, exid);
1414
1415 memset(&data, 0xfe, sizeof(data));
1416 data.cbSize = sizeof(data);
1417
1418 ret = FindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL,
1419 ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, clsname, &data);
1420 ok_(__FILE__, line)(ret, "FindActCtxSectionStringW failed: %lu, class %s\n", GetLastError(),
1421 wine_dbgstr_w(clsname));
1422 if (!ret) return;
1423
1424 ok_(__FILE__, line)(data.cbSize == sizeof(data), "data.cbSize=%lu\n", data.cbSize);
1425 ok_(__FILE__, line)(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%lu\n", data.ulDataFormatVersion);
1426 ok_(__FILE__, line)(data.lpData != NULL, "data.lpData == NULL\n");
1427 ok_(__FILE__, line)(data.ulLength > 0, "data.ulLength=%lu\n", data.ulLength);
1428 ok_(__FILE__, line)(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
1429 ok_(__FILE__, line)(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%lu\n",
1430 data.ulSectionGlobalDataLength);
1431 ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
1432 ok_(__FILE__, line)(data.ulSectionTotalLength > 0, "data.ulSectionTotalLength=%lu\n", data.ulSectionTotalLength);
1433 ok_(__FILE__, line)(data.hActCtx == handle, "data.hActCtx=%p\n", data.hActCtx);
1434 ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%lu, expected %lu\n",
1435 data.ulAssemblyRosterIndex, exid);
1436
1438}
1439
1441{
1445};
1446
1448{
1454};
1455
1456static void test_find_activatable_class(HANDLE handle, const WCHAR *classid, enum winrt_threading_model threading_model,
1457 const WCHAR *file, ULONG exid, int line)
1458{
1459 struct activatable_class_data *activatable_class;
1460 struct strsection_header *header;
1461 ACTCTX_SECTION_KEYED_DATA data;
1462 void *ptr;
1463 BOOL ret;
1464
1465 memset(&data, 0xfe, sizeof(data));
1466 data.cbSize = sizeof(data);
1467
1468 ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_WINRT_ACTIVATABLE_CLASSES, classid, &data);
1469 ok_(__FILE__, line)(ret || broken(!ret) /* <= Win10 v1809 */, "FindActCtxSectionStringW failed, error %lu\n", GetLastError());
1470 if (!ret)
1471 {
1472 ok_(__FILE__, line)(GetLastError() == ERROR_SXS_SECTION_NOT_FOUND, "got error %lu\n", GetLastError());
1473 return;
1474 }
1475
1476 ok_(__FILE__, line)(data.cbSize == sizeof(data), "got cbSize %lu\n", data.cbSize);
1477 ok_(__FILE__, line)(data.ulDataFormatVersion == 1, "got ulDataFormatVersion %lu\n", data.ulDataFormatVersion);
1478 ok_(__FILE__, line)(data.lpData != NULL, "got lpData %p\n", data.lpData);
1479
1480 header = (struct strsection_header *)data.lpSectionBase;
1481 ok_(__FILE__, line)(data.lpSectionBase != NULL, "got lpSectionBase %p\n", data.lpSectionBase);
1482 ok_(__FILE__, line)(header->magic == 0x64487353, "got wrong magic 0x%08lx\n", header->magic);
1483 ok_(__FILE__, line)(data.ulSectionTotalLength > 0, "got ulSectionTotalLength %lu\n", data.ulSectionTotalLength);
1484 ok_(__FILE__, line)(data.lpSectionGlobalData == (BYTE *)header + header->global_offset,
1485 "got lpSectionGlobalData %p\n", data.lpSectionGlobalData);
1486 ok_(__FILE__, line)(data.ulSectionGlobalDataLength == header->global_len,
1487 "got ulSectionGlobalDataLength %lu\n", data.ulSectionGlobalDataLength);
1488 ok_(__FILE__, line)(data.hActCtx == NULL, "got hActCtx %p\n", data.hActCtx);
1489 ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "got ulAssemblyRosterIndex %lu\n", data.ulAssemblyRosterIndex);
1490
1491 activatable_class = (struct activatable_class_data *)data.lpData;
1492 ok_(__FILE__, line)(activatable_class->size == sizeof(*activatable_class), "got size %lu\n",
1493 activatable_class->size);
1494 ok_(__FILE__, line)(activatable_class->threading_model == threading_model, "got threading_model %lu\n",
1495 activatable_class->threading_model);
1496
1497 ptr = (BYTE *)header + activatable_class->module_offset;
1498 ok_(__FILE__, line)(wcslen(ptr) * sizeof(WCHAR) == activatable_class->module_len,
1499 "got module_len %lu\n", activatable_class->module_len);
1500 ok_(__FILE__, line)(!wcscmp(ptr, file), "got data.lpSectionGlobalData %s\n", debugstr_w(ptr));
1501}
1502
1503static void test_find_string_fail(void)
1504{
1505 ACTCTX_SECTION_KEYED_DATA data = {sizeof(data)};
1506 BOOL ret;
1507
1509 ok(!ret, "FindActCtxSectionStringW succeeded\n");
1510 ok(GetLastError() == ERROR_SXS_SECTION_NOT_FOUND, "GetLastError()=%lu\n", GetLastError());
1511
1512 ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, testlib2_dll, &data);
1513 ok(!ret, "FindActCtxSectionStringW succeeded\n");
1514 ok(GetLastError() == ERROR_SXS_KEY_NOT_FOUND, "GetLastError()=%lu\n", GetLastError());
1515
1516 ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, testlib_dll, NULL);
1517 ok(!ret, "FindActCtxSectionStringW succeeded\n");
1518 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()=%lu\n", GetLastError());
1519
1520 ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, NULL, &data);
1521 ok(!ret, "FindActCtxSectionStringW succeeded\n");
1522 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()=%lu\n", GetLastError());
1523
1524 data.cbSize = 0;
1525 ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, testlib_dll, &data);
1526 ok(!ret, "FindActCtxSectionStringW succeeded\n");
1527 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()=%lu\n", GetLastError());
1528
1529 data.cbSize = 35;
1530 ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, testlib_dll, &data);
1531 ok(!ret, "FindActCtxSectionStringW succeeded\n");
1532 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()=%lu\n", GetLastError());
1533}
1534
1535
1537{
1538 ACTIVATION_CONTEXT_BASIC_INFORMATION basic;
1539 SIZE_T size;
1540 BOOL b;
1541
1542 b = QueryActCtxW(QUERY_ACTCTX_FLAG_NO_ADDREF, handle, NULL, ActivationContextBasicInformation, &basic,
1543 sizeof(basic), &size);
1544
1545 ok_(__FILE__, line) (b,"ActivationContextBasicInformation failed\n");
1546 ok_(__FILE__, line) (size == sizeof(ACTIVATION_CONTEXT_BASIC_INFORMATION),"size mismatch\n");
1547 ok_(__FILE__, line) (basic.dwFlags == 0, "unexpected flags %lx\n",basic.dwFlags);
1548 ok_(__FILE__, line) (basic.hActCtx == handle, "unexpected handle\n");
1549
1550 b = QueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX | QUERY_ACTCTX_FLAG_NO_ADDREF, handle, NULL,
1551 ActivationContextBasicInformation, &basic,
1552 sizeof(basic), &size);
1553 if (handle)
1554 {
1555 ok_(__FILE__, line) (!b,"ActivationContextBasicInformation succeeded\n");
1556 ok_(__FILE__, line) (size == 0,"size mismatch\n");
1557 ok_(__FILE__, line) (GetLastError() == ERROR_INVALID_PARAMETER, "Wrong last error\n");
1558 ok_(__FILE__, line) (basic.dwFlags == 0, "unexpected flags %lx\n",basic.dwFlags);
1559 ok_(__FILE__, line) (basic.hActCtx == handle, "unexpected handle\n");
1560 }
1561 else
1562 {
1563 ok_(__FILE__, line) (b,"ActivationContextBasicInformation failed\n");
1564 ok_(__FILE__, line) (size == sizeof(ACTIVATION_CONTEXT_BASIC_INFORMATION),"size mismatch\n");
1565 ok_(__FILE__, line) (basic.dwFlags == 0, "unexpected flags %lx\n",basic.dwFlags);
1566 ok_(__FILE__, line) (basic.hActCtx == handle, "unexpected handle\n");
1567 }
1568}
1569
1577
1585
1586struct comclassredirect_data {
1587 ULONG size;
1589 DWORD model;
1590 GUID clsid;
1591 GUID alias;
1592 GUID clsid2;
1605};
1606
1607struct clrclass_data {
1608 ULONG size;
1609 DWORD res[2];
1616 DWORD res2[2];
1617};
1618
1619static void validate_guid_index(const ACTCTX_SECTION_KEYED_DATA *data, int line)
1620{
1621#define GUIDSECTION_MAGIC 0x64487347 /* dHsG */
1622 struct guidsection_header *header;
1623 struct guid_index *index;
1624 unsigned int i;
1625
1626 header = (struct guidsection_header *)data->lpSectionBase;
1627
1628 ok_(__FILE__, line)(header->magic == GUIDSECTION_MAGIC, "Unexpected magic %#lx.\n", header->magic);
1629 ok_(__FILE__, line)(header->size == sizeof(*header), "Unexpected size %ld.\n", header->size);
1630 ok_(__FILE__, line)(header->index_offset >= sizeof(*header), "Unexpected index offset %lu.\n", header->index_offset);
1631
1632 index = (struct guid_index *)((BYTE *)data->lpSectionBase + header->index_offset);
1633 for (i = 0; i < header->count; ++i)
1634 {
1635 ok_(__FILE__, line)(index[i].data_len <= data->ulSectionTotalLength, "Unexpected data length.\n");
1636 ok_(__FILE__, line)(index[i].data_offset <= data->ulSectionTotalLength - index[i].data_len,
1637 "Unexpected data offset %ld, section total length %lu, data length %lu.\n",
1638 index[i].data_offset, data->ulSectionTotalLength, index[i].data_len);
1639 }
1640}
1641
1642static void test_find_com_redirection(HANDLE handle, const GUID *clsid, const GUID *tlid, const WCHAR *progid, ULONG exid, int line)
1643{
1644 struct comclassredirect_data *comclass, *comclass2;
1645 ACTCTX_SECTION_KEYED_DATA data, data2;
1646 struct guidsection_header *header;
1647 BOOL ret;
1648
1649 memset(&data, 0xfe, sizeof(data));
1650 data.cbSize = sizeof(data);
1651
1652 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, clsid, &data);
1653 if (!ret)
1654 {
1655 skip("failed for guid %s\n", wine_dbgstr_guid(clsid));
1656 return;
1657 }
1658 ok_(__FILE__, line)(ret, "FindActCtxSectionGuid failed: %lu\n", GetLastError());
1659
1660 comclass = (struct comclassredirect_data*)data.lpData;
1661
1662 ok_(__FILE__, line)(data.cbSize == sizeof(data), "data.cbSize=%lu\n", data.cbSize);
1663 ok_(__FILE__, line)(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%lu\n", data.ulDataFormatVersion);
1664 ok_(__FILE__, line)(data.lpData != NULL, "data.lpData == NULL\n");
1665 ok_(__FILE__, line)(comclass->size == sizeof(*comclass), "got %ld for header size\n", comclass->size);
1666 if (data.lpData && comclass->size == sizeof(*comclass))
1667 {
1669 WCHAR *ptr;
1670
1671 ok_(__FILE__, line)(comclass->model == ThreadingModel_Neutral, "got model %ld\n", comclass->model);
1672 ok_(__FILE__, line)(IsEqualGUID(&comclass->clsid, clsid), "got wrong clsid %s\n", wine_dbgstr_guid(&comclass->clsid));
1673 ok_(__FILE__, line)(IsEqualGUID(&comclass->clsid2, clsid), "got wrong clsid2 %s\n", wine_dbgstr_guid(&comclass->clsid2));
1674 if (tlid)
1675 ok_(__FILE__, line)(IsEqualGUID(&comclass->tlid, tlid), "got wrong tlid %s\n", wine_dbgstr_guid(&comclass->tlid));
1676 ok_(__FILE__, line)(comclass->name_len > 0, "got modulename len %ld\n", comclass->name_len);
1677
1678 if (progid)
1679 {
1680 len = comclass->size + comclass->clrdata_len;
1681 ok_(__FILE__, line)(comclass->progid_offset == len, "got progid offset %ld, expected %ld\n", comclass->progid_offset, len);
1682 }
1683 else
1684 ok_(__FILE__, line)(comclass->progid_offset == 0, "got progid offset %ld, expected 0\n", comclass->progid_offset);
1685
1686 if (comclass->progid_offset)
1687 {
1688 ptr = (WCHAR*)((BYTE*)comclass + comclass->progid_offset);
1689 ok_(__FILE__, line)(!lstrcmpW(ptr, progid), "got wrong progid %s, expected %s\n", wine_dbgstr_w(ptr), wine_dbgstr_w(progid));
1690 ok_(__FILE__, line)(lstrlenW(progid)*sizeof(WCHAR) == comclass->progid_len,
1691 "got progid name length %ld\n", comclass->progid_len);
1692 }
1693
1694 /* data length is simply header length + string data length including nulls */
1695 len = comclass->size + comclass->clrdata_len;
1696 if (comclass->progid_len) len += comclass->progid_len + sizeof(WCHAR);
1697 ok_(__FILE__, line)(data.ulLength == len, "got wrong data length %ld, expected %ld\n", data.ulLength, len);
1698
1699 /* keyed data structure doesn't include module name, it's available from section data */
1700 ok_(__FILE__, line)(data.ulSectionTotalLength > comclass->name_offset, "got wrong offset %ld\n", comclass->name_offset);
1701
1702 /* check misc fields are set */
1703 miscmask = (comclass->flags >> 8) & 0xff;
1704 if (miscmask)
1705 {
1706 if (miscmask & MiscStatus)
1707 ok_(__FILE__, line)(comclass->miscstatus != 0, "got miscstatus 0x%08lx\n", comclass->miscstatus);
1709 ok_(__FILE__, line)(comclass->miscstatusicon != 0, "got miscstatusicon 0x%08lx\n", comclass->miscstatusicon);
1711 ok_(__FILE__, line)(comclass->miscstatuscontent != 0, "got miscstatuscontent 0x%08lx\n", comclass->miscstatuscontent);
1713 ok_(__FILE__, line)(comclass->miscstatusthumbnail != 0, "got miscstatusthumbnail 0x%08lx\n", comclass->miscstatusthumbnail);
1715 ok_(__FILE__, line)(comclass->miscstatusdocprint != 0, "got miscstatusdocprint 0x%08lx\n", comclass->miscstatusdocprint);
1716 }
1717 ok_(__FILE__, line)(!(comclass->flags & 0xffff00ff), "Unexpected flags %#lx.\n", comclass->flags);
1718
1719 /* part used for clrClass only */
1720 if (comclass->clrdata_len)
1721 {
1722 static const WCHAR mscoreeW[] = {'M','S','C','O','R','E','E','.','D','L','L',0};
1723 static const WCHAR mscoree2W[] = {'m','s','c','o','r','e','e','.','d','l','l',0};
1724 struct clrclass_data *clrclass;
1725 WCHAR *ptrW;
1726
1727 clrclass = (struct clrclass_data*)((BYTE*)data.lpData + comclass->clrdata_offset);
1728 ok_(__FILE__, line)(clrclass->size == sizeof(*clrclass), "clrclass: got size %ld\n", clrclass->size);
1729 ok_(__FILE__, line)(clrclass->res[0] == 0, "clrclass: got res[0]=0x%08lx\n", clrclass->res[0]);
1730 ok_(__FILE__, line)(clrclass->res[1] == 2, "clrclass: got res[1]=0x%08lx\n", clrclass->res[1]);
1731 ok_(__FILE__, line)(clrclass->module_len == lstrlenW(mscoreeW)*sizeof(WCHAR), "clrclass: got module len %ld\n", clrclass->module_len);
1732 ok_(__FILE__, line)(clrclass->module_offset > 0, "clrclass: got module offset %ld\n", clrclass->module_offset);
1733
1734 ok_(__FILE__, line)(clrclass->name_len > 0, "clrclass: got name len %ld\n", clrclass->name_len);
1735 ok_(__FILE__, line)(clrclass->name_offset == clrclass->size, "clrclass: got name offset %ld\n", clrclass->name_offset);
1736 ok_(__FILE__, line)(clrclass->version_len > 0, "clrclass: got version len %ld\n", clrclass->version_len);
1737 ok_(__FILE__, line)(clrclass->version_offset > 0, "clrclass: got version offset %ld\n", clrclass->version_offset);
1738
1739 ok_(__FILE__, line)(clrclass->res2[0] == 0, "clrclass: got res2[0]=0x%08lx\n", clrclass->res2[0]);
1740 ok_(__FILE__, line)(clrclass->res2[1] == 0, "clrclass: got res2[1]=0x%08lx\n", clrclass->res2[1]);
1741
1742 /* clrClass uses mscoree.dll as module name, but in two variants - comclass data points to module name
1743 in lower case, clsclass subsection - in upper case */
1744 ok_(__FILE__, line)(comclass->name_len == lstrlenW(mscoree2W)*sizeof(WCHAR), "clrclass: got com name len %ld\n", comclass->name_len);
1745 ok_(__FILE__, line)(comclass->name_offset > 0, "clrclass: got name offset %ld\n", clrclass->name_offset);
1746
1747 ptrW = (WCHAR*)((BYTE*)data.lpSectionBase + comclass->name_offset);
1748 ok_(__FILE__, line)(!lstrcmpW(ptrW, mscoreeW), "clrclass: module name %s\n", wine_dbgstr_w(ptrW));
1749
1750 ptrW = (WCHAR*)((BYTE*)data.lpSectionBase + clrclass->module_offset);
1751 ok_(__FILE__, line)(!lstrcmpW(ptrW, mscoree2W), "clrclass: module name2 %s\n", wine_dbgstr_w(ptrW));
1752 }
1753 }
1754
1755 header = (struct guidsection_header*)data.lpSectionBase;
1756 ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
1757 ok_(__FILE__, line)(data.lpSectionGlobalData == ((BYTE*)header + header->names_offset), "data.lpSectionGlobalData == NULL\n");
1758 ok_(__FILE__, line)(data.ulSectionGlobalDataLength == header->names_len, "data.ulSectionGlobalDataLength=%lu\n",
1759 data.ulSectionGlobalDataLength);
1760 ok_(__FILE__, line)(data.ulSectionTotalLength > 0, "data.ulSectionTotalLength=%lu\n",
1761 data.ulSectionTotalLength);
1762 ok_(__FILE__, line)(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx);
1763 ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%lu, expected %lu\n",
1764 data.ulAssemblyRosterIndex, exid);
1766
1767 /* generated guid for this class works as key guid in search */
1768 memset(&data2, 0xfe, sizeof(data2));
1769 data2.cbSize = sizeof(data2);
1770 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &comclass->alias, &data2);
1771 ok_(__FILE__, line)(ret, "FindActCtxSectionGuid failed: %lu\n", GetLastError());
1772
1773 comclass2 = (struct comclassredirect_data*)data2.lpData;
1774 ok_(__FILE__, line)(comclass->size == comclass2->size, "got wrong data length %ld, expected %ld\n", comclass2->size, comclass->size);
1775 ok_(__FILE__, line)(!memcmp(comclass, comclass2, comclass->size), "got wrong data\n");
1776}
1777
1779{
1781 BaseIface = 2
1783
1785{
1786 ULONG size;
1787 DWORD mask;
1788 GUID iid;
1790 GUID tlbid;
1791 GUID base;
1794};
1795
1796static void test_find_ifaceps_redirection(HANDLE handle, const GUID *iid, const GUID *tlbid, const GUID *base,
1797 const GUID *ps32, ULONG exid, int line)
1798{
1799 struct ifacepsredirect_data *ifaceps;
1800 ACTCTX_SECTION_KEYED_DATA data;
1801 BOOL ret;
1802
1803 memset(&data, 0xfe, sizeof(data));
1804 data.cbSize = sizeof(data);
1805
1806 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION, iid, &data);
1807 ok_(__FILE__, line)(ret, "FindActCtxSectionGuid failed: %lu\n", GetLastError());
1808
1809 ifaceps = (struct ifacepsredirect_data*)data.lpData;
1810
1811 ok_(__FILE__, line)(data.cbSize == sizeof(data), "data.cbSize=%lu\n", data.cbSize);
1812 ok_(__FILE__, line)(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%lu\n", data.ulDataFormatVersion);
1813 ok_(__FILE__, line)(data.lpData != NULL, "data.lpData == NULL\n");
1814 ok_(__FILE__, line)(ifaceps->size == sizeof(*ifaceps), "got %ld for header size\n", ifaceps->size);
1815 if (data.lpData && ifaceps->size == sizeof(*ifaceps))
1816 {
1817 ULONG len;
1818
1819 /* for external proxy stubs it contains a value from 'proxyStubClsid32' */
1820 if (ps32)
1821 {
1822 ok_(__FILE__, line)(IsEqualGUID(&ifaceps->iid, ps32), "got wrong iid %s\n", wine_dbgstr_guid(&ifaceps->iid));
1823 }
1824 else
1825 ok_(__FILE__, line)(IsEqualGUID(&ifaceps->iid, iid), "got wrong iid %s\n", wine_dbgstr_guid(&ifaceps->iid));
1826
1827 ok_(__FILE__, line)(IsEqualGUID(&ifaceps->tlbid, tlbid), "got wrong tlid %s\n", wine_dbgstr_guid(&ifaceps->tlbid));
1828 ok_(__FILE__, line)(ifaceps->name_len > 0, "got modulename len %ld\n", ifaceps->name_len);
1829 ok_(__FILE__, line)(ifaceps->name_offset == ifaceps->size, "got progid offset %ld\n", ifaceps->name_offset);
1830
1831 /* data length is simply header length + string data length including nulls */
1832 len = ifaceps->size + ifaceps->name_len + sizeof(WCHAR);
1833 ok_(__FILE__, line)(data.ulLength == len, "got wrong data length %ld, expected %ld\n", data.ulLength, len);
1834
1835 /* mask purpose is to indicate if attribute was specified, for testing purposes assume that manifest
1836 always has non-zero value for it */
1837 if (ifaceps->mask & NumMethods)
1838 ok_(__FILE__, line)(ifaceps->nummethods != 0, "got nummethods %ld\n", ifaceps->nummethods);
1839 if (ifaceps->mask & BaseIface)
1840 ok_(__FILE__, line)(IsEqualGUID(&ifaceps->base, base), "got base %s\n", wine_dbgstr_guid(&ifaceps->base));
1841 }
1842
1843 ok_(__FILE__, line)(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
1844 ok_(__FILE__, line)(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%lu\n",
1845 data.ulSectionGlobalDataLength);
1846 ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
1847 ok_(__FILE__, line)(data.ulSectionTotalLength > 0, "data.ulSectionTotalLength=%lu\n",
1848 data.ulSectionTotalLength);
1849 ok_(__FILE__, line)(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx);
1850 ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%lu, expected %lu\n",
1851 data.ulAssemblyRosterIndex, exid);
1852
1854}
1855
1857{
1865};
1866
1867static void test_find_surrogate(HANDLE handle, const GUID *clsid, const WCHAR *name, const WCHAR *version,
1868 ULONG exid, int line)
1869{
1870 struct clrsurrogate_data *surrogate;
1871 ACTCTX_SECTION_KEYED_DATA data;
1872 BOOL ret;
1873
1874#ifdef __REACTOS__
1875 if (is_reactos()) {
1876 ok(FALSE, "FIXME: This test crashes on ReactOS\n");
1877 return;
1878 }
1879#endif
1880 memset(&data, 0xfe, sizeof(data));
1881 data.cbSize = sizeof(data);
1882
1883 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES, clsid, &data);
1884 if (!ret)
1885 {
1886 skip("surrogate sections are not supported\n");
1887 return;
1888 }
1889 ok_(__FILE__, line)(ret, "FindActCtxSectionGuid failed: %lu\n", GetLastError());
1890
1891 surrogate = (struct clrsurrogate_data*)data.lpData;
1892
1893 ok_(__FILE__, line)(data.cbSize == sizeof(data), "data.cbSize=%lu\n", data.cbSize);
1894 ok_(__FILE__, line)(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%lu\n", data.ulDataFormatVersion);
1895 ok_(__FILE__, line)(data.lpData != NULL, "data.lpData == NULL\n");
1896 ok_(__FILE__, line)(surrogate->size == sizeof(*surrogate), "got %ld for header size\n", surrogate->size);
1897 if (data.lpData && surrogate->size == sizeof(*surrogate))
1898 {
1899 WCHAR *ptrW;
1900 ULONG len;
1901
1902 ok_(__FILE__, line)(surrogate->res == 0, "invalid res value %ld\n", surrogate->res);
1903 ok_(__FILE__, line)(IsEqualGUID(&surrogate->clsid, clsid), "got wrong clsid %s\n", wine_dbgstr_guid(&surrogate->clsid));
1904
1905 ok_(__FILE__, line)(surrogate->version_len == lstrlenW(version)*sizeof(WCHAR), "got version len %ld\n", surrogate->version_len);
1906 ok_(__FILE__, line)(surrogate->version_offset == surrogate->size, "got version offset %ld\n", surrogate->version_offset);
1907
1908 ok_(__FILE__, line)(surrogate->name_len == lstrlenW(name)*sizeof(WCHAR), "got name len %ld\n", surrogate->name_len);
1909 ok_(__FILE__, line)(surrogate->name_offset > surrogate->version_offset, "got name offset %ld\n", surrogate->name_offset);
1910
1911 len = surrogate->size + surrogate->name_len + surrogate->version_len + 2*sizeof(WCHAR);
1912 ok_(__FILE__, line)(data.ulLength == len, "got wrong data length %ld, expected %ld\n", data.ulLength, len);
1913
1914 ptrW = (WCHAR*)((BYTE*)surrogate + surrogate->name_offset);
1915 ok(!lstrcmpW(ptrW, name), "got wrong name %s\n", wine_dbgstr_w(ptrW));
1916
1917 ptrW = (WCHAR*)((BYTE*)surrogate + surrogate->version_offset);
1918 ok(!lstrcmpW(ptrW, version), "got wrong name %s\n", wine_dbgstr_w(ptrW));
1919 }
1920
1921 ok_(__FILE__, line)(data.lpSectionGlobalData == NULL, "data.lpSectionGlobalData != NULL\n");
1922 ok_(__FILE__, line)(data.ulSectionGlobalDataLength == 0, "data.ulSectionGlobalDataLength=%lu\n",
1923 data.ulSectionGlobalDataLength);
1924 ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
1925 ok_(__FILE__, line)(data.ulSectionTotalLength > 0, "data.ulSectionTotalLength=%lu\n",
1926 data.ulSectionTotalLength);
1927 ok_(__FILE__, line)(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx);
1928 ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%lu, expected %lu\n",
1929 data.ulAssemblyRosterIndex, exid);
1930
1932}
1933
1934static void test_find_progid_redirection(HANDLE handle, const GUID *clsid, const char *progid, ULONG exid, int line)
1935{
1936 struct progidredirect_data *progiddata;
1937 struct comclassredirect_data *comclass;
1938 ACTCTX_SECTION_KEYED_DATA data, data2;
1939 struct strsection_header *header;
1940 BOOL ret;
1941
1942#if defined(__REACTOS__) && defined(_MSC_VER)
1943 if (is_reactos()) {
1944 ok(FALSE, "FIXME: This crashes on MSVC ReactOS\n");
1945 return;
1946 }
1947#endif
1948 memset(&data, 0xfe, sizeof(data));
1949 data.cbSize = sizeof(data);
1950
1951 ret = FindActCtxSectionStringA(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION, progid, &data);
1952 ok_(__FILE__, line)(ret, "FindActCtxSectionStringA failed: %lu\n", GetLastError());
1953
1954 progiddata = (struct progidredirect_data*)data.lpData;
1955
1956 ok_(__FILE__, line)(data.cbSize == sizeof(data), "data.cbSize=%lu\n", data.cbSize);
1957 ok_(__FILE__, line)(data.ulDataFormatVersion == 1, "data.ulDataFormatVersion=%lu\n", data.ulDataFormatVersion);
1958 ok_(__FILE__, line)(data.lpData != NULL, "data.lpData == NULL\n");
1959 ok_(__FILE__, line)(progiddata->size == sizeof(*progiddata), "got %ld for header size\n", progiddata->size);
1960 if (data.lpData && progiddata->size == sizeof(*progiddata))
1961 {
1962 GUID *guid;
1963
1964 ok_(__FILE__, line)(progiddata->reserved == 0, "got reserved as %ld\n", progiddata->reserved);
1965 ok_(__FILE__, line)(progiddata->clsid_offset > 0, "got clsid_offset as %ld\n", progiddata->clsid_offset);
1966
1967 /* progid data points to generated alias guid */
1968 guid = (GUID*)((BYTE*)data.lpSectionBase + progiddata->clsid_offset);
1969
1970 memset(&data2, 0, sizeof(data2));
1971 data2.cbSize = sizeof(data2);
1972 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, guid, &data2);
1973 ok_(__FILE__, line)(ret, "FindActCtxSectionGuid failed: %lu\n", GetLastError());
1974
1975 comclass = (struct comclassredirect_data*)data2.lpData;
1976 ok_(__FILE__, line)(IsEqualGUID(guid, &comclass->alias), "got wrong alias referenced from progid %s, %s\n", progid, wine_dbgstr_guid(guid));
1977 ok_(__FILE__, line)(IsEqualGUID(clsid, &comclass->clsid), "got wrong class referenced from progid %s, %s\n", progid, wine_dbgstr_guid(clsid));
1978
1980 }
1981
1982 header = (struct strsection_header*)data.lpSectionBase;
1983 ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n");
1984 ok_(__FILE__, line)(data.lpSectionGlobalData == (BYTE*)header + header->global_offset, "data.lpSectionGlobalData == NULL\n");
1985 ok_(__FILE__, line)(data.ulSectionGlobalDataLength == header->global_len, "data.ulSectionGlobalDataLength=%lu\n", data.ulSectionGlobalDataLength);
1986 ok_(__FILE__, line)(data.ulSectionTotalLength > 0, "data.ulSectionTotalLength=%lu\n", data.ulSectionTotalLength);
1987 ok_(__FILE__, line)(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx);
1988 ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%lu, expected %lu\n",
1989 data.ulAssemblyRosterIndex, exid);
1990}
1991
1992static void test_wndclass_section(void)
1993{
1994 static const WCHAR cls1W[] = {'1','.','2','.','3','.','4','!','w','n','d','C','l','a','s','s','1',0};
1995 ACTCTX_SECTION_KEYED_DATA data, data2;
1996 struct wndclass_redirect_data *classdata;
1997 struct strsection_header *section;
1999 HANDLE handle;
2000 WCHAR *ptrW;
2001 BOOL ret;
2002
2003 /* use two dependent manifests, each defines 2 window class redirects */
2004 create_manifest_file("testdep1.manifest", manifest_wndcls1, -1, NULL, NULL);
2005 create_manifest_file("testdep2.manifest", manifest_wndcls2, -1, NULL, NULL);
2006 create_manifest_file("main_wndcls.manifest", manifest_wndcls_main, -1, NULL, NULL);
2007
2008 handle = test_create("main_wndcls.manifest");
2009 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2010
2011 DeleteFileA("testdep1.manifest");
2012 DeleteFileA("testdep2.manifest");
2013 DeleteFileA("main_wndcls.manifest");
2014
2016 ok(ret, "ActivateActCtx failed: %lu\n", GetLastError());
2017
2018 memset(&data, 0, sizeof(data));
2019 memset(&data2, 0, sizeof(data2));
2020 data.cbSize = sizeof(data);
2021 data2.cbSize = sizeof(data2);
2022
2023 /* get data for two classes from different assemblies */
2024 ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, wndClass1W, &data);
2025 ok(ret, "got %d\n", ret);
2026 ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, wndClass3W, &data2);
2027 ok(ret, "got %d\n", ret);
2028
2029 section = (struct strsection_header*)data.lpSectionBase;
2030 ok(section->count == 4, "got %ld\n", section->count);
2031 ok(section->size == sizeof(*section), "got %ld\n", section->size);
2032
2033 /* For both string same section is returned, meaning it's one wndclass section per context */
2034 ok(data.lpSectionBase == data2.lpSectionBase, "got %p, %p\n", data.lpSectionBase, data2.lpSectionBase);
2035 ok(data.ulSectionTotalLength == data2.ulSectionTotalLength, "got %lu, %lu\n", data.ulSectionTotalLength,
2036 data2.ulSectionTotalLength);
2037
2038 /* wndClass1 is versioned, wndClass3 is not */
2039 classdata = (struct wndclass_redirect_data*)data.lpData;
2040 ptrW = (WCHAR*)((BYTE*)data.lpData + classdata->name_offset);
2041 ok(!lstrcmpW(ptrW, cls1W), "got %s\n", wine_dbgstr_w(ptrW));
2042
2043 classdata = (struct wndclass_redirect_data*)data2.lpData;
2044 ptrW = (WCHAR*)((BYTE*)data2.lpData + classdata->name_offset);
2045 ok(!lstrcmpW(ptrW, wndClass3W), "got %s\n", wine_dbgstr_w(ptrW));
2046
2048 ok(ret, "DeactivateActCtx failed: %lu\n", GetLastError());
2049
2051}
2052
2054{
2055 static const WCHAR testlib1W[] = {'t','e','s','t','l','i','b','1','.','d','l','l',0};
2056 static const WCHAR testlib2W[] = {'t','e','s','t','l','i','b','2','.','d','l','l',0};
2057 ACTCTX_SECTION_KEYED_DATA data, data2;
2058 struct strsection_header *section;
2060 HANDLE handle;
2061 BOOL ret;
2062
2063 /* use two dependent manifests, 4 'files' total */
2064 create_manifest_file("testdep1.manifest", manifest_wndcls1, -1, NULL, NULL);
2065 create_manifest_file("testdep2.manifest", manifest_wndcls2, -1, NULL, NULL);
2066 create_manifest_file("main_wndcls.manifest", manifest_wndcls_main, -1, NULL, NULL);
2067
2068 handle = test_create("main_wndcls.manifest");
2069 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2070
2071 DeleteFileA("testdep1.manifest");
2072 DeleteFileA("testdep2.manifest");
2073 DeleteFileA("main_wndcls.manifest");
2074
2076 ok(ret, "ActivateActCtx failed: %lu\n", GetLastError());
2077
2078 memset(&data, 0, sizeof(data));
2079 memset(&data2, 0, sizeof(data2));
2080 data.cbSize = sizeof(data);
2081 data2.cbSize = sizeof(data2);
2082
2083 /* get data for two files from different assemblies */
2084 ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, testlib1W, &data);
2085 ok(ret, "got %d\n", ret);
2086 ret = FindActCtxSectionStringW(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, testlib2W, &data2);
2087 ok(ret, "got %d\n", ret);
2088
2089 section = (struct strsection_header*)data.lpSectionBase;
2090 ok(section->count == 4, "got %ld\n", section->count);
2091 ok(section->size == sizeof(*section), "got %ld\n", section->size);
2092
2093 /* For both string same section is returned, meaning it's one dll redirect section per context */
2094 ok(data.lpSectionBase == data2.lpSectionBase, "got %p, %p\n", data.lpSectionBase, data2.lpSectionBase);
2095 ok(data.ulSectionTotalLength == data2.ulSectionTotalLength, "got %lu, %lu\n", data.ulSectionTotalLength,
2096 data2.ulSectionTotalLength);
2097
2099 ok(ret, "DeactivateActCtx failed: %lu\n", GetLastError());
2100
2102}
2103
2104static void test_typelib_section(void)
2105{
2106 static const WCHAR helpW[] = {'h','e','l','p'};
2107 ACTCTX_SECTION_KEYED_DATA data, data2;
2109 struct tlibredirect_data *tlib;
2111 HANDLE handle;
2112 BOOL ret;
2113
2114 /* use two dependent manifests, 4 'files' total */
2115 create_manifest_file("testdep1.manifest", manifest_wndcls1, -1, NULL, NULL);
2116 create_manifest_file("testdep2.manifest", manifest_wndcls2, -1, NULL, NULL);
2117 create_manifest_file("main_wndcls.manifest", manifest_wndcls_main, -1, NULL, NULL);
2118
2119 handle = test_create("main_wndcls.manifest");
2120 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2121
2122 DeleteFileA("testdep1.manifest");
2123 DeleteFileA("testdep2.manifest");
2124 DeleteFileA("main_wndcls.manifest");
2125
2127 ok(ret, "ActivateActCtx failed: %lu\n", GetLastError());
2128
2129 memset(&data, 0, sizeof(data));
2130 memset(&data2, 0, sizeof(data2));
2131 data.cbSize = sizeof(data);
2132 data2.cbSize = sizeof(data2);
2133
2134 /* get data for two typelibs from different assemblies */
2135 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION, &IID_TlibTest, &data);
2136 ok(ret, "got %d\n", ret);
2137
2138 ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION,
2139 &IID_TlibTest4, &data2);
2140 ok(ret, "got %d\n", ret);
2141
2142 section = (struct guidsection_header*)data.lpSectionBase;
2143 ok(section->count == 4, "got %ld\n", section->count);
2144 ok(section->size == sizeof(*section), "got %ld\n", section->size);
2145 validate_guid_index(&data, __LINE__);
2146
2147 /* For both GUIDs same section is returned */
2148 ok(data.lpSectionBase == data2.lpSectionBase, "got %p, %p\n", data.lpSectionBase, data2.lpSectionBase);
2149 ok(data.ulSectionTotalLength == data2.ulSectionTotalLength, "got %lu, %lu\n", data.ulSectionTotalLength,
2150 data2.ulSectionTotalLength);
2151
2152 ok(data.lpSectionGlobalData == ((BYTE*)section + section->names_offset), "data.lpSectionGlobalData == NULL\n");
2153 ok(data.ulSectionGlobalDataLength == section->names_len, "data.ulSectionGlobalDataLength=%lu\n",
2154 data.ulSectionGlobalDataLength);
2155
2156 /* test some actual data */
2157 tlib = (struct tlibredirect_data*)data.lpData;
2158 ok(tlib->size == sizeof(*tlib), "got %ld\n", tlib->size);
2159 ok(tlib->major_version == 1, "got %d\n", tlib->major_version);
2160 ok(tlib->minor_version == 0, "got %d\n", tlib->minor_version);
2161 ok(tlib->help_offset > 0, "got %ld\n", tlib->help_offset);
2162 ok(tlib->help_len == sizeof(helpW), "got %ld\n", tlib->help_len);
2163 ok(tlib->flags == (LIBFLAG_FHIDDEN|LIBFLAG_FCONTROL|LIBFLAG_FRESTRICTED), "got %x\n", tlib->flags);
2164
2166 ok(ret, "DeactivateActCtx failed: %lu\n", GetLastError());
2167
2169}
2170
2172{
2173 HANDLE handle;
2174
2175 if (!create_manifest_file("test5.manifest", manifest5, -1, NULL, NULL)) {
2176 skip("Could not create manifest file\n");
2177 return;
2178 }
2179
2180 handle = test_create("test5.manifest");
2182 win_skip("allowDelayedBinding attribute is not supported.\n");
2183 return;
2184 }
2185
2186 DeleteFileA("test5.manifest");
2187 DeleteFileA("testdep.manifest");
2189 test_basic_info(handle, __LINE__);
2191 }
2192}
2193
2194static void test_actctx(void)
2195{
2197 HANDLE handle;
2198 BOOL b;
2199
2200 trace("default actctx\n");
2201
2203 ok(handle == NULL, "handle = %p, expected NULL\n", handle);
2204 ok(b, "GetCurrentActCtx failed: %lu\n", GetLastError());
2205 if(b) {
2206 test_basic_info(handle, __LINE__);
2210 }
2211
2212 /* test for whitespace handling in Eq ::= S? '=' S? */
2213 create_manifest_file("test1_1.manifest", manifest1_1, -1, NULL, NULL);
2214 handle = test_create("test1_1.manifest");
2215 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2216 DeleteFileA("test1_1.manifest");
2218
2219 if(!create_manifest_file("test1.manifest", manifest1, -1, NULL, NULL)) {
2220 skip("Could not create manifest file\n");
2221 return;
2222 }
2223
2224 trace("manifest1\n");
2225
2226 handle = test_create("test1.manifest");
2227 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2228 DeleteFileA("test1.manifest");
2230 test_basic_info(handle, __LINE__);
2233
2234 if (!IsDebuggerPresent())
2235 {
2236 /* CloseHandle will generate an exception if a debugger is present */
2237 b = CloseHandle(handle);
2238 ok(!b, "CloseHandle succeeded\n");
2239 ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() == %lu\n", GetLastError());
2240 }
2241
2243 }
2244
2245 if(!create_manifest_file("test2.manifest", manifest2, -1, "testdep.manifest", testdep_manifest1)) {
2246 skip("Could not create manifest file\n");
2247 return;
2248 }
2249
2250 trace("manifest2 depmanifest1\n");
2251
2252 handle = test_create("test2.manifest");
2253 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2254 DeleteFileA("test2.manifest");
2255 DeleteFileA("testdep.manifest");
2257 test_basic_info(handle, __LINE__);
2262 }
2263
2264 if(!create_manifest_file("test2-2.manifest", manifest2, -1, "testdep.manifest", testdep_manifest2)) {
2265 skip("Could not create manifest file\n");
2266 return;
2267 }
2268
2269 trace("manifest2 depmanifest2\n");
2270
2271 handle = test_create("test2-2.manifest");
2272 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2273 DeleteFileA("test2-2.manifest");
2274 DeleteFileA("testdep.manifest");
2276 test_basic_info(handle, __LINE__);
2280 test_file_info(handle, 1, 0, testlib_dll, __LINE__);
2281 test_file_info(handle, 1, 1, testlib2_dll, __LINE__);
2282
2284 ok(b, "ActivateActCtx failed: %lu\n", GetLastError());
2288 ok(b, "DeactivateActCtx failed: %lu\n", GetLastError());
2289
2291 }
2292
2293 trace("manifest2 depmanifest3\n");
2294
2295 if(!create_manifest_file("test2-3.manifest", manifest2, -1, "testdep.manifest", testdep_manifest3)) {
2296 skip("Could not create manifest file\n");
2297 return;
2298 }
2299
2300 handle = test_create("test2-3.manifest");
2301 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2302 DeleteFileA("test2-3.manifest");
2303 DeleteFileA("testdep.manifest");
2305 test_basic_info(handle, __LINE__);
2309 test_file_info(handle, 1, 0, testlib_dll, __LINE__);
2310 test_file_info(handle, 1, 1, testlib2_dll, __LINE__);
2311
2313 ok(b, "ActivateActCtx failed: %lu\n", GetLastError());
2319 ok(b, "DeactivateActCtx failed: %lu\n", GetLastError());
2320
2322 }
2323
2324 trace("manifest3\n");
2325
2326 if(!create_manifest_file("test3.manifest", manifest3, -1, NULL, NULL)) {
2327 skip("Could not create manifest file\n");
2328 return;
2329 }
2330
2331 handle = test_create("test3.manifest");
2332 ok(handle != INVALID_HANDLE_VALUE || broken(handle == INVALID_HANDLE_VALUE) /* XP pre-SP2, win2k3 w/o SP */,
2333 "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2335 win_skip("Some activation context features not supported, skipping a test (possibly old XP/Win2k3 system\n");
2336 DeleteFileA("test3.manifest");
2338 static const WCHAR nameW[] = {'t','e','s','t','s','u','r','r','o','g','a','t','e',0};
2339 static const WCHAR versionW[] = {'v','2','.','0','.','5','0','7','2','7',0};
2340 static const WCHAR progidW[] = {'P','r','o','g','I','d','.','P','r','o','g','I','d',0};
2341 static const WCHAR clrprogidW[] = {'c','l','r','p','r','o','g','i','d',0};
2342
2343 test_basic_info(handle, __LINE__);
2346 test_file_info(handle, 0, 0, testlib_dll, __LINE__);
2347
2349 ok(b, "ActivateActCtx failed: %lu\n", GetLastError());
2352 test_find_com_redirection(handle, &IID_CoTest, &IID_TlibTest, progidW, 1, __LINE__);
2353 test_find_com_redirection(handle, &IID_CoTest2, NULL, NULL, 1, __LINE__);
2354 test_find_com_redirection(handle, &CLSID_clrclass, &IID_TlibTest, clrprogidW, 1, __LINE__);
2355 test_find_progid_redirection(handle, &IID_CoTest, "ProgId.ProgId", 1, __LINE__);
2356 test_find_progid_redirection(handle, &IID_CoTest, "ProgId.ProgId.1", 1, __LINE__);
2357 test_find_progid_redirection(handle, &IID_CoTest, "ProgId.ProgId.2", 1, __LINE__);
2358 test_find_progid_redirection(handle, &IID_CoTest, "ProgId.ProgId.3", 1, __LINE__);
2359 test_find_progid_redirection(handle, &IID_CoTest, "ProgId.ProgId.4", 1, __LINE__);
2360 test_find_progid_redirection(handle, &IID_CoTest, "ProgId.ProgId.5", 1, __LINE__);
2361 test_find_progid_redirection(handle, &IID_CoTest, "ProgId.ProgId.6", 1, __LINE__);
2362 test_find_progid_redirection(handle, &CLSID_clrclass, "clrprogid", 1, __LINE__);
2363 test_find_progid_redirection(handle, &CLSID_clrclass, "clrprogid.1", 1, __LINE__);
2364 test_find_progid_redirection(handle, &CLSID_clrclass, "clrprogid.2", 1, __LINE__);
2365 test_find_progid_redirection(handle, &CLSID_clrclass, "clrprogid.3", 1, __LINE__);
2366 test_find_progid_redirection(handle, &CLSID_clrclass, "clrprogid.4", 1, __LINE__);
2367 test_find_progid_redirection(handle, &CLSID_clrclass, "clrprogid.5", 1, __LINE__);
2368 test_find_progid_redirection(handle, &CLSID_clrclass, "clrprogid.6", 1, __LINE__);
2369 test_find_surrogate(handle, &IID_Iiface, nameW, versionW, 1, __LINE__);
2370 test_find_ifaceps_redirection(handle, &IID_Iifaceps, &IID_TlibTest4, &IID_Ibifaceps, NULL, 1, __LINE__);
2371 test_find_ifaceps_redirection(handle, &IID_Iifaceps2, &IID_TlibTest4, &IID_Ibifaceps, &IID_PS32, 1, __LINE__);
2372 test_find_ifaceps_redirection(handle, &IID_Iifaceps3, &IID_TlibTest4, &IID_Ibifaceps, NULL, 1, __LINE__);
2374 test_find_activatable_class(handle, L"Wine.Test.Class1", WINRT_THREADING_MODEL_MTA, L"testlib.dll", 1, __LINE__);
2375 test_find_activatable_class(handle, L"Wine.Test.Class2", WINRT_THREADING_MODEL_BOTH, L"testlib.dll", 1, __LINE__);
2376 test_find_activatable_class(handle, L"Wine.Test.Class3", WINRT_THREADING_MODEL_STA, L"testlib.dll", 1, __LINE__);
2377 test_find_activatable_class(handle, L"Wine.Test.Class4", WINRT_THREADING_MODEL_STA, L"Wine.Test.dll", 1, __LINE__);
2378
2380 ok(b, "DeactivateActCtx failed: %lu\n", GetLastError());
2382 }
2383
2384 trace("manifest6\n");
2385
2386 if(create_manifest_file("test6.manifest", manifest6, -1, NULL, NULL)) {
2387 handle = test_create("test6.manifest");
2389 "Unexpected context handle %p.\n", handle);
2390 DeleteFileA("test6.manifest");
2391 DeleteFileA("testdep.manifest");
2393 {
2396 }
2397 }
2398 else
2399 skip("Could not create manifest file 6\n");
2400
2401 trace("manifest7\n");
2402
2403 if(create_manifest_file("test7.manifest", manifest7, -1, NULL, NULL)) {
2404 handle = test_create("test7.manifest");
2405 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2406 DeleteFileA("test7.manifest");
2407 DeleteFileA("testdep.manifest");
2409 {
2412 }
2413 }
2414 else
2415 skip("Could not create manifest file 7\n");
2416
2417 trace("manifest8\n");
2418
2419 if(create_manifest_file("test8.manifest", manifest8, -1, NULL, NULL)) {
2420 handle = test_create("test8.manifest");
2421 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2422 DeleteFileA("test8.manifest");
2423 DeleteFileA("testdep.manifest");
2425 {
2428 }
2429 }
2430 else
2431 skip("Could not create manifest file 8\n");
2432
2433 trace("manifest9\n");
2434
2435 if(create_manifest_file("test9.manifest", manifest9, -1, NULL, NULL)) {
2436 handle = test_create("test9.manifest");
2437 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2438 DeleteFileA("test9.manifest");
2439 DeleteFileA("testdep.manifest");
2441 {
2444 }
2445 }
2446 else
2447 skip("Could not create manifest file 9\n");
2448
2449 if(create_manifest_file("test10.manifest", manifest10, -1, NULL, NULL)) {
2450 handle = test_create("test10.manifest");
2451 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2452 DeleteFileA("test10.manifest");
2453 DeleteFileA("testdep.manifest");
2455 {
2458 }
2459 }
2460 else
2461 skip("Could not create manifest file 10\n");
2462
2463 if (create_manifest_file("test11.manifest", manifest11, -1, NULL, NULL))
2464 {
2465 handle = test_create("test11.manifest");
2466 ok(handle != INVALID_HANDLE_VALUE, "Failed to create activation context for %s, error %lu\n",
2467 "manifest11", GetLastError());
2468 DeleteFileA("test11.manifest");
2471 }
2472 else
2473 skip("Could not create manifest file 11\n");
2474
2475 trace("manifest4\n");
2476
2477 if(!create_manifest_file("test4.manifest", manifest4, -1, NULL, NULL)) {
2478 skip("Could not create manifest file\n");
2479 return;
2480 }
2481
2482 handle = test_create("test4.manifest");
2483 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2484 DeleteFileA("test4.manifest");
2485 DeleteFileA("testdep.manifest");
2487 test_basic_info(handle, __LINE__);
2492 }
2493
2494 trace("manifest1 in subdir\n");
2495
2498 {
2499 if(!create_manifest_file("..\\test1.manifest", manifest1, -1, NULL, NULL)) {
2500 skip("Could not create manifest file\n");
2501 return;
2502 }
2503 handle = test_create("..\\test1.manifest");
2504 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2505 DeleteFileA("..\\test1.manifest");
2507 test_basic_info(handle, __LINE__);
2511 }
2513 }
2514 else
2515 skip("Couldn't change directory\n");
2517
2518 trace("UTF-16 manifest1, with BOM\n");
2519 if(!create_wide_manifest("test1.manifest", manifest1, TRUE, FALSE)) {
2520 skip("Could not create manifest file\n");
2521 return;
2522 }
2523
2524 handle = test_create("test1.manifest");
2525 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2526 DeleteFileA("test1.manifest");
2528 test_basic_info(handle, __LINE__);
2532 }
2533
2534 trace("UTF-16 manifest1, reverse endian, with BOM\n");
2535 if(!create_wide_manifest("test1.manifest", manifest1, TRUE, TRUE)) {
2536 skip("Could not create manifest file\n");
2537 return;
2538 }
2539
2540 handle = test_create("test1.manifest");
2541 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2542 DeleteFileA("test1.manifest");
2544 test_basic_info(handle, __LINE__);
2548 }
2549
2550 /* Empty <assembly/> element. */
2551 create_manifest_file("empty_assembly.manifest", empty_assembly_manifest, -1, NULL, NULL);
2552 handle = test_create("empty_assembly.manifest");
2553 ok(handle != INVALID_HANDLE_VALUE, "Failed to create activation context.\n");
2554 DeleteFileA("empty_assembly.manifest");
2556 {
2557 test_basic_info(handle, __LINE__);
2559 }
2560
2565}
2566
2567static void test_app_manifest(void)
2568{
2569 HANDLE handle;
2570 BOOL b;
2571
2572 trace("child process manifest1\n");
2573
2575 ok(handle == NULL, "handle != NULL\n");
2576 ok(b, "GetCurrentActCtx failed: %lu\n", GetLastError());
2577 if(b) {
2578 test_basic_info(handle, __LINE__);
2582 }
2583}
2584
2585static HANDLE create_manifest(const char *filename, const char *data, int line)
2586{
2587 HANDLE handle;
2589
2591 ok_(__FILE__, line)(handle != INVALID_HANDLE_VALUE,
2592 "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
2593
2595 return handle;
2596}
2597
2598static void kernel32_find(ULONG section, const char *string_to_find, BOOL should_find, BOOL todo, int line)
2599{
2600 UNICODE_STRING string_to_findW;
2601 ACTCTX_SECTION_KEYED_DATA data;
2602 BOOL ret;
2603 DWORD err;
2604
2605 pRtlCreateUnicodeStringFromAsciiz(&string_to_findW, string_to_find);
2606
2607 memset(&data, 0xfe, sizeof(data));
2608 data.cbSize = sizeof(data);
2609
2610 SetLastError(0);
2611 ret = FindActCtxSectionStringA(0, NULL, section, string_to_find, &data);
2612 err = GetLastError();
2613 ok_(__FILE__, line)(ret == should_find,
2614 "FindActCtxSectionStringA: expected ret = %u, got %u\n", should_find, ret);
2616 ok_(__FILE__, line)(err == (should_find ? ERROR_SUCCESS : ERROR_SXS_KEY_NOT_FOUND),
2617 "FindActCtxSectionStringA: unexpected error %lu\n", err);
2618
2619 memset(&data, 0xfe, sizeof(data));
2620 data.cbSize = sizeof(data);
2621
2622 SetLastError(0);
2623 ret = FindActCtxSectionStringW(0, NULL, section, string_to_findW.Buffer, &data);
2624 err = GetLastError();
2625 ok_(__FILE__, line)(ret == should_find,
2626 "FindActCtxSectionStringW: expected ret = %u, got %u\n", should_find, ret);
2628 ok_(__FILE__, line)(err == (should_find ? ERROR_SUCCESS : ERROR_SXS_KEY_NOT_FOUND),
2629 "FindActCtxSectionStringW: unexpected error %lu\n", err);
2630
2631 SetLastError(0);
2632 ret = FindActCtxSectionStringA(0, NULL, section, string_to_find, NULL);
2633 err = GetLastError();
2634 ok_(__FILE__, line)(!ret,
2635 "FindActCtxSectionStringA: expected failure, got %u\n", ret);
2636 ok_(__FILE__, line)(err == ERROR_INVALID_PARAMETER,
2637 "FindActCtxSectionStringA: unexpected error %lu\n", err);
2638
2639 SetLastError(0);
2640 ret = FindActCtxSectionStringW(0, NULL, section, string_to_findW.Buffer, NULL);
2641 err = GetLastError();
2642 ok_(__FILE__, line)(!ret,
2643 "FindActCtxSectionStringW: expected failure, got %u\n", ret);
2644 ok_(__FILE__, line)(err == ERROR_INVALID_PARAMETER,
2645 "FindActCtxSectionStringW: unexpected error %lu\n", err);
2646
2647 pRtlFreeUnicodeString(&string_to_findW);
2648}
2649
2650static void ntdll_find(ULONG section, const char *string_to_find, BOOL should_find, BOOL todo, int line)
2651{
2652 UNICODE_STRING string_to_findW;
2653 ACTCTX_SECTION_KEYED_DATA data;
2654 NTSTATUS ret;
2655
2656 pRtlCreateUnicodeStringFromAsciiz(&string_to_findW, string_to_find);
2657
2658 memset(&data, 0xfe, sizeof(data));
2659 data.cbSize = sizeof(data);
2660
2661 ret = pRtlFindActivationContextSectionString(0, NULL, section, &string_to_findW, &data);
2663 ok_(__FILE__, line)(ret == (should_find ? STATUS_SUCCESS : STATUS_SXS_KEY_NOT_FOUND),
2664 "RtlFindActivationContextSectionString: unexpected status 0x%lx\n", ret);
2665
2666 ret = pRtlFindActivationContextSectionString(0, NULL, section, &string_to_findW, NULL);
2668 ok_(__FILE__, line)(ret == (should_find ? STATUS_SUCCESS : STATUS_SXS_KEY_NOT_FOUND),
2669 "RtlFindActivationContextSectionString: unexpected status 0x%lx\n", ret);
2670
2671 pRtlFreeUnicodeString(&string_to_findW);
2672}
2673
2674static void test_findsectionstring(void)
2675{
2676 HANDLE handle;
2677 BOOL ret;
2679
2680 handle = create_manifest("test.manifest", testdep_manifest3, __LINE__);
2682 ok(ret, "ActivateActCtx failed: %lu\n", GetLastError());
2683
2684 /* first we show the parameter validation from kernel32 */
2685 kernel32_find(ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION, "testdep", FALSE, TRUE, __LINE__);
2686 kernel32_find(ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, "testlib.dll", TRUE, FALSE, __LINE__);
2687 kernel32_find(ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, "testlib2.dll", TRUE, FALSE, __LINE__);
2688 kernel32_find(ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, "testlib3.dll", FALSE, FALSE, __LINE__);
2689 kernel32_find(ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, "wndClass", TRUE, FALSE, __LINE__);
2690 kernel32_find(ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, "wndClass2", TRUE, FALSE, __LINE__);
2691 kernel32_find(ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, "wndClass3", FALSE, FALSE, __LINE__);
2692
2693 /* then we show that ntdll plays by different rules */
2694 ntdll_find(ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION, "testdep", FALSE, TRUE, __LINE__);
2695 ntdll_find(ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, "testlib.dll", TRUE, FALSE, __LINE__);
2696 ntdll_find(ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, "testlib2.dll", TRUE, FALSE, __LINE__);
2697 ntdll_find(ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, "testlib3.dll", FALSE, FALSE, __LINE__);
2698 ntdll_find(ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, "wndClass", TRUE, FALSE, __LINE__);
2699 ntdll_find(ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, "wndClass2", TRUE, FALSE, __LINE__);
2700 ntdll_find(ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, "wndClass3", FALSE, FALSE, __LINE__);
2701
2702#ifdef __REACTOS__
2703 if (is_reactos()) {
2704 trace("HACK: ReactOS crashes on DeactivateActCtx() below.\n");
2705 ret = FALSE;
2706 } else
2707#endif
2709 ok(ret, "DeactivateActCtx failed: %lu\n", GetLastError());
2711}
2712
2713static void run_child_process(void)
2714{
2715 char cmdline[MAX_PATH];
2716 char path[MAX_PATH];
2717 char **argv;
2719 STARTUPINFOA si = { 0 };
2720 HANDLE file;
2721 FILETIME now;
2722 BOOL ret;
2723
2725 strcat(path, ".manifest");
2727 skip("Could not create manifest file\n");
2728 return;
2729 }
2730
2731 si.cb = sizeof(si);
2733 /* Vista+ seems to cache presence of .manifest files. Change last modified
2734 date to defeat the cache */
2736 NULL, OPEN_EXISTING, 0, NULL);
2737 if (file != INVALID_HANDLE_VALUE) {
2741 }
2742 sprintf(cmdline, "\"%s\" %s manifest1", argv[0], argv[1]);
2743 ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
2744 ok(ret, "Could not create process: %lu\n", GetLastError());
2749}
2750
2751static void init_paths(void)
2752{
2753 LPWSTR ptr;
2754
2755 static const WCHAR dot_manifest[] = {'.','M','a','n','i','f','e','s','t',0};
2756 static const WCHAR backslash[] = {'\\',0};
2757 static const WCHAR subdir[] = {'T','e','s','t','S','u','b','d','i','r','\\',0};
2758
2761 for(ptr=app_dir+lstrlenW(app_dir); *ptr != '\\' && *ptr != '/'; ptr--);
2762 ptr[1] = 0;
2763
2765 ptr = work_dir + lstrlenW( work_dir ) - 1;
2766 if (*ptr != '\\' && *ptr != '/')
2767 lstrcatW(work_dir, backslash);
2769 lstrcatW(work_dir_subdir, subdir);
2770
2773}
2774
2775static void write_manifest(const char *filename, const char *manifest)
2776{
2777 HANDLE file;
2778 DWORD size;
2780
2783
2785 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
2788}
2789
2790static void delete_manifest_file(const char *filename)
2791{
2793
2797}
2798
2799static void extract_resource(const char *name, const char *type, const char *path)
2800{
2801 DWORD written;
2802 HANDLE file;
2803 HRSRC res;
2804 void *ptr;
2805
2807 ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %ld\n", path, GetLastError());
2808
2810 ok( res != 0, "couldn't find resource\n" );
2813 ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" );
2814 CloseHandle( file );
2815}
2816
2817static void test_CreateActCtx(void)
2818{
2821 static const struct
2822 {
2824 } test[] =
2825 {
2826 { FIELD_OFFSET(ACTCTXW, lpSource), 0, ERROR_INVALID_PARAMETER },
2827 { FIELD_OFFSET(ACTCTXW, wProcessorArchitecture), 0, 0 },
2828 { FIELD_OFFSET(ACTCTXW, lpAssemblyDirectory), ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID, ERROR_INVALID_PARAMETER },
2829 { FIELD_OFFSET(ACTCTXW, lpResourceName), ACTCTX_FLAG_RESOURCE_NAME_VALID, ERROR_INVALID_PARAMETER },
2830 { FIELD_OFFSET(ACTCTXW, hModule), ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID, ERROR_INVALID_PARAMETER },
2831 };
2834 ACTCTXA actctx;
2835 ACTCTXW ctxW;
2836 HANDLE handle;
2837 int i;
2838
2840 strcpy(dir, path);
2841 strcat(path, "main_wndcls.manifest");
2842
2843 write_manifest("testdep1.manifest", manifest_wndcls1);
2844 write_manifest("testdep2.manifest", manifest_wndcls2);
2845 write_manifest("main_wndcls.manifest", manifest_wndcls_main);
2846
2849
2851 wcscpy(dirW, pathW);
2852 wcscat(pathW, L"main_wndcls.manifest");
2853
2854 memset(&ctxW, 0, sizeof(ctxW));
2855 ctxW.cbSize = sizeof(ctxW);
2856 ctxW.dwFlags = ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID | ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID;
2857 ctxW.lpSource = pathW;
2858 ctxW.lpAssemblyDirectory = dirW;
2859 ctxW.lpResourceName = (LPWSTR)124;
2860 ctxW.hModule = GetModuleHandleW(NULL);
2862 ok(handle != INVALID_HANDLE_VALUE, "CreateActCtx error %lu\n", GetLastError());
2864
2865 for (i = 0; i < ARRAY_SIZE(test); i++)
2866 {
2867 winetest_push_context("%i", i);
2868 ctxW.cbSize = test[i].size;
2869 ctxW.dwFlags = test[i].flags;
2870 SetLastError(0xdeadbeef);
2872 if (!test[i].error)
2873 {
2874 ok(handle != INVALID_HANDLE_VALUE, "CreateActCtx error %lu\n", GetLastError());
2876 }
2877 else
2878 {
2879 ok(handle == INVALID_HANDLE_VALUE, "CreateActCtx should fail\n");
2880 ok(test[i].error == GetLastError(), "expected %lu, got %lu\n", test[i].error, GetLastError());
2881 }
2882
2883 ctxW.cbSize += sizeof(void *);
2884 if ((ctxW.dwFlags & (ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID)) == ACTCTX_FLAG_RESOURCE_NAME_VALID)
2885 ctxW.lpSource = sourceW; /* source without hModule must point to valid PE */
2886 SetLastError(0xdeadbeef);
2888 ok(handle != INVALID_HANDLE_VALUE, "CreateActCtx error %lu\n", GetLastError());
2890
2892 }
2893
2894 memset(&actctx, 0, sizeof(actctx));
2895 actctx.cbSize = sizeof(actctx);
2896 actctx.dwFlags = ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID | ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID;
2897 actctx.lpSource = path;
2898 actctx.lpAssemblyDirectory = dir;
2899 actctx.lpResourceName = (LPSTR)124;
2900 actctx.hModule = GetModuleHandleW(NULL);
2902 ok(handle != INVALID_HANDLE_VALUE, "CreateActCtx error %lu\n", GetLastError());
2904
2905 for (i = 0; i < ARRAY_SIZE(test); i++)
2906 {
2907 winetest_push_context("%i", i);
2908 actctx.cbSize = test[i].size;
2909 actctx.dwFlags = test[i].flags;
2910 SetLastError(0xdeadbeef);
2912 if (!test[i].error)
2913 {
2914 ok(handle != INVALID_HANDLE_VALUE, "CreateActCtx error %lu\n", GetLastError());
2916 }
2917 else
2918 {
2919 ok(handle == INVALID_HANDLE_VALUE, "CreateActCtx should fail\n");
2920 ok(test[i].error == GetLastError(), "expected %lu, got %lu\n", test[i].error, GetLastError());
2921 }
2922
2923 actctx.cbSize += sizeof(void *);
2924 if ((actctx.dwFlags & (ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID)) == ACTCTX_FLAG_RESOURCE_NAME_VALID)
2925 actctx.lpSource = source; /* source without hModule must point to valid PE */
2926 SetLastError(0xdeadbeef);
2928 ok(handle != INVALID_HANDLE_VALUE, "CreateActCtx error %lu\n", GetLastError());
2930
2932 }
2933
2934 memset(&actctx, 0, sizeof(ACTCTXA));
2935 actctx.cbSize = sizeof(ACTCTXA);
2936 actctx.lpSource = path;
2937
2938 /* create using lpSource without specified directory */
2940 ok(handle != INVALID_HANDLE_VALUE, "failed to generate context, error %lu\n", GetLastError());
2942
2943 /* with specified directory, that doesn't contain dependent assembly */
2945
2946 memset(&actctx, 0, sizeof(ACTCTXA));
2947 actctx.cbSize = sizeof(ACTCTXA);
2948 actctx.dwFlags = ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID;
2949 actctx.lpAssemblyDirectory = dir;
2950 actctx.lpSource = path;
2951
2952 SetLastError(0xdeadbeef);
2954todo_wine {
2955 ok(handle == INVALID_HANDLE_VALUE, "got handle %p\n", handle);
2956 ok(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX, "got error %ld\n", GetLastError());
2957}
2959
2960 /* with specified directory, that does contain dependent assembly */
2962 actctx.lpAssemblyDirectory = dir;
2964 ok(handle != INVALID_HANDLE_VALUE, "got handle %p\n", handle);
2966
2967 /* Should still work if we add a dll with the same name, but without manifest */
2968 strcpy(dll, dir);
2969 strcat(dll, "testdep1.dll");
2970 extract_resource("dummy.dll", "TESTDLL", dll);
2974 DeleteFileA(dll);
2975
2976 delete_manifest_file("main_wndcls.manifest");
2977 delete_manifest_file("testdep1.manifest");
2978 delete_manifest_file("testdep2.manifest");
2979
2980 /* create from HMODULE - resource doesn't exist, lpSource is set */
2981 memset(&actctx, 0, sizeof(ACTCTXA));
2982 actctx.cbSize = sizeof(ACTCTXA);
2983 actctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID;
2984 actctx.lpSource = "dummyfile.dll";
2985 actctx.lpResourceName = MAKEINTRESOURCEA(20);
2986 actctx.hModule = GetModuleHandleA(NULL);
2987
2988 SetLastError(0xdeadbeef);
2990 ok(handle == INVALID_HANDLE_VALUE, "got handle %p\n", handle);
2991 ok(GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND, "got error %ld\n", GetLastError());
2992
2993 /* load manifest from lpAssemblyDirectory directory */
2994 write_manifest("testdir.manifest", manifest1);
2997 strcat(path, "assembly_dir");
2998 strcpy(dir, path);
2999 strcat(path, "\\testdir.manifest");
3000
3001 memset(&actctx, 0, sizeof(actctx));
3002 actctx.cbSize = sizeof(actctx);
3003 actctx.dwFlags = ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID;
3004 actctx.lpSource = "testdir.manifest";
3005 actctx.lpAssemblyDirectory = dir;
3006
3007 SetLastError(0xdeadbeef);
3009 ok(handle == INVALID_HANDLE_VALUE, "got handle %p\n", handle);
3012 "got error %ld\n", GetLastError());
3013
3015 memset(&actctx, 0, sizeof(actctx));
3016 actctx.cbSize = sizeof(actctx);
3017 actctx.dwFlags = ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID;
3018 actctx.lpSource = "testdir.manifest";
3019 actctx.lpAssemblyDirectory = dir;
3020
3021 SetLastError(0xdeadbeef);
3023 ok(handle == INVALID_HANDLE_VALUE, "got handle %p\n", handle);
3024 ok(GetLastError() == ERROR_FILE_NOT_FOUND, "got error %ld\n", GetLastError());
3026
3027 write_manifest("assembly_dir\\testdir.manifest", manifest1);
3028 memset(&actctx, 0, sizeof(actctx));
3029 actctx.cbSize = sizeof(actctx);
3030 actctx.dwFlags = ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID;
3031 actctx.lpSource = "testdir.manifest";
3032 actctx.lpAssemblyDirectory = dir;
3033
3035 ok(handle != INVALID_HANDLE_VALUE, "got handle %p\n", handle);
3037
3038 memset(&actctx, 0, sizeof(actctx));
3039 actctx.cbSize = sizeof(actctx);
3040 actctx.dwFlags = ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID;
3041 actctx.lpSource = path;
3042 actctx.lpAssemblyDirectory = dir;
3043
3045 ok(handle != INVALID_HANDLE_VALUE, "got handle %p\n", handle);
3047
3048 delete_manifest_file("testdir.manifest");
3049 delete_manifest_file("assembly_dir\\testdir.manifest");
3051
3052 /* create using lpSource with a DLL relative name */
3053 memset(&actctx, 0, sizeof(actctx));
3054 actctx.cbSize = sizeof(actctx);
3055 actctx.lpSource = "shell32.dll";
3056 actctx.lpResourceName = MAKEINTRESOURCEA(124);
3057 actctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID;
3059 ok(handle == INVALID_HANDLE_VALUE, "CreateActCtxA succeeded\n");
3060
3061 /* create from module loaded as data file */
3062 memset(&actctx, 0, sizeof(actctx));
3063 actctx.cbSize = sizeof(actctx);
3064 actctx.lpResourceName = MAKEINTRESOURCEA(1);
3065 actctx.dwFlags = ACTCTX_FLAG_HMODULE_VALID | ACTCTX_FLAG_RESOURCE_NAME_VALID;
3066#ifdef __REACTOS__
3067 char path_explorer[MAX_PATH];
3068 GetWindowsDirectoryA(path_explorer, sizeof(path_explorer));
3069 strcat(path_explorer, "\\explorer.exe");
3070#endif
3071 for (i = 0; i < ARRAY_SIZE(flags); ++i)
3072 {
3073 winetest_push_context("%lu", flags[i]);
3074
3075 /* use explorer.exe because using modules already loaded has a different behavior */
3076#ifdef __REACTOS__
3077 if (GetNTVersion() < _WIN32_WINNT_VISTA && i > 0)
3078 break; // Only the first test is valid for WS03.
3079 actctx.hModule = LoadLibraryExA(path_explorer, NULL, flags[i]);
3080#else
3081 actctx.hModule = LoadLibraryExA("C:\\windows\\explorer.exe", NULL, flags[i]);
3082#endif
3083 ok(actctx.hModule != NULL, "LoadLibraryExA failed, error %lu\n", GetLastError());
3085 ok(handle == INVALID_HANDLE_VALUE, "CreateActCtxA succeeded\n");
3086 FreeLibrary(actctx.hModule);
3087
3089 }
3090}
3091
3093{
3094 WCHAR tmp_manifest_pathname[MAX_PATH];
3095 HANDLE handle, manifest_file;
3096 ACTCTXW actctx;
3097
3098 manifest_file = create_temp_manifest_file(manifest1, tmp_manifest_pathname);
3099
3100 memset(&actctx, 0, sizeof(ACTCTXW));
3101 actctx.cbSize = sizeof(ACTCTXW);
3102 actctx.lpSource = tmp_manifest_pathname;
3103
3105#ifdef __REACTOS__
3106 ok(handle != INVALID_HANDLE_VALUE || GetLastError() == ERROR_SHARING_VIOLATION /* WS03 */, "CreateActCtxW returned error %lu\n", GetLastError());
3107#else
3108 ok(handle != INVALID_HANDLE_VALUE, "CreateActCtxW returned error %lu\n", GetLastError());
3109#endif
3110 ok(handle != NULL, "CreateActCtxW returned %p\n", handle);
3111
3113
3114 CloseHandle(manifest_file);
3115}
3116
3117static BOOL init_funcs(void)
3118{
3119 HMODULE hLibrary = GetModuleHandleA("kernel32.dll");
3120
3121#define X(f) if (!(p##f = (void*)GetProcAddress(hLibrary, #f))) return FALSE;
3122 pQueryActCtxSettingsW = (void *)GetProcAddress( hLibrary, "QueryActCtxSettingsW" );
3123
3124 hLibrary = GetModuleHandleA("ntdll.dll");
3128#undef X
3129
3130 return TRUE;
3131}
3132
3133static void test_ZombifyActCtx(void)
3134{
3135 ACTIVATION_CONTEXT_BASIC_INFORMATION basicinfo;
3138 BOOL ret;
3139
3140 SetLastError(0xdeadbeef);
3142 todo_wine
3143 ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "got %d, error %ld\n", ret, GetLastError());
3144
3145 handle = create_manifest("test.manifest", testdep_manifest3, __LINE__);
3146
3148 ok(ret, "got %d, error %ld\n", ret, GetLastError());
3149 ok(current == NULL, "got %p\n", current);
3150
3152 ok(ret, "ActivateActCtx failed: %lu\n", GetLastError());
3153
3155 ok(ret, "got %d, error %ld\n", ret, GetLastError());
3156 ok(handle == current, "got %p, %p\n", current, handle);
3157
3158 memset(&basicinfo, 0xff, sizeof(basicinfo));
3159 ret = QueryActCtxW(0, handle, 0, ActivationContextBasicInformation, &basicinfo, sizeof(basicinfo), NULL);
3160 ok(ret, "got %d, error %ld\n", ret, GetLastError());
3161 ok(basicinfo.hActCtx == handle, "got %p\n", basicinfo.hActCtx);
3162 ok(basicinfo.dwFlags == 0, "got %lx\n", basicinfo.dwFlags);
3163
3164 memset(&basicinfo, 0xff, sizeof(basicinfo));
3165 ret = QueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX, NULL, 0, ActivationContextBasicInformation,
3166 &basicinfo, sizeof(basicinfo), NULL);
3167 ok(ret, "got %d, error %ld\n", ret, GetLastError());
3168 ok(basicinfo.hActCtx == handle, "got %p\n", basicinfo.hActCtx);
3169 ok(basicinfo.dwFlags == 0, "got %lx\n", basicinfo.dwFlags);
3170
3172 todo_wine
3173 ok(ret, "got %d\n", ret);
3174
3175 memset(&basicinfo, 0xff, sizeof(basicinfo));
3176 ret = QueryActCtxW(0, handle, 0, ActivationContextBasicInformation, &basicinfo, sizeof(basicinfo), NULL);
3177 ok(ret, "got %d, error %ld\n", ret, GetLastError());
3178 ok(basicinfo.hActCtx == handle, "got %p\n", basicinfo.hActCtx);
3179 ok(basicinfo.dwFlags == 0, "got %lx\n", basicinfo.dwFlags);
3180
3181 memset(&basicinfo, 0xff, sizeof(basicinfo));
3182 ret = QueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX, NULL, 0, ActivationContextBasicInformation,
3183 &basicinfo, sizeof(basicinfo), NULL);
3184 ok(ret, "got %d, error %ld\n", ret, GetLastError());
3185 ok(basicinfo.hActCtx == handle, "got %p\n", basicinfo.hActCtx);
3186 ok(basicinfo.dwFlags == 0, "got %lx\n", basicinfo.dwFlags);
3187
3189 ok(ret, "got %d, error %ld\n", ret, GetLastError());
3190 ok(current == handle, "got %p\n", current);
3191
3192 /* one more time */
3194 todo_wine
3195 ok(ret, "got %d\n", ret);
3196
3197#ifdef __REACTOS__
3198 if (is_reactos()) {
3199 trace("HACK: ReactOS crashes on DeactivateActCtx() below.\n");
3200 ret = FALSE;
3201 } else
3202#endif
3204 ok(ret, "DeactivateActCtx failed: %lu\n", GetLastError());
3206}
3207
3208/* Test structure to verify alignment */
3211 COMPATIBILITY_CONTEXT_ELEMENT Elements[10];
3213
3214/* Win10 versions before 1909 don't have the MaxVersionTested field */
3215typedef struct
3216{
3218 ACTCTX_COMPATIBILITY_ELEMENT_TYPE Type;
3220
3221typedef struct
3222{
3226
3227
3229{
3230 test_act_ctx_compat_info compat_info;
3231 SIZE_T size;
3232 BOOL b;
3233
3234 memset(&compat_info, 0, sizeof(compat_info));
3235 b = QueryActCtxW(QUERY_ACTCTX_FLAG_NO_ADDREF, handle, NULL, CompatibilityInformationInActivationContext,
3236 &compat_info, sizeof(compat_info), &size);
3237
3238 ok_(__FILE__, line)(b, "CompatibilityInformationInActivationContext failed\n");
3239 ok_(__FILE__, line)(size == offsetof(test_act_ctx_compat_info,Elements[0]) ||
3241 "size mismatch got %Iu\n", size);
3242 ok_(__FILE__, line)(compat_info.ElementCount == 0, "unexpected ElementCount %lu\n", compat_info.ElementCount);
3243}
3244
3245static void test_with_compat(HANDLE handle, DWORD num_compat, DWORD num_version,
3246 const GUID *expected_compat[], const ULONGLONG expected_version[], int line)
3247{
3248 test_act_ctx_compat_info compat_info;
3249 SIZE_T size;
3250 DWORD n;
3251 BOOL b;
3252
3253 memset(&compat_info, 0, sizeof(compat_info));
3254 b = QueryActCtxW(QUERY_ACTCTX_FLAG_NO_ADDREF, handle, NULL, CompatibilityInformationInActivationContext,
3255 &compat_info, sizeof(compat_info), &size);
3256
3257 ok_(__FILE__, line)(b, "CompatibilityInformationInActivationContext failed\n");
3258 ok_(__FILE__, line)(size == offsetof(test_act_ctx_compat_info,Elements[num_compat + num_version]) ||
3259 broken(size == offsetof(old_win10_test_act_ctx_compat_info,Elements[num_compat])),
3260 "size mismatch got %Iu\n", size);
3261 ok_(__FILE__, line)(compat_info.ElementCount == num_compat + num_version ||
3262 broken(compat_info.ElementCount == num_compat),
3263 "unexpected ElementCount %lu\n", compat_info.ElementCount);
3264
3265 if (size == offsetof(old_win10_test_act_ctx_compat_info,Elements[num_compat]))
3266 {
3267 for (n = 0; n < num_compat; ++n)
3268 {
3270 ok_(__FILE__, line)(IsEqualGUID(&info->Elements[n].Id, expected_compat[n]),
3271 "got wrong clsid %s, expected %s for %lu\n",
3272 wine_dbgstr_guid(&info->Elements[n].Id),
3273 wine_dbgstr_guid(expected_compat[n]),
3274 n);
3275 ok_(__FILE__, line)(info->Elements[n].Type == ACTCTX_COMPATIBILITY_ELEMENT_TYPE_OS,
3276 "Wrong type, got %lu for %lu\n", (DWORD)info->Elements[n].Type, n);
3277 }
3278 }
3279 else
3280 {
3281 for (n = 0; n < num_compat; ++n)
3282 {
3283 ok_(__FILE__, line)(IsEqualGUID(&compat_info.Elements[n].Id, expected_compat[n]),
3284 "got wrong clsid %s, expected %s for %lu\n",
3285 wine_dbgstr_guid(&compat_info.Elements[n].Id),
3286 wine_dbgstr_guid(expected_compat[n]),
3287 n);
3288 ok_(__FILE__, line)(compat_info.Elements[n].Type == ACTCTX_COMPATIBILITY_ELEMENT_TYPE_OS,
3289 "Wrong type, got %lu for %lu\n", (DWORD)compat_info.Elements[n].Type, n);
3290 }
3291 for (; n < num_compat + num_version; ++n)
3292 {
3293 ok_(__FILE__, line)(compat_info.Elements[n].Type == ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MAXVERSIONTESTED,
3294 "Wrong type, got %lu for %lu\n", (DWORD)compat_info.Elements[n].Type, n);
3295 ok_(__FILE__, line)(compat_info.Elements[n].MaxVersionTested == expected_version[n - num_compat],
3296 "Wrong version, got %s for %lu\n", wine_dbgstr_longlong(compat_info.Elements[n].MaxVersionTested), n);
3297 }
3298 }
3299}
3300
3301static void test_compatibility(void)
3302{
3303 HANDLE handle;
3304
3305 /* No compat results returned */
3306 trace("manifest1\n");
3307 if(!create_manifest_file("test1.manifest", manifest1, -1, NULL, NULL))
3308 {
3309 skip("Could not create manifest file\n");
3310 return;
3311 }
3312 handle = test_create("test1.manifest");
3313 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
3314 DeleteFileA("test1.manifest");
3316 {
3317 char buffer[sizeof(COMPATIBILITY_CONTEXT_ELEMENT) * 2 + sizeof(DWORD)];
3318 SIZE_T size;
3319 BOOL b;
3320
3321 memset(buffer, 0, sizeof(buffer));
3322 b = QueryActCtxW(QUERY_ACTCTX_FLAG_NO_ADDREF, handle, NULL, CompatibilityInformationInActivationContext,
3323 buffer, sizeof(buffer), &size);
3324
3326 {
3327 win_skip("CompatibilityInformationInActivationContext not supported.\n");
3329 return;
3330 }
3331
3332 test_basic_info(handle, __LINE__);
3333 test_no_compat(handle, __LINE__);
3335 }
3336
3337 /* Still no compat results returned */
3338 trace("no_supportedOs\n");
3339 if(!create_manifest_file("no_supportedOs.manifest", compat_manifest_no_supportedOs, -1, NULL, NULL))
3340 {
3341 skip("Could not create manifest file\n");
3342 return;
3343 }
3344 handle = test_create("no_supportedOs.manifest");
3345 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
3346 DeleteFileA("no_supportedOs.manifest");
3348 {
3349 test_basic_info(handle, __LINE__);
3350 test_no_compat(handle, __LINE__);
3352 }
3353
3354 /* Just one result returned */
3355 trace("manifest_vista\n");
3356 if(!create_manifest_file("manifest_vista.manifest", compat_manifest_vista, -1, NULL, NULL))
3357 {
3358 skip("Could not create manifest file\n");
3359 return;
3360 }
3361 handle = test_create("manifest_vista.manifest");
3362 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
3363 DeleteFileA("manifest_vista.manifest");
3365 {
3366 static const GUID* expect_manifest[] =
3367 {
3368 &VISTA_COMPAT_GUID
3369 };
3370 test_basic_info(handle, __LINE__);
3371 test_with_compat(handle, 1, 0, expect_manifest, NULL, __LINE__);
3373 }
3374
3375 /* Show that the order is retained */
3376 trace("manifest_vista_7_8_10_81\n");
3377 if(!create_manifest_file("manifest_vista_7_8_10_81.manifest", compat_manifest_vista_7_8_10_81, -1, NULL, NULL))
3378 {
3379 skip("Could not create manifest file\n");
3380 return;
3381 }
3382 handle = test_create("manifest_vista_7_8_10_81.manifest");
3383 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
3384 DeleteFileA("manifest_vista_7_8_10_81.manifest");
3386 {
3387 static const GUID* expect_manifest[] =
3388 {
3389 &VISTA_COMPAT_GUID,
3390 &WIN7_COMPAT_GUID,
3391 &WIN8_COMPAT_GUID,
3392 &WIN10_COMPAT_GUID,
3393 &WIN81_COMPAT_GUID,
3394 };
3395 static const ULONGLONG expect_version[] =
3396 {
3397 0x000a000047b60000ull, /* 10.0.18358.0 */
3398 0x0002000300040005ull, /* 2.3.4.5 */
3399 };
3400 test_basic_info(handle, __LINE__);
3401 test_with_compat(handle, 5, 2, expect_manifest, expect_version, __LINE__);
3403 }
3404
3405 /* Show that even unknown GUID's are stored */
3406 trace("manifest_other_guid\n");
3407 if(!create_manifest_file("manifest_other_guid.manifest", compat_manifest_other_guid, -1, NULL, NULL))
3408 {
3409 skip("Could not create manifest file\n");
3410 return;
3411 }
3412 handle = test_create("manifest_other_guid.manifest");
3413 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
3414 DeleteFileA("manifest_other_guid.manifest");
3416 {
3417 static const GUID* expect_manifest[] =
3418 {
3419 &OTHER_COMPAT_GUID,
3420 };
3421 test_basic_info(handle, __LINE__);
3422 test_with_compat(handle, 1, 0, expect_manifest, NULL, __LINE__);
3424 }
3425}
3426
3427static void test_settings(void)
3428{
3429 static const WCHAR dpiAwareW[] = {'d','p','i','A','w','a','r','e',0};
3430 static const WCHAR dpiAwarenessW[] = {'d','p','i','A','w','a','r','e','n','e','s','s',0};
3431 static const WCHAR dummyW[] = {'d','u','m','m','y',0};
3432 static const WCHAR trueW[] = {'t','r','u','e',0};
3433 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};
3434 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};
3435 WCHAR buffer[80];
3436 SIZE_T size;
3437 HANDLE handle;
3438 BOOL ret;
3439
3440#if defined(__REACTOS__) && DLL_EXPORT_VERSION >= 0x600
3441 /* FIXME: QueryActCtxSettingsW() is a STUB on ReactOS. */
3442 if (is_reactos() || !pQueryActCtxSettingsW)
3443#else
3444 if (!pQueryActCtxSettingsW)
3445#endif
3446 {
3447 win_skip( "QueryActCtxSettingsW is missing\n" );
3448 return;
3449 }
3450 create_manifest_file( "manifest_settings.manifest", settings_manifest, -1, NULL, NULL );
3451 handle = test_create("manifest_settings.manifest");
3452 ok( handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError() );
3453 DeleteFileA( "manifest_settings.manifest" );
3454
3455 SetLastError( 0xdeadbeef );
3456 ret = pQueryActCtxSettingsW( 1, handle, NULL, dpiAwareW, buffer, 80, &size );
3457 ok( !ret, "QueryActCtxSettingsW failed err %lu\n", GetLastError() );
3458 ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
3459 SetLastError( 0xdeadbeef );
3460 ret = pQueryActCtxSettingsW( 0, handle, dummyW, dpiAwareW, buffer, 80, &size );
3461 ok( !ret, "QueryActCtxSettingsW failed err %lu\n", GetLastError() );
3462 ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
3463 SetLastError( 0xdeadbeef );
3464 size = 0xdead;
3465 memset( buffer, 0xcc, sizeof(buffer) );
3466 ret = pQueryActCtxSettingsW( 0, handle, NULL, dpiAwareW, buffer, 80, &size );
3467 ok( ret, "QueryActCtxSettingsW failed err %lu\n", GetLastError() );
3468 ok( !lstrcmpW( buffer, trueW ), "got %s\n", wine_dbgstr_w(buffer) );
3469 ok( size == lstrlenW( buffer ) + 1, "wrong len %Iu\n", size );
3470 SetLastError( 0xdeadbeef );
3471 size = 0xdead;
3472 memset( buffer, 0xcc, sizeof(buffer) );
3473 ret = pQueryActCtxSettingsW( 0, handle, NULL, dummyW, buffer, 80, &size );
3474 ok( !ret, "QueryActCtxSettingsW succeeded\n" );
3475 ok( GetLastError() == ERROR_SXS_KEY_NOT_FOUND, "wrong error %lu\n", GetLastError() );
3476 ok( buffer[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer) );
3477 SetLastError( 0xdeadbeef );
3478 size = 0xdead;
3479 memset( buffer, 0xcc, sizeof(buffer) );
3480 ret = pQueryActCtxSettingsW( 0, handle, namespace2005W, dpiAwareW, buffer, 80, &size );
3481 ok( ret, "QueryActCtxSettingsW failed err %lu\n", GetLastError() );
3482 ok( !lstrcmpW( buffer, trueW ), "got %s\n", wine_dbgstr_w(buffer) );
3483 ok( size == ARRAY_SIZE(trueW), "wrong len %Iu\n", size );
3484 SetLastError( 0xdeadbeef );
3485 size = 0xdead;
3486 memset( buffer, 0xcc, sizeof(buffer) );
3487 ret = pQueryActCtxSettingsW( 0, handle, namespace2005W, dpiAwareW, buffer, lstrlenW(trueW) + 1, &size );
3488 ok( ret, "QueryActCtxSettingsW failed err %lu\n", GetLastError() );
3489 ok( !lstrcmpW( buffer, trueW ), "got %s\n", wine_dbgstr_w(buffer) );
3490 ok( size == ARRAY_SIZE(trueW), "wrong len %Iu\n", size );
3491 SetLastError( 0xdeadbeef );
3492 size = 0xdead;
3493 memset( buffer, 0xcc, sizeof(buffer) );
3494 ret = pQueryActCtxSettingsW( 0, handle, namespace2016W, dpiAwareW, buffer, lstrlenW(trueW) + 1, &size );
3495 ok( !ret, "QueryActCtxSettingsW succeeded\n" );
3497 "wrong error %lu\n", GetLastError() );
3498 ok( buffer[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer) );
3499 SetLastError( 0xdeadbeef );
3500 size = 0xdead;
3501 memset( buffer, 0xcc, sizeof(buffer) );
3502 ret = pQueryActCtxSettingsW( 0, handle, NULL, dpiAwarenessW, buffer, lstrlenW(trueW) + 1, &size );
3503 ok( !ret, "QueryActCtxSettingsW succeeded\n" );
3504 ok( GetLastError() == ERROR_SXS_KEY_NOT_FOUND, "wrong error %lu\n", GetLastError() );
3505 ok( buffer[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer) );
3506 SetLastError( 0xdeadbeef );
3507 size = 0xdead;
3508 memset( buffer, 0xcc, sizeof(buffer) );
3509 ret = pQueryActCtxSettingsW( 0, handle, namespace2005W, dpiAwarenessW, buffer, lstrlenW(trueW) + 1, &size );
3510 ok( !ret, "QueryActCtxSettingsW succeeded\n" );
3511 ok( GetLastError() == ERROR_SXS_KEY_NOT_FOUND, "wrong error %lu\n", GetLastError() );
3512 ok( buffer[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer) );
3513 SetLastError( 0xdeadbeef );
3514 size = 0xdead;
3515 memset( buffer, 0xcc, sizeof(buffer) );
3516 ret = pQueryActCtxSettingsW( 0, handle, namespace2016W, dpiAwarenessW, buffer, lstrlenW(trueW) + 1, &size );
3518 "QueryActCtxSettingsW failed err %lu\n", GetLastError() );
3519 if (ret)
3520 {
3521 ok( !lstrcmpW( buffer, trueW ), "got %s\n", wine_dbgstr_w(buffer) );
3522 ok( size == ARRAY_SIZE(trueW), "wrong len %Iu\n", size );
3523 }
3524 else ok( buffer[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer) );
3525 SetLastError( 0xdeadbeef );
3526 size = 0xdead;
3527 memset( buffer, 0xcc, sizeof(buffer) );
3528 ret = pQueryActCtxSettingsW( 0, handle, NULL, dpiAwareW, buffer, lstrlenW(trueW), &size );
3529 ok( ret, "QueryActCtxSettingsW failed err %lu\n", GetLastError() );
3530 ok( !lstrcmpW( buffer, trueW ), "got %s\n", wine_dbgstr_w(buffer) );
3531 ok( size == ARRAY_SIZE(trueW), "wrong len %Iu\n", size );
3532 SetLastError( 0xdeadbeef );
3533 size = 0xdead;
3534 memset( buffer, 0xcc, sizeof(buffer) );
3535 ret = pQueryActCtxSettingsW( 0, handle, NULL, dpiAwareW, buffer, lstrlenW(trueW) - 1, &size );
3536 ok( !ret, "QueryActCtxSettingsW failed err %lu\n", GetLastError() );
3537 ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "wrong error %lu\n", GetLastError() );
3538 ok( buffer[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer) );
3539 ok( size == ARRAY_SIZE(trueW), "wrong len %Iu\n", size );
3541
3542 create_manifest_file( "manifest_settings2.manifest", settings_manifest2, -1, NULL, NULL );
3543 handle = test_create("manifest_settings2.manifest");
3544 ok( handle != INVALID_HANDLE_VALUE || broken( handle == INVALID_HANDLE_VALUE ), /* <= vista */
3545 "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError() );
3546 DeleteFileA( "manifest_settings2.manifest" );
3548 {
3549 SetLastError( 0xdeadbeef );
3550 size = 0xdead;
3551 memset( buffer, 0xcc, sizeof(buffer) );
3552 ret = pQueryActCtxSettingsW( 0, handle, NULL, dpiAwareW, buffer, 80, &size );
3553 ok( ret, "QueryActCtxSettingsW failed err %lu\n", GetLastError() );
3554 ok( !lstrcmpW( buffer, trueW ), "got %s\n", wine_dbgstr_w(buffer) );
3555 ok( size == lstrlenW( buffer ) + 1, "wrong len %Iu\n", size );
3557 }
3558
3559 create_manifest_file( "manifest_settings3.manifest", settings_manifest3, -1, NULL, NULL );
3560 handle = test_create("manifest_settings3.manifest");
3561 ok( handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError() );
3562 DeleteFileA( "manifest_settings3.manifest" );
3563 SetLastError( 0xdeadbeef );
3564 size = 0xdead;
3565 memset( buffer, 0xcc, sizeof(buffer) );
3566 ret = pQueryActCtxSettingsW( 0, handle, NULL, dpiAwareW, buffer, 80, &size );
3567 ok( !ret, "QueryActCtxSettingsW succeeded\n" );
3568 ok( GetLastError() == ERROR_SXS_KEY_NOT_FOUND, "wrong error %lu\n", GetLastError() );
3570
3571 /* lookup occurs in first non empty node */
3572 create_manifest_file( "manifest_settings4.manifest", settings_manifest4, -1, NULL, NULL );
3573 handle = test_create("manifest_settings4.manifest");
3574 ok( handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError() );
3575 DeleteFileA( "manifest_settings4.manifest" );
3576 SetLastError( 0xdeadbeef );
3577 size = 0xdead;
3578 memset( buffer, 0xcc, sizeof(buffer) );
3579 ret = pQueryActCtxSettingsW( 0, handle, NULL, dpiAwareW, buffer, 80, &size );
3580 ok( ret, "QueryActCtxSettingsW failed\n" );
3581 SetLastError( 0xdeadbeef );
3582 size = 0xdead;
3583 memset( buffer, 0xcc, sizeof(buffer) );
3584 ret = pQueryActCtxSettingsW( 0, handle, NULL, dpiAwarenessW, buffer, 80, &size );
3585 ok( !ret, "QueryActCtxSettingsW succeeded\n" );
3587}
3588
3589typedef struct
3590{
3591 char path_tmp[MAX_PATH];
3592 char path_dll[MAX_PATH + 11];
3593 char path_manifest_exe[MAX_PATH + 12];
3594 char path_manifest_dll[MAX_PATH + 16];
3595 ACTCTXA context;
3600} sxs_info;
3601
3602static BOOL fill_sxs_info(sxs_info *info, const char *temp, const char *path_dll, const char *exe_manifest, const char *dll_manifest, BOOL do_load)
3603{
3604 BOOL success;
3605
3606 GetTempPathA(MAX_PATH, info->path_tmp);
3607 strcat(info->path_tmp, temp);
3608 strcat(info->path_tmp, "\\");
3609 CreateDirectoryA(info->path_tmp, NULL);
3610
3611 sprintf(info->path_dll, "%s%s", info->path_tmp, "sxs_dll.dll");
3612 extract_resource(path_dll, "TESTDLL", info->path_dll);
3613
3614 sprintf(info->path_manifest_exe, "%s%s", info->path_tmp, "exe.manifest");
3615 create_manifest_file(info->path_manifest_exe, exe_manifest, -1, NULL, NULL);
3616
3617 sprintf(info->path_manifest_dll, "%s%s", info->path_tmp, "sxs_dll.manifest");
3618 create_manifest_file(info->path_manifest_dll, dll_manifest, -1, NULL, NULL);
3619
3620 info->context.cbSize = sizeof(ACTCTXA);
3621 info->context.lpSource = info->path_manifest_exe;
3622 info->context.lpAssemblyDirectory = info->path_tmp;
3623 info->context.dwFlags = ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID;
3624
3625 info->handle_context = CreateActCtxA(&info->context);
3626 ok((info->handle_context != NULL && info->handle_context != INVALID_HANDLE_VALUE )
3627 || broken(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX), /* XP doesn't support manifests outside of PE files */
3628 "CreateActCtxA failed: %ld\n", GetLastError());
3630 {
3631 skip("Failed to create activation context.\n");
3632 return FALSE;
3633 }
3634
3635 if (do_load)
3636 {
3637 success = ActivateActCtx(info->handle_context, &info->cookie);
3638 ok(success, "ActivateActCtx failed: %ld\n", GetLastError());
3639
3640 info->module = LoadLibraryA("sxs_dll.dll");
3641 ok(info->module != NULL, "LoadLibrary failed\n");
3642
3643 info->get_path = (void *)GetProcAddress(info->module, "get_path");
3644 ok(info->get_path != NULL, "GetProcAddress failed\n");
3645
3646 DeactivateActCtx(0, info->cookie);
3647 }
3648 return TRUE;
3649}
3650
3652{
3653 if (info->handle_context)
3654 ReleaseActCtx(info->handle_context);
3655 if (*info->path_dll)
3656 {
3657 BOOL ret = DeleteFileA(info->path_dll);
3658 ok(ret, "DeleteFileA failed for %s: %ld\n", info->path_dll, GetLastError());
3659 }
3660 if (*info->path_manifest_exe)
3661 {
3662 BOOL ret = DeleteFileA(info->path_manifest_exe);
3663 ok(ret, "DeleteFileA failed for %s: %ld\n", info->path_manifest_exe, GetLastError());
3664 }
3665 if (*info->path_manifest_dll)
3666 {
3667 BOOL ret = DeleteFileA(info->path_manifest_dll);
3668 ok(ret, "DeleteFileA failed for %s: %ld\n", info->path_manifest_dll, GetLastError());
3669 }
3670 if (*info->path_tmp)
3671 {
3672 BOOL ret = RemoveDirectoryA(info->path_tmp);
3673 ok(ret, "RemoveDirectoryA failed for %s: %ld\n", info->path_tmp, GetLastError());
3674 }
3675}
3676
3678{
3679 char *end;
3681 end = strrchr(buffer, '\\');
3682 end[1] = 0;
3683}
3684
3685/* Test loading two sxs dlls at the same time */
3687{
3688 sxs_info dll_1;
3689 sxs_info dll_2;
3690 char path1[MAX_PATH], path2[MAX_PATH];
3691
3692 if (!fill_sxs_info(&dll_1, "1", "dummy.dll", two_dll_manifest_exe, two_dll_manifest_dll, TRUE))
3693 goto cleanup1;
3694 if (!fill_sxs_info(&dll_2, "2", "dummy.dll", two_dll_manifest_exe, two_dll_manifest_dll, TRUE))
3695 goto cleanup2;
3696
3697 ok(dll_1.module != dll_2.module, "Libraries are the same\n");
3698 dll_1.get_path(path1, sizeof(path1));
3699 ok(strcmp(path1, dll_1.path_dll) == 0, "Got '%s', expected '%s'\n", path1, dll_1.path_dll);
3700 dll_2.get_path(path2, sizeof(path2));
3701 ok(strcmp(path2, dll_2.path_dll) == 0, "Got '%s', expected '%s'\n", path2, dll_2.path_dll);
3702
3703cleanup2:
3704 if (dll_2.module)
3705 FreeLibrary(dll_2.module);
3706 clean_sxs_info(&dll_2);
3707cleanup1:
3708 if (dll_1.module)
3709 FreeLibrary(dll_1.module);
3710 clean_sxs_info(&dll_1);
3711}
3712
3713/* Test loading a normal dll and then a sxs dll with the same name */
3715{
3716 sxs_info dll;
3717 char path_dll_local[MAX_PATH + 11];
3718 char path_application[MAX_PATH];
3720 char path1[MAX_PATH], path2[MAX_PATH];
3721 void (WINAPI *get_path)(char *buffer, int buffer_size);
3722
3723 get_application_directory(path_application, sizeof(path_application));
3724
3725 sprintf(path_dll_local, "%s%s", path_application, "sxs_dll.dll");
3726 extract_resource("dummy.dll", "TESTDLL", path_dll_local);
3727
3728 module = LoadLibraryA(path_dll_local);
3729 get_path = (void *)GetProcAddress(module, "get_path");
3730
3731 if (!fill_sxs_info(&dll, "1", "dummy.dll", two_dll_manifest_exe, two_dll_manifest_dll, TRUE))
3732 goto cleanup;
3733
3734 ok(dll.module != module, "Libraries are the same\n");
3735 dll.get_path(path1, sizeof(path1));
3736 ok(strcmp(path1, dll.path_dll) == 0, "Got '%s', expected '%s'\n", path1, dll.path_dll);
3737 get_path(path2, sizeof(path2));
3738 ok(strcmp(path2, path_dll_local) == 0, "Got '%s', expected '%s'\n", path2, path_dll_local);
3739
3740cleanup:
3741 if (module)
3743 if (dll.module)
3744 FreeLibrary(dll.module);
3745 if (*path_dll_local)
3746 {
3747 BOOL success = DeleteFileA(path_dll_local);
3748 ok(success, "DeleteFileA failed for %s: %ld\n", path_dll_local, GetLastError());
3749 }
3750 clean_sxs_info(&dll);
3751}
3752
3753/* Test if sxs dll has priority over normal dll */
3755{
3756 sxs_info dll;
3757 char path_dll_local[MAX_PATH + 11];
3758 char path_application[MAX_PATH];
3760 char path1[MAX_PATH], path2[MAX_PATH];
3761 void (WINAPI *get_path)(char *buffer, int buffer_size);
3762
3763 get_application_directory(path_application, sizeof(path_application));
3764
3765 sprintf(path_dll_local, "%s%s", path_application, "sxs_dll.dll");
3766 extract_resource("dummy.dll", "TESTDLL", path_dll_local);
3767
3768 if (!fill_sxs_info(&dll, "1", "dummy.dll", two_dll_manifest_exe, two_dll_manifest_dll, TRUE))
3769 goto cleanup;
3770
3771 module = LoadLibraryA(path_dll_local);
3772 get_path = (void *)GetProcAddress(module, "get_path");
3773
3774 ok(dll.module != module, "Libraries are the same\n");
3775 dll.get_path(path1, sizeof(path1));
3776 ok(strcmp(path1, dll.path_dll) == 0, "Got '%s', expected '%s'\n", path1, dll.path_dll);
3777 get_path(path2, sizeof(path2));
3778 ok(strcmp(path2, path_dll_local) == 0, "Got '%s', expected '%s'\n", path2, path_dll_local);
3779
3780cleanup:
3781 if (module)
3783 if (dll.module)
3784 FreeLibrary(dll.module);
3785 if (*path_dll_local)
3786 {
3787 BOOL success = DeleteFileA(path_dll_local);
3788 ok(success, "DeleteFileA failed for %s: %ld\n", path_dll_local, GetLastError());
3789 }
3790 clean_sxs_info(&dll);
3791}
3792
3793
3794/* Test if we can get a module handle from loaded normal dll while context is active */
3796{
3797 sxs_info dll;
3798 char path_dll_local[MAX_PATH + 11];
3799 char path_tmp[MAX_PATH];
3800 HMODULE module = NULL, module_temp;
3801 BOOL success;
3802
3803 GetTempPathA(sizeof(path_tmp), path_tmp);
3804
3805 sprintf(path_dll_local, "%s%s", path_tmp, "sxs_dll.dll");
3806 extract_resource("dummy.dll", "TESTDLL", path_dll_local);
3807
3808 module = LoadLibraryA(path_dll_local);
3809
3810 if (!fill_sxs_info(&dll, "1", "dummy.dll", two_dll_manifest_exe, two_dll_manifest_dll, FALSE))
3811 goto cleanup;
3812
3814 ok(success, "ActivateActCtx failed: %ld\n", GetLastError());
3815
3816 module_temp = GetModuleHandleA("sxs_dll.dll");
3817 ok (module_temp == 0, "Expected 0, got %p\n", module_temp);
3818
3819 DeactivateActCtx(0, dll.cookie);
3820
3821cleanup:
3822 if (module)
3824 if (dll.module)
3825 FreeLibrary(dll.module);
3826 if (*path_dll_local)
3827 {
3828 success = DeleteFileA(path_dll_local);
3829 ok(success, "DeleteFileA failed for %s: %ld\n", path_dll_local, GetLastError());
3830 }
3831 clean_sxs_info(&dll);
3832}
3833
3834static void test_builtin_sxs(void)
3835{
3836 char path_manifest[MAX_PATH + 12];
3837 char path_tmp[MAX_PATH];
3838 HMODULE module_msvcp = 0, module_msvcr = 0;
3839 char path_msvcp[MAX_PATH], path_msvcr[MAX_PATH];
3840 ACTCTXA context;
3842 HANDLE handle_context;
3843 BOOL success;
3844#ifdef __REACTOS__
3845 static char expected_path[MAX_PATH];
3846 GetWindowsDirectoryA(expected_path, sizeof(expected_path));
3847 strcat(expected_path, "\\WinSxS");
3848#else
3849 static const char *expected_path = "C:\\Windows\\WinSxS";
3850#endif
3851
3852 GetTempPathA(sizeof(path_tmp), path_tmp);
3853
3854 sprintf(path_manifest, "%s%s", path_tmp, "exe.manifest");
3855 create_manifest_file(path_manifest, builtin_dll_manifest, -1, NULL, NULL);
3856
3857 context.cbSize = sizeof(ACTCTXA);
3858 context.lpSource = path_manifest;
3859 context.lpAssemblyDirectory = path_tmp;
3860 context.dwFlags = ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID;
3861
3862 handle_context = CreateActCtxA(&context);
3863 ok((handle_context != NULL && handle_context != INVALID_HANDLE_VALUE )
3864 || broken(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX), /* XP doesn't support manifests outside of PE files */
3865 "CreateActCtxA failed: %ld\n", GetLastError());
3867 {
3868 skip("Failed to create activation context.\n");
3869 goto cleanup;
3870 }
3871
3872
3873 success = ActivateActCtx(handle_context, &cookie);
3874 ok(success, "ActivateActCtx failed: %ld\n", GetLastError());
3875
3876 module_msvcp = LoadLibraryA("msvcp90.dll");
3877 ok (module_msvcp != 0 || broken(module_msvcp == 0), "LoadLibraryA failed, %ld\n", GetLastError());
3878 module_msvcr = LoadLibraryA("msvcr90.dll");
3879 ok (module_msvcr != 0 || broken(module_msvcr == 0), "LoadLibraryA failed, %ld\n", GetLastError());
3880 if (!module_msvcp || !module_msvcr)
3881 {
3882 skip("Failed to find msvcp90 or msvcr90.\n");
3883 goto cleanup;
3884 }
3885
3886 GetModuleFileNameA(module_msvcp, path_msvcp, sizeof(path_msvcp));
3887 GetModuleFileNameA(module_msvcr, path_msvcr, sizeof(path_msvcr));
3888 ok(strnicmp(expected_path, path_msvcp, strlen(expected_path)) == 0, "Expected path to start with %s, got %s\n", expected_path, path_msvcp);
3889 ok(strnicmp(expected_path, path_msvcr, strlen(expected_path)) == 0, "Expected path to start with %s, got %s\n", expected_path, path_msvcr);
3890
3892
3893cleanup:
3894 if (module_msvcp)
3895 FreeLibrary(module_msvcp);
3896 if (module_msvcr)
3897 FreeLibrary(module_msvcr);
3898 if (*path_manifest)
3899 {
3900 success = DeleteFileA(path_manifest);
3901 ok(success, "DeleteFileA failed for %s: %ld\n", path_manifest, GetLastError());
3902 }
3903}
3904
3906{
3907 const char *name;
3910};
3911
3913{
3914 size_t count;
3916};
3917
3918static void add_sxs_dll_manifest(const char *pathname,
3919 const struct manifest_res_spec_list *res_lists,
3920 size_t num_lists,
3921 const char *manifest)
3922{
3923 HANDLE update_h;
3924 BOOL ret;
3925 size_t i, j;
3926
3927 update_h = BeginUpdateResourceA(pathname, FALSE);
3928 ok(update_h != NULL, "BeginUpdateResourceA returned error %lu.\n", GetLastError());
3929
3930 for (i = 0; i < num_lists; i++)
3931 {
3932 for (j = 0; j < res_lists[i].count; j++)
3933 {
3934 const struct manifest_res_spec *res_spec = &res_lists[i].items[j];
3935 const char *cur_manifest = res_spec->override_manifest ? res_spec->override_manifest : manifest;
3936 ret = UpdateResourceA(update_h,
3938 res_spec->name,
3939 res_spec->lang,
3940 (void *)cur_manifest,
3941 strlen(cur_manifest));
3942 ok(ret, "UpdateResourceA returned error %lu.\n", GetLastError());
3943 }
3944 }
3945
3946 ret = EndUpdateResourceA(update_h, FALSE);
3947 ok(ret, "EndUpdateResourceA returned error %lu.\n", GetLastError());
3948}
3949
3951{
3952 struct manifest_res_spec manifest_inline; /* optional */
3953 const struct manifest_res_spec *manifests; /* optional */
3955};
3956
3957#define subtest_manifest_res(d,e,t,l) subtest_manifest_res_(__LINE__,d,e,t,l)
3958static DWORD subtest_manifest_res_(int line, const char *manifest_exe, const char *manifest_dll,
3960{
3961 char path_tmp[MAX_PATH] = "", path_dll[MAX_PATH] = "", path_manifest_exe[MAX_PATH] = "";
3962 static const char path_tmp_suffix[] = "winek32t\\";
3964 struct manifest_res_spec_list res_lists[2];
3965 char path_tmp_lang[MAX_PATH] = "";
3966 static volatile LONG last_uniqid;
3967 DWORD err, prefix_len;
3968 ACTCTXA actctx;
3969 HANDLE handle;
3970 BOOL ret;
3971 int r;
3972
3973 prefix_len = GetTempPathA(MAX_PATH - ARRAY_SIZE(path_tmp_suffix), path_tmp);
3974 ok_(__FILE__, line)(prefix_len > 0, "GetTempPathA returned error %lu.\n", GetLastError());
3975
3976 memcpy(&path_tmp[prefix_len], path_tmp_suffix, sizeof(path_tmp_suffix) - sizeof(*path_tmp_suffix));
3977 ret = CreateDirectoryA(path_tmp, NULL);
3978 ok_(__FILE__, line)(ret || GetLastError() == ERROR_ALREADY_EXISTS,
3979 "CreateDirectoryA returned error %lu.\n", GetLastError());
3980
3981 if (lang)
3982 {
3983#if !defined(__REACTOS__) || DLL_EXPORT_VERSION >= 0x600
3986 ok(r > 0, "lang 0x%04x, error %lu.\n", lang, GetLastError());
3987#endif
3988 }
3989
3990 if (locale_name[0])
3991 {
3992 r = snprintf(path_tmp_lang, ARRAY_SIZE(path_tmp_lang), "%s%ls\\", path_tmp, locale_name);
3993 ok_(__FILE__, line)(r > 0 && r < ARRAY_SIZE(path_tmp_lang), "got %d\n", r);
3994
3995 ret = CreateDirectoryA(path_tmp_lang, NULL);
3996 ok_(__FILE__, line)(ret || GetLastError() == ERROR_ALREADY_EXISTS,
3997 "CreateDirectoryA returned error %lu.\n", GetLastError());
3998 }
3999 else
4000 {
4001 r = snprintf(path_tmp_lang, ARRAY_SIZE(path_tmp_lang), "%s", path_tmp);
4002 ok_(__FILE__, line)(r > 0 && r < ARRAY_SIZE(path_tmp_lang), "got %d\n", r);
4003 }
4004
4005 r = snprintf(path_dll, ARRAY_SIZE(path_dll), "%s%s", path_tmp_lang, "sxs_dll.dll");
4006 ok_(__FILE__, line)(r > 0 && r < ARRAY_SIZE(path_dll), "got %d\n", r);
4007
4008 r = snprintf(path_manifest_exe, ARRAY_SIZE(path_manifest_exe), "%sexe%08lx.manifest",
4009 path_tmp, InterlockedIncrement(&last_uniqid));
4010 ok_(__FILE__, line)(r > 0 && r < ARRAY_SIZE(path_manifest_exe), "got %d\n", r);
4011 create_manifest_file(path_manifest_exe, manifest_exe, -1, NULL, NULL);
4012
4013 extract_resource("dummy.dll", "TESTDLL", path_dll);
4014
4015 res_lists[0].count = test_data->manifest_inline.name ? 1 : 0;
4016 res_lists[0].items = &test_data->manifest_inline;
4017
4018 if (test_data->manifests)
4019 {
4020 size_t n = 0;
4021
4022 while (test_data->manifests[n].name)
4023 n++;
4024
4025 res_lists[1].count = n;
4026 res_lists[1].items = test_data->manifests;
4027 }
4028 else
4029 {
4030 res_lists[1].count = 0;
4031 res_lists[1].items = NULL;
4032 }
4033
4034 add_sxs_dll_manifest(path_dll, res_lists, ARRAY_SIZE(res_lists), manifest_dll);
4035
4036 memset(&actctx, 0, sizeof(actctx));
4037 actctx.cbSize = sizeof(actctx);
4038 actctx.lpSource = path_manifest_exe;
4039 actctx.lpAssemblyDirectory = path_tmp;
4040 actctx.dwFlags = ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID;
4041
4042 SetLastError(0xccccccccUL);
4045 {
4046 err = GetLastError();
4047 ok_(__FILE__, line)(err != ERROR_SUCCESS, "got %#lx.\n", err);
4048 }
4049 else
4050 {
4052 ok_(__FILE__, line)(handle != NULL, "CreateActCtxA returned %p (error %lu)\n", handle, err);
4054 }
4055 ok_(__FILE__, line)(err == test_data->expected_error,
4056 "expected error %lu, got %lu\n", test_data->expected_error, err);
4057
4058 ret = DeleteFileA(path_manifest_exe);
4059 ok_(__FILE__, line)(ret, "DeleteFileA(%s) returned error %lu\n.",
4060 debugstr_a(path_manifest_exe), GetLastError());
4061
4062 ret = DeleteFileA(path_dll);
4063 ok_(__FILE__, line)(ret, "DeleteFileA(%s) returned error %lu\n.", debugstr_a(path_dll), GetLastError());
4064
4065 if (locale_name[0])
4066 {
4067 ret = RemoveDirectoryA(path_tmp_lang);
4068 ok_(__FILE__, line)(ret, "RemoveDirectoryA(%s) returned error %lu\n.",
4069 debugstr_a(path_tmp_lang), GetLastError());
4070 }
4071
4072 ret = RemoveDirectoryA(path_tmp);
4073 ok_(__FILE__, line)(ret, "RemoveDirectoryA(%s) returned error %lu %s\n.",
4074 debugstr_a(path_tmp), GetLastError(), debugstr_a(path_tmp_lang));
4075
4076 return err;
4077}
4078
4079/* Test loading DLL with dependency assembly in manifest resource */
4081{
4082#ifdef __REACTOS__
4083 skip("test_manifest_resources() is invalid for WS03 - Win10 1607.\n");
4084#else
4085 static const struct manifest_res_spec wrong_manifest_resources_numbered[] = {
4088 { (char *)3, 0, wrong_manifest1 },
4089 { (char *)0x1234, 0, wrong_manifest1 },
4090 { NULL },
4091 };
4092 static const struct manifest_res_spec correct_manifest_resources_numbered[] = {
4093 { (char *)2, MAKELANGID(LANG_ENGLISH,SUBLANG_DEFAULT) },
4094 { (char *)2, MAKELANGID(LANG_FRENCH,SUBLANG_DEFAULT) },
4095 { (char *)3, 0 },
4096 { (char *)0x1234, 0 },
4097 { NULL },
4098 };
4099 static const struct manifest_res_spec wrong_manifest_resources_gte_3[] = {
4100 { (char *)3, 0, wrong_manifest1 },
4102 { NULL },
4103 };
4104 static const struct manifest_res_spec correct_manifest_resources_gte_3[] = {
4105 { (char *)3, 0 },
4106 { (char *)3, MAKELANGID(LANG_ENGLISH,SUBLANG_DEFAULT) },
4107 { NULL },
4108 };
4109 static const struct manifest_res_spec wrong_manifest_resources_named[] = {
4110 { "foo", 0, wrong_manifest1 },
4112 { NULL },
4113 };
4114 static const struct manifest_res_spec correct_manifest_resources_named[] = {
4115 { "foo", 0 },
4117 { NULL },
4118 };
4119 struct multiple_manifest_test tests[] = {
4120 /* Test well-known manifest resource IDs */
4124
4125 /* Test remaining reserved manifest resource IDs */
4126 { { (char *)4 }, NULL, ERROR_SUCCESS },
4127 { { (char *)5 }, NULL, ERROR_SUCCESS },
4128 { { (char *)6 }, NULL, ERROR_SUCCESS },
4129 { { (char *)7 }, NULL, ERROR_SUCCESS },
4130 { { (char *)8 }, NULL, ERROR_SUCCESS },
4131 { { (char *)9 }, NULL, ERROR_SUCCESS },
4132 { { (char *)10 }, NULL, ERROR_SUCCESS },
4133 { { (char *)11 }, NULL, ERROR_SUCCESS },
4134 { { (char *)12 }, NULL, ERROR_SUCCESS },
4135 { { (char *)13 }, NULL, ERROR_SUCCESS },
4136 { { (char *)14 }, NULL, ERROR_SUCCESS },
4137 { { (char *)15 }, NULL, ERROR_SUCCESS },
4139
4140 /* Test arbitrary resource IDs */
4141 { { (char *)0x1234 }, NULL, ERROR_SUCCESS },
4142 { { (char *)0x89ab }, NULL, ERROR_SUCCESS },
4143 { { (char *)0xffff }, NULL, ERROR_SUCCESS },
4144
4145 /* Test arbitrary LANGID */
4148 { { (char *)2, 0x1234 }, NULL, ERROR_SUCCESS },
4149 { { (char *)2, 0xffff }, NULL, ERROR_SUCCESS },
4150
4151 /* Test multiple manifest resources coexisting inside a module */
4152 { { (char *)2, 0 }, wrong_manifest_resources_numbered, ERROR_SUCCESS },
4153 { { (char *)2, 0, wrong_manifest1 }, correct_manifest_resources_numbered,
4155
4156 /* Test that smaller resource ID takes precedence regardless of language ID */
4157 { { (char *)2, MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL) },
4158 wrong_manifest_resources_gte_3, ERROR_SUCCESS },
4160 correct_manifest_resources_gte_3, ERROR_SXS_CANT_GEN_ACTCTX },
4161
4162 /* Test multiple manifest resources (ID / name) coexisting inside a module */
4163 { { (char *)2, 0 }, wrong_manifest_resources_named, ERROR_SUCCESS },
4164 { { (char *)2, 0, wrong_manifest1 },
4165 correct_manifest_resources_named, ERROR_SXS_CANT_GEN_ACTCTX },
4166
4167 /* Test name-only RT_MANIFEST resources */
4168 { { NULL }, correct_manifest_resources_named, ERROR_SXS_CANT_GEN_ACTCTX },
4169 };
4170 size_t i;
4171
4172 for (i = 0; i < ARRAY_SIZE(tests); i++)
4173 {
4174 winetest_push_context("tests[%Iu] (%p 0x%04x)", i,
4175 tests[i].manifest_inline.name, tests[i].manifest_inline.lang);
4178 }
4179#endif
4180}
4181
4182#define LANGID_PREC_MAX_COUNT 5
4183
4184static void get_langid_precedence(LANGID *langs_arr, size_t *lang_count)
4185{
4186 LANGID src_langs[LANGID_PREC_MAX_COUNT];
4187 LANGID user_ui_lang;
4188 size_t i, j, n = 0;
4189
4190 user_ui_lang = GetUserDefaultUILanguage();
4191
4192 src_langs[0] = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
4193 src_langs[1] = user_ui_lang;
4194 src_langs[2] = MAKELANGID(PRIMARYLANGID(user_ui_lang), SUBLANG_NEUTRAL);
4195 src_langs[3] = MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT);
4196 src_langs[4] = 0x1; /* least number that is a valid LANGID */
4197
4198 for (i = 0; i < ARRAY_SIZE(src_langs); i++)
4199 {
4200 LANGID item = src_langs[i];
4201 BOOL is_item_duplicate = FALSE;
4202
4203 for (j = 0; j < n; j++)
4204 {
4205 if (langs_arr[j] == item)
4206 {
4207 is_item_duplicate = TRUE;
4208 break;
4209 }
4210 }
4211
4212 if (!is_item_duplicate)
4213 {
4214 langs_arr[n++] = item;
4215 }
4216 }
4217
4218 *lang_count = n;
4219}
4220
4222{
4223 static const char manifest_exe_fmt[] =
4224 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
4225 "<dependency>"
4226 "<dependentAssembly>"
4227 "<assemblyIdentity type=\"win32\" name=\"sxs_dll\" version=\"1.0.0.0\""
4228 " processorArchitecture=\"" ARCH "\" publicKeyToken=\"0000000000000000\" language=\"%ls\"/>"
4229 "</dependentAssembly>"
4230 "</dependency>"
4231 "</assembly>";
4232 static const char manifest_dll_fmt[] =
4233 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v3\" manifestVersion=\"1.0\">"
4234 "<assemblyIdentity type=\"win32\" name=\"sxs_dll\" version=\"1.0.0.0\""
4235 " processorArchitecture=\"" ARCH "\" publicKeyToken=\"0000000000000000\" language=\"%ls\"/>"
4236 "</assembly>";
4237 static const char manifest_dll_nofmt[] =
4238 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v3\" manifestVersion=\"1.0\">"
4239 "<assemblyIdentity type=\"win32\" name=\"sxs_dll\" version=\"1.0.0.0\""
4240 " processorArchitecture=\"" ARCH "\" publicKeyToken=\"0000000000000000\"/>"
4241 "</assembly>";
4242 char manifest_exe[1024], manifest_dll[1024];
4244 UINT16 langs_arr[LANGID_PREC_MAX_COUNT];
4245 size_t lang_count = 0, i, j;
4246 int ret;
4247
4248 if (actctx_lang == MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL))
4249 {
4250 wcscpy(locale_name, L"*");
4251 strcpy(manifest_dll, manifest_dll_nofmt);
4252 }
4253 else
4254 {
4255 actctx_lang = ConvertDefaultLocale(actctx_lang);
4256 ok(actctx_lang != MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
4257 "unexpected neutral locale\n");
4258#if !defined(__REACTOS__) || DLL_EXPORT_VERSION >= 0x600
4259 ret = LCIDToLocaleName(MAKELCID(actctx_lang, SORT_DEFAULT),
4261 ok(ret > 0, "error %lu.\n", GetLastError());
4262#endif
4263
4264 ret = snprintf(manifest_dll, ARRAY_SIZE(manifest_dll), manifest_dll_fmt, locale_name);
4265 ok(ret > 0 && ret < ARRAY_SIZE(manifest_dll), "ret %d.\n", ret);
4266 }
4267
4268 ret = snprintf(manifest_exe, ARRAY_SIZE(manifest_exe), manifest_exe_fmt, locale_name);
4269 ok(ret > 0 && ret < ARRAY_SIZE(manifest_exe), "ret %d.\n", ret);
4270
4271 get_langid_precedence(langs_arr, &lang_count);
4272
4273 for (i = 0; i < lang_count; i++)
4274 {
4275 struct manifest_res_spec specs[ARRAY_SIZE(langs_arr) + 1];
4276 struct multiple_manifest_test test = { { NULL } };
4277 size_t num_specs;
4278 DWORD err;
4279
4280 winetest_push_context("langs[%Id:]", i);
4281
4282 /* Generate manifest spec list from language IDs.
4283 *
4284 * All manifest spec items point to the wrong manifest, expect for the
4285 * current language ID.
4286 */
4287 num_specs = 0;
4288 for (j = i; j < lang_count; j++)
4289 {
4290 struct manifest_res_spec spec = {(char *)2};
4291 spec.lang = langs_arr[j];
4292 if (j != i) spec.override_manifest = wrong_manifest1;
4293 ok(num_specs < ARRAY_SIZE(specs), "overrun\n");
4294 specs[num_specs++] = spec;
4295 }
4296 memset(&specs[num_specs++], 0, sizeof(*specs));
4297
4298 test.manifests = specs;
4299 test.expected_error = ERROR_SUCCESS;
4300 err = subtest_manifest_res(manifest_exe, manifest_dll, &test, actctx_lang);
4301
4302 if (winetest_debug > 1 && err != ERROR_SUCCESS)
4303 {
4304 for (j = 0; j < lang_count; j++)
4305 {
4306 trace("langs[%Id] = 0x%04x %c\n", j, langs_arr[j], j == i ? '<' : ' ');
4307 }
4308 }
4309
4311 }
4312}
4313
4315{
4316#ifdef __REACTOS__
4317 skip("test_valid_manifest_resources_locale() is invalid for WS03 - Win10 1607.\n");
4318#else
4319 static const LANGID langs[] = {
4322 };
4323 size_t i;
4324
4325 for (i = 0; i < ARRAY_SIZE(langs); i++)
4326 {
4327 winetest_push_context("[%Iu]lang=0x%04x", i, langs[i]);
4330 }
4331#endif
4332}
4333
4334static void run_sxs_test(int run)
4335{
4336 switch(run)
4337 {
4338 case 1:
4340 break;
4341 case 2:
4343 break;
4344 case 3:
4346 break;
4347 case 4:
4349 break;
4350 case 5:
4352 break;
4353 }
4354}
4355
4356static void run_child_process_two_dll(int run)
4357{
4358 char cmdline[MAX_PATH];
4359 char exe[MAX_PATH];
4360 char **argv;
4362 STARTUPINFOA si = { 0 };
4363 BOOL ret;
4364
4366
4367 if (strstr(argv[0], ".exe"))
4368 sprintf(exe, "%s", argv[0]);
4369 else
4370 sprintf(exe, "%s.exe", argv[0]);
4371 sprintf(cmdline, "\"%s\" %s two_dll %d", argv[0], argv[1], run);
4372
4373 si.cb = sizeof(si);
4374 ret = CreateProcessA(exe, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
4375 ok(ret, "Could not create process: %lu\n", GetLastError());
4376
4378
4381}
4382
4384{
4385 1, 1, 1, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, exe_path,
4386 ACTIVATION_CONTEXT_PATH_TYPE_NONE, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE,
4387 app_dir,
4388};
4389
4391{
4392 ACTCTXW ctx;
4393 HANDLE handle;
4394
4395#ifdef __REACTOS__
4397 skip("test_manifest_in_module() crashes on WS03.\n");
4398 return;
4399 }
4400#endif
4401 memset(&ctx, 0, sizeof(ctx));
4402 ctx.cbSize = sizeof(ctx);
4403 ctx.dwFlags = ACTCTX_FLAG_HMODULE_VALID | ACTCTX_FLAG_RESOURCE_NAME_VALID;
4404 ctx.lpResourceName = (LPWSTR)124;
4405 ctx.hModule = GetModuleHandleW(NULL);
4407 ok(handle != INVALID_HANDLE_VALUE, "CreateActCtx error %lu\n", GetLastError());
4408
4409 test_basic_info(handle, __LINE__);
4411
4413}
4414
4416{
4417 WCHAR pathbuf[MAX_PATH];
4418 HANDLE handle;
4419 ACTCTXW ctx;
4420 DWORD err, len;
4421
4422 memset(&ctx, 0, sizeof(ctx));
4423 ctx.cbSize = sizeof(ctx);
4424 ctx.dwFlags = ACTCTX_FLAG_HMODULE_VALID;
4425 ctx.hModule = GetModuleHandleW(NULL);
4427 err = GetLastError();
4428 ok(handle == INVALID_HANDLE_VALUE, "CreateActCtxW shall fail\n");
4429 todo_wine
4430#ifdef __REACTOS__
4431 ok(err == ERROR_RESOURCE_TYPE_NOT_FOUND || broken(err == ERROR_NOT_ENOUGH_MEMORY) /* WS03 */, "got %lu\n", err);
4432#else
4433 ok(err == ERROR_RESOURCE_TYPE_NOT_FOUND, "got %lu\n", err);
4434#endif
4435
4436 memset(&ctx, 0, sizeof(ctx));
4437 ctx.cbSize = sizeof(ctx);
4438 ctx.dwFlags = ACTCTX_FLAG_HMODULE_VALID | ACTCTX_FLAG_RESOURCE_NAME_VALID;
4439 ctx.hModule = GetModuleHandleW(NULL);
4440 ctx.lpResourceName = NULL;
4442 err = GetLastError();
4443 ok(handle == INVALID_HANDLE_VALUE, "CreateActCtxW shall fail\n");
4444#ifdef __REACTOS__
4445 ok(err == ERROR_INVALID_PARAMETER || broken(err == ERROR_NOT_ENOUGH_MEMORY) /* WS03 */, "got %lu\n", err);
4446#else
4447 ok(err == ERROR_INVALID_PARAMETER, "got %lu\n", err);
4448#endif
4449
4450 len = GetModuleFileNameW(NULL, pathbuf, ARRAY_SIZE(pathbuf));
4451 ok(len > 0 && len < ARRAY_SIZE(pathbuf), "GetModuleFileNameW returned error %lu\n", GetLastError());
4452
4453 memset(&ctx, 0, sizeof(ctx));
4454 ctx.cbSize = sizeof(ctx);
4455 ctx.lpSource = pathbuf;
4456 ctx.dwFlags = 0;
4458 err = GetLastError();
4459 ok(handle == INVALID_HANDLE_VALUE, "CreateActCtxW shall fail\n");
4460 todo_wine
4461 ok(err == ERROR_RESOURCE_TYPE_NOT_FOUND, "got %lu\n", err);
4462
4463 memset(&ctx, 0, sizeof(ctx));
4464 ctx.cbSize = sizeof(ctx);
4465 ctx.lpSource = pathbuf;
4466 ctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID;
4467 ctx.lpResourceName = NULL;
4469 err = GetLastError();
4470 ok(handle == INVALID_HANDLE_VALUE, "CreateActCtxW shall fail\n");
4471 ok(err == ERROR_INVALID_PARAMETER, "got %lu\n", err);
4472}
4473
4475{
4476 int argc;
4477 char **argv;
4478
4480
4481 if (!init_funcs())
4482 {
4483 win_skip("Needed functions are not available\n");
4484 return;
4485 }
4486 init_paths();
4487
4488 if(argc > 2 && !strcmp(argv[2], "manifest1")) {
4490 return;
4491 }
4492
4493 if (argc > 2 && !strcmp(argv[2], "two_dll"))
4494 {
4495 int run = atoi(argv[3]);
4496 run_sxs_test(run);
4497 return;
4498 }
4499
4504 test_actctx();
4512 test_settings();
4513#ifdef __REACTOS__
4515#endif
4521#ifdef __REACTOS__
4522 }
4523#endif
4524}
int WINAPI LCIDToLocaleName(_In_ LCID Locale, _Out_writes_opt_(cchName) LPWSTR lpName, _In_ int cchName, _In_ DWORD dwFlags)
std::set< LANGID > langs
Definition: LocaleTests.cpp:65
unsigned short UINT16
static int argc
Definition: ServiceArgs.c:12
#define VOID
Definition: acefi.h:82
#define GetNTVersion()
Definition: apitest.h:17
unsigned int dir
Definition: maze.c:112
#define InterlockedIncrement
Definition: armddk.h:53
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
static const WCHAR ctxW[]
Definition: axinstall.c:33
LONG NTSTATUS
Definition: precomp.h:26
static const WCHAR nameW[]
Definition: main.c:49
#define index(s, c)
Definition: various.h:29
#define ARRAY_SIZE(A)
Definition: main.h:20
HMODULE hLibrary
Definition: odbccp32.c:12
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NTSTATUS
Definition: precomp.h:19
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define FreeLibrary(x)
Definition: compat.h:748
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define lstrcpyW
Definition: compat.h:749
#define MultiByteToWideChar
Definition: compat.h:110
#define FILE_SHARE_READ
Definition: compat.h:136
#define lstrlenW
Definition: compat.h:750
static const WCHAR version[]
Definition: asmname.c:66
static void cleanup(void)
Definition: main.c:1335
BOOL WINAPI ZombifyActCtx(HANDLE hActCtx)
Definition: actctx.c:219
VOID WINAPI ReleaseActCtx(IN HANDLE hActCtx)
Definition: actctx.c:208
BOOL WINAPI DeactivateActCtx(IN DWORD dwFlags, IN ULONG_PTR ulCookie)
Definition: actctx.c:268
BOOL WINAPI QueryActCtxW(IN DWORD dwFlags, IN HANDLE hActCtx, IN PVOID pvSubInstance, IN ULONG ulInfoClass, IN PVOID pvBuffer, IN SIZE_T cbBuffer, IN OUT SIZE_T *pcbWrittenOrRequired OPTIONAL)
Definition: actctx.c:328
BOOL WINAPI GetCurrentActCtx(OUT PHANDLE phActCtx)
Definition: actctx.c:298
BOOL WINAPI ActivateActCtx(IN HANDLE hActCtx, OUT PULONG_PTR ulCookie)
Definition: actctx.c:237
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714
BOOL WINAPI CreateDirectoryW(IN LPCWSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:90
BOOL WINAPI RemoveDirectoryW(IN LPCWSTR lpPathName)
Definition: dir.c:732
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
BOOL WINAPI SetFileTime(IN HANDLE hFile, CONST FILETIME *lpCreationTime OPTIONAL, CONST FILETIME *lpLastAccessTime OPTIONAL, CONST FILETIME *lpLastWriteTime OPTIONAL)
Definition: fileinfo.c:948
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:159
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2080
UINT WINAPI GetWindowsDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2337
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2249
BOOL WINAPI SetCurrentDirectoryA(IN LPCSTR lpPathName)
Definition: path.c:2206
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2054
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4749
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
BOOL WINAPI FindActCtxSectionStringW(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, LPCWSTR lpSearchStr, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:238
HANDLE WINAPI CreateActCtxA(PCACTCTXA pActCtx)
Definition: actctx.c:26
BOOL WINAPI FindActCtxSectionStringA(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, LPCSTR lpSearchStr, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:206
HANDLE WINAPI CreateActCtxW(PCACTCTXW pActCtx)
Definition: actctx.c:102
BOOL WINAPI FindActCtxSectionGuid(DWORD dwFlags, const GUID *lpExtGuid, ULONG ulId, const GUID *lpSearchGuid, PACTCTX_SECTION_KEYED_DATA pInfo)
Definition: actctx.c:265
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
BOOL WINAPI UpdateResourceA(HANDLE hUpdate, LPCSTR lpType, LPCSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cbData)
Definition: res.c:1738
HANDLE WINAPI BeginUpdateResourceA(LPCSTR pFileName, BOOL bDeleteExistingResources)
Definition: res.c:1657
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
BOOL WINAPI EndUpdateResourceA(HANDLE hUpdate, BOOL fDiscard)
Definition: res.c:1697
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4246
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: locale.c:1380
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4265
LCID WINAPI ConvertDefaultLocale(LCID lcid)
Definition: locale.c:2879
BOOL WINAPI IsDebuggerPresent(void)
Definition: debug.c:167
GUID guid
Definition: version.c:147
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
_ACRTIMP int __cdecl atoi(const char *)
Definition: string.c:1715
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
_ACRTIMP char *__cdecl strstr(const char *, const char *)
Definition: string.c:3415
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
_ACRTIMP char *__cdecl strrchr(const char *, int)
Definition: string.c:3298
comclass_miscfields
Definition: compobj.c:99
comclass_threadingmodel
Definition: compobj.c:90
static const WCHAR versionW[]
Definition: name.c:52
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#define progid(str)
Definition: exdisp.idl:31
static unsigned char buff[32768]
Definition: fatten.c:17
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
time_t now
Definition: finger.c:65
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
GLuint res
Definition: glext.h:9613
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
GLuint index
Definition: glext.h:6031
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
GLsizei const GLuint * paths
Definition: glext.h:11717
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static const WCHAR helpW[]
Definition: htmlevent.c:70
NTSYSAPI NTSTATUS WINAPI RtlFindActivationContextSectionString(ULONG, const GUID *, ULONG, const UNICODE_STRING *, PVOID)
Definition: actctx.c:5874
const char * filename
Definition: ioapi.h:137
static const WCHAR trueW[]
Definition: json.c:33
static const WCHAR sourceW[]
Definition: jsregexp.c:37
#define b
Definition: ke_i.h:79
#define debugstr_a
Definition: kernel32.h:31
#define actctx
Definition: kernel32.h:8
#define debugstr_w
Definition: kernel32.h:32
#define wine_dbgstr_w
Definition: kernel32.h:34
USHORT LANGID
Definition: mui.h:9
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
int winetest_debug
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
#define win_skip
Definition: minitest.h:67
#define todo_wine_if(is_todo)
Definition: minitest.h:81
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
#define todo_wine
Definition: minitest.h:80
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct task_struct * current
Definition: linux.c:32
char pathname[512]
Definition: util.h:13
#define CREATE_ALWAYS
Definition: disk.h:72
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define TRUNCATE_EXISTING
Definition: disk.h:71
#define FILE_FLAG_DELETE_ON_CLOSE
Definition: disk.h:42
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static PVOID ptr
Definition: dispmode.c:27
static struct test_info tests[]
#define sprintf
Definition: sprintf.c:45
static void test_create(void)
Definition: monthcal.c:1595
BOOL todo
Definition: filedlg.c:313
struct _test_act_ctx_compat_info test_act_ctx_compat_info
winrt_threading_model
Definition: actctx.c:1441
@ WINRT_THREADING_MODEL_BOTH
Definition: actctx.c:1442
@ WINRT_THREADING_MODEL_MTA
Definition: actctx.c:1444
@ WINRT_THREADING_MODEL_STA
Definition: actctx.c:1443
static const char wrong_manifest2[]
Definition: actctx.c:338
static const char two_dll_manifest_exe[]
Definition: actctx.c:537
static void test_typelib_section(void)
Definition: actctx.c:2104
static void test_CreateActCtx(void)
Definition: actctx.c:2817
static const char wrong_manifest1[]
Definition: actctx.c:333
static const char wrong_manifest7[]
Definition: actctx.c:365
static WCHAR work_dir_subdir[MAX_PATH]
Definition: actctx.c:586
static void write_manifest(const char *filename, const char *manifest)
Definition: actctx.c:2775
static const char empty_assembly_manifest[]
Definition: actctx.c:562
static BOOL init_funcs(void)
Definition: actctx.c:3117
static void test_no_compat(HANDLE handle, int line)
Definition: actctx.c:3228
static const char manifest9[]
Definition: actctx.c:274
static SIZE_T *static const GUID PACTCTX_SECTION_KEYED_DATA
Definition: actctx.c:34
static const char wrong_manifest11[]
Definition: actctx.c:410
static WCHAR exe_path[MAX_PATH]
Definition: actctx.c:586
static const char manifest5[]
Definition: actctx.c:226
static void test_dllredirect_section(void)
Definition: actctx.c:2053
static void test_find_progid_redirection(HANDLE handle, const GUID *clsid, const char *progid, ULONG exid, int line)
Definition: actctx.c:1934
static const info_in_assembly manifest1_child_info
Definition: actctx.c:813
static const info_in_assembly manifest3_info
Definition: actctx.c:825
@ MiscStatusContent
Definition: actctx.c:1581
@ MiscStatusThumbnail
Definition: actctx.c:1582
@ MiscStatus
Definition: actctx.c:1579
@ MiscStatusDocPrint
Definition: actctx.c:1583
@ MiscStatusIcon
Definition: actctx.c:1580
static const char builtin_dll_manifest[]
Definition: actctx.c:546
static const char wrong_manifest9[]
Definition: actctx.c:377
static void test_find_string_fail(void)
Definition: actctx.c:1503
static WCHAR app_manifest_path[MAX_PATH]
Definition: actctx.c:587
static SIZE_T *static const GUID PUNICODE_STRING
Definition: actctx.c:34
static const char compat_manifest_no_supportedOs[]
Definition: actctx.c:423
static const char testdep_manifest3[]
Definition: actctx.c:323
static const runlevel_info_t runlevel_info9
Definition: actctx.c:1034
static void test_one_sxs_and_one_local_1(void)
Definition: actctx.c:3714
static PCSZ
Definition: actctx.c:35
static const char manifest4[]
Definition: actctx.c:213
static const runlevel_info_t runlevel_info0
Definition: actctx.c:1018
static void test_actctx(void)
Definition: actctx.c:2194
static BOOL create_manifest_file(const char *filename, const char *manifest, int manifest_len, const char *depfile, const char *depmanifest)
Definition: actctx.c:589
static const char manifest6[]
Definition: actctx.c:237
static void test_one_with_sxs_and_GetModuleHandleA(void)
Definition: actctx.c:3795
static const char manifest_wndcls1[]
Definition: actctx.c:173
static void test_compatibility(void)
Definition: actctx.c:3301
static void test_two_dlls_at_same_time(void)
Definition: actctx.c:3686
static const char wrong_manifest10[]
Definition: actctx.c:390
#define X(f)
static void test_settings(void)
Definition: actctx.c:3427
static const char manifest3[]
Definition: actctx.c:86
#define DLL_REDIRECT_PATH_OMITS_ASSEMBLY_ROOT
Definition: actctx.c:1257
static const char testdep_manifest2[]
Definition: actctx.c:316
static const char manifest1_1[]
Definition: actctx.c:55
static const WCHAR testlib_dll[]
Definition: actctx.c:573
static void init_paths(void)
Definition: actctx.c:2751
static const char manifest_wndcls2[]
Definition: actctx.c:184
static HANDLE
Definition: actctx.c:32
#define subtest_manifest_res(d, e, t, l)
Definition: actctx.c:3957
static void kernel32_find(ULONG section, const char *string_to_find, BOOL should_find, BOOL todo, int line)
Definition: actctx.c:2598
static void test_manifest_in_module(void)
Definition: actctx.c:4390
static const info_in_assembly depmanifest3_info
Definition: actctx.c:851
static const char manifest2[]
Definition: actctx.c:60
static void test_builtin_sxs(void)
Definition: actctx.c:3834
static const char testdep_manifest1[]
Definition: actctx.c:311
static const char manifest7[]
Definition: actctx.c:249
static WCHAR depmanifest_path[MAX_PATH]
Definition: actctx.c:587
static void test_create_and_fail(const char *manifest, const char *depmanifest, int todo, BOOL is_broken)
Definition: actctx.c:1094
static const char settings_manifest3[]
Definition: actctx.c:504
static void test_ZombifyActCtx(void)
Definition: actctx.c:3133
static void add_sxs_dll_manifest(const char *pathname, const struct manifest_res_spec_list *res_lists, size_t num_lists, const char *manifest)
Definition: actctx.c:3918
static const char settings_manifest[]
Definition: actctx.c:468
static const detailed_info_t detailed_info3
Definition: actctx.c:4383
ifaceps_mask
Definition: actctx.c:1779
@ BaseIface
Definition: actctx.c:1781
@ NumMethods
Definition: actctx.c:1780
static const char two_dll_manifest_dll[]
Definition: actctx.c:531
static void run_sxs_test(int run)
Definition: actctx.c:4334
static void test_with_compat(HANDLE handle, DWORD num_compat, DWORD num_version, const GUID *expected_compat[], const ULONGLONG expected_version[], int line)
Definition: actctx.c:3245
static void test_valid_manifest_resources_locale(void)
Definition: actctx.c:4314
static HANDLE create_manifest(const char *filename, const char *data, int line)
Definition: actctx.c:2585
#define ARCH
Definition: actctx.c:47
static void test_find_dll_redirection(HANDLE handle, LPCWSTR libname, ULONG exid, int line)
Definition: actctx.c:1282
static const char wrong_manifest4[]
Definition: actctx.c:348
static void subtest_valid_manifest_resources_locale(LANGID actctx_lang)
Definition: actctx.c:4221
static BOOL create_wide_manifest(const char *filename, const char *manifest, BOOL fBOM, BOOL fReverse)
Definition: actctx.c:625
static LPWSTR
Definition: actctx.c:32
static void test_one_sxs_and_one_local_2(void)
Definition: actctx.c:3754
static const char settings_manifest2[]
Definition: actctx.c:479
static void test_manifest_resources(void)
Definition: actctx.c:4080
static const char wrong_manifest6[]
Definition: actctx.c:360
static const char manifest11[]
Definition: actctx.c:305
static void get_langid_precedence(LANGID *langs_arr, size_t *lang_count)
Definition: actctx.c:4184
static const runlevel_info_t runlevel_info7
Definition: actctx.c:1026
static void test_create_fail(void)
Definition: actctx.c:1143
static void delete_manifest_file(const char *filename)
Definition: actctx.c:2790
static const info_in_assembly manifest1_info
Definition: actctx.c:807
static const char manifest_wndcls_main[]
Definition: actctx.c:198
static const info_in_assembly manifest_comctrl_info
Definition: actctx.c:857
static void test_findsectionstring(void)
Definition: actctx.c:2674
static void clean_sxs_info(sxs_info *info)
Definition: actctx.c:3651
static void test_basic_info(HANDLE handle, int line)
Definition: actctx.c:1536
static const WCHAR testlib2_dll[]
Definition: actctx.c:575
static const info_in_assembly manifest2_info
Definition: actctx.c:819
static DWORD subtest_manifest_res_(int line, const char *manifest_exe, const char *manifest_dll, const struct multiple_manifest_test *test_data, LANGID lang)
Definition: actctx.c:3958
static const info_in_assembly depmanifest2_info
Definition: actctx.c:844
static const char wrong_manifest5[]
Definition: actctx.c:354
static void run_child_process(void)
Definition: actctx.c:2713
static void test_wndclass_section(void)
Definition: actctx.c:1992
static void get_application_directory(char *buffer, int buffer_size)
Definition: actctx.c:3677
static const char manifest10[]
Definition: actctx.c:292
static HANDLE create_temp_manifest_file(const char *manifest, WCHAR *pathname)
Definition: actctx.c:644
static void test_find_activatable_class(HANDLE handle, const WCHAR *classid, enum winrt_threading_model threading_model, const WCHAR *file, ULONG exid, int line)
Definition: actctx.c:1456
static void extract_resource(const char *name, const char *type, const char *path)
Definition: actctx.c:2799
static const char wrong_manifest8[]
Definition: actctx.c:371
static const detailed_info_t detailed_info1_child
Definition: actctx.c:709
static void test_find_surrogate(HANDLE handle, const GUID *clsid, const WCHAR *name, const WCHAR *version, ULONG exid, int line)
Definition: actctx.c:1867
static const char compat_manifest_vista[]
Definition: actctx.c:432
static WCHAR work_dir[MAX_PATH]
Definition: actctx.c:586
static const WCHAR wndClass2W[]
Definition: actctx.c:581
static const char compat_manifest_vista_7_8_10_81[]
Definition: actctx.c:442
static const char compat_manifest_other_guid[]
Definition: actctx.c:458
static BOOL fill_sxs_info(sxs_info *info, const char *temp, const char *path_dll, const char *exe_manifest, const char *dll_manifest, BOOL do_load)
Definition: actctx.c:3602
static const WCHAR wndClass3W[]
Definition: actctx.c:583
static void ntdll_find(ULONG section, const char *string_to_find, BOOL should_find, BOOL todo, int line)
Definition: actctx.c:2650
static const char manifest1[]
Definition: actctx.c:50
static const detailed_info_t detailed_info2
Definition: actctx.c:716
static SIZE_T
Definition: actctx.c:32
static void test_find_ifaceps_redirection(HANDLE handle, const GUID *iid, const GUID *tlbid, const GUID *base, const GUID *ps32, ULONG exid, int line)
Definition: actctx.c:1796
static void test_info_in_assembly(HANDLE handle, DWORD id, const info_in_assembly *exinfo, int line)
Definition: actctx.c:861
static SIZE_T *static const GUID ULONG
Definition: actctx.c:34
static void test_allowDelayedBinding(void)
Definition: actctx.c:2171
static const info_in_assembly manifest4_info
Definition: actctx.c:831
#define GUIDSECTION_MAGIC
#define LANGID_PREC_MAX_COUNT
Definition: actctx.c:4182
static const char wrong_manifest3[]
Definition: actctx.c:343
static const char wrong_depmanifest1[]
Definition: actctx.c:418
static void test_CreateActCtx_share_mode(void)
Definition: actctx.c:3092
static const info_in_assembly depmanifest1_info
Definition: actctx.c:837
static const runlevel_info_t runlevel_info6
Definition: actctx.c:1022
static void test_runlevel_info(HANDLE handle, const runlevel_info_t *exinfo, int line)
Definition: actctx.c:1038
static const WCHAR wndClassW[]
Definition: actctx.c:577
static const WCHAR wndClass1W[]
Definition: actctx.c:579
static void test_find_com_redirection(HANDLE handle, const GUID *clsid, const GUID *tlid, const WCHAR *progid, ULONG exid, int line)
Definition: actctx.c:1642
static const detailed_info_t detailed_info0
Definition: actctx.c:699
static const runlevel_info_t runlevel_info8
Definition: actctx.c:1030
static void test_find_window_class(HANDLE handle, LPCWSTR clsname, ULONG exid, int line)
Definition: actctx.c:1346
static void test_app_manifest(void)
Definition: actctx.c:2567
static void run_child_process_two_dll(int run)
Definition: actctx.c:4356
@ ThreadingModel_No
Definition: actctx.c:1573
@ ThreadingModel_Both
Definition: actctx.c:1574
@ ThreadingModel_Neutral
Definition: actctx.c:1575
@ ThreadingModel_Free
Definition: actctx.c:1572
@ ThreadingModel_Apartment
Definition: actctx.c:1571
static void test_manifest_resource_name_omitted(void)
Definition: actctx.c:4415
static const char settings_manifest4[]
Definition: actctx.c:514
static WCHAR manifest_path[MAX_PATH]
Definition: actctx.c:587
static WCHAR app_dir[MAX_PATH]
Definition: actctx.c:586
static void test_create_wide_and_fail(const char *manifest, BOOL fBOM)
Definition: actctx.c:1123
static const detailed_info_t detailed_info1
Definition: actctx.c:703
static void test_detailed_info(HANDLE handle, const detailed_info_t *exinfo, int line)
Definition: actctx.c:722
static void validate_guid_index(const ACTCTX_SECTION_KEYED_DATA *data, int line)
Definition: actctx.c:1619
static const char manifest8[]
Definition: actctx.c:261
static PROCESS_INFORMATION pi
Definition: debugger.c:2303
static const WCHAR pathW[]
Definition: path.c:2368
static SYSTEM_INFO si
Definition: virtual.c:39
static const WCHAR dummyW[]
Definition: directory.c:79
static const WCHAR progidW[]
Definition: compobj.c:112
static const WCHAR path1[]
Definition: path.c:28
static const WCHAR path2[]
Definition: path.c:29
#define argv
Definition: mplay32.c:18
const CLSID * clsid
Definition: msctf.cpp:50
unsigned int UINT
Definition: ndis.h:50
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
HMODULE hModule
Definition: netsh.c:17
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
#define DELETE
Definition: nt_native.h:57
#define BOOL
Definition: nt_native.h:43
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define DWORD
Definition: nt_native.h:44
#define GENERIC_WRITE
Definition: nt_native.h:90
#define LOCALE_NAME_MAX_LENGTH
#define SORT_DEFAULT
#define MAKELCID(lgid, srtid)
static void test_file_info(void)
Definition: pipe.c:1262
#define STATUS_SXS_KEY_NOT_FOUND
Definition: ntstatus.h:1777
#define BOOLEAN
Definition: pedump.c:73
long LONG
Definition: pedump.c:60
static Character const *__cdecl get_path()
Definition: popen.cpp:172
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
Definition: guiddef.h:68
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define err(...)
#define test
Definition: rosglue.h:37
static calc_node_t temp
Definition: rpn_ieee.c:38
#define offsetof(TYPE, MEMBER)
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_ENGLISH
Definition: nls.h:52
#define SUBLANG_NEUTRAL
Definition: nls.h:167
#define SUBLANG_DEFAULT
Definition: nls.h:168
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define LANG_INVARIANT
Definition: nls.h:23
#define LANG_FRENCH
Definition: nls.h:58
wcscat
wcscpy
strcat
Definition: string.h:92
strcpy
Definition: string.h:131
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
#define is_reactos()
Definition: test.h:1041
int winetest_get_mainargs(char ***pargv)
#define wait_child_process
Definition: test.h:177
#define memset(x, y, z)
Definition: compat.h:39
static const WCHAR dpiAwarenessW[]
Definition: actctx.c:723
@ LIBFLAG_FRESTRICTED
Definition: actctx.c:72
@ LIBFLAG_FCONTROL
Definition: actctx.c:73
@ LIBFLAG_FHIDDEN
Definition: actctx.c:74
static const WCHAR dpiAwareW[]
Definition: actctx.c:722
static const WCHAR mscoree2W[]
Definition: actctx.c:680
static const WCHAR mscoreeW[]
Definition: actctx.c:679
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
#define STATUS_SUCCESS
Definition: shellext.h:65
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
TCHAR * cmdline
Definition: stretchblt.cpp:32
COMPATIBILITY_CONTEXT_ELEMENT Elements[10]
Definition: actctx.c:3211
ULONG module_len
Definition: sxs.c:94
DWORD res2[2]
Definition: sxs.c:100
DWORD res[2]
Definition: sxs.c:93
ULONG size
Definition: sxs.c:92
ULONG version_offset
Definition: sxs.c:99
ULONG name_offset
Definition: sxs.c:97
ULONG module_offset
Definition: sxs.c:95
ULONG name_len
Definition: sxs.c:96
ULONG version_len
Definition: sxs.c:98
ULONG version_len
Definition: actctx.c:1862
ULONG name_offset
Definition: actctx.c:1863
ULONG version_offset
Definition: actctx.c:1861
DWORD miscstatusdocprint
Definition: compobj.c:128
DWORD miscstatusthumbnail
Definition: compobj.c:126
Definition: http.c:7252
Definition: cookie.c:34
Definition: tftpd.h:138
ULONG assembly_cnt_max
Definition: actctx.c:691
LPWSTR root_manifest_path
Definition: actctx.c:693
ULONG assembly_cnt_min
Definition: actctx.c:690
ULONG root_manifest_type
Definition: actctx.c:692
ULONG app_dir_type
Definition: actctx.c:695
LPCWSTR app_dir
Definition: actctx.c:696
ULONG root_config_type
Definition: actctx.c:694
ULONG format_version
Definition: actctx.c:689
ULONG paths_offset
Definition: actctx.c:1252
ULONG total_len
Definition: actctx.c:1250
ULONG paths_count
Definition: actctx.c:1251
Definition: fci.c:127
GUID guid
Definition: actctx.c:1224
ULONG rosterindex
Definition: actctx.c:1227
ULONG data_offset
Definition: actctx.c:1225
ULONG data_len
Definition: actctx.c:1226
ULONG index_offset
Definition: actctx.c:1216
DWORD unk[3]
Definition: actctx.c:1214
ULONG names_offset
Definition: actctx.c:1218
LPCWSTR manifest_path
Definition: actctx.c:802
BOOL has_assembly_dir
Definition: actctx.c:804
LPCWSTR encoded_assembly_id
Definition: actctx.c:803
Definition: parser.c:49
const struct manifest_res_spec * items
Definition: actctx.c:3915
const char * override_manifest
Definition: actctx.c:3909
const char * name
Definition: actctx.c:3907
struct manifest_res_spec manifest_inline
Definition: actctx.c:3952
const struct manifest_res_spec * manifests
Definition: actctx.c:3953
Definition: name.c:39
ACTCTX_COMPATIBILITY_ELEMENT_TYPE Type
Definition: actctx.c:3218
ACTCTX_REQUESTED_RUN_LEVEL run_level
Definition: actctx.c:1014
DWORD ui_access
Definition: actctx.c:1015
Definition: parser.c:56
ULONG data_offset
Definition: actctx.c:1205
ULONG name_len
Definition: actctx.c:1204
ULONG hash
Definition: actctx.c:1202
ULONG name_offset
Definition: actctx.c:1203
ULONG data_len
Definition: actctx.c:1206
ULONG rosterindex
Definition: actctx.c:1207
char path_dll[MAX_PATH+11]
Definition: actctx.c:3592
ULONG_PTR cookie
Definition: actctx.c:3596
HANDLE handle_context
Definition: actctx.c:3597
HMODULE module
Definition: actctx.c:3598
int buffer_size
Definition: actctx.c:3599
ACTCTXA context
Definition: actctx.c:3595
ULONG name_offset
Definition: oleaut.c:792
ULONG help_len
Definition: oleaut.c:795
ULONG help_offset
Definition: oleaut.c:796
WORD minor_version
Definition: oleaut.c:798
ULONG name_len
Definition: oleaut.c:791
LANGID langid
Definition: oleaut.c:793
WORD major_version
Definition: oleaut.c:797
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
static const CHAR manifest[]
Definition: v6util.h:41
static const WCHAR lang[]
Definition: wbemdisp.c:287
#define success(from, fromstr, to, tostr)
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define LOAD_LIBRARY_AS_IMAGE_RESOURCE
Definition: winbase.h:343
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:338
#define WINAPI
Definition: msvc.h:6
#define ERROR_SHARING_VIOLATION
Definition: winerror.h:257
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:228
#define ERROR_RESOURCE_TYPE_NOT_FOUND
Definition: winerror.h:1477
#define ERROR_RESOURCE_NAME_NOT_FOUND
Definition: winerror.h:1478
#define ERROR_SXS_KEY_NOT_FOUND
Definition: winerror.h:3101
#define ERROR_SXS_CANT_GEN_ACTCTX
Definition: winerror.h:3095
#define ERROR_SXS_SECTION_NOT_FOUND
Definition: winerror.h:3094
#define LOCALE_ALLOW_NEUTRAL_NAMES
Definition: winnls.h:25
#define snprintf
Definition: wintirpc.h:48
#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID
Definition: winuser.h:628
#define CREATEPROCESS_MANIFEST_RESOURCE_ID
Definition: winuser.h:626
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define RT_MANIFEST
Definition: winuser.h:625
#define MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID
Definition: winuser.h:630
#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID
Definition: winuser.h:627
#define strnicmp
Definition: xmlstorage.h:206
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char * LPSTR
Definition: xmlstorage.h:182
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193