17732cf19297a28f0818eb3464fb2d14f7800474
[reactos.git] / rostests / apitests / kernel32 / DefaultActCtx.c
1 /*
2 * Test for the default activation context that is active in every process.
3 *
4 * Copyright 2017 Giannis Adamopoulos
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21
22 #include <stdarg.h>
23 #include <stdio.h>
24
25 #include "wine/test.h"
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winerror.h"
29
30 START_TEST(DefaultActCtx)
31 {
32 DWORD buffer[256];
33 BOOL res;
34 PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION details = (PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION)buffer;
35 PACTIVATION_CONTEXT_DETAILED_INFORMATION info = (PACTIVATION_CONTEXT_DETAILED_INFORMATION)buffer;
36 HANDLE h;
37 DWORD i;
38 ACTCTX_SECTION_KEYED_DATA KeyedData = { 0 };
39
40 res = QueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX,
41 NULL,
42 NULL,
43 ActivationContextDetailedInformation,
44 &buffer,
45 sizeof(buffer),
46 NULL);
47 ok(res == TRUE, "\n");
48 ok(info->lpRootManifestPath == NULL, "Expected null lpRootManifestPath, got %S\n", info->lpRootManifestPath);
49 ok(info->lpRootConfigurationPath == NULL, "Expected null lpRootConfigurationPath, got %S\n", info->lpRootConfigurationPath);
50 ok(info->lpAppDirPath == NULL, "Expected null lpAppDirPath, got %S\n", info->lpAppDirPath);
51 ok(info->ulAssemblyCount == 0, "\n");
52
53 i = 0;
54 res = QueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX,
55 NULL,
56 &i,
57 AssemblyDetailedInformationInActivationContext,
58 &buffer,
59 sizeof(buffer),
60 NULL);
61 ok(res == TRUE, "\n");
62 ok(details->lpAssemblyEncodedAssemblyIdentity == NULL, "Expected null lpAssemblyEncodedAssemblyIdentity, got %S\n", details->lpAssemblyEncodedAssemblyIdentity);
63 ok(details->lpAssemblyManifestPath == NULL, "Expected null lpAssemblyManifestPath, got %S\n", details->lpAssemblyManifestPath);
64 ok(details->lpAssemblyPolicyPath == NULL, "Expected null lpAssemblyPolicyPath, got %S\n", details->lpAssemblyPolicyPath);
65 ok(details->lpAssemblyDirectoryName == NULL, "Expected null lpAssemblyDirectoryName, got %S\n", details->lpAssemblyDirectoryName);
66
67 i = 1;
68 res = QueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX,
69 NULL,
70 &i,
71 AssemblyDetailedInformationInActivationContext,
72 &buffer,
73 sizeof(buffer),
74 NULL);
75 ok(res == TRUE, "\n"); /* This is FALSE in win10 */
76 ok(details->lpAssemblyEncodedAssemblyIdentity == NULL, "Expected null lpAssemblyEncodedAssemblyIdentity, got %S\n", details->lpAssemblyEncodedAssemblyIdentity);
77 ok(details->lpAssemblyManifestPath == NULL, "Expected null lpAssemblyManifestPath, got %S\n", details->lpAssemblyManifestPath);
78 ok(details->lpAssemblyPolicyPath == NULL, "Expected null lpAssemblyPolicyPath, got %S\n", details->lpAssemblyPolicyPath);
79 ok(details->lpAssemblyDirectoryName == NULL, "Expected null lpAssemblyDirectoryName, got %S\n", details->lpAssemblyDirectoryName);
80
81 res = GetCurrentActCtx (&h);
82 ok(res == TRUE, "\n");
83 ok(h == NULL, "\n");
84
85 KeyedData.cbSize = sizeof(KeyedData);
86 res = FindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX,
87 NULL,
88 ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION,
89 L"Microsoft.Windows.SysyemCompatible",
90 &KeyedData);
91 ok(res == FALSE, "\n");
92
93 KeyedData.cbSize = sizeof(KeyedData);
94 res = FindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX,
95 NULL,
96 ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION,
97 L"System Default Context",
98 &KeyedData);
99 ok(res == FALSE, "\n");
100
101 KeyedData.cbSize = sizeof(KeyedData);
102 res = FindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX,
103 NULL,
104 ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION,
105 L"Microsoft.Windows.Common-Controls",
106 &KeyedData);
107 ok(res == TRUE, "\n");
108 ok(KeyedData.hActCtx == NULL, "Expected null handle for common control context\n");
109 ok(KeyedData.ulAssemblyRosterIndex != 0, "%d\n", KeyedData.ulAssemblyRosterIndex);
110 //ok(wcsstr(details-> , L"SystemCompative"
111
112 }