[MSI] Sync with Wine Staging 1.9.23. CORE-12409
[reactos.git] / rostests / winetests / msi / action.c
1 /*
2 * Copyright (C) 2006 James Hawkins
3 * Copyright 2010 Hans Leidekker for CodeWeavers
4 *
5 * Tests concentrating on standard actions
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22 #define _WIN32_MSI 300
23 #include <stdio.h>
24 #include <stdlib.h>
25
26 #include <windows.h>
27 #include <msiquery.h>
28 #include <msidefs.h>
29 #include <msi.h>
30 #include <fci.h>
31 #include <srrestoreptapi.h>
32 #include <wtypes.h>
33 #include <shellapi.h>
34 #include <winsvc.h>
35
36 #include "wine/test.h"
37
38 static UINT (WINAPI *pMsiQueryComponentStateA)
39 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *);
40 static UINT (WINAPI *pMsiSourceListEnumSourcesA)
41 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
42 static UINT (WINAPI *pMsiSourceListGetInfoA)
43 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD);
44 static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
45 (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
46 static UINT (WINAPI *pMsiQueryFeatureStateExA)
47 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *);
48
49 static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL);
50 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR *);
51 static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE);
52 static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
53 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
54
55 static HMODULE hsrclient;
56 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
57 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA *, STATEMGRSTATUS *);
58
59 static BOOL is_wow64;
60 static const BOOL is_64bit = sizeof(void *) > sizeof(int);
61
62 static const char *msifile = "msitest.msi";
63 static CHAR CURR_DIR[MAX_PATH];
64 static CHAR PROG_FILES_DIR[MAX_PATH];
65 static CHAR COMMON_FILES_DIR[MAX_PATH];
66 static CHAR APP_DATA_DIR[MAX_PATH];
67 static CHAR WINDOWS_DIR[MAX_PATH];
68
69 /* msi database data */
70
71 static const char component_dat[] =
72 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
73 "s72\tS38\ts72\ti2\tS255\tS72\n"
74 "Component\tComponent\n"
75 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
76 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
77 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n"
78 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
79 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
80 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
81 "component\t\tMSITESTDIR\t0\t1\tfile\n"
82 "service_comp\t{935A0A91-22A3-4F87-BCA8-928FFDFE2353}\tMSITESTDIR\t0\t\tservice_file\n"
83 "service_comp2\t{3F7B04A4-9521-4649-BDC9-0C8722740A49}\tMSITESTDIR\t0\t\tservice_file2\n"
84 "service_comp3\t{DBCD1502-20E3-423F-B53E-F37E263CDC7E}\tMSITESTDIR\t0\t\t\n";
85
86 static const char directory_dat[] =
87 "Directory\tDirectory_Parent\tDefaultDir\n"
88 "s72\tS72\tl255\n"
89 "Directory\tDirectory\n"
90 "CABOUTDIR\tMSITESTDIR\tcabout\n"
91 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
92 "FIRSTDIR\tMSITESTDIR\tfirst\n"
93 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
94 "NEWDIR\tCABOUTDIR\tnew\n"
95 "ProgramFilesFolder\tTARGETDIR\t.\n"
96 "TARGETDIR\t\tSourceDir";
97
98 static const char feature_dat[] =
99 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
100 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
101 "Feature\tFeature\n"
102 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
103 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
104 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
105 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
106 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
107 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
108 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
109
110 static const char feature_comp_dat[] =
111 "Feature_\tComponent_\n"
112 "s38\ts72\n"
113 "FeatureComponents\tFeature_\tComponent_\n"
114 "Five\tFive\n"
115 "Four\tFour\n"
116 "One\tOne\n"
117 "Three\tThree\n"
118 "Two\tTwo\n"
119 "feature\tcomponent\n"
120 "service_feature\tservice_comp\n"
121 "service_feature\tservice_comp2\n"
122 "service_feature\tservice_comp3";
123
124 static const char file_dat[] =
125 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
126 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
127 "File\tFile\n"
128 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
129 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
130 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
131 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
132 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
133 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
134 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t6\n"
135 "service_file2\tservice_comp2\tservice2.exe\t100\t\t\t8192\t7";
136
137 static const char install_exec_seq_dat[] =
138 "Action\tCondition\tSequence\n"
139 "s72\tS255\tI2\n"
140 "InstallExecuteSequence\tAction\n"
141 "AllocateRegistrySpace\tNOT Installed\t1550\n"
142 "CostFinalize\t\t1000\n"
143 "CostInitialize\t\t800\n"
144 "FileCost\t\t900\n"
145 "ResolveSource\t\t950\n"
146 "MoveFiles\t\t1700\n"
147 "InstallFiles\t\t4000\n"
148 "DuplicateFiles\t\t4500\n"
149 "WriteEnvironmentStrings\t\t4550\n"
150 "CreateShortcuts\t\t4600\n"
151 "InstallServices\t\t5000\n"
152 "InstallFinalize\t\t6600\n"
153 "InstallInitialize\t\t1500\n"
154 "InstallValidate\t\t1400\n"
155 "LaunchConditions\t\t100\n"
156 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
157
158 static const char media_dat[] =
159 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
160 "i2\ti4\tL64\tS255\tS32\tS72\n"
161 "Media\tDiskId\n"
162 "1\t3\t\t\tDISK1\t\n"
163 "2\t7\t\tmsitest.cab\tDISK2\t\n";
164
165 static const char property_dat[] =
166 "Property\tValue\n"
167 "s72\tl0\n"
168 "Property\tProperty\n"
169 "DefaultUIFont\tDlgFont8\n"
170 "HASUIRUN\t0\n"
171 "INSTALLLEVEL\t3\n"
172 "InstallMode\tTypical\n"
173 "Manufacturer\tWine\n"
174 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
175 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
176 "ProductID\tnone\n"
177 "ProductLanguage\t1033\n"
178 "ProductName\tMSITEST\n"
179 "ProductVersion\t1.1.1\n"
180 "PROMPTROLLBACKCOST\tP\n"
181 "Setup\tSetup\n"
182 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
183 "AdminProperties\tPOSTADMIN\n"
184 "ROOTDRIVE\tC:\\\n"
185 "SERVNAME\tTestService\n"
186 "SERVNAME2\tTestService2\n"
187 "SERVDISP\tTestServiceDisp\n"
188 "SERVDISP2\tTestServiceDisp2\n"
189 "MSIFASTINSTALL\t1\n"
190 "regdata15\t#x01\n";
191
192 static const char environment_dat[] =
193 "Environment\tName\tValue\tComponent_\n"
194 "s72\tl255\tL255\ts72\n"
195 "Environment\tEnvironment\n"
196 "Var1\t=-MSITESTVAR1\t1\tOne\n"
197 "Var2\tMSITESTVAR2\t1\tOne\n"
198 "Var3\t=-MSITESTVAR3\t1\tOne\n"
199 "Var4\tMSITESTVAR4\t1\tOne\n"
200 "Var5\t-MSITESTVAR5\t\tOne\n"
201 "Var6\tMSITESTVAR6\t\tOne\n"
202 "Var7\t!-MSITESTVAR7\t\tOne\n"
203 "Var8\t!-*MSITESTVAR8\t\tOne\n"
204 "Var9\t=-MSITESTVAR9\t\tOne\n"
205 "Var10\t=MSITESTVAR10\t\tOne\n"
206 "Var11\t+-MSITESTVAR11\t[~];1\tOne\n"
207 "Var12\t+-MSITESTVAR11\t[~];2\tOne\n"
208 "Var13\t+-MSITESTVAR12\t[~];1\tOne\n"
209 "Var14\t=MSITESTVAR13\t[~];1\tOne\n"
210 "Var15\t=MSITESTVAR13\t[~];2\tOne\n"
211 "Var16\t=MSITESTVAR14\t;1;\tOne\n"
212 "Var17\t=MSITESTVAR15\t;;1;;\tOne\n"
213 "Var18\t=MSITESTVAR16\t 1 \tOne\n"
214 "Var19\t+-MSITESTVAR17\t1\tOne\n"
215 "Var20\t+-MSITESTVAR17\t;;2;;[~]\tOne\n"
216 "Var21\t+-MSITESTVAR18\t1\tOne\n"
217 "Var22\t+-MSITESTVAR18\t[~];;2;;\tOne\n"
218 "Var23\t+-MSITESTVAR19\t1\tOne\n"
219 "Var24\t+-MSITESTVAR19\t[~]2\tOne\n"
220 "Var25\t+-MSITESTVAR20\t1\tOne\n"
221 "Var26\t+-MSITESTVAR20\t2[~]\tOne\n"
222 "Var27\t+-MSITESTVAR21\t[~];1\tOne\n";
223
224 static const char service_install_dat[] =
225 "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
226 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
227 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
228 "ServiceInstall\tServiceInstall\n"
229 "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService\t\t-a arg\tservice_comp\tdescription\n"
230 "TestService2\tSERVNAME2]\t[SERVDISP2]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService2\t\t-a arg\tservice_comp2\tdescription";
231
232 static const char service_install2_dat[] =
233 "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
234 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
235 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
236 "ServiceInstall\tServiceInstall\n"
237 "TestService\tTestService\tTestService\t2\t3\t32768\t\t\tTestService\t\t\tservice_comp\t\n"
238 "TestService4\tTestService4\tTestService4\t2\t3\t0\t\t\tTestService4\t\t\tservice_comp3\t\n";
239
240 static const char service_control_dat[] =
241 "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
242 "s72\tl255\ti2\tL255\tI2\ts72\n"
243 "ServiceControl\tServiceControl\n"
244 "ServiceControl\tTestService3\t8\t\t0\tservice_comp\n"
245 "ServiceControl2\tTestService3\t128\t\t0\tservice_comp2";
246
247 static const char sss_service_control_dat[] =
248 "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
249 "s72\tl255\ti2\tL255\tI2\ts72\n"
250 "ServiceControl\tServiceControl\n"
251 "ServiceControl\tSpooler\t1\t\t1\tservice_comp\n"
252 "ServiceControl2\tSpooler\t2\t\t1\tservice_comp\n"
253 "ServiceControl3\tSpooler\t16\t\t1\tservice_comp\n"
254 "ServiceControl4\tSpooler\t32\t\t1\tservice_comp\n";
255
256 static const char sss_install_exec_seq_dat[] =
257 "Action\tCondition\tSequence\n"
258 "s72\tS255\tI2\n"
259 "InstallExecuteSequence\tAction\n"
260 "LaunchConditions\t\t100\n"
261 "CostInitialize\t\t800\n"
262 "FileCost\t\t900\n"
263 "ResolveSource\t\t950\n"
264 "CostFinalize\t\t1000\n"
265 "InstallValidate\t\t1400\n"
266 "InstallInitialize\t\t1500\n"
267 "StopServices\t\t4000\n"
268 "DeleteServices\t\t5000\n"
269 "MoveFiles\t\t5100\n"
270 "InstallFiles\t\t5200\n"
271 "DuplicateFiles\t\t5300\n"
272 "StartServices\t\t5400\n"
273 "RegisterProduct\t\t5500\n"
274 "PublishFeatures\t\t5600\n"
275 "PublishProduct\t\t5700\n"
276 "InstallFinalize\t\t6000\n";
277
278 static const char sds_install_exec_seq_dat[] =
279 "Action\tCondition\tSequence\n"
280 "s72\tS255\tI2\n"
281 "InstallExecuteSequence\tAction\n"
282 "LaunchConditions\t\t100\n"
283 "CostInitialize\t\t800\n"
284 "FileCost\t\t900\n"
285 "ResolveSource\t\t950\n"
286 "CostFinalize\t\t1000\n"
287 "InstallValidate\t\t1400\n"
288 "InstallInitialize\t\t1500\n"
289 "StopServices\t\t5000\n"
290 "DeleteServices\t\t5050\n"
291 "MoveFiles\t\t5100\n"
292 "InstallFiles\t\t5200\n"
293 "DuplicateFiles\t\t5300\n"
294 "InstallServices\t\t5400\n"
295 "StartServices\t\t5450\n"
296 "RegisterProduct\t\t5500\n"
297 "PublishFeatures\t\t5600\n"
298 "PublishProduct\t\t5700\n"
299 "InstallFinalize\t\t6000\n";
300
301 static const char rof_component_dat[] =
302 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
303 "s72\tS38\ts72\ti2\tS255\tS72\n"
304 "Component\tComponent\n"
305 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
306
307 static const char rof_feature_dat[] =
308 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
309 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
310 "Feature\tFeature\n"
311 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
312 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
313
314 static const char rof_feature_comp_dat[] =
315 "Feature_\tComponent_\n"
316 "s38\ts72\n"
317 "FeatureComponents\tFeature_\tComponent_\n"
318 "feature\tmaximus\n"
319 "montecristo\tmaximus";
320
321 static const char rof_file_dat[] =
322 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
323 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
324 "File\tFile\n"
325 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
326
327 static const char rof_media_dat[] =
328 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
329 "i2\ti4\tL64\tS255\tS32\tS72\n"
330 "Media\tDiskId\n"
331 "1\t1\t\t\tDISK1\t\n";
332
333 static const char ci2_feature_comp_dat[] =
334 "Feature_\tComponent_\n"
335 "s38\ts72\n"
336 "FeatureComponents\tFeature_\tComponent_\n"
337 "feature\taugustus";
338
339 static const char ci2_file_dat[] =
340 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
341 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
342 "File\tFile\n"
343 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
344
345 static const char pp_install_exec_seq_dat[] =
346 "Action\tCondition\tSequence\n"
347 "s72\tS255\tI2\n"
348 "InstallExecuteSequence\tAction\n"
349 "ValidateProductID\t\t700\n"
350 "CostInitialize\t\t800\n"
351 "FileCost\t\t900\n"
352 "CostFinalize\t\t1000\n"
353 "InstallValidate\t\t1400\n"
354 "InstallInitialize\t\t1500\n"
355 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
356 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
357 "RemoveFiles\t\t3500\n"
358 "InstallFiles\t\t4000\n"
359 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
360 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
361 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
362 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
363 "InstallFinalize\t\t6600";
364
365 static const char pp_component_dat[] =
366 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
367 "s72\tS38\ts72\ti2\tS255\tS72\n"
368 "Component\tComponent\n"
369 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\t\tmaximus\n";
370
371 static const char ppc_component_dat[] =
372 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
373 "s72\tS38\ts72\ti2\tS255\tS72\n"
374 "Component\tComponent\n"
375 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\t\tmaximus\n"
376 "augustus\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\taugustus\n";
377
378 static const char ppc_file_dat[] =
379 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
380 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
381 "File\tFile\n"
382 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1\n"
383 "augustus\taugustus\taugustus\t500\t\t\t8192\t2";
384
385 static const char ppc_media_dat[] =
386 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
387 "i2\ti4\tL64\tS255\tS32\tS72\n"
388 "Media\tDiskId\n"
389 "1\t2\t\t\tDISK1\t\n";
390
391 static const char ppc_feature_comp_dat[] =
392 "Feature_\tComponent_\n"
393 "s38\ts72\n"
394 "FeatureComponents\tFeature_\tComponent_\n"
395 "feature\tmaximus\n"
396 "feature\taugustus\n"
397 "montecristo\tmaximus";
398
399 static const char cwd_component_dat[] =
400 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
401 "s72\tS38\ts72\ti2\tS255\tS72\n"
402 "Component\tComponent\n"
403 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
404
405 static const char rem_component_dat[] =
406 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
407 "s72\tS38\ts72\ti2\tS255\tS72\n"
408 "Component\tComponent\n"
409 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t0\t\thydrogen\n"
410 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\thelium\n"
411 "lithium\t\tMSITESTDIR\t2\t\tlithium\n";
412
413 static const char rem_feature_comp_dat[] =
414 "Feature_\tComponent_\n"
415 "s38\ts72\n"
416 "FeatureComponents\tFeature_\tComponent_\n"
417 "feature\thydrogen\n"
418 "feature\thelium\n"
419 "feature\tlithium";
420
421 static const char rem_file_dat[] =
422 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
423 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
424 "File\tFile\n"
425 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
426 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
427 "lithium\tlithium\tlithium\t0\t\t\t8192\t1";
428
429 static const char rem_install_exec_seq_dat[] =
430 "Action\tCondition\tSequence\n"
431 "s72\tS255\tI2\n"
432 "InstallExecuteSequence\tAction\n"
433 "ValidateProductID\t\t700\n"
434 "CostInitialize\t\t800\n"
435 "FileCost\t\t900\n"
436 "CostFinalize\t\t1000\n"
437 "InstallValidate\t\t1400\n"
438 "InstallInitialize\t\t1500\n"
439 "ProcessComponents\t\t1600\n"
440 "UnpublishFeatures\t\t1800\n"
441 "RemoveFiles\t\t3500\n"
442 "InstallFiles\t\t4000\n"
443 "RegisterProduct\t\t6100\n"
444 "PublishFeatures\t\t6300\n"
445 "PublishProduct\t\t6400\n"
446 "InstallFinalize\t\t6600";
447
448 static const char rem_remove_files_dat[] =
449 "FileKey\tComponent_\tFileName\tDirProperty\tInstallMode\n"
450 "s72\ts72\tS255\ts72\tI2\n"
451 "RemoveFile\tFileKey\n"
452 "furlong\thydrogen\tfurlong\tMSITESTDIR\t1\n"
453 "firkin\thelium\tfirkin\tMSITESTDIR\t1\n"
454 "fortnight\tlithium\tfortnight\tMSITESTDIR\t1\n"
455 "becquerel\thydrogen\tbecquerel\tMSITESTDIR\t2\n"
456 "dioptre\thelium\tdioptre\tMSITESTDIR\t2\n"
457 "attoparsec\tlithium\tattoparsec\tMSITESTDIR\t2\n"
458 "storeys\thydrogen\tstoreys\tMSITESTDIR\t3\n"
459 "block\thelium\tblock\tMSITESTDIR\t3\n"
460 "siriometer\tlithium\tsiriometer\tMSITESTDIR\t3\n"
461 "nanoacre\thydrogen\t\tCABOUTDIR\t3\n";
462
463 static const char mov_move_file_dat[] =
464 "FileKey\tComponent_\tSourceName\tDestName\tSourceFolder\tDestFolder\tOptions\n"
465 "s72\ts72\tS255\tS255\tS72\ts72\ti2\n"
466 "MoveFile\tFileKey\n"
467 "abkhazia\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t0\n"
468 "bahamas\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t1\n"
469 "cambodia\taugustus\tcameroon\tcanada\tSourceDir\tMSITESTDIR\t0\n"
470 "denmark\taugustus\tdjibouti\tdominica\tSourceDir\tMSITESTDIR\t1\n"
471 "ecuador\taugustus\tegypt\telsalvador\tNotAProp\tMSITESTDIR\t1\n"
472 "fiji\taugustus\tfinland\tfrance\tSourceDir\tNotAProp\t1\n"
473 "gabon\taugustus\tgambia\tgeorgia\tSOURCEFULL\tMSITESTDIR\t1\n"
474 "haiti\taugustus\thonduras\thungary\tSourceDir\tDESTFULL\t1\n"
475 "iceland\taugustus\tindia\tindonesia\tMSITESTDIR\tMSITESTDIR\t1\n"
476 "jamaica\taugustus\tjapan\tjordan\tFILEPATHBAD\tMSITESTDIR\t1\n"
477 "kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n"
478 "laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n"
479 "namibia\taugustus\tnauru\tkiribati\tSourceDir\tMSITESTDIR\t1\n"
480 "pakistan\taugustus\tperu\tsfn|poland\tSourceDir\tMSITESTDIR\t1\n"
481 "wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
482 "single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
483 "wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
484 "singlenodest\taugustus\tb?r\t\tSourceDir\tMSITESTDIR\t1\n";
485
486 static const char df_directory_dat[] =
487 "Directory\tDirectory_Parent\tDefaultDir\n"
488 "s72\tS72\tl255\n"
489 "Directory\tDirectory\n"
490 "THIS\tMSITESTDIR\tthis\n"
491 "DOESNOT\tTHIS\tdoesnot\n"
492 "NONEXISTENT\tDOESNOT\texist\n"
493 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
494 "ProgramFilesFolder\tTARGETDIR\t.\n"
495 "TARGETDIR\t\tSourceDir";
496
497 static const char df_duplicate_file_dat[] =
498 "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
499 "s72\ts72\ts72\tS255\tS72\n"
500 "DuplicateFile\tFileKey\n"
501 "maximus\tmaximus\tmaximus\taugustus\t\n"
502 "caesar\tmaximus\tmaximus\t\tNONEXISTENT\n"
503 "augustus\tnosuchcomponent\tmaximus\t\tMSITESTDIR\n";
504
505 static const char wrv_component_dat[] =
506 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
507 "s72\tS38\ts72\ti2\tS255\tS72\n"
508 "Component\tComponent\n"
509 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
510
511 static const char wrv_registry_dat[] =
512 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
513 "s72\ti2\tl255\tL255\tL0\ts72\n"
514 "Registry\tRegistry\n"
515 "regdata\t2\tSOFTWARE\\Wine\\msitest\tValue\t[~]one[~]two[~]three\taugustus\n"
516 "regdata1\t2\tSOFTWARE\\Wine\\msitest\t*\t\taugustus\n"
517 "regdata2\t2\tSOFTWARE\\Wine\\msitest\t*\t#%\taugustus\n"
518 "regdata3\t2\tSOFTWARE\\Wine\\msitest\t*\t#x\taugustus\n"
519 "regdata4\t2\tSOFTWARE\\Wine\\msitest\\VisualStudio\\10.0\\AD7Metrics\\Exception\\{049EC4CC-30D2-4032-9256-EE18EB41B62B}\\Common Language Runtime Exceptions\\System.Workflow.ComponentModel.Serialization\\System.Workflow.ComponentModel.Serialization.WorkflowMarkupSerializationException\tlong\tkey\taugustus\n"
520 "regdata5\t2\tSOFTWARE\\Wine\\msitest\tValue1\t[~]one[~]\taugustus\n"
521 "regdata6\t2\tSOFTWARE\\Wine\\msitest\tValue2\t[~]two\taugustus\n"
522 "regdata7\t2\tSOFTWARE\\Wine\\msitest\tValue3\tone[~]\taugustus\n"
523 "regdata8\t2\tSOFTWARE\\Wine\\msitest\tValue4\tone[~]two\taugustus\n"
524 "regdata9\t2\tSOFTWARE\\Wine\\msitest\tValue5\t[~]one[~]two[~]three\taugustus\n"
525 "regdata10\t2\tSOFTWARE\\Wine\\msitest\tValue6\t[~]\taugustus\n"
526 "regdata11\t2\tSOFTWARE\\Wine\\msitest\tValue7\t[~]two\taugustus\n"
527 "regdata12\t2\tSOFTWARE\\Wine\\msitest\tValue8\t#1\taugustus\n"
528 "regdata13\t2\tSOFTWARE\\Wine\\msitest\tValue9\t#x1\taugustus\n"
529 "regdata14\t2\tSOFTWARE\\Wine\\msitest\tValue10\t#x01\taugustus\n"
530 "regdata15\t2\tSOFTWARE\\Wine\\msitest\tValue11\t[regdata15]\taugustus\n";
531
532 static const char cf_directory_dat[] =
533 "Directory\tDirectory_Parent\tDefaultDir\n"
534 "s72\tS72\tl255\n"
535 "Directory\tDirectory\n"
536 "FIRSTDIR\tMSITESTDIR\tfirst\n"
537 "SECONDDIR\tMSITESTDIR\tsecond\n"
538 "THIRDDIR\tMSITESTDIR\tthird\n"
539 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
540 "ProgramFilesFolder\tTARGETDIR\t.\n"
541 "TARGETDIR\t\tSourceDir";
542
543 static const char cf_component_dat[] =
544 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
545 "s72\tS38\ts72\ti2\tS255\tS72\n"
546 "Component\tComponent\n"
547 "One\t{F8CD42AC-9C38-48FE-8664-B35FD121012A}\tFIRSTDIR\t0\t\tone.txt\n"
548 "Two\t{DE2DB02E-2DDF-4E34-8CF6-DCA13E29DF52}\tSECONDDIR\t0\t\ttwo.txt\n";
549
550 static const char cf_feature_dat[] =
551 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
552 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
553 "Feature\tFeature\n"
554 "One\t\tOne\tThe One Feature\t1\t3\tFIRSTDIR\t0\n"
555 "Two\t\tTwo\tThe Two Feature\t1\t3\tSECONDDIR\t0\n";
556
557 static const char cf_feature_comp_dat[] =
558 "Feature_\tComponent_\n"
559 "s38\ts72\n"
560 "FeatureComponents\tFeature_\tComponent_\n"
561 "One\tOne\n"
562 "Two\tTwo\n";
563
564 static const char cf_file_dat[] =
565 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
566 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
567 "File\tFile\n"
568 "one.txt\tOne\tone.txt\t0\t\t\t0\t1\n"
569 "two.txt\tTwo\ttwo.txt\t0\t\t\t0\t2\n";
570
571 static const char cf_create_folders_dat[] =
572 "Directory_\tComponent_\n"
573 "s72\ts72\n"
574 "CreateFolder\tDirectory_\tComponent_\n"
575 "FIRSTDIR\tOne\n"
576 "SECONDDIR\tTwo\n"
577 "THIRDDIR\tTwo\n";
578
579 static const char cf_install_exec_seq_dat[] =
580 "Action\tCondition\tSequence\n"
581 "s72\tS255\tI2\n"
582 "InstallExecuteSequence\tAction\n"
583 "CostFinalize\t\t1000\n"
584 "ValidateProductID\t\t700\n"
585 "CostInitialize\t\t800\n"
586 "FileCost\t\t900\n"
587 "RemoveFiles\t\t3500\n"
588 "CreateFolders\t\t3700\n"
589 "RemoveFolders\t\t3800\n"
590 "InstallFiles\t\t4000\n"
591 "RegisterUser\t\t6000\n"
592 "RegisterProduct\t\t6100\n"
593 "PublishFeatures\t\t6300\n"
594 "PublishProduct\t\t6400\n"
595 "InstallFinalize\t\t6600\n"
596 "InstallInitialize\t\t1500\n"
597 "ProcessComponents\t\t1600\n"
598 "UnpublishFeatures\t\t1800\n"
599 "InstallValidate\t\t1400\n"
600 "LaunchConditions\t\t100\n";
601
602 static const char sr_selfreg_dat[] =
603 "File_\tCost\n"
604 "s72\tI2\n"
605 "SelfReg\tFile_\n"
606 "one.txt\t1\n";
607
608 static const char sr_install_exec_seq_dat[] =
609 "Action\tCondition\tSequence\n"
610 "s72\tS255\tI2\n"
611 "InstallExecuteSequence\tAction\n"
612 "CostFinalize\t\t1000\n"
613 "CostInitialize\t\t800\n"
614 "FileCost\t\t900\n"
615 "ResolveSource\t\t950\n"
616 "MoveFiles\t\t1700\n"
617 "SelfUnregModules\t\t3900\n"
618 "InstallFiles\t\t4000\n"
619 "DuplicateFiles\t\t4500\n"
620 "WriteEnvironmentStrings\t\t4550\n"
621 "CreateShortcuts\t\t4600\n"
622 "InstallFinalize\t\t6600\n"
623 "InstallInitialize\t\t1500\n"
624 "InstallValidate\t\t1400\n"
625 "LaunchConditions\t\t100\n";
626
627 static const char font_media_dat[] =
628 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
629 "i2\ti4\tL64\tS255\tS32\tS72\n"
630 "Media\tDiskId\n"
631 "1\t3\t\t\tDISK1\t\n";
632
633 static const char font_file_dat[] =
634 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
635 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
636 "File\tFile\n"
637 "font.ttf\tfonts\tfont.ttf\t1000\t\t\t8192\t1\n";
638
639 static const char font_feature_dat[] =
640 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
641 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
642 "Feature\tFeature\n"
643 "fonts\t\t\tfont feature\t1\t2\tMSITESTDIR\t0\n";
644
645 static const char font_component_dat[] =
646 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
647 "s72\tS38\ts72\ti2\tS255\tS72\n"
648 "Component\tComponent\n"
649 "fonts\t{F5920ED0-1183-4B8F-9330-86CE56557C05}\tMSITESTDIR\t0\t\tfont.ttf\n";
650
651 static const char font_feature_comp_dat[] =
652 "Feature_\tComponent_\n"
653 "s38\ts72\n"
654 "FeatureComponents\tFeature_\tComponent_\n"
655 "fonts\tfonts\n";
656
657 static const char font_dat[] =
658 "File_\tFontTitle\n"
659 "s72\tS128\n"
660 "Font\tFile_\n"
661 "font.ttf\tmsi test font\n";
662
663 static const char font_install_exec_seq_dat[] =
664 "Action\tCondition\tSequence\n"
665 "s72\tS255\tI2\n"
666 "InstallExecuteSequence\tAction\n"
667 "ValidateProductID\t\t700\n"
668 "CostInitialize\t\t800\n"
669 "FileCost\t\t900\n"
670 "CostFinalize\t\t1000\n"
671 "InstallValidate\t\t1400\n"
672 "InstallInitialize\t\t1500\n"
673 "ProcessComponents\t\t1600\n"
674 "UnpublishFeatures\t\t1800\n"
675 "RemoveFiles\t\t3500\n"
676 "InstallFiles\t\t4000\n"
677 "RegisterFonts\t\t4100\n"
678 "UnregisterFonts\t\t4200\n"
679 "RegisterUser\t\t6000\n"
680 "RegisterProduct\t\t6100\n"
681 "PublishFeatures\t\t6300\n"
682 "PublishProduct\t\t6400\n"
683 "InstallFinalize\t\t6600";
684
685 static const char vp_property_dat[] =
686 "Property\tValue\n"
687 "s72\tl0\n"
688 "Property\tProperty\n"
689 "HASUIRUN\t0\n"
690 "INSTALLLEVEL\t3\n"
691 "InstallMode\tTypical\n"
692 "Manufacturer\tWine\n"
693 "PIDTemplate\t###-#######\n"
694 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
695 "ProductLanguage\t1033\n"
696 "ProductName\tMSITEST\n"
697 "ProductVersion\t1.1.1\n"
698 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
699 "MSIFASTINSTALL\t1\n";
700
701 static const char vp_custom_action_dat[] =
702 "Action\tType\tSource\tTarget\tISComments\n"
703 "s72\ti2\tS64\tS0\tS255\n"
704 "CustomAction\tAction\n"
705 "SetProductID1\t51\tProductID\t1\t\n"
706 "SetProductID2\t51\tProductID\t2\t\n"
707 "TestProductID1\t19\t\t\tHalts installation\n"
708 "TestProductID2\t19\t\t\tHalts installation\n";
709
710 static const char vp_install_exec_seq_dat[] =
711 "Action\tCondition\tSequence\n"
712 "s72\tS255\tI2\n"
713 "InstallExecuteSequence\tAction\n"
714 "LaunchConditions\t\t100\n"
715 "CostInitialize\t\t800\n"
716 "FileCost\t\t900\n"
717 "CostFinalize\t\t1000\n"
718 "InstallValidate\t\t1400\n"
719 "InstallInitialize\t\t1500\n"
720 "SetProductID1\tSET_PRODUCT_ID=1\t3000\n"
721 "SetProductID2\tSET_PRODUCT_ID=2\t3100\n"
722 "ValidateProductID\t\t3200\n"
723 "InstallExecute\t\t3300\n"
724 "TestProductID1\tProductID=1\t3400\n"
725 "TestProductID2\tProductID=\"123-1234567\"\t3500\n"
726 "InstallFiles\t\t4000\n"
727 "InstallFinalize\t\t6000\n";
728
729 static const char odbc_file_dat[] =
730 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
731 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
732 "File\tFile\n"
733 "ODBCdriver.dll\todbc\tODBCdriver.dll\t1000\t\t\t8192\t1\n"
734 "ODBCdriver2.dll\todbc\tODBCdriver2.dll\t1000\t\t\t8192\t2\n"
735 "ODBCtranslator.dll\todbc\tODBCtranslator.dll\t1000\t\t\t8192\t3\n"
736 "ODBCtranslator2.dll\todbc\tODBCtranslator2.dll\t1000\t\t\t8192\t4\n"
737 "ODBCsetup.dll\todbc\tODBCsetup.dll\t1000\t\t\t8192\t5\n";
738
739 static const char odbc_feature_dat[] =
740 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
741 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
742 "Feature\tFeature\n"
743 "odbc\t\t\todbc feature\t1\t2\tMSITESTDIR\t0\n";
744
745 static const char odbc_feature_comp_dat[] =
746 "Feature_\tComponent_\n"
747 "s38\ts72\n"
748 "FeatureComponents\tFeature_\tComponent_\n"
749 "odbc\todbc\n";
750
751 static const char odbc_component_dat[] =
752 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
753 "s72\tS38\ts72\ti2\tS255\tS72\n"
754 "Component\tComponent\n"
755 "odbc\t{B6F3E4AE-35D1-4B72-9044-989F03E20A43}\tMSITESTDIR\t0\t\tODBCdriver.dll\n";
756
757 static const char odbc_driver_dat[] =
758 "Driver\tComponent_\tDescription\tFile_\tFile_Setup\n"
759 "s72\ts72\ts255\ts72\tS72\n"
760 "ODBCDriver\tDriver\n"
761 "ODBC test driver\todbc\tODBC test driver\tODBCdriver.dll\t\n"
762 "ODBC test driver2\todbc\tODBC test driver2\tODBCdriver2.dll\tODBCsetup.dll\n";
763
764 static const char odbc_translator_dat[] =
765 "Translator\tComponent_\tDescription\tFile_\tFile_Setup\n"
766 "s72\ts72\ts255\ts72\tS72\n"
767 "ODBCTranslator\tTranslator\n"
768 "ODBC test translator\todbc\tODBC test translator\tODBCtranslator.dll\t\n"
769 "ODBC test translator2\todbc\tODBC test translator2\tODBCtranslator2.dll\tODBCsetup.dll\n";
770
771 static const char odbc_datasource_dat[] =
772 "DataSource\tComponent_\tDescription\tDriverDescription\tRegistration\n"
773 "s72\ts72\ts255\ts255\ti2\n"
774 "ODBCDataSource\tDataSource\n"
775 "ODBC data source\todbc\tODBC data source\tODBC driver\t0\n";
776
777 static const char odbc_install_exec_seq_dat[] =
778 "Action\tCondition\tSequence\n"
779 "s72\tS255\tI2\n"
780 "InstallExecuteSequence\tAction\n"
781 "LaunchConditions\t\t100\n"
782 "CostInitialize\t\t800\n"
783 "FileCost\t\t900\n"
784 "CostFinalize\t\t1000\n"
785 "InstallValidate\t\t1400\n"
786 "InstallInitialize\t\t1500\n"
787 "ProcessComponents\t\t1600\n"
788 "InstallODBC\t\t3000\n"
789 "RemoveODBC\t\t3100\n"
790 "RemoveFiles\t\t3900\n"
791 "InstallFiles\t\t4000\n"
792 "RegisterProduct\t\t5000\n"
793 "PublishFeatures\t\t5100\n"
794 "PublishProduct\t\t5200\n"
795 "InstallFinalize\t\t6000\n";
796
797 static const char odbc_media_dat[] =
798 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
799 "i2\ti4\tL64\tS255\tS32\tS72\n"
800 "Media\tDiskId\n"
801 "1\t5\t\t\tDISK1\t\n";
802
803 static const char tl_file_dat[] =
804 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
805 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
806 "File\tFile\n"
807 "typelib.dll\ttypelib\ttypelib.dll\t1000\t\t\t8192\t1\n";
808
809 static const char tl_feature_dat[] =
810 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
811 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
812 "Feature\tFeature\n"
813 "typelib\t\t\ttypelib feature\t1\t2\tMSITESTDIR\t0\n";
814
815 static const char tl_feature_comp_dat[] =
816 "Feature_\tComponent_\n"
817 "s38\ts72\n"
818 "FeatureComponents\tFeature_\tComponent_\n"
819 "typelib\ttypelib\n";
820
821 static const char tl_component_dat[] =
822 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
823 "s72\tS38\ts72\ti2\tS255\tS72\n"
824 "Component\tComponent\n"
825 "typelib\t{BB4C26FD-89D8-4E49-AF1C-DB4DCB5BF1B0}\tMSITESTDIR\t0\t\ttypelib.dll\n";
826
827 static const char tl_typelib_dat[] =
828 "LibID\tLanguage\tComponent_\tVersion\tDescription\tDirectory_\tFeature_\tCost\n"
829 "s38\ti2\ts72\tI4\tL128\tS72\ts38\tI4\n"
830 "TypeLib\tLibID\tLanguage\tComponent_\n"
831 "{EAC5166A-9734-4D91-878F-1DD02304C66C}\t0\ttypelib\t1793\t\tMSITESTDIR\ttypelib\t\n";
832
833 static const char tl_install_exec_seq_dat[] =
834 "Action\tCondition\tSequence\n"
835 "s72\tS255\tI2\n"
836 "InstallExecuteSequence\tAction\n"
837 "LaunchConditions\t\t100\n"
838 "CostInitialize\t\t800\n"
839 "FileCost\t\t900\n"
840 "CostFinalize\t\t1000\n"
841 "InstallValidate\t\t1400\n"
842 "InstallInitialize\t\t1500\n"
843 "ProcessComponents\t\t1600\n"
844 "RemoveFiles\t\t1700\n"
845 "InstallFiles\t\t2000\n"
846 "RegisterTypeLibraries\tREGISTER_TYPELIB=1\t3000\n"
847 "UnregisterTypeLibraries\t\t3100\n"
848 "RegisterProduct\t\t5100\n"
849 "PublishFeatures\t\t5200\n"
850 "PublishProduct\t\t5300\n"
851 "InstallFinalize\t\t6000\n";
852
853 static const char crs_file_dat[] =
854 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
855 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
856 "File\tFile\n"
857 "target.txt\tshortcut\ttarget.txt\t1000\t\t\t8192\t1\n";
858
859 static const char crs_feature_dat[] =
860 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
861 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
862 "Feature\tFeature\n"
863 "shortcut\t\t\tshortcut feature\t1\t2\tMSITESTDIR\t0\n";
864
865 static const char crs_feature_comp_dat[] =
866 "Feature_\tComponent_\n"
867 "s38\ts72\n"
868 "FeatureComponents\tFeature_\tComponent_\n"
869 "shortcut\tshortcut\n";
870
871 static const char crs_component_dat[] =
872 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
873 "s72\tS38\ts72\ti2\tS255\tS72\n"
874 "Component\tComponent\n"
875 "shortcut\t{5D20E3C6-7206-498F-AC28-87AF2F9AD4CC}\tMSITESTDIR\t0\t\ttarget.txt\n";
876
877 static const char crs_shortcut_dat[] =
878 "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
879 "s72\ts72\tl128\ts72\ts72\tL255\tL255\tI2\tS72\tI2\tI2\tS72\n"
880 "Shortcut\tShortcut\n"
881 "shortcut\tMSITESTDIR\tshortcut\tshortcut\t[MSITESTDIR]target.txt\t\t\t\t\t\t\t\n";
882
883 static const char crs_install_exec_seq_dat[] =
884 "Action\tCondition\tSequence\n"
885 "s72\tS255\tI2\n"
886 "InstallExecuteSequence\tAction\n"
887 "LaunchConditions\t\t100\n"
888 "CostInitialize\t\t800\n"
889 "FileCost\t\t900\n"
890 "CostFinalize\t\t1000\n"
891 "InstallValidate\t\t1400\n"
892 "InstallInitialize\t\t1500\n"
893 "ProcessComponents\t\t1600\n"
894 "RemoveFiles\t\t1700\n"
895 "InstallFiles\t\t2000\n"
896 "RemoveShortcuts\t\t3000\n"
897 "CreateShortcuts\t\t3100\n"
898 "RegisterProduct\t\t5000\n"
899 "PublishFeatures\t\t5100\n"
900 "PublishProduct\t\t5200\n"
901 "InstallFinalize\t\t6000\n";
902
903 static const char pub_file_dat[] =
904 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
905 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
906 "File\tFile\n"
907 "english.txt\tpublish\tenglish.txt\t1000\t\t\t8192\t1\n";
908
909 static const char pub_feature_dat[] =
910 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
911 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
912 "Feature\tFeature\n"
913 "publish\t\t\tpublish feature\t1\t2\tMSITESTDIR\t0\n";
914
915 static const char pub_feature_comp_dat[] =
916 "Feature_\tComponent_\n"
917 "s38\ts72\n"
918 "FeatureComponents\tFeature_\tComponent_\n"
919 "publish\tpublish\n";
920
921 static const char pub_component_dat[] =
922 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
923 "s72\tS38\ts72\ti2\tS255\tS72\n"
924 "Component\tComponent\n"
925 "publish\t{B4EA0ACF-6238-426E-9C6D-7869F0F9C768}\tMSITESTDIR\t0\t\tenglish.txt\n";
926
927 static const char pub_publish_component_dat[] =
928 "ComponentId\tQualifier\tComponent_\tAppData\tFeature_\n"
929 "s38\ts255\ts72\tL255\ts38\n"
930 "PublishComponent\tComponentId\tQualifier\tComponent_\n"
931 "{92AFCBC0-9CA6-4270-8454-47C5EE2B8FAA}\tenglish.txt\tpublish\t\tpublish\n";
932
933 static const char pub_install_exec_seq_dat[] =
934 "Action\tCondition\tSequence\n"
935 "s72\tS255\tI2\n"
936 "InstallExecuteSequence\tAction\n"
937 "LaunchConditions\t\t100\n"
938 "CostInitialize\t\t800\n"
939 "FileCost\t\t900\n"
940 "CostFinalize\t\t1000\n"
941 "InstallValidate\t\t1400\n"
942 "InstallInitialize\t\t1500\n"
943 "ProcessComponents\t\t1600\n"
944 "RemoveFiles\t\t1700\n"
945 "InstallFiles\t\t2000\n"
946 "PublishComponents\t\t3000\n"
947 "UnpublishComponents\t\t3100\n"
948 "RegisterProduct\t\t5000\n"
949 "PublishFeatures\t\t5100\n"
950 "PublishProduct\t\t5200\n"
951 "InstallFinalize\t\t6000\n";
952
953 static const char rd_file_dat[] =
954 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
955 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
956 "File\tFile\n"
957 "original.txt\tduplicate\toriginal.txt\t1000\t\t\t8192\t1\n"
958 "original2.txt\tduplicate\toriginal2.txt\t1000\t\t\t8192\t2\n"
959 "original3.txt\tduplicate2\toriginal3.txt\t1000\t\t\t8192\t3\n";
960
961 static const char rd_feature_dat[] =
962 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
963 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
964 "Feature\tFeature\n"
965 "duplicate\t\t\tduplicate feature\t1\t2\tMSITESTDIR\t0\n";
966
967 static const char rd_feature_comp_dat[] =
968 "Feature_\tComponent_\n"
969 "s38\ts72\n"
970 "FeatureComponents\tFeature_\tComponent_\n"
971 "duplicate\tduplicate\n";
972
973 static const char rd_component_dat[] =
974 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
975 "s72\tS38\ts72\ti2\tS255\tS72\n"
976 "Component\tComponent\n"
977 "duplicate\t{EB45D06A-ADFE-44E3-8D41-B7DE150E41AD}\tMSITESTDIR\t0\t\toriginal.txt\n"
978 "duplicate2\t{B8BA60E0-B2E9-488E-9D0E-E60F25F04F97}\tMSITESTDIR\t0\tDUPLICATE2=1\toriginal3.txt\n";
979
980 static const char rd_duplicate_file_dat[] =
981 "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
982 "s72\ts72\ts72\tS255\tS72\n"
983 "DuplicateFile\tFileKey\n"
984 "duplicate\tduplicate\toriginal.txt\tduplicate.txt\t\n"
985 "duplicate2\tduplicate\toriginal2.txt\t\tMSITESTDIR\n"
986 "duplicate3\tduplicate2\toriginal3.txt\tduplicate2.txt\t\n";
987
988 static const char rd_install_exec_seq_dat[] =
989 "Action\tCondition\tSequence\n"
990 "s72\tS255\tI2\n"
991 "InstallExecuteSequence\tAction\n"
992 "LaunchConditions\t\t100\n"
993 "CostInitialize\t\t800\n"
994 "FileCost\t\t900\n"
995 "CostFinalize\t\t1000\n"
996 "InstallValidate\t\t1400\n"
997 "InstallInitialize\t\t1500\n"
998 "ProcessComponents\t\t1600\n"
999 "RemoveDuplicateFiles\t\t1900\n"
1000 "InstallFiles\t\t2000\n"
1001 "DuplicateFiles\t\t2100\n"
1002 "RegisterProduct\t\t5000\n"
1003 "PublishFeatures\t\t5100\n"
1004 "PublishProduct\t\t5200\n"
1005 "InstallFinalize\t\t6000\n";
1006
1007 static const char rrv_file_dat[] =
1008 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1009 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1010 "File\tFile\n"
1011 "registry.txt\tregistry\tregistry.txt\t1000\t\t\t8192\t1\n";
1012
1013 static const char rrv_feature_dat[] =
1014 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1015 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1016 "Feature\tFeature\n"
1017 "registry\t\t\tregistry feature\t1\t2\tMSITESTDIR\t0\n";
1018
1019 static const char rrv_feature_comp_dat[] =
1020 "Feature_\tComponent_\n"
1021 "s38\ts72\n"
1022 "FeatureComponents\tFeature_\tComponent_\n"
1023 "registry\tregistry\n";
1024
1025 static const char rrv_component_dat[] =
1026 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1027 "s72\tS38\ts72\ti2\tS255\tS72\n"
1028 "Component\tComponent\n"
1029 "registry\t{DA97585B-962D-45EB-AD32-DA15E60CA9EE}\tMSITESTDIR\t0\t\tregistry.txt\n";
1030
1031 static const char rrv_registry_dat[] =
1032 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
1033 "s72\ti2\tl255\tL255\tL0\ts72\n"
1034 "Registry\tRegistry\n"
1035 "reg1\t2\tSOFTWARE\\Wine\\keyA\t\tA\tregistry\n"
1036 "reg2\t2\tSOFTWARE\\Wine\\keyA\tvalueA\tA\tregistry\n"
1037 "reg3\t2\tSOFTWARE\\Wine\\key1\t-\t\tregistry\n";
1038
1039 static const char rrv_remove_registry_dat[] =
1040 "RemoveRegistry\tRoot\tKey\tName\tComponent_\n"
1041 "s72\ti2\tl255\tL255\ts72\n"
1042 "RemoveRegistry\tRemoveRegistry\n"
1043 "reg1\t2\tSOFTWARE\\Wine\\keyB\t\tregistry\n"
1044 "reg2\t2\tSOFTWARE\\Wine\\keyB\tValueB\tregistry\n"
1045 "reg3\t2\tSOFTWARE\\Wine\\key2\t-\tregistry\n";
1046
1047 static const char rrv_install_exec_seq_dat[] =
1048 "Action\tCondition\tSequence\n"
1049 "s72\tS255\tI2\n"
1050 "InstallExecuteSequence\tAction\n"
1051 "LaunchConditions\t\t100\n"
1052 "CostInitialize\t\t800\n"
1053 "FileCost\t\t900\n"
1054 "CostFinalize\t\t1000\n"
1055 "InstallValidate\t\t1400\n"
1056 "InstallInitialize\t\t1500\n"
1057 "ProcessComponents\t\t1600\n"
1058 "RemoveFiles\t\t1700\n"
1059 "InstallFiles\t\t2000\n"
1060 "RemoveRegistryValues\t\t3000\n"
1061 "RegisterProduct\t\t5000\n"
1062 "PublishFeatures\t\t5100\n"
1063 "PublishProduct\t\t5200\n"
1064 "InstallFinalize\t\t6000\n";
1065
1066 static const char frp_file_dat[] =
1067 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1068 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1069 "File\tFile\n"
1070 "product.txt\tproduct\tproduct.txt\t1000\t\t\t8192\t1\n";
1071
1072 static const char frp_feature_dat[] =
1073 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1074 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1075 "Feature\tFeature\n"
1076 "product\t\t\tproduct feature\t1\t2\tMSITESTDIR\t0\n";
1077
1078 static const char frp_feature_comp_dat[] =
1079 "Feature_\tComponent_\n"
1080 "s38\ts72\n"
1081 "FeatureComponents\tFeature_\tComponent_\n"
1082 "product\tproduct\n";
1083
1084 static const char frp_component_dat[] =
1085 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1086 "s72\tS38\ts72\ti2\tS255\tS72\n"
1087 "Component\tComponent\n"
1088 "product\t{44725EE0-EEA8-40BD-8162-A48224A2FEA1}\tMSITESTDIR\t0\t\tproduct.txt\n";
1089
1090 static const char frp_custom_action_dat[] =
1091 "Action\tType\tSource\tTarget\tISComments\n"
1092 "s72\ti2\tS64\tS0\tS255\n"
1093 "CustomAction\tAction\n"
1094 "TestProp\t19\t\t\tPROP set\n";
1095
1096 static const char frp_upgrade_dat[] =
1097 "UpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\tRemove\tActionProperty\n"
1098 "s38\tS20\tS20\tS255\ti4\tS255\ts72\n"
1099 "Upgrade\tUpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\n"
1100 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}\t1.1.1\t2.2.2\t\t768\t\tPROP\n";
1101
1102 static const char frp_install_exec_seq_dat[] =
1103 "Action\tCondition\tSequence\n"
1104 "s72\tS255\tI2\n"
1105 "InstallExecuteSequence\tAction\n"
1106 "FindRelatedProducts\t\t50\n"
1107 "TestProp\tPROP AND NOT REMOVE\t51\n"
1108 "LaunchConditions\t\t100\n"
1109 "CostInitialize\t\t800\n"
1110 "FileCost\t\t900\n"
1111 "CostFinalize\t\t1000\n"
1112 "InstallValidate\t\t1400\n"
1113 "InstallInitialize\t\t1500\n"
1114 "ProcessComponents\t\t1600\n"
1115 "RemoveFiles\t\t1700\n"
1116 "InstallFiles\t\t2000\n"
1117 "RegisterProduct\t\t5000\n"
1118 "PublishFeatures\t\t5100\n"
1119 "PublishProduct\t\t5200\n"
1120 "InstallFinalize\t\t6000\n";
1121
1122 static const char riv_file_dat[] =
1123 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1124 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1125 "File\tFile\n"
1126 "inifile.txt\tinifile\tinifile.txt\t1000\t\t\t8192\t1\n";
1127
1128 static const char riv_feature_dat[] =
1129 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1130 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1131 "Feature\tFeature\n"
1132 "inifile\t\t\tinifile feature\t1\t2\tMSITESTDIR\t0\n";
1133
1134 static const char riv_feature_comp_dat[] =
1135 "Feature_\tComponent_\n"
1136 "s38\ts72\n"
1137 "FeatureComponents\tFeature_\tComponent_\n"
1138 "inifile\tinifile\n";
1139
1140 static const char riv_component_dat[] =
1141 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1142 "s72\tS38\ts72\ti2\tS255\tS72\n"
1143 "Component\tComponent\n"
1144 "inifile\t{A0F15705-4F57-4437-88C4-6C8B37ACC6DE}\tMSITESTDIR\t0\t\tinifile.txt\n";
1145
1146 static const char riv_ini_file_dat[] =
1147 "IniFile\tFileName\tDirProperty\tSection\tKey\tValue\tAction\tComponent_\n"
1148 "s72\tl255\tS72\tl96\tl128\tl255\ti2\ts72\n"
1149 "IniFile\tIniFile\n"
1150 "inifile1\ttest.ini\tMSITESTDIR\tsection1\tkey1\tvalue1\t0\tinifile\n";
1151
1152 static const char riv_remove_ini_file_dat[] =
1153 "RemoveIniFile\tFileName\tDirProperty\tSection\tKey\tValue\tAction\tComponent_\n"
1154 "s72\tl255\tS72\tl96\tl128\tL255\ti2\ts72\n"
1155 "RemoveIniFile\tRemoveIniFile\n"
1156 "inifile1\ttest.ini\tMSITESTDIR\tsectionA\tkeyA\tvalueA\t2\tinifile\n";
1157
1158 static const char riv_install_exec_seq_dat[] =
1159 "Action\tCondition\tSequence\n"
1160 "s72\tS255\tI2\n"
1161 "InstallExecuteSequence\tAction\n"
1162 "LaunchConditions\t\t100\n"
1163 "CostInitialize\t\t800\n"
1164 "FileCost\t\t900\n"
1165 "CostFinalize\t\t1000\n"
1166 "InstallValidate\t\t1400\n"
1167 "InstallInitialize\t\t1500\n"
1168 "ProcessComponents\t\t1600\n"
1169 "RemoveFiles\t\t1700\n"
1170 "InstallFiles\t\t2000\n"
1171 "RemoveIniValues\t\t3000\n"
1172 "RegisterProduct\t\t5000\n"
1173 "PublishFeatures\t\t5100\n"
1174 "PublishProduct\t\t5200\n"
1175 "InstallFinalize\t\t6000\n";
1176
1177 static const char res_file_dat[] =
1178 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1179 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1180 "File\tFile\n"
1181 "envvar.txt\tenvvar\tenvvar.txt\t1000\t\t\t8192\t1\n";
1182
1183 static const char res_feature_dat[] =
1184 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1185 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1186 "Feature\tFeature\n"
1187 "envvar\t\t\tenvvar feature\t1\t2\tMSITESTDIR\t0\n";
1188
1189 static const char res_feature_comp_dat[] =
1190 "Feature_\tComponent_\n"
1191 "s38\ts72\n"
1192 "FeatureComponents\tFeature_\tComponent_\n"
1193 "envvar\tenvvar\n";
1194
1195 static const char res_component_dat[] =
1196 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1197 "s72\tS38\ts72\ti2\tS255\tS72\n"
1198 "Component\tComponent\n"
1199 "envvar\t{45EE9AF4-E5D1-445F-8BB7-B22D4EEBD29E}\tMSITESTDIR\t0\t\tenvvar.txt\n";
1200
1201 static const char res_environment_dat[] =
1202 "Environment\tName\tValue\tComponent_\n"
1203 "s72\tl255\tL255\ts72\n"
1204 "Environment\tEnvironment\n"
1205 "var1\t=-MSITESTVAR1\t1\tenvvar\n"
1206 "var2\t=+-MSITESTVAR2\t1\tenvvar\n"
1207 "var3\t=MSITESTVAR3\t1\tenvvar\n"
1208 "var4\t=-MSITESTVAR4\t\tenvvar\n"
1209 "var5\t=MSITESTVAR5\t\tenvvar\n"
1210 "Var6\t-MSITESTVAR6\t1;[~]\tenvvar\n"
1211 "Var7\t-MSITESTVAR7\t[~];1\tenvvar\n"
1212 "Var8\t-MSITESTVAR8\t1;[~]\tenvvar\n"
1213 "Var9\t-MSITESTVAR9\t[~];1\tenvvar\n"
1214 "Var10\t-MSITESTVAR10\t1\tenvvar\n"
1215 "Var11\t-MSITESTVAR11\t2\tenvvar\n";
1216
1217 static const char res_install_exec_seq_dat[] =
1218 "Action\tCondition\tSequence\n"
1219 "s72\tS255\tI2\n"
1220 "InstallExecuteSequence\tAction\n"
1221 "LaunchConditions\t\t100\n"
1222 "CostInitialize\t\t800\n"
1223 "FileCost\t\t900\n"
1224 "CostFinalize\t\t1000\n"
1225 "InstallValidate\t\t1400\n"
1226 "InstallInitialize\t\t1500\n"
1227 "ProcessComponents\t\t1600\n"
1228 "RemoveFiles\t\t1700\n"
1229 "InstallFiles\t\t2000\n"
1230 "RemoveEnvironmentStrings\t\t3000\n"
1231 "RegisterProduct\t\t5000\n"
1232 "PublishFeatures\t\t5100\n"
1233 "PublishProduct\t\t5200\n"
1234 "InstallFinalize\t\t6000\n";
1235
1236 static const char rci_file_dat[] =
1237 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1238 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1239 "File\tFile\n"
1240 "class.txt\tclass\tclass.txt\t1000\t\t\t8192\t1\n";
1241
1242 static const char rci_feature_dat[] =
1243 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1244 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1245 "Feature\tFeature\n"
1246 "class\t\t\tclass feature\t1\t2\tMSITESTDIR\t0\n";
1247
1248 static const char rci_feature_comp_dat[] =
1249 "Feature_\tComponent_\n"
1250 "s38\ts72\n"
1251 "FeatureComponents\tFeature_\tComponent_\n"
1252 "class\tclass\n";
1253
1254 static const char rci_component_dat[] =
1255 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1256 "s72\tS38\ts72\ti2\tS255\tS72\n"
1257 "Component\tComponent\n"
1258 "class\t{89A98345-F8A1-422E-A48B-0250B5809F2D}\tMSITESTDIR\t0\t\tclass.txt\n";
1259
1260 static const char rci_appid_dat[] =
1261 "AppId\tRemoteServerName\tLocalService\tServiceParameters\tDllSurrogate\tActivateAtStorage\tRunAsInteractiveUser\n"
1262 "s38\tS255\tS255\tS255\tS255\tI2\tI2\n"
1263 "AppId\tAppId\n"
1264 "{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\t\t\t\t\t\t\n";
1265
1266 static const char rci_class_dat[] =
1267 "CLSID\tContext\tComponent_\tProgId_Default\tDescription\tAppId_\tFileTypeMask\tIcon_\tIconIndex\tDefInprocHandler\tArgument\tFeature_\tAttributes\n"
1268 "s38\ts32\ts72\tS255\tL255\tS38\tS255\tS72\tI2\tS32\tS255\ts38\tI2\n"
1269 "Class\tCLSID\tContext\tComponent_\n"
1270 "{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tLocalServer\tclass\t\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tclass\t\n";
1271
1272 static const char rci_install_exec_seq_dat[] =
1273 "Action\tCondition\tSequence\n"
1274 "s72\tS255\tI2\n"
1275 "InstallExecuteSequence\tAction\n"
1276 "LaunchConditions\t\t100\n"
1277 "CostInitialize\t\t800\n"
1278 "FileCost\t\t900\n"
1279 "CostFinalize\t\t1000\n"
1280 "InstallValidate\t\t1400\n"
1281 "InstallInitialize\t\t1500\n"
1282 "ProcessComponents\t\t1600\n"
1283 "RemoveFiles\t\t1700\n"
1284 "InstallFiles\t\t2000\n"
1285 "UnregisterClassInfo\t\t3000\n"
1286 "RegisterClassInfo\t\t4000\n"
1287 "RegisterProduct\t\t5000\n"
1288 "PublishFeatures\t\t5100\n"
1289 "PublishProduct\t\t5200\n"
1290 "InstallFinalize\t\t6000\n";
1291
1292 static const char rei_file_dat[] =
1293 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1294 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1295 "File\tFile\n"
1296 "extension.txt\textension\textension.txt\t1000\t\t\t8192\t1\n";
1297
1298 static const char rei_feature_dat[] =
1299 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1300 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1301 "Feature\tFeature\n"
1302 "extension\t\t\textension feature\t1\t2\tMSITESTDIR\t0\n";
1303
1304 static const char rei_feature_comp_dat[] =
1305 "Feature_\tComponent_\n"
1306 "s38\ts72\n"
1307 "FeatureComponents\tFeature_\tComponent_\n"
1308 "extension\textension\n";
1309
1310 static const char rei_component_dat[] =
1311 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1312 "s72\tS38\ts72\ti2\tS255\tS72\n"
1313 "Component\tComponent\n"
1314 "extension\t{9A3060D4-60BA-4A82-AB55-9FB148AD013C}\tMSITESTDIR\t0\t\textension.txt\n";
1315
1316 static const char rei_extension_dat[] =
1317 "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n"
1318 "s255\ts72\tS255\tS64\ts38\n"
1319 "Extension\tExtension\tComponent_\n"
1320 "extension\textension\tProg.Id.1\t\textension\n";
1321
1322 static const char rei_verb_dat[] =
1323 "Extension_\tVerb\tSequence\tCommand\tArgument\n"
1324 "s255\ts32\tI2\tL255\tL255\n"
1325 "Verb\tExtension_\tVerb\n"
1326 "extension\tOpen\t1\t&Open\t/argument\n";
1327
1328 static const char rei_progid_dat[] =
1329 "ProgId\tProgId_Parent\tClass_\tDescription\tIcon_\tIconIndex\n"
1330 "s255\tS255\tS38\tL255\tS72\tI2\n"
1331 "ProgId\tProgId\n"
1332 "Prog.Id.1\t\t\tdescription\t\t\n";
1333
1334 static const char rei_install_exec_seq_dat[] =
1335 "Action\tCondition\tSequence\n"
1336 "s72\tS255\tI2\n"
1337 "InstallExecuteSequence\tAction\n"
1338 "LaunchConditions\t\t100\n"
1339 "CostInitialize\t\t800\n"
1340 "FileCost\t\t900\n"
1341 "CostFinalize\t\t1000\n"
1342 "InstallValidate\t\t1400\n"
1343 "InstallInitialize\t\t1500\n"
1344 "ProcessComponents\t\t1600\n"
1345 "RemoveFiles\t\t1700\n"
1346 "InstallFiles\t\t2000\n"
1347 "UnregisterExtensionInfo\t\t3000\n"
1348 "RegisterExtensionInfo\t\t4000\n"
1349 "RegisterProduct\t\t5000\n"
1350 "PublishFeatures\t\t5100\n"
1351 "PublishProduct\t\t5200\n"
1352 "InstallFinalize\t\t6000\n";
1353
1354 static const char rpi_file_dat[] =
1355 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1356 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1357 "File\tFile\n"
1358 "progid.txt\tprogid\tprogid.txt\t1000\t\t\t8192\t1\n";
1359
1360 static const char rpi_feature_dat[] =
1361 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1362 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1363 "Feature\tFeature\n"
1364 "progid\t\t\tprogid feature\t1\t2\tMSITESTDIR\t0\n";
1365
1366 static const char rpi_feature_comp_dat[] =
1367 "Feature_\tComponent_\n"
1368 "s38\ts72\n"
1369 "FeatureComponents\tFeature_\tComponent_\n"
1370 "progid\tprogid\n";
1371
1372 static const char rpi_component_dat[] =
1373 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1374 "s72\tS38\ts72\ti2\tS255\tS72\n"
1375 "Component\tComponent\n"
1376 "progid\t{89A98345-F8A1-422E-A48B-0250B5809F2D}\tMSITESTDIR\t0\t\tprogid.txt\n";
1377
1378 static const char rpi_appid_dat[] =
1379 "AppId\tRemoteServerName\tLocalService\tServiceParameters\tDllSurrogate\tActivateAtStorage\tRunAsInteractiveUser\n"
1380 "s38\tS255\tS255\tS255\tS255\tI2\tI2\n"
1381 "AppId\tAppId\n"
1382 "{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\t\t\t\t\t\t\n";
1383
1384 static const char rpi_class_dat[] =
1385 "CLSID\tContext\tComponent_\tProgId_Default\tDescription\tAppId_\tFileTypeMask\tIcon_\tIconIndex\tDefInprocHandler\tArgument\tFeature_\tAttributes\n"
1386 "s38\ts32\ts72\tS255\tL255\tS38\tS255\tS72\tI2\tS32\tS255\ts38\tI2\n"
1387 "Class\tCLSID\tContext\tComponent_\n"
1388 "{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tLocalServer\tprogid\tWinetest.Class.1\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tprogid\t\n"
1389 "{904E6BC9-F57F-4412-B460-D40DE2F256E2}\tLocalServer\tprogid\tWinetest.VerClass\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tprogid\t\n"
1390 "{57C413FB-CA02-498A-81F6-7E769BDB7C97}\tLocalServer\tprogid\t\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tprogid\t\n";
1391
1392 static const char rpi_extension_dat[] =
1393 "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n"
1394 "s255\ts72\tS255\tS64\ts38\n"
1395 "Extension\tExtension\tComponent_\n"
1396 "winetest\tprogid\tWinetest.Extension\t\tprogid\n";
1397
1398 static const char rpi_verb_dat[] =
1399 "Extension_\tVerb\tSequence\tCommand\tArgument\n"
1400 "s255\ts32\tI2\tL255\tL255\n"
1401 "Verb\tExtension_\tVerb\n"
1402 "winetest\tOpen\t1\t&Open\t/argument\n";
1403
1404 static const char rpi_progid_dat[] =
1405 "ProgId\tProgId_Parent\tClass_\tDescription\tIcon_\tIconIndex\n"
1406 "s255\tS255\tS38\tL255\tS72\tI2\n"
1407 "ProgId\tProgId\n"
1408 "Winetest.Class.1\t\t{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tdescription\t\t\n"
1409 "Winetest.Class\tWinetest.Class.1\t\tdescription\t\t\n"
1410 "Winetest.Class.2\t\t{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tdescription\t\t\n"
1411 "Winetest.VerClass.1\t\t{904E6BC9-F57F-4412-B460-D40DE2F256E2}\tdescription\t\t\n"
1412 "Winetest.VerClass\tWinetest.VerClass.1\t\tdescription\t\t\n"
1413 "Winetest.NoProgIdClass.1\t\t{57C413FB-CA02-498A-81F6-7E769BDB7C97}\tdescription\t\t\n"
1414 "Winetest.NoProgIdClass\tWinetest.NoProgIdClass.1\t\tdescription\t\t\n"
1415 "Winetest.Orphaned\t\t\tdescription\t\t\n"
1416 "Winetest.Orphaned2\t\t\tdescription\t\t\n"
1417 "Winetest.Extension\t\t\tdescription\t\t\n";
1418
1419 static const char rpi_install_exec_seq_dat[] =
1420 "Action\tCondition\tSequence\n"
1421 "s72\tS255\tI2\n"
1422 "InstallExecuteSequence\tAction\n"
1423 "LaunchConditions\t\t100\n"
1424 "CostInitialize\t\t800\n"
1425 "FileCost\t\t900\n"
1426 "CostFinalize\t\t1000\n"
1427 "InstallValidate\t\t1400\n"
1428 "InstallInitialize\t\t1500\n"
1429 "ProcessComponents\t\t1600\n"
1430 "RemoveFiles\t\t1700\n"
1431 "UnregisterClassInfo\t\t3000\n"
1432 "UnregisterExtensionInfo\t\t3200\n"
1433 "UnregisterProgIdInfo\t\t3400\n"
1434 "InstallFiles\t\t3600\n"
1435 "RegisterClassInfo\t\t4000\n"
1436 "RegisterExtensionInfo\t\t4200\n"
1437 "RegisterProgIdInfo\t\t4400\n"
1438 "RegisterProduct\t\t5000\n"
1439 "PublishFeatures\t\t5100\n"
1440 "PublishProduct\t\t5200\n"
1441 "InstallFinalize\t\t6000\n";
1442
1443 static const char rmi_file_dat[] =
1444 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1445 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1446 "File\tFile\n"
1447 "mime.txt\tmime\tmime.txt\t1000\t\t\t8192\t1\n";
1448
1449 static const char rmi_feature_dat[] =
1450 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1451 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1452 "Feature\tFeature\n"
1453 "mime\t\t\tmime feature\t1\t2\tMSITESTDIR\t0\n";
1454
1455 static const char rmi_feature_comp_dat[] =
1456 "Feature_\tComponent_\n"
1457 "s38\ts72\n"
1458 "FeatureComponents\tFeature_\tComponent_\n"
1459 "mime\tmime\n";
1460
1461 static const char rmi_component_dat[] =
1462 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1463 "s72\tS38\ts72\ti2\tS255\tS72\n"
1464 "Component\tComponent\n"
1465 "mime\t{A1D630CE-13A7-4882-AFDD-148E2BBAFC6D}\tMSITESTDIR\t0\t\tmime.txt\n";
1466
1467 static const char rmi_extension_dat[] =
1468 "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n"
1469 "s255\ts72\tS255\tS64\ts38\n"
1470 "Extension\tExtension\tComponent_\n"
1471 "mime\tmime\t\tmime/type\tmime\n";
1472
1473 static const char rmi_verb_dat[] =
1474 "Extension_\tVerb\tSequence\tCommand\tArgument\n"
1475 "s255\ts32\tI2\tL255\tL255\n"
1476 "Verb\tExtension_\tVerb\n"
1477 "mime\tOpen\t1\t&Open\t/argument\n";
1478
1479 static const char rmi_mime_dat[] =
1480 "ContentType\tExtension_\tCLSID\n"
1481 "s64\ts255\tS38\n"
1482 "MIME\tContentType\n"
1483 "mime/type\tmime\t\n";
1484
1485 static const char rmi_install_exec_seq_dat[] =
1486 "Action\tCondition\tSequence\n"
1487 "s72\tS255\tI2\n"
1488 "InstallExecuteSequence\tAction\n"
1489 "LaunchConditions\t\t100\n"
1490 "CostInitialize\t\t800\n"
1491 "FileCost\t\t900\n"
1492 "CostFinalize\t\t1000\n"
1493 "InstallValidate\t\t1400\n"
1494 "InstallInitialize\t\t1500\n"
1495 "ProcessComponents\t\t1600\n"
1496 "RemoveFiles\t\t1700\n"
1497 "InstallFiles\t\t2000\n"
1498 "UnregisterExtensionInfo\t\t3000\n"
1499 "UnregisterMIMEInfo\t\t3500\n"
1500 "RegisterExtensionInfo\t\t4000\n"
1501 "RegisterMIMEInfo\t\t4500\n"
1502 "RegisterProduct\t\t5000\n"
1503 "PublishFeatures\t\t5100\n"
1504 "PublishProduct\t\t5200\n"
1505 "InstallFinalize\t\t6000\n";
1506
1507 static const char pa_file_dat[] =
1508 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1509 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1510 "File\tFile\n"
1511 "win32.txt\twin32\twin32.txt\t1000\t\t\t8192\t1\n"
1512 "manifest.txt\twin32\tmanifest.txt\t1000\t\t\t8192\t1\n"
1513 "win32_local.txt\twin32_local\twin32_local.txt\t1000\t\t\t8192\t1\n"
1514 "manifest_local.txt\twin32_local\tmanifest_local.txt\t1000\t\t\t8192\t1\n"
1515 "dotnet.txt\tdotnet\tdotnet.txt\t1000\t\t\t8192\t1\n"
1516 "dotnet_local.txt\tdotnet_local\tdotnet_local.txt\t1000\t\t\t8192\t1\n"
1517 "application_win32.txt\twin32_local\tapplication_win32.txt\t1000\t\t\t8192\t1\n"
1518 "application_dotnet.txt\tdotnet_local\tapplication_dotnet.txt\t1000\t\t\t8192\t1\n";
1519
1520 static const char pa_feature_dat[] =
1521 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1522 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1523 "Feature\tFeature\n"
1524 "assembly\t\t\tassembly feature\t1\t2\tMSITESTDIR\t0\n";
1525
1526 static const char pa_feature_comp_dat[] =
1527 "Feature_\tComponent_\n"
1528 "s38\ts72\n"
1529 "FeatureComponents\tFeature_\tComponent_\n"
1530 "assembly\twin32\n"
1531 "assembly\twin32_local\n"
1532 "assembly\tdotnet\n"
1533 "assembly\tdotnet_local\n";
1534
1535 static const char pa_component_dat[] =
1536 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1537 "s72\tS38\ts72\ti2\tS255\tS72\n"
1538 "Component\tComponent\n"
1539 "win32\t{F515549E-7E61-425D-AAC1-9BEF2E066D06}\tMSITESTDIR\t0\t\twin32.txt\n"
1540 "win32_local\t{D34D3FBA-6789-4E57-AD1A-1281297DC201}\tMSITESTDIR\t0\t\twin32_local.txt\n"
1541 "dotnet\t{8943164F-2B31-4C09-A894-493A8CBDE0A4}\tMSITESTDIR\t0\t\tdotnet.txt\n"
1542 "dotnet_local\t{4E8567E8-8EAE-4E36-90F1-B99D33C663F8}\tMSITESTDIR\t0\t\tdotnet_local.txt\n";
1543
1544 static const char pa_msi_assembly_dat[] =
1545 "Component_\tFeature_\tFile_Manifest\tFile_Application\tAttributes\n"
1546 "s72\ts38\tS72\tS72\tI2\n"
1547 "MsiAssembly\tComponent_\n"
1548 "win32\tassembly\tmanifest.txt\t\t1\n"
1549 "win32_local\tassembly\tmanifest_local.txt\tapplication_win32.txt\t1\n"
1550 "dotnet\tassembly\t\t\t0\n"
1551 "dotnet_local\tassembly\t\tapplication_dotnet.txt\t0\n";
1552
1553 static const char pa_msi_assembly_name_dat[] =
1554 "Component_\tName\tValue\n"
1555 "s72\ts255\ts255\n"
1556 "MsiAssemblyName\tComponent_\tName\n"
1557 "win32\tName\tWine.Win32.Assembly\n"
1558 "win32\tprocessorArchitecture\tx86\n"
1559 "win32\tpublicKeyToken\tabcdef0123456789\n"
1560 "win32\ttype\twin32\n"
1561 "win32\tversion\t1.0.0.0\n"
1562 "win32_local\tName\tWine.Win32.Local.Assembly\n"
1563 "win32_local\tprocessorArchitecture\tx86\n"
1564 "win32_local\tpublicKeyToken\tabcdef0123456789\n"
1565 "win32_local\ttype\twin32\n"
1566 "win32_local\tversion\t1.0.0.0\n"
1567 "dotnet\tName\tWine.Dotnet.Assembly\n"
1568 "dotnet\tprocessorArchitecture\tMSIL\n"
1569 "dotnet\tpublicKeyToken\tabcdef0123456789\n"
1570 "dotnet\tculture\tneutral\n"
1571 "dotnet\tversion\t1.0.0.0\n"
1572 "dotnet_local\tName\tWine.Dotnet.Local.Assembly\n"
1573 "dotnet_local\tprocessorArchitecture\tMSIL\n"
1574 "dotnet_local\tpublicKeyToken\tabcdef0123456789\n"
1575 "dotnet_local\tculture\tneutral\n"
1576 "dotnet_local\tversion\t1.0.0.0\n";
1577
1578 static const char pa_install_exec_seq_dat[] =
1579 "Action\tCondition\tSequence\n"
1580 "s72\tS255\tI2\n"
1581 "InstallExecuteSequence\tAction\n"
1582 "LaunchConditions\t\t100\n"
1583 "CostInitialize\t\t800\n"
1584 "FileCost\t\t900\n"
1585 "CostFinalize\t\t1000\n"
1586 "InstallValidate\t\t1400\n"
1587 "InstallInitialize\t\t1500\n"
1588 "ProcessComponents\t\t1600\n"
1589 "MsiPublishAssemblies\t\t3000\n"
1590 "MsiUnpublishAssemblies\t\t4000\n"
1591 "RegisterProduct\t\t5000\n"
1592 "PublishFeatures\t\t5100\n"
1593 "PublishProduct\t\t5200\n"
1594 "InstallFinalize\t\t6000\n";
1595
1596 static const char rep_file_dat[] =
1597 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1598 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1599 "File\tFile\n"
1600 "rep.txt\trep\trep.txt\t1000\t\t\t8192\t1\n";
1601
1602 static const char rep_feature_dat[] =
1603 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1604 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1605 "Feature\tFeature\n"
1606 "rep\t\t\trep feature\t1\t2\tMSITESTDIR\t0\n";
1607
1608 static const char rep_feature_comp_dat[] =
1609 "Feature_\tComponent_\n"
1610 "s38\ts72\n"
1611 "FeatureComponents\tFeature_\tComponent_\n"
1612 "rep\trep\n";
1613
1614 static const char rep_component_dat[] =
1615 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1616 "s72\tS38\ts72\ti2\tS255\tS72\n"
1617 "Component\tComponent\n"
1618 "rep\t{A24FAF2A-3B2E-41EF-AA78-331542E1A29D}\tMSITESTDIR\t0\t\trep.txt\n";
1619
1620 static const char rep_upgrade_dat[] =
1621 "UpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\tRemove\tActionProperty\n"
1622 "s38\tS20\tS20\tS255\ti4\tS255\ts72\n"
1623 "Upgrade\tUpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\n"
1624 "{2967C1CC-34D4-42EE-8D96-CD6836F192BF}\t\t\t\t256\t\tPRODUCT\n";
1625
1626 static const char rep_property_dat[] =
1627 "Property\tValue\n"
1628 "s72\tl0\n"
1629 "Property\tProperty\n"
1630 "HASUIRUN\t0\n"
1631 "INSTALLLEVEL\t3\n"
1632 "InstallMode\tTypical\n"
1633 "Manufacturer\tWine\n"
1634 "PIDTemplate\t###-#######\n"
1635 "ProductCode\t{1699F0BB-0B61-4A89-AFE4-CFD60DFD76F3}\n"
1636 "ProductLanguage\t1033\n"
1637 "ProductName\tMSITEST\n"
1638 "ProductVersion\t1.1.1\n"
1639 "UpgradeCode\t{2967C1CC-34D4-42EE-8D96-CD6836F192BF}\n"
1640 "PRODUCT\t2F41860D-7B4C-4DA7-BED9-B64F26594C56\n"
1641 "MSIFASTINSTALL\t1\n";
1642
1643 static const char rep_install_exec_seq_dat[] =
1644 "Action\tCondition\tSequence\n"
1645 "s72\tS255\tI2\n"
1646 "InstallExecuteSequence\tAction\n"
1647 "FindRelatedProducts\t\t100\n"
1648 "CostInitialize\t\t800\n"
1649 "FileCost\t\t900\n"
1650 "CostFinalize\t\t1000\n"
1651 "InstallValidate\t\t1400\n"
1652 "RemoveExistingProducts\t\t1499\n"
1653 "InstallInitialize\t\t1500\n"
1654 "ProcessComponents\t\t1600\n"
1655 "RemoveFiles\t\t1700\n"
1656 "InstallFiles\t\t2000\n"
1657 "UnregisterExtensionInfo\t\t3000\n"
1658 "UnregisterMIMEInfo\t\t3500\n"
1659 "RegisterExtensionInfo\t\t4000\n"
1660 "RegisterMIMEInfo\t\t4500\n"
1661 "RegisterProduct\t\t5000\n"
1662 "PublishFeatures\t\t5100\n"
1663 "PublishProduct\t\t5200\n"
1664 "InstallFinalize\t\t6000\n";
1665
1666 typedef struct _msi_table
1667 {
1668 const char *filename;
1669 const char *data;
1670 unsigned int size;
1671 } msi_table;
1672
1673 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
1674
1675 static const msi_table env_tables[] =
1676 {
1677 ADD_TABLE(component),
1678 ADD_TABLE(directory),
1679 ADD_TABLE(feature),
1680 ADD_TABLE(feature_comp),
1681 ADD_TABLE(file),
1682 ADD_TABLE(install_exec_seq),
1683 ADD_TABLE(media),
1684 ADD_TABLE(property),
1685 ADD_TABLE(environment)
1686 };
1687
1688 static const msi_table pp_tables[] =
1689 {
1690 ADD_TABLE(pp_component),
1691 ADD_TABLE(directory),
1692 ADD_TABLE(rof_feature),
1693 ADD_TABLE(rof_feature_comp),
1694 ADD_TABLE(rof_file),
1695 ADD_TABLE(pp_install_exec_seq),
1696 ADD_TABLE(rof_media),
1697 ADD_TABLE(property),
1698 };
1699
1700 static const msi_table ppc_tables[] =
1701 {
1702 ADD_TABLE(ppc_component),
1703 ADD_TABLE(directory),
1704 ADD_TABLE(rof_feature),
1705 ADD_TABLE(ppc_feature_comp),
1706 ADD_TABLE(ppc_file),
1707 ADD_TABLE(pp_install_exec_seq),
1708 ADD_TABLE(ppc_media),
1709 ADD_TABLE(property),
1710 };
1711
1712 static const msi_table rem_tables[] =
1713 {
1714 ADD_TABLE(rem_component),
1715 ADD_TABLE(directory),
1716 ADD_TABLE(rof_feature),
1717 ADD_TABLE(rem_feature_comp),
1718 ADD_TABLE(rem_file),
1719 ADD_TABLE(rem_install_exec_seq),
1720 ADD_TABLE(rof_media),
1721 ADD_TABLE(property),
1722 ADD_TABLE(rem_remove_files),
1723 };
1724
1725 static const msi_table mov_tables[] =
1726 {
1727 ADD_TABLE(cwd_component),
1728 ADD_TABLE(directory),
1729 ADD_TABLE(rof_feature),
1730 ADD_TABLE(ci2_feature_comp),
1731 ADD_TABLE(ci2_file),
1732 ADD_TABLE(install_exec_seq),
1733 ADD_TABLE(rof_media),
1734 ADD_TABLE(property),
1735 ADD_TABLE(mov_move_file),
1736 };
1737
1738 static const msi_table df_tables[] =
1739 {
1740 ADD_TABLE(rof_component),
1741 ADD_TABLE(df_directory),
1742 ADD_TABLE(rof_feature),
1743 ADD_TABLE(rof_feature_comp),
1744 ADD_TABLE(rof_file),
1745 ADD_TABLE(install_exec_seq),
1746 ADD_TABLE(rof_media),
1747 ADD_TABLE(property),
1748 ADD_TABLE(df_duplicate_file),
1749 };
1750
1751 static const msi_table wrv_tables[] =
1752 {
1753 ADD_TABLE(wrv_component),
1754 ADD_TABLE(directory),
1755 ADD_TABLE(rof_feature),
1756 ADD_TABLE(ci2_feature_comp),
1757 ADD_TABLE(ci2_file),
1758 ADD_TABLE(install_exec_seq),
1759 ADD_TABLE(rof_media),
1760 ADD_TABLE(property),
1761 ADD_TABLE(wrv_registry),
1762 };
1763
1764 static const msi_table cf_tables[] =
1765 {
1766 ADD_TABLE(cf_component),
1767 ADD_TABLE(cf_directory),
1768 ADD_TABLE(cf_feature),
1769 ADD_TABLE(cf_feature_comp),
1770 ADD_TABLE(cf_file),
1771 ADD_TABLE(cf_create_folders),
1772 ADD_TABLE(cf_install_exec_seq),
1773 ADD_TABLE(media),
1774 ADD_TABLE(property)
1775 };
1776
1777 static const msi_table sss_tables[] =
1778 {
1779 ADD_TABLE(component),
1780 ADD_TABLE(directory),
1781 ADD_TABLE(feature),
1782 ADD_TABLE(feature_comp),
1783 ADD_TABLE(file),
1784 ADD_TABLE(sss_install_exec_seq),
1785 ADD_TABLE(sss_service_control),
1786 ADD_TABLE(media),
1787 ADD_TABLE(property)
1788 };
1789
1790 static const msi_table sds_tables[] =
1791 {
1792 ADD_TABLE(component),
1793 ADD_TABLE(directory),
1794 ADD_TABLE(feature),
1795 ADD_TABLE(feature_comp),
1796 ADD_TABLE(file),
1797 ADD_TABLE(sds_install_exec_seq),
1798 ADD_TABLE(service_control),
1799 ADD_TABLE(service_install),
1800 ADD_TABLE(media),
1801 ADD_TABLE(property)
1802 };
1803
1804 static const msi_table sis_tables[] =
1805 {
1806 ADD_TABLE(component),
1807 ADD_TABLE(directory),
1808 ADD_TABLE(feature),
1809 ADD_TABLE(feature_comp),
1810 ADD_TABLE(file),
1811 ADD_TABLE(sds_install_exec_seq),
1812 ADD_TABLE(service_install2),
1813 ADD_TABLE(media),
1814 ADD_TABLE(property)
1815 };
1816
1817 static const msi_table sr_tables[] =
1818 {
1819 ADD_TABLE(component),
1820 ADD_TABLE(directory),
1821 ADD_TABLE(feature),
1822 ADD_TABLE(feature_comp),
1823 ADD_TABLE(file),
1824 ADD_TABLE(sr_selfreg),
1825 ADD_TABLE(sr_install_exec_seq),
1826 ADD_TABLE(media),
1827 ADD_TABLE(property)
1828 };
1829
1830 static const msi_table font_tables[] =
1831 {
1832 ADD_TABLE(font_component),
1833 ADD_TABLE(directory),
1834 ADD_TABLE(font_feature),
1835 ADD_TABLE(font_feature_comp),
1836 ADD_TABLE(font_file),
1837 ADD_TABLE(font),
1838 ADD_TABLE(font_install_exec_seq),
1839 ADD_TABLE(font_media),
1840 ADD_TABLE(property)
1841 };
1842
1843 static const msi_table vp_tables[] =
1844 {
1845 ADD_TABLE(component),
1846 ADD_TABLE(directory),
1847 ADD_TABLE(feature),
1848 ADD_TABLE(feature_comp),
1849 ADD_TABLE(file),
1850 ADD_TABLE(vp_custom_action),
1851 ADD_TABLE(vp_install_exec_seq),
1852 ADD_TABLE(media),
1853 ADD_TABLE(vp_property)
1854 };
1855
1856 static const msi_table odbc_tables[] =
1857 {
1858 ADD_TABLE(odbc_component),
1859 ADD_TABLE(directory),
1860 ADD_TABLE(odbc_feature),
1861 ADD_TABLE(odbc_feature_comp),
1862 ADD_TABLE(odbc_file),
1863 ADD_TABLE(odbc_driver),
1864 ADD_TABLE(odbc_translator),
1865 ADD_TABLE(odbc_datasource),
1866 ADD_TABLE(odbc_install_exec_seq),
1867 ADD_TABLE(odbc_media),
1868 ADD_TABLE(property)
1869 };
1870
1871 static const msi_table tl_tables[] =
1872 {
1873 ADD_TABLE(tl_component),
1874 ADD_TABLE(directory),
1875 ADD_TABLE(tl_feature),
1876 ADD_TABLE(tl_feature_comp),
1877 ADD_TABLE(tl_file),
1878 ADD_TABLE(tl_typelib),
1879 ADD_TABLE(tl_install_exec_seq),
1880 ADD_TABLE(media),
1881 ADD_TABLE(property)
1882 };
1883
1884 static const msi_table crs_tables[] =
1885 {
1886 ADD_TABLE(crs_component),
1887 ADD_TABLE(directory),
1888 ADD_TABLE(crs_feature),
1889 ADD_TABLE(crs_feature_comp),
1890 ADD_TABLE(crs_file),
1891 ADD_TABLE(crs_shortcut),
1892 ADD_TABLE(crs_install_exec_seq),
1893 ADD_TABLE(media),
1894 ADD_TABLE(property)
1895 };
1896
1897 static const msi_table pub_tables[] =
1898 {
1899 ADD_TABLE(directory),
1900 ADD_TABLE(pub_component),
1901 ADD_TABLE(pub_feature),
1902 ADD_TABLE(pub_feature_comp),
1903 ADD_TABLE(pub_file),
1904 ADD_TABLE(pub_publish_component),
1905 ADD_TABLE(pub_install_exec_seq),
1906 ADD_TABLE(media),
1907 ADD_TABLE(property)
1908 };
1909
1910 static const msi_table rd_tables[] =
1911 {
1912 ADD_TABLE(directory),
1913 ADD_TABLE(rd_component),
1914 ADD_TABLE(rd_feature),
1915 ADD_TABLE(rd_feature_comp),
1916 ADD_TABLE(rd_file),
1917 ADD_TABLE(rd_duplicate_file),
1918 ADD_TABLE(rd_install_exec_seq),
1919 ADD_TABLE(media),
1920 ADD_TABLE(property)
1921 };
1922
1923 static const msi_table rrv_tables[] =
1924 {
1925 ADD_TABLE(directory),
1926 ADD_TABLE(rrv_component),
1927 ADD_TABLE(rrv_feature),
1928 ADD_TABLE(rrv_feature_comp),
1929 ADD_TABLE(rrv_file),
1930 ADD_TABLE(rrv_registry),
1931 ADD_TABLE(rrv_remove_registry),
1932 ADD_TABLE(rrv_install_exec_seq),
1933 ADD_TABLE(media),
1934 ADD_TABLE(property)
1935 };
1936
1937 static const msi_table frp_tables[] =
1938 {
1939 ADD_TABLE(directory),
1940 ADD_TABLE(frp_component),
1941 ADD_TABLE(frp_feature),
1942 ADD_TABLE(frp_feature_comp),
1943 ADD_TABLE(frp_file),
1944 ADD_TABLE(frp_upgrade),
1945 ADD_TABLE(frp_custom_action),
1946 ADD_TABLE(frp_install_exec_seq),
1947 ADD_TABLE(media),
1948 ADD_TABLE(property)
1949 };
1950
1951 static const msi_table riv_tables[] =
1952 {
1953 ADD_TABLE(directory),
1954 ADD_TABLE(riv_component),
1955 ADD_TABLE(riv_feature),
1956 ADD_TABLE(riv_feature_comp),
1957 ADD_TABLE(riv_file),
1958 ADD_TABLE(riv_ini_file),
1959 ADD_TABLE(riv_remove_ini_file),
1960 ADD_TABLE(riv_install_exec_seq),
1961 ADD_TABLE(media),
1962 ADD_TABLE(property)
1963 };
1964
1965 static const msi_table res_tables[] =
1966 {
1967 ADD_TABLE(directory),
1968 ADD_TABLE(res_component),
1969 ADD_TABLE(res_feature),
1970 ADD_TABLE(res_feature_comp),
1971 ADD_TABLE(res_file),
1972 ADD_TABLE(res_environment),
1973 ADD_TABLE(res_install_exec_seq),
1974 ADD_TABLE(media),
1975 ADD_TABLE(property)
1976 };
1977
1978 static const msi_table rci_tables[] =
1979 {
1980 ADD_TABLE(directory),
1981 ADD_TABLE(rci_component),
1982 ADD_TABLE(rci_feature),
1983 ADD_TABLE(rci_feature_comp),
1984 ADD_TABLE(rci_file),
1985 ADD_TABLE(rci_appid),
1986 ADD_TABLE(rci_class),
1987 ADD_TABLE(rci_install_exec_seq),
1988 ADD_TABLE(media),
1989 ADD_TABLE(property)
1990 };
1991
1992 static const msi_table rei_tables[] =
1993 {
1994 ADD_TABLE(directory),
1995 ADD_TABLE(rei_component),
1996 ADD_TABLE(rei_feature),
1997 ADD_TABLE(rei_feature_comp),
1998 ADD_TABLE(rei_file),
1999 ADD_TABLE(rei_extension),
2000 ADD_TABLE(rei_verb),
2001 ADD_TABLE(rei_progid),
2002 ADD_TABLE(rei_install_exec_seq),
2003 ADD_TABLE(media),
2004 ADD_TABLE(property)
2005 };
2006
2007 static const msi_table rpi_tables[] =
2008 {
2009 ADD_TABLE(directory),
2010 ADD_TABLE(rpi_component),
2011 ADD_TABLE(rpi_feature),
2012 ADD_TABLE(rpi_feature_comp),
2013 ADD_TABLE(rpi_file),
2014 ADD_TABLE(rpi_appid),
2015 ADD_TABLE(rpi_class),
2016 ADD_TABLE(rpi_extension),
2017 ADD_TABLE(rpi_verb),
2018 ADD_TABLE(rpi_progid),
2019 ADD_TABLE(rpi_install_exec_seq),
2020 ADD_TABLE(media),
2021 ADD_TABLE(property)
2022 };
2023
2024 static const msi_table rmi_tables[] =
2025 {
2026 ADD_TABLE(directory),
2027 ADD_TABLE(rmi_component),
2028 ADD_TABLE(rmi_feature),
2029 ADD_TABLE(rmi_feature_comp),
2030 ADD_TABLE(rmi_file),
2031 ADD_TABLE(rmi_extension),
2032 ADD_TABLE(rmi_verb),
2033 ADD_TABLE(rmi_mime),
2034 ADD_TABLE(rmi_install_exec_seq),
2035 ADD_TABLE(media),
2036 ADD_TABLE(property)
2037 };
2038
2039 static const msi_table pa_tables[] =
2040 {
2041 ADD_TABLE(directory),
2042 ADD_TABLE(pa_component),
2043 ADD_TABLE(pa_feature),
2044 ADD_TABLE(pa_feature_comp),
2045 ADD_TABLE(pa_file),
2046 ADD_TABLE(pa_msi_assembly),
2047 ADD_TABLE(pa_msi_assembly_name),
2048 ADD_TABLE(pa_install_exec_seq),
2049 ADD_TABLE(media),
2050 ADD_TABLE(property)
2051 };
2052
2053 static const msi_table rep_tables[] =
2054 {
2055 ADD_TABLE(directory),
2056 ADD_TABLE(rep_component),
2057 ADD_TABLE(rep_feature),
2058 ADD_TABLE(rep_feature_comp),
2059 ADD_TABLE(rep_file),
2060 ADD_TABLE(rep_upgrade),
2061 ADD_TABLE(rep_property),
2062 ADD_TABLE(rep_install_exec_seq),
2063 ADD_TABLE(media)
2064 };
2065
2066 /* based on RegDeleteTreeW from dlls/advapi32/registry.c */
2067 static LSTATUS action_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey, REGSAM access)
2068 {
2069 LONG ret;
2070 DWORD dwMaxSubkeyLen, dwMaxValueLen;
2071 DWORD dwMaxLen, dwSize;
2072 char szNameBuf[MAX_PATH], *lpszName = szNameBuf;
2073 HKEY hSubKey = hKey;
2074
2075 if(lpszSubKey)
2076 {
2077 ret = RegOpenKeyExA(hKey, lpszSubKey, 0, access, &hSubKey);
2078 if (ret) return ret;
2079 }
2080
2081 ret = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, NULL,
2082 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
2083 if (ret) goto cleanup;
2084
2085 dwMaxSubkeyLen++;
2086 dwMaxValueLen++;
2087 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
2088 if (dwMaxLen > sizeof(szNameBuf))
2089 {
2090 /* Name too big: alloc a buffer for it */
2091 if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen)))
2092 {
2093 ret = ERROR_NOT_ENOUGH_MEMORY;
2094 goto cleanup;
2095 }
2096 }
2097
2098 /* Recursively delete all the subkeys */
2099 while (TRUE)
2100 {
2101 dwSize = dwMaxLen;
2102 if (RegEnumKeyExA(hSubKey, 0, lpszName, &dwSize, NULL,
2103 NULL, NULL, NULL)) break;
2104
2105 ret = action_RegDeleteTreeA(hSubKey, lpszName, access);
2106 if (ret) goto cleanup;
2107 }
2108
2109 if (lpszSubKey)
2110 {
2111 if (pRegDeleteKeyExA)
2112 ret = pRegDeleteKeyExA(hKey, lpszSubKey, access, 0);
2113 else
2114 ret = RegDeleteKeyA(hKey, lpszSubKey);
2115 }
2116 else
2117 while (TRUE)
2118 {
2119 dwSize = dwMaxLen;
2120 if (RegEnumValueA(hKey, 0, lpszName, &dwSize,
2121 NULL, NULL, NULL, NULL)) break;
2122
2123 ret = RegDeleteValueA(hKey, lpszName);
2124 if (ret) goto cleanup;
2125 }
2126
2127 cleanup:
2128 if (lpszName != szNameBuf)
2129 HeapFree(GetProcessHeap(), 0, lpszName);
2130 if(lpszSubKey)
2131 RegCloseKey(hSubKey);
2132 return ret;
2133 }
2134
2135 /* cabinet definitions */
2136
2137 /* make the max size large so there is only one cab file */
2138 #define MEDIA_SIZE 0x7FFFFFFF
2139 #define FOLDER_THRESHOLD 900000
2140
2141 /* the FCI callbacks */
2142
2143 static void * CDECL mem_alloc(ULONG cb)
2144 {
2145 return HeapAlloc(GetProcessHeap(), 0, cb);
2146 }
2147
2148 static void CDECL mem_free(void *memory)
2149 {
2150 HeapFree(GetProcessHeap(), 0, memory);
2151 }
2152
2153 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
2154 {
2155 sprintf(pccab->szCab, pv, pccab->iCab);
2156 return TRUE;
2157 }
2158
2159 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
2160 {
2161 return 0;
2162 }
2163
2164 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
2165 BOOL fContinuation, void *pv)
2166 {
2167 return 0;
2168 }
2169
2170 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
2171 {
2172 HANDLE handle;
2173 DWORD dwAccess = 0;
2174 DWORD dwShareMode = 0;
2175 DWORD dwCreateDisposition = OPEN_EXISTING;
2176
2177 dwAccess = GENERIC_READ | GENERIC_WRITE;
2178 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
2179
2180 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
2181 dwCreateDisposition = OPEN_EXISTING;
2182 else
2183 dwCreateDisposition = CREATE_NEW;
2184
2185 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
2186 dwCreateDisposition, 0, NULL);
2187
2188 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
2189
2190 return (INT_PTR)handle;
2191 }
2192
2193 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2194 {
2195 HANDLE handle = (HANDLE)hf;
2196 DWORD dwRead;
2197 BOOL res;
2198
2199 res = ReadFile(handle, memory, cb, &dwRead, NULL);
2200 ok(res, "Failed to ReadFile\n");
2201
2202 return dwRead;
2203 }
2204
2205 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2206 {
2207 HANDLE handle = (HANDLE)hf;
2208 DWORD dwWritten;
2209 BOOL res;
2210
2211 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2212 ok(res, "Failed to WriteFile\n");
2213
2214 return dwWritten;
2215 }
2216
2217 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
2218 {
2219 HANDLE handle = (HANDLE)hf;
2220 ok(CloseHandle(handle), "Failed to CloseHandle\n");
2221
2222 return 0;
2223 }
2224
2225 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
2226 {
2227 HANDLE handle = (HANDLE)hf;
2228 DWORD ret;
2229
2230 ret = SetFilePointer(handle, dist, NULL, seektype);
2231 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2232
2233 return ret;
2234 }
2235
2236 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
2237 {
2238 BOOL ret = DeleteFileA(pszFile);
2239 ok(ret, "Failed to DeleteFile %s\n", pszFile);
2240
2241 return 0;
2242 }
2243
2244 static void init_functionpointers(void)
2245 {
2246 HMODULE hmsi = GetModuleHandleA("msi.dll");
2247 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2248 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2249
2250 #define GET_PROC(mod, func) \
2251 p ## func = (void*)GetProcAddress(mod, #func); \
2252 if(!p ## func) \
2253 trace("GetProcAddress(%s) failed\n", #func);
2254
2255 GET_PROC(hmsi, MsiQueryComponentStateA);
2256 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
2257 GET_PROC(hmsi, MsiSourceListGetInfoA);
2258 GET_PROC(hmsi, MsiGetComponentPathExA);
2259 GET_PROC(hmsi, MsiQueryFeatureStateExA);
2260
2261 GET_PROC(hadvapi32, CheckTokenMembership);
2262 GET_PROC(hadvapi32, ConvertSidToStringSidA);
2263 GET_PROC(hadvapi32, OpenProcessToken);
2264 GET_PROC(hadvapi32, RegDeleteKeyExA)
2265 GET_PROC(hkernel32, IsWow64Process)
2266
2267 hsrclient = LoadLibraryA("srclient.dll");
2268 GET_PROC(hsrclient, SRRemoveRestorePoint);
2269 GET_PROC(hsrclient, SRSetRestorePointA);
2270
2271 #undef GET_PROC
2272 }
2273
2274 static BOOL is_process_limited(void)
2275 {
2276 SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
2277 PSID Group = NULL;
2278 BOOL IsInGroup;
2279 HANDLE token;
2280
2281 if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
2282
2283 if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
2284 DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
2285 !pCheckTokenMembership(NULL, Group, &IsInGroup))
2286 {
2287 trace("Could not check if the current user is an administrator\n");
2288 FreeSid(Group);
2289 return FALSE;
2290 }
2291 FreeSid(Group);
2292
2293 if (!IsInGroup)
2294 {
2295 /* Only administrators have enough privileges for these tests */
2296 return TRUE;
2297 }
2298
2299 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2300 {
2301 BOOL ret;
2302 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
2303 DWORD size;
2304
2305 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2306 CloseHandle(token);
2307 return (ret && type == TokenElevationTypeLimited);
2308 }
2309 return FALSE;
2310 }
2311
2312 static char *get_user_sid(void)
2313 {
2314 HANDLE token;
2315 DWORD size = 0;
2316 TOKEN_USER *user;
2317 char *usersid = NULL;
2318
2319 if (!pConvertSidToStringSidA)
2320 {
2321 win_skip("ConvertSidToStringSidA is not available\n");
2322 return NULL;
2323 }
2324 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
2325 GetTokenInformation(token, TokenUser, NULL, size, &size);
2326
2327 user = HeapAlloc(GetProcessHeap(), 0, size);
2328 GetTokenInformation(token, TokenUser, user, size, &size);
2329 pConvertSidToStringSidA(user->User.Sid, &usersid);
2330 HeapFree(GetProcessHeap(), 0, user);
2331
2332 CloseHandle(token);
2333 return usersid;
2334 }
2335
2336 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2337 {
2338 LPSTR tempname;
2339
2340 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2341 GetTempFileNameA(".", "xx", 0, tempname);
2342
2343 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2344 {
2345 lstrcpyA(pszTempName, tempname);
2346 HeapFree(GetProcessHeap(), 0, tempname);
2347 return TRUE;
2348 }
2349
2350 HeapFree(GetProcessHeap(), 0, tempname);
2351
2352 return FALSE;
2353 }
2354
2355 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2356 USHORT *pattribs, int *err, void *pv)
2357 {
2358 BY_HANDLE_FILE_INFORMATION finfo;
2359 FILETIME filetime;
2360 HANDLE handle;
2361 DWORD attrs;
2362 BOOL res;
2363
2364 handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2365 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2366
2367 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2368
2369 res = GetFileInformationByHandle(handle, &finfo);
2370 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2371
2372 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2373 FileTimeToDosDateTime(&filetime, pdate, ptime);
2374
2375 attrs = GetFileAttributesA(pszName);
2376 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2377
2378 return (INT_PTR)handle;
2379 }
2380
2381 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2382 {
2383 char path[MAX_PATH];
2384 char filename[MAX_PATH];
2385
2386 lstrcpyA(path, CURR_DIR);
2387 lstrcatA(path, "\\");
2388 lstrcatA(path, file);
2389
2390 lstrcpyA(filename, file);
2391
2392 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2393 progress, get_open_info, compress);
2394 }
2395
2396 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2397 {
2398 ZeroMemory(pCabParams, sizeof(CCAB));
2399
2400 pCabParams->cb = max_size;
2401 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2402 pCabParams->setID = 0xbeef;
2403 pCabParams->iCab = 1;
2404 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2405 lstrcatA(pCabParams->szCabPath, "\\");
2406 lstrcpyA(pCabParams->szCab, name);
2407 }
2408
2409 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2410 {
2411 CCAB cabParams;
2412 LPCSTR ptr;
2413 HFCI hfci;
2414 ERF erf;
2415 BOOL res;
2416
2417 set_cab_parameters(&cabParams, name, max_size);
2418
2419 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2420 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2421 get_temp_file, &cabParams, NULL);
2422
2423 ok(hfci != NULL, "Failed to create an FCI context\n");
2424
2425 ptr = files;
2426 while (*ptr)
2427 {
2428 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2429 ok(res, "Failed to add file: %s\n", ptr);
2430 ptr += lstrlenA(ptr) + 1;
2431 }
2432
2433 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2434 ok(res, "Failed to flush the cabinet\n");
2435
2436 res = FCIDestroy(hfci);
2437 ok(res, "Failed to destroy the cabinet\n");
2438 }
2439
2440 static BOOL get_user_dirs(void)
2441 {
2442 HKEY hkey;
2443 DWORD type, size;
2444
2445 if (RegOpenKeyA(HKEY_CURRENT_USER,
2446 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2447 return FALSE;
2448
2449 size = MAX_PATH;
2450 if (RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size))
2451 {
2452 RegCloseKey(hkey);
2453 return FALSE;
2454 }
2455
2456 RegCloseKey(hkey);
2457 return TRUE;
2458 }
2459
2460 static BOOL get_system_dirs(void)
2461 {
2462 HKEY hkey;
2463 DWORD type, size;
2464
2465 if (RegOpenKeyA(HKEY_LOCAL_MACHINE,
2466 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2467 return FALSE;
2468
2469 size = MAX_PATH;
2470 if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2471 RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size))
2472 {
2473 RegCloseKey(hkey);
2474 return FALSE;
2475 }
2476
2477 size = MAX_PATH;
2478 if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2479 RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size))
2480 {
2481 RegCloseKey(hkey);
2482 return FALSE;
2483 }
2484
2485 RegCloseKey(hkey);
2486
2487 if (!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH))
2488 return FALSE;
2489
2490 return TRUE;
2491 }
2492
2493 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2494 {
2495 HANDLE file;
2496 DWORD written;
2497
2498 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2499 if (file == INVALID_HANDLE_VALUE)
2500 return;
2501
2502 WriteFile(file, data, strlen(data), &written, NULL);
2503
2504 if (size)
2505 {
2506 SetFilePointer(file, size, NULL, FILE_BEGIN);
2507 SetEndOfFile(file);
2508 }
2509
2510 CloseHandle(file);
2511 }
2512
2513 #define create_file(name, size) create_file_data(name, name, size)
2514
2515 static void create_test_files(void)
2516 {
2517 CreateDirectoryA("msitest", NULL);
2518 create_file("msitest\\one.txt", 100);
2519 CreateDirectoryA("msitest\\first", NULL);
2520 create_file("msitest\\first\\two.txt", 100);
2521 CreateDirectoryA("msitest\\second", NULL);
2522 create_file("msitest\\second\\three.txt", 100);
2523
2524 create_file("four.txt", 100);
2525 create_file("five.txt", 100);
2526 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2527
2528 create_file("msitest\\filename", 100);
2529 create_file("msitest\\service.exe", 100);
2530 create_file("msitest\\service2.exe", 100);
2531
2532 DeleteFileA("four.txt");
2533 DeleteFileA("five.txt");
2534 }
2535
2536 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2537 {
2538 CHAR path[MAX_PATH];
2539
2540 lstrcpyA(path, PROG_FILES_DIR);
2541 lstrcatA(path, "\\");
2542 lstrcatA(path, rel_path);
2543
2544 if (is_file)
2545 return DeleteFileA(path);
2546 else
2547 return RemoveDirectoryA(path);
2548 }
2549
2550 static void delete_test_files(void)
2551 {
2552 DeleteFileA("msitest.msi");
2553 DeleteFileA("msitest.cab");
2554 DeleteFileA("msitest\\second\\three.txt");
2555 DeleteFileA("msitest\\first\\two.txt");
2556 DeleteFileA("msitest\\one.txt");
2557 DeleteFileA("msitest\\service.exe");
2558 DeleteFileA("msitest\\service2.exe");
2559 DeleteFileA("msitest\\filename");
2560 RemoveDirectoryA("msitest\\second");
2561 RemoveDirectoryA("msitest\\first");
2562 RemoveDirectoryA("msitest");
2563 }
2564
2565 static void write_file(const CHAR *filename, const char *data, int data_size)
2566 {
2567 DWORD size;
2568 HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2569 WriteFile(hf, data, data_size, &size, NULL);
2570 CloseHandle(hf);
2571 }
2572
2573 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, const char *template)
2574 {
2575 MSIHANDLE summary;
2576 UINT r;
2577
2578 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2579 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2580
2581 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2582 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2583
2584 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
2585 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2586 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2587
2588 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL);
2589 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2590
2591 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2592 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2593
2594 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2595 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2596
2597 /* write the summary changes back to the stream */
2598 r = MsiSummaryInfoPersist(summary);
2599 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2600
2601 MsiCloseHandle(summary);
2602 }
2603
2604 #define create_database(name, tables, num_tables) \
2605 create_database_wordcount(name, tables, num_tables, 100, 0, ";1033");
2606
2607 #define create_database_template(name, tables, num_tables, version, template) \
2608 create_database_wordcount(name, tables, num_tables, version, 0, template);
2609
2610 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2611 int num_tables, INT version, INT wordcount,
2612 const char *template)
2613 {
2614 MSIHANDLE db;
2615 UINT r;
2616 WCHAR *nameW;
2617 int j, len;
2618
2619 len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2620 if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
2621 MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2622
2623 r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
2624 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2625
2626 /* import the tables into the database */
2627 for (j = 0; j < num_tables; j++)
2628 {
2629 const msi_table *table = &tables[j];
2630
2631 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2632
2633 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2634 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2635
2636 DeleteFileA(table->filename);
2637 }
2638
2639 write_msi_summary_info(db, version, wordcount, template);
2640
2641 r = MsiDatabaseCommit(db);
2642 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2643
2644 MsiCloseHandle(db);
2645 HeapFree( GetProcessHeap(), 0, nameW );
2646 }
2647
2648 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2649 {
2650 RESTOREPOINTINFOA spec;
2651
2652 spec.dwEventType = event_type;
2653 spec.dwRestorePtType = APPLICATION_INSTALL;
2654 spec.llSequenceNumber = status->llSequenceNumber;
2655 lstrcpyA(spec.szDescription, "msitest restore point");
2656
2657 return pSRSetRestorePointA(&spec, status);
2658 }
2659
2660 static void remove_restore_point(DWORD seq_number)
2661 {
2662 DWORD res;
2663
2664 res = pSRRemoveRestorePoint(seq_number);
2665 if (res != ERROR_SUCCESS)
2666 trace("Failed to remove the restore point : %08x\n", res);
2667 }
2668
2669 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
2670 {
2671 if (pRegDeleteKeyExA)
2672 return pRegDeleteKeyExA( key, subkey, access, 0 );
2673 return RegDeleteKeyA( key, subkey );
2674 }
2675
2676 static BOOL file_exists(LPCSTR file)
2677 {
2678 return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES;
2679 }
2680
2681 static BOOL pf_exists(LPCSTR file)
2682 {
2683 CHAR path[MAX_PATH];
2684
2685 lstrcpyA(path, PROG_FILES_DIR);
2686 lstrcatA(path, "\\");
2687 lstrcatA(path, file);
2688
2689 return file_exists(path);
2690 }
2691
2692 static void delete_pfmsitest_files(void)
2693 {
2694 SHFILEOPSTRUCTA shfl;
2695 CHAR path[MAX_PATH+11];
2696
2697 lstrcpyA(path, PROG_FILES_DIR);
2698 lstrcatA(path, "\\msitest\\*");
2699 path[strlen(path) + 1] = '\0';
2700
2701 shfl.hwnd = NULL;
2702 shfl.wFunc = FO_DELETE;
2703 shfl.pFrom = path;
2704 shfl.pTo = NULL;
2705 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT | FOF_NOERRORUI;
2706
2707 SHFileOperationA(&shfl);
2708
2709 lstrcpyA(path, PROG_FILES_DIR);
2710 lstrcatA(path, "\\msitest");
2711 RemoveDirectoryA(path);
2712 }
2713
2714 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
2715 {
2716 char val[MAX_PATH];
2717 DWORD size, type;
2718 LONG res;
2719
2720 size = MAX_PATH;
2721 val[0] = '\0';
2722 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
2723
2724 if (res != ERROR_SUCCESS ||
2725 (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
2726 {
2727 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2728 return;
2729 }
2730
2731 if (!expected)
2732 ok_(__FILE__, line)(!val[0], "Expected empty string, got %s\n", val);
2733 else
2734 {
2735 if (bcase)
2736 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
2737 else
2738 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
2739 }
2740 }
2741
2742 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
2743 {
2744 DWORD val, size, type;
2745 LONG res;
2746
2747 size = sizeof(DWORD);
2748 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2749
2750 if (res != ERROR_SUCCESS || type != REG_DWORD)
2751 {
2752 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2753 return;
2754 }
2755
2756 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
2757 }
2758
2759 static void check_reg_dword4(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3,
2760 DWORD expected4, DWORD line)
2761 {
2762 DWORD val, size, type;
2763 LONG res;
2764
2765 size = sizeof(DWORD);
2766 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2767
2768 if (res != ERROR_SUCCESS || type != REG_DWORD)
2769 {
2770 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2771 return;
2772 }
2773
2774 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4,
2775 "Expected %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, val);
2776 }
2777
2778 static void check_reg_dword5(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3,
2779 DWORD expected4, DWORD expected5, DWORD line)
2780 {
2781 DWORD val, size, type;
2782 LONG res;
2783
2784 size = sizeof(DWORD);
2785 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2786
2787 if (res != ERROR_SUCCESS || type != REG_DWORD)
2788 {
2789 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2790 return;
2791 }
2792
2793 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4 ||
2794 val == expected5,
2795 "Expected %d, %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, expected5, val);
2796 }
2797
2798 #define CHECK_REG_STR(prodkey, name, expected) \
2799 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
2800
2801 #define CHECK_DEL_REG_STR(prodkey, name, expected) \
2802 do { \
2803 check_reg_str(prodkey, name, expected, TRUE, __LINE__); \
2804 RegDeleteValueA(prodkey, name); \
2805 } while(0)
2806
2807 #define CHECK_REG_ISTR(prodkey, name, expected) \
2808 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
2809
2810 #define CHECK_DEL_REG_ISTR(prodkey, name, expected) \
2811 do { \
2812 check_reg_str(prodkey, name, expected, FALSE, __LINE__); \
2813 RegDeleteValueA(prodkey, name); \
2814 } while(0)
2815
2816 #define CHECK_REG_DWORD(prodkey, name, expected) \
2817 check_reg_dword(prodkey, name, expected, __LINE__);
2818
2819 #define CHECK_DEL_REG_DWORD(prodkey, name, expected) \
2820 do { \
2821 check_reg_dword(prodkey, name, expected, __LINE__); \
2822 RegDeleteValueA(prodkey, name); \
2823 } while(0)
2824
2825 #define CHECK_REG_DWORD2(prodkey, name, expected1, expected2) \
2826 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__);
2827
2828 #define CHECK_DEL_REG_DWORD2(prodkey, name, expected1, expected2) \
2829 do { \
2830 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__); \
2831 RegDeleteValueA(prodkey, name); \
2832 } while(0)
2833
2834 #define CHECK_REG_DWORD4(prodkey, name, expected1, expected2, expected3, expected4) \
2835 check_reg_dword4(prodkey, name, expected1, expected2, expected3, expected4, __LINE__);
2836
2837 #define CHECK_DEL_REG_DWORD5(prodkey, name, expected1, expected2, expected3, expected4 ,expected5) \
2838 do { \
2839 check_reg_dword5(prodkey, name, expected1, expected2, expected3, expected4, expected5, __LINE__); \
2840 RegDeleteValueA(prodkey, name); \
2841 } while(0)
2842
2843 static void get_date_str(LPSTR date)
2844 {
2845 SYSTEMTIME systime;
2846
2847 static const char date_fmt[] = "%d%02d%02d";
2848 GetLocalTime(&systime);
2849 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
2850 }
2851
2852 static void test_register_product(void)
2853 {
2854 UINT r;
2855 LONG res;
2856 HKEY hkey, props, usage;
2857 LPSTR usersid;
2858 char date[MAX_PATH], temp[MAX_PATH], keypath[MAX_PATH], path[MAX_PATH];
2859 DWORD size, type;
2860 REGSAM access = KEY_ALL_ACCESS;
2861
2862 static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2863 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2864 static const CHAR uninstall_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion"
2865 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2866 static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2867 "\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2868 static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2869 "\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2870 static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2871 "\\51AAE0C44620A5E4788506E91F249BD2";
2872
2873 if (is_process_limited())
2874 {
2875 skip("process is limited\n");
2876 return;
2877 }
2878
2879 if (!(usersid = get_user_sid()))
2880 return;
2881
2882 get_date_str(date);
2883 GetTempPathA(MAX_PATH, temp);
2884
2885 CreateDirectoryA("msitest", NULL);
2886 create_file("msitest\\maximus", 500);
2887
2888 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2889
2890 if (is_wow64)
2891 access |= KEY_WOW64_64KEY;
2892
2893 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2894
2895 /* RegisterProduct */
2896 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
2897 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2898 {
2899 skip("Not enough rights to perform tests\n");
2900 goto error;
2901 }
2902 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2903 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2904 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2905
2906 res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
2907 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2908
2909 if (is_64bit)
2910 {
2911 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey);
2912 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2913 }
2914 else
2915 {
2916 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_ALL_ACCESS, &hkey);
2917 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2918 }
2919
2920 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2921 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2922 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2923 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2924 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2925 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2926 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2927 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2928 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2929 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2930 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2931 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2932 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2933 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2934 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2935 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2936 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2937 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2938 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2939 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2940 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2941 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2942 todo_wine
2943 {
2944 CHECK_DEL_REG_DWORD5(hkey, "EstimatedSize", 12, -12, 4, 10, 24);
2945 }
2946
2947 delete_key(hkey, "", access);
2948 RegCloseKey(hkey);
2949
2950 sprintf(keypath, userdata, usersid);
2951 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
2952 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2953
2954 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
2955 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2956
2957 size = sizeof(path);
2958 RegQueryValueExA(props, "LocalPackage", NULL, &type, (LPBYTE)path, &size);
2959 DeleteFileA(path);
2960 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2961
2962 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2963 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2964 CHECK_DEL_REG_STR(props, "InstallDate", date);
2965 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2966 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2967 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2968 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2969 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2970 CHECK_DEL_REG_STR(props, "Comments", NULL);
2971 CHECK_DEL_REG_STR(props, "Contact", NULL);
2972 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2973 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2974 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2975 CHECK_DEL_REG_STR(props, "Readme", NULL);
2976 CHECK_DEL_REG_STR(props, "Size", NULL);
2977 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2978 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2979 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2980 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2981 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2982 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2983 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2984 todo_wine
2985 {
2986 CHECK_DEL_REG_DWORD5(props, "EstimatedSize", 12, -12, 4, 10, 24);
2987 }
2988
2989 delete_key(props, "", access);
2990 RegCloseKey(props);
2991
2992 res = RegOpenKeyExA(hkey, "Usage", 0, access, &usage);
2993 todo_wine
2994 {
2995 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2996 }
2997
2998 delete_key(usage, "", access);
2999 RegCloseKey(usage);
3000 delete_key(hkey, "", access);
3001 RegCloseKey(hkey);
3002
3003 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, access, &hkey);
3004 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3005
3006 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3007
3008 delete_key(hkey, "", access);
3009 RegCloseKey(hkey);
3010
3011 /* RegisterProduct, machine */
3012 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 ALLUSERS=1");
3013 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3014 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3015 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3016
3017 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, userugkey, 0, access, &hkey);
3018 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3019
3020 if (is_64bit)
3021 {
3022 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey);
3023 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3024 }
3025 else
3026 {
3027 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_ALL_ACCESS, &hkey);
3028 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3029 }
3030
3031 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
3032 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
3033 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
3034 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
3035 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3036 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
3037 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3038 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
3039 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
3040 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
3041 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
3042 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
3043 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
3044 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
3045 CHECK_DEL_REG_STR(hkey, "Size", NULL);
3046 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
3047 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
3048 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3049 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3050 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
3051 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
3052 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
3053 todo_wine
3054 {
3055 CHECK_DEL_REG_DWORD5(hkey, "EstimatedSize", 12, -12, 4, 10, 24);
3056 }
3057
3058 delete_key(hkey, "", access);
3059 RegCloseKey(hkey);
3060
3061 sprintf(keypath, userdata, "S-1-5-18");
3062 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3063 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3064
3065 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
3066 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3067
3068 size = sizeof(path);
3069 RegQueryValueExA(props, "LocalPackage", NULL, &type, (LPBYTE)path, &size);
3070 DeleteFileA(path);
3071 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
3072
3073 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
3074 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
3075 CHECK_DEL_REG_STR(props, "InstallDate", date);
3076 CHECK_DEL_REG_STR(props, "InstallSource", temp);
3077 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3078 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
3079 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3080 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
3081 CHECK_DEL_REG_STR(props, "Comments", NULL);
3082 CHECK_DEL_REG_STR(props, "Contact", NULL);
3083 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
3084 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
3085 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
3086 CHECK_DEL_REG_STR(props, "Readme", NULL);
3087 CHECK_DEL_REG_STR(props, "Size", NULL);
3088 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
3089 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
3090 CHECK_DEL_REG_DWORD(props, "Language", 1033);
3091 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
3092 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
3093 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
3094 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
3095 todo_wine
3096 {
3097 CHECK_DEL_REG_DWORD5(props, "EstimatedSize", 12, -12, 4, 10, 24);
3098 }
3099
3100 delete_key(props, "", access);
3101 RegCloseKey(props);
3102
3103 res = RegOpenKeyExA(hkey, "Usage", 0, access, &usage);
3104 todo_wine
3105 {
3106 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3107 }
3108
3109 delete_key(usage, "", access);
3110 RegCloseKey(usage);
3111 delete_key(hkey, "", access);
3112 RegCloseKey(hkey);
3113
3114 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, access, &hkey);
3115 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3116
3117 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3118
3119 delete_key(hkey, "", access);
3120 RegCloseKey(hkey);
3121
3122 error:
3123 DeleteFileA(msifile);
3124 DeleteFileA("msitest\\maximus");
3125 RemoveDirectoryA("msitest");
3126 HeapFree(GetProcessHeap(), 0, usersid);
3127 }
3128
3129 static void test_publish_product(void)
3130 {
3131 static const char prodpath[] =
3132 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
3133 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3134 static const char cuprodpath[] =
3135 "Software\\Microsoft\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3136 static const char cuupgrades[] =
3137 "Software\\Microsoft\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
3138 static const char badprod[] =
3139 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products"
3140 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3141 static const char machprod[] =
3142 "Software\\Classes\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3143 static const char machup[] =
3144 "Software\\Classes\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
3145 UINT r;
3146 LONG res;
3147 LPSTR usersid;
3148 HKEY sourcelist, net, props;
3149 HKEY hkey, patches, media;
3150 CHAR keypath[MAX_PATH];
3151 CHAR temp[MAX_PATH];
3152 CHAR path[MAX_PATH];
3153 BOOL old_installer = FALSE;
3154 REGSAM access = KEY_ALL_ACCESS;
3155
3156 if (is_process_limited())
3157 {
3158 skip("process is limited\n");
3159 return;
3160 }
3161
3162 if (!(usersid = get_user_sid()))
3163 return;
3164
3165 GetTempPathA(MAX_PATH, temp);
3166
3167 CreateDirectoryA("msitest", NULL);
3168 create_file("msitest\\maximus", 500);
3169
3170 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3171
3172 if (is_wow64)
3173 access |= KEY_WOW64_64KEY;
3174
3175 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3176
3177 /* PublishProduct, current user */
3178 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
3179 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3180 {
3181 skip("Not enough rights to perform tests\n");
3182 goto error;
3183 }
3184 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3185 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3186 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3187
3188 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, badprod, 0, access, &hkey);
3189 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3190
3191 sprintf(keypath, prodpath, usersid);
3192 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3193 if (res == ERROR_FILE_NOT_FOUND)
3194 {
3195 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
3196 if (res == ERROR_SUCCESS)
3197 {
3198 win_skip("Windows Installer < 3.0 detected\n");
3199 RegCloseKey(hkey);
3200 old_installer = TRUE;
3201 goto currentuser;
3202 }
3203 else
3204 {
3205 win_skip("Install failed, no need to continue\n");
3206 return;
3207 }
3208 }
3209 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3210
3211 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
3212 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3213
3214 res = RegOpenKeyExA(hkey, "Patches", 0, access, &patches);
3215 todo_wine
3216 {
3217 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3218 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3219 }
3220
3221 delete_key(patches, "", access);
3222 RegCloseKey(patches);
3223 delete_key(hkey, "", access);
3224 RegCloseKey(hkey);
3225
3226 currentuser:
3227 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
3228 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3229
3230 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3231 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052C94DA02821EECD05F2F");
3232 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3233 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3234 if (!old_installer)
3235 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3236 CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
3237 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3238 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3239 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3240
3241 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
3242 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3243
3244 lstrcpyA(path, "n;1;");
3245 lstrcatA(path, temp);
3246 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3247 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3248
3249 res = RegOpenKeyA(sourcelist, "Net", &net);
3250 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3251
3252 CHECK_DEL_REG_STR(net, "1", temp);
3253
3254 RegDeleteKeyA(net, "");
3255 RegCloseKey(net);
3256
3257 res = RegOpenKeyA(sourcelist, "Media", &media);
3258 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3259
3260 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3261
3262 RegDeleteKeyA(media, "");
3263 RegCloseKey(media);
3264 RegDeleteKeyA(sourcelist, "");
3265 RegCloseKey(sourcelist);
3266 RegDeleteKeyA(hkey, "");
3267 RegCloseKey(hkey);
3268
3269 res = RegOpenKeyA(HKEY_CURRENT_USER, cuupgrades, &hkey);
3270 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3271
3272 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3273
3274 RegDeleteKeyA(hkey, "");
3275 RegCloseKey(hkey);
3276
3277 /* PublishProduct, machine */
3278 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
3279 if (old_installer)
3280 goto machprod;
3281 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3282 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3283 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3284
3285 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, badprod, 0, access, &hkey);
3286 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3287
3288 sprintf(keypath, prodpath, "S-1-5-18");
3289 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3290 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3291
3292 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
3293 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3294
3295 res = RegOpenKeyExA(hkey, "Patches", 0, access, &patches);
3296 todo_wine
3297 {
3298 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3299 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3300 }
3301
3302 delete_key(patches, "", access);
3303 RegCloseKey(patches);
3304 delete_key(hkey, "", access);
3305 RegCloseKey(hkey);
3306
3307 machprod:
3308 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, machprod, 0, access, &hkey);
3309 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3310
3311 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3312 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052C94DA02821EECD05F2F");
3313 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3314 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3315 if (!old_installer)
3316 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3317 todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
3318 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3319 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3320 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3321
3322 res = RegOpenKeyExA(hkey, "SourceList", 0, access, &sourcelist);
3323 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3324
3325 lstrcpyA(path, "n;1;");
3326 lstrcatA(path, temp);
3327 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3328 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3329
3330 res = RegOpenKeyExA(sourcelist, "Net", 0, access, &net);
3331 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3332
3333 CHECK_DEL_REG_STR(net, "1", temp);
3334
3335 res = delete_key(net, "", access);
3336 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3337 RegCloseKey(net);
3338
3339 res = RegOpenKeyExA(sourcelist, "Media", 0, access, &media);
3340 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3341
3342 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3343
3344 res = delete_key(media, "", access);
3345 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3346 RegCloseKey(media);
3347 res = delete_key(sourcelist, "", access);
3348 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3349 RegCloseKey(sourcelist);
3350 res = delete_key(hkey, "", access);
3351 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3352 RegCloseKey(hkey);
3353
3354 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, machup, 0, access, &hkey);
3355 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3356
3357 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3358
3359 res = delete_key(hkey, "", access);
3360 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3361 RegCloseKey(hkey);
3362
3363 error:
3364 DeleteFileA(msifile);
3365 DeleteFileA("msitest\\maximus");
3366 RemoveDirectoryA("msitest");
3367 HeapFree(GetProcessHeap(), 0, usersid);
3368 }
3369
3370 static void test_publish_features(void)
3371 {
3372 static const char cupath[] =
3373 "Software\\Microsoft\\Installer\\Features\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3374 static const char udfeatpath[] =
3375 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
3376 "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
3377 static const char udpridpath[] =
3378 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
3379 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3380 static const char featkey[] =
3381 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Features";
3382 static const char classfeat[] =
3383 "Software\\Classes\\Installer\\Features\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3384 UINT r;
3385 LONG res;
3386 HKEY hkey;
3387 LPSTR usersid;
3388 CHAR keypath[MAX_PATH];
3389 REGSAM access = KEY_ALL_ACCESS;
3390
3391 if (is_process_limited())
3392 {
3393 skip("process is limited\n");
3394 return;
3395 }
3396
3397 if (!(usersid = get_user_sid()))
3398 return;
3399
3400 CreateDirectoryA("msitest", NULL);
3401 create_file("msitest\\maximus", 500);
3402
3403 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3404
3405 if (is_wow64)
3406 access |= KEY_WOW64_64KEY;
3407
3408 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3409
3410 /* PublishFeatures, current user */
3411 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
3412 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3413 {
3414 skip("Not enough rights to perform tests\n");
3415 goto error;
3416 }
3417 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3418 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3419 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3420
3421 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, featkey, 0, access, &hkey);
3422 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3423
3424 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, classfeat, 0, access, &hkey);
3425 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3426
3427 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
3428 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3429
3430 CHECK_REG_STR(hkey, "feature", "");
3431 CHECK_REG_STR(hkey, "montecristo", "");
3432
3433 RegDeleteValueA(hkey, "feature");
3434 RegDeleteValueA(hkey, "montecristo");
3435 delete_key(hkey, "", access);
3436 RegCloseKey(hkey);
3437
3438 sprintf(keypath, udfeatpath, usersid);
3439 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3440 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3441
3442 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
3443 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
3444
3445 RegDeleteValueA(hkey, "feature");
3446 RegDeleteValueA(hkey, "montecristo");
3447 delete_key(hkey, "", access);
3448 RegCloseKey(hkey);
3449 sprintf(keypath, udpridpath, usersid);
3450 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3451
3452 /* PublishFeatures, machine */
3453 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
3454 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3455 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3456 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3457
3458 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, featkey, 0, access, &hkey);
3459 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3460
3461 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
3462 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3463 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, classfeat, 0, access, &hkey);
3464 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3465
3466 CHECK_REG_STR(hkey, "feature", "");
3467 CHECK_REG_STR(hkey, "montecristo", "");
3468
3469 RegDeleteValueA(hkey, "feature");
3470 RegDeleteValueA(hkey, "montecristo");
3471 delete_key(hkey, "", access);
3472 RegCloseKey(hkey);
3473
3474 sprintf(keypath, udfeatpath, "S-1-5-18");
3475 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3476 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3477
3478 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
3479 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
3480
3481 RegDeleteValueA(hkey, "feature");
3482 RegDeleteValueA(hkey, "montecristo");
3483 delete_key(hkey, "", access);
3484 RegCloseKey(hkey);
3485 sprintf(keypath, udpridpath, "S-1-5-18");
3486 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3487
3488 error:
3489 DeleteFileA(msifile);
3490 DeleteFileA("msitest\\maximus");
3491 RemoveDirectoryA("msitest");
3492 HeapFree(GetProcessHeap(), 0, usersid);
3493 }
3494
3495 static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
3496 {
3497 DWORD len = 0;
3498 LPSTR val;
3499 LONG r;
3500
3501 r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
3502 if (r != ERROR_SUCCESS)
3503 return NULL;
3504
3505 len += sizeof (WCHAR);
3506 val = HeapAlloc(GetProcessHeap(), 0, len);
3507 if (!val) return NULL;
3508 val[0] = 0;
3509 RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
3510 return val;
3511 }
3512
3513 static void get_owner_company(LPSTR *owner, LPSTR *company)
3514 {
3515 LONG res;
3516 HKEY hkey;
3517 REGSAM access = KEY_ALL_ACCESS;
3518
3519 *owner = *company = NULL;
3520
3521 if (is_wow64)
3522 access |= KEY_WOW64_64KEY;
3523
3524 res = RegOpenKeyA(HKEY_CURRENT_USER,
3525 "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
3526 if (res == ERROR_SUCCESS)
3527 {
3528 *owner = reg_get_val_str(hkey, "DefName");
3529 *company = reg_get_val_str(hkey, "DefCompany");
3530 RegCloseKey(hkey);
3531 }
3532
3533 if (!*owner || !*company)
3534 {
3535 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
3536 "Software\\Microsoft\\Windows\\CurrentVersion", 0, access, &hkey);
3537 if (res == ERROR_SUCCESS)
3538 {
3539 *owner = reg_get_val_str(hkey, "RegisteredOwner");
3540 *company = reg_get_val_str(hkey, "RegisteredOrganization");
3541 RegCloseKey(hkey);
3542 }
3543 }
3544
3545 if (!*owner || !*company)
3546 {
3547 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
3548 "Software\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey);
3549 if (res == ERROR_SUCCESS)
3550 {
3551 *owner = reg_get_val_str(hkey, "RegisteredOwner");
3552 *company = reg_get_val_str(hkey, "RegisteredOrganization");
3553 RegCloseKey(hkey);
3554 }
3555 }
3556 }
3557
3558 static void test_register_user(void)
3559 {
3560 UINT r;
3561 LONG res;
3562 HKEY props;
3563 LPSTR usersid;
3564 LPSTR owner, company;
3565 CHAR keypath[MAX_PATH];
3566 REGSAM access = KEY_ALL_ACCESS;
3567
3568 static const CHAR keypropsfmt[] =
3569 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3570 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
3571 static const CHAR keypridfmt[] =
3572 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3573 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3574
3575 if (is_process_limited())
3576 {
3577 skip("process is limited\n");
3578 return;
3579 }
3580
3581 if (!(usersid = get_user_sid()))
3582 return;
3583
3584 get_owner_company(&owner, &company);
3585
3586 CreateDirectoryA("msitest", NULL);
3587 create_file("msitest\\maximus", 500);
3588
3589 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3590
3591 if (is_wow64)
3592 access |= KEY_WOW64_64KEY;
3593
3594 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3595
3596 /* RegisterUser, per-user */
3597 r = MsiInstallProductA(msifile, "REGISTER_USER=1");
3598 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3599 {
3600 skip("Not enough rights to perform tests\n");
3601 goto error;
3602 }
3603 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3604 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3605 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3606
3607 sprintf(keypath, keypropsfmt, usersid);
3608 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
3609 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3610
3611 CHECK_REG_STR(props, "ProductID", "none");
3612 CHECK_REG_STR(props, "RegCompany", company);
3613 CHECK_REG_STR(props, "RegOwner", owner);
3614
3615 RegDeleteValueA(props, "ProductID");
3616 RegDeleteValueA(props, "RegCompany");
3617 RegDeleteValueA(props, "RegOwner");
3618 delete_key(props, "", access);
3619 RegCloseKey(props);
3620 sprintf(keypath, keypridfmt, usersid);
3621 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3622
3623 /* RegisterUser, machine */
3624 r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
3625 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3626 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3627 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3628
3629 sprintf(keypath, keypropsfmt, "S-1-5-18");
3630 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
3631 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3632
3633 CHECK_REG_STR(props, "ProductID", "none");
3634 CHECK_REG_STR(props, "RegCompany", company);
3635 CHECK_REG_STR(props, "RegOwner", owner);
3636
3637 RegDeleteValueA(props, "ProductID");
3638 RegDeleteValueA(props, "RegCompany");
3639 RegDeleteValueA(props, "RegOwner");
3640 delete_key(props, "", access);
3641 RegCloseKey(props);
3642 sprintf(keypath, keypridfmt, "S-1-5-18");
3643 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3644
3645 error:
3646 HeapFree(GetProcessHeap(), 0, company);
3647 HeapFree(GetProcessHeap(), 0, owner);
3648
3649 DeleteFileA(msifile);
3650 DeleteFileA("msitest\\maximus");
3651 RemoveDirectoryA("msitest");
3652 LocalFree(usersid);
3653 }
3654
3655 static void test_process_components(void)
3656 {
3657 static const char keyfmt[] =
3658 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Components\\%s";
3659 static const char compkey[] =
3660 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
3661 UINT r;
3662 LONG res;
3663 DWORD size;
3664 HKEY comp, hkey;
3665 LPSTR usersid;
3666 CHAR val[MAX_PATH];
3667 CHAR keypath[MAX_PATH];
3668 CHAR program_files_maximus[MAX_PATH];
3669 REGSAM access = KEY_ALL_ACCESS;
3670
3671 if (is_process_limited())
3672 {
3673 skip("process is limited\n");
3674 return;
3675 }
3676
3677 if (!(usersid = get_user_sid()))
3678 return;
3679
3680 CreateDirectoryA("msitest", NULL);
3681 create_file("msitest\\maximus", 500);
3682
3683 create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table));
3684
3685 if (is_wow64)
3686 access |= KEY_WOW64_64KEY;
3687
3688 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3689
3690 /* ProcessComponents, per-user */
3691 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3692 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3693 {
3694 skip("Not enough rights to perform tests\n");
3695 goto error;
3696 }
3697 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3698 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3699 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3700
3701 sprintf(keypath, keyfmt, usersid, "CBABC2FDCCB35E749A8944D8C1C098B5");
3702 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3703 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3704
3705 size = MAX_PATH;
3706 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3707 NULL, NULL, (LPBYTE)val, &size);
3708 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3709
3710 lstrcpyA(program_files_maximus,PROG_FILES_DIR);
3711 lstrcatA(program_files_maximus,"\\msitest\\maximus");
3712
3713 ok(!lstrcmpiA(val, program_files_maximus),
3714 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3715
3716 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3717 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3718
3719 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3720 delete_key(comp, "", access);
3721 RegCloseKey(comp);
3722
3723 sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
3724 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3725 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3726
3727 size = MAX_PATH;
3728 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3729 NULL, NULL, (LPBYTE)val, &size);
3730 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3731 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3732 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3733
3734 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3735 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3736
3737 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3738 delete_key(comp, "", access);
3739 RegCloseKey(comp);
3740
3741 /* ProcessComponents, machine */
3742 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
3743 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3744 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3745 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3746
3747 sprintf(keypath, keyfmt, "S-1-5-18", "CBABC2FDCCB35E749A8944D8C1C098B5");
3748 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3749 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3750
3751 size = MAX_PATH;
3752 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3753 NULL, NULL, (LPBYTE)val, &size);
3754 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3755 ok(!lstrcmpiA(val, program_files_maximus),
3756 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3757
3758 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3759 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3760
3761 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3762 delete_key(comp, "", access);
3763 RegCloseKey(comp);
3764
3765 sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
3766 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3767 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3768
3769 size = MAX_PATH;
3770 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3771 NULL, NULL, (LPBYTE)val, &size);
3772 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3773 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3774 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3775
3776 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3777 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3778
3779 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3780 delete_key(comp, "", access);
3781 RegCloseKey(comp);
3782
3783 error:
3784 DeleteFileA(msifile);
3785 DeleteFileA("msitest\\maximus");
3786 RemoveDirectoryA("msitest");
3787 LocalFree(usersid);
3788 }
3789
3790 static void test_publish(void)
3791 {
3792 static const char subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3793 static const char subkey_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3794 UINT r;
3795 LONG res;
3796 HKEY uninstall, prodkey, uninstall_32node = NULL;
3797 INSTALLSTATE state;
3798 char date[MAX_PATH], temp[MAX_PATH], prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3799 REGSAM access = KEY_ALL_ACCESS;
3800 DWORD error;
3801
3802 if (!pMsiQueryFeatureStateExA)
3803 {
3804 win_skip("MsiQueryFeatureStateExA is not available\n");
3805 return;
3806 }
3807 if (is_process_limited())
3808 {
3809 skip("process is limited\n");
3810 return;
3811 }
3812
3813 get_date_str(date);
3814 GetTempPathA(MAX_PATH, temp);
3815
3816 if (is_wow64)
3817 access |= KEY_WOW64_64KEY;
3818
3819 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey, 0, KEY_ALL_ACCESS, &uninstall);
3820 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3821
3822 if (is_64bit)
3823 {
3824 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey_32node, 0, KEY_ALL_ACCESS, &uninstall_32node);
3825 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3826 }
3827
3828 CreateDirectoryA("msitest", NULL);
3829 create_file("msitest\\maximus", 500);
3830
3831 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3832
3833 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3834
3835 state = MsiQueryProductStateA(prodcode);
3836 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3837
3838 state = MsiQueryFeatureStateA(prodcode, "feature");
3839 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3840
3841 state = 0xdead;
3842 SetLastError(0xdeadbeef);
3843 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state);
3844 error = GetLastError();
3845 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3846 ok(state == 0xdead, "got %d\n", state);
3847 ok(error == 0xdeadbeef, "got %u\n", error);
3848
3849 state = 0xdead;
3850 SetLastError(0xdeadbeef);
3851 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state);
3852 error = GetLastError();
3853 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3854 ok(state == 0xdead, "got %d\n", state);
3855 ok(error == ERROR_SUCCESS, "got %u\n", error);
3856
3857 state = 0xdead;
3858 SetLastError(0xdeadbeef);
3859 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state);
3860 error = GetLastError();
3861 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3862 ok(state == 0xdead, "got %d\n", state);
3863 ok(error == ERROR_SUCCESS, "got %u\n", error);
3864
3865 state = MsiQueryFeatureStateA(prodcode, "feature");
3866 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3867
3868 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3869 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3870
3871 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3872 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3873 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3874 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3875
3876 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3877 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3878
3879 /* nothing published */
3880 r = MsiInstallProductA(msifile, NULL);
3881 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3882 {
3883 skip("Not enough rights to perform tests\n");
3884 goto error;
3885 }
3886 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3887 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3888 ok(pf_exists("msitest"), "File not installed\n");
3889
3890 state = MsiQueryProductStateA(prodcode);
3891 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3892
3893 state = MsiQueryFeatureStateA(prodcode, "feature");
3894 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3895
3896 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3897 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3898
3899 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3900 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3901 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3902 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3903
3904 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3905 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3906
3907 /* PublishProduct and RegisterProduct */
3908 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
3909 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3910 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3911 ok(pf_exists("msitest"), "File not installed\n");
3912
3913 state = MsiQueryProductStateA(prodcode);
3914 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3915
3916 state = MsiQueryFeatureStateA(prodcode, "feature");
3917 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3918
3919 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3920 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3921
3922 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3923 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3924 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
3925 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3926
3927 if (is_64bit)
3928 {
3929 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3930 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3931 }
3932 else
3933 {
3934 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3935 if (is_wow64 && res == ERROR_FILE_NOT_FOUND) /* XP - Vista, Wow64 */
3936 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3937 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3938 }
3939
3940 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3941 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3942 CHECK_REG_STR(prodkey, "InstallDate", date);
3943 CHECK_REG_STR(prodkey, "InstallSource", temp);
3944 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3945 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3946 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3947 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3948 CHECK_REG_STR(prodkey, "Comments", NULL);
3949 CHECK_REG_STR(prodkey, "Contact", NULL);
3950 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3951 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3952 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3953 CHECK_REG_STR(prodkey, "Readme", NULL);
3954 CHECK_REG_STR(prodkey, "Size", NULL);
3955 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3956 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3957 CHECK_REG_DWORD(prodkey, "Language", 1033);
3958 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3959 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3960 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3961 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3962 todo_wine
3963 {
3964 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
3965 }
3966
3967 RegCloseKey(prodkey);
3968
3969 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3970 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3971 ok(pf_exists("msitest\\maximus"), "File deleted\n");
3972 ok(pf_exists("msitest"), "File deleted\n");
3973
3974 state = MsiQueryProductStateA(prodcode);
3975 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3976
3977 state = MsiQueryFeatureStateA(prodcode, "feature");
3978 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3979
3980 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3981 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3982
3983 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3984 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3985 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3986 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3987
3988 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3989 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3990
3991 /* complete install */
3992 r = MsiInstallProductA(msifile, "FULL=1");
3993 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3994 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3995 ok(pf_exists("msitest"), "File not installed\n");
3996
3997 state = MsiQueryProductStateA(prodcode);
3998 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3999
4000 state = MsiQueryFeatureStateA(prodcode, "feature");
4001 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4002
4003 state = 0xdead;
4004 SetLastError(0xdeadbeef);
4005 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state);
4006 error = GetLastError();
4007 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
4008 ok(state == 0xdead, "got %d\n", state);
4009 ok(error == 0xdeadbeef, "got %u\n", error);
4010
4011 state = 0xdead;
4012 SetLastError(0xdeadbeef);
4013 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state);
4014 error = GetLastError();
4015 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
4016 ok(state == 0xdead, "got %d\n", state);
4017 ok(error == ERROR_SUCCESS, "got %u\n", error);
4018
4019 state = 0xdead;
4020 SetLastError(0xdeadbeef);
4021 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state);
4022 error = GetLastError();
4023 ok(r == ERROR_SUCCESS, "got %u\n", r);
4024 ok(state == INSTALLSTATE_LOCAL, "got %d\n", state);
4025 ok(error == ERROR_SUCCESS, "got %u\n", error);
4026
4027 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4028 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4029
4030 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4031 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4032 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4033 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4034
4035 if (is_64bit)
4036 {
4037 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4038 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4039 }
4040 else
4041 {
4042 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4043 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4044 }
4045
4046 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4047 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4048 CHECK_REG_STR(prodkey, "InstallDate", date);
4049 CHECK_REG_STR(prodkey, "InstallSource", temp);
4050 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4051 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4052 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4053 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4054 CHECK_REG_STR(prodkey, "Comments", NULL);
4055 CHECK_REG_STR(prodkey, "Contact", NULL);
4056 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4057 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4058 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4059 CHECK_REG_STR(prodkey, "Readme", NULL);
4060 CHECK_REG_STR(prodkey, "Size", NULL);
4061 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4062 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4063 CHECK_REG_DWORD(prodkey, "Language", 1033);
4064 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4065 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4066 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4067 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4068 todo_wine
4069 {
4070 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4071 }
4072
4073 RegCloseKey(prodkey);
4074
4075 /* no UnpublishFeatures */
4076 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4077 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4078 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4079 ok(!pf_exists("msitest"), "Directory not deleted\n");
4080
4081 state = MsiQueryProductStateA(prodcode);
4082 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4083
4084 state = MsiQueryFeatureStateA(prodcode, "feature");
4085 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4086
4087 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4088 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4089
4090 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4091 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4092 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4093 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4094
4095 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
4096 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4097
4098 /* complete install */
4099 r = MsiInstallProductA(msifile, "FULL=1");
4100 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4101 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4102 ok(pf_exists("msitest"), "File not installed\n");
4103
4104 state = MsiQueryProductStateA(prodcode);
4105 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4106
4107 state = MsiQueryFeatureStateA(prodcode, "feature");
4108 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4109
4110 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4111 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4112
4113 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4114 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4115 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4116 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4117
4118 if (is_64bit)
4119 {
4120 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4121 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4122 }
4123 else
4124 {
4125 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4126 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4127 }
4128
4129 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4130 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4131 CHECK_REG_STR(prodkey, "InstallDate", date);
4132 CHECK_REG_STR(prodkey, "InstallSource", temp);
4133 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4134 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4135 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4136 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4137 CHECK_REG_STR(prodkey, "Comments", NULL);
4138 CHECK_REG_STR(prodkey, "Contact", NULL);
4139 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4140 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4141 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4142 CHECK_REG_STR(prodkey, "Readme", NULL);
4143 CHECK_REG_STR(prodkey, "Size", NULL);
4144 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4145 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4146 CHECK_REG_DWORD(prodkey, "Language", 1033);
4147 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4148 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4149 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4150 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4151 todo_wine
4152 {
4153 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4154 }
4155
4156 RegCloseKey(prodkey);
4157
4158 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
4159 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
4160 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4161 ok(pf_exists("msitest\\maximus"), "File deleted\n");
4162 ok(pf_exists("msitest"), "Directory deleted\n");
4163
4164 state = MsiQueryProductStateA(prodcode);
4165 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4166
4167 state = MsiQueryFeatureStateA(prodcode, "feature");
4168 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4169
4170 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4171 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4172
4173 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4174 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4175 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4176 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4177
4178 if (is_64bit)
4179 {
4180 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4181 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4182 }
4183 else
4184 {
4185 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4186 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4187 }
4188
4189 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4190 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4191 CHECK_REG_STR(prodkey, "InstallDate", date);
4192 CHECK_REG_STR(prodkey, "InstallSource", temp);
4193 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4194 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4195 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4196 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4197 CHECK_REG_STR(prodkey, "Comments", NULL);
4198 CHECK_REG_STR(prodkey, "Contact", NULL);
4199 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4200 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4201 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4202 CHECK_REG_STR(prodkey, "Readme", NULL);
4203 CHECK_REG_STR(prodkey, "Size", NULL);
4204 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4205 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4206 CHECK_REG_DWORD(prodkey, "Language", 1033);
4207 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4208 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4209 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4210 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4211 todo_wine
4212 {
4213 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4214 }
4215
4216 RegCloseKey(prodkey);
4217
4218 /* complete install */
4219 r = MsiInstallProductA(msifile, "FULL=1");
4220 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4221 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4222 ok(pf_exists("msitest"), "File not installed\n");
4223
4224 state = MsiQueryProductStateA(prodcode);
4225 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4226
4227 state = MsiQueryFeatureStateA(prodcode, "feature");
4228 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4229
4230 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4231 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4232
4233 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4234 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4235 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4236 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4237
4238 if (is_64bit)
4239 {
4240 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4241 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4242 }
4243 else
4244 {
4245 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4246 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4247 }
4248
4249 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4250 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4251 CHECK_REG_STR(prodkey, "InstallDate", date);
4252 CHECK_REG_STR(prodkey, "InstallSource", temp);
4253 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4254 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4255 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4256 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4257 CHECK_REG_STR(prodkey, "Comments", NULL);
4258 CHECK_REG_STR(prodkey, "Contact", NULL);
4259 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4260 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4261 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4262 CHECK_REG_STR(prodkey, "Readme", NULL);
4263 CHECK_REG_STR(prodkey, "Size", NULL);
4264 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4265 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4266 CHECK_REG_DWORD(prodkey, "Language", 1033);
4267 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4268 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4269 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4270 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4271 todo_wine
4272 {
4273 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -20, 10, 24);
4274 }
4275
4276 RegCloseKey(prodkey);
4277
4278 /* UnpublishFeatures, both features removed */
4279 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
4280 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4281 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4282 ok(!pf_exists("msitest"), "Directory not deleted\n");
4283
4284 state = MsiQueryProductStateA(prodcode);
4285 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4286
4287 state = MsiQueryFeatureStateA(prodcode, "feature");
4288 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4289
4290 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4291 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4292
4293 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4294 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4295 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4296 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4297
4298 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
4299 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4300
4301 /* complete install */
4302 r = MsiInstallProductA(msifile, "FULL=1");
4303 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4304 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4305 ok(pf_exists("msitest"), "File not installed\n");
4306
4307 state = MsiQueryProductStateA(prodcode);
4308 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4309
4310 state = MsiQueryFeatureStateA(prodcode, "feature");
4311 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4312
4313 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4314 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4315
4316 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4317 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4318 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4319 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4320
4321 if (is_64bit)
4322 {
4323 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4324 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4325 }
4326 else
4327 {
4328 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4329 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4330 }
4331
4332 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4333 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4334 CHECK_REG_STR(prodkey, "InstallDate", date);
4335 CHECK_REG_STR(prodkey, "InstallSource", temp);
4336 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4337 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4338 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4339 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4340 CHECK_REG_STR(prodkey, "Comments", NULL);
4341 CHECK_REG_STR(prodkey, "Contact", NULL);
4342 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4343 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4344 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4345 CHECK_REG_STR(prodkey, "Readme", NULL);
4346 CHECK_REG_STR(prodkey, "Size", NULL);
4347 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4348 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4349 CHECK_REG_DWORD(prodkey, "Language", 1033);
4350 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4351 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4352 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4353 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4354 todo_wine
4355 {
4356 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4357 }
4358
4359 RegCloseKey(prodkey);
4360
4361 /* complete uninstall */
4362 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4363 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4364 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4365 ok(!pf_exists("msitest"), "Directory not deleted\n");
4366
4367 state = MsiQueryProductStateA(prodcode);
4368 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4369
4370 state = MsiQueryFeatureStateA(prodcode, "feature");
4371 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4372
4373 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4374 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4375
4376 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4377 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4378 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4379 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4380
4381 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
4382 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4383
4384 /* make sure 'Program Files\msitest' is removed */
4385 delete_pfmsitest_files();
4386
4387 error:
4388 RegCloseKey(uninstall);
4389 RegCloseKey(uninstall_32node);
4390 DeleteFileA(msifile);
4391 DeleteFileA("msitest\\maximus");
4392 RemoveDirectoryA("msitest");
4393 }
4394
4395 static void test_publish_sourcelist(void)
4396 {
4397 UINT r;
4398 DWORD size;
4399 CHAR value[MAX_PATH];
4400 CHAR path[MAX_PATH];
4401 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
4402
4403 if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
4404 {
4405 win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
4406 return;
4407 }
4408 if (is_process_limited())
4409 {
4410 skip("process is limited\n");
4411 return;
4412 }
4413
4414 CreateDirectoryA("msitest", NULL);
4415 create_file("msitest\\maximus", 500);
4416
4417 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4418
4419 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4420
4421 r = MsiInstallProductA(msifile, NULL);
4422 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4423 {
4424 skip("Not enough rights to perform tests\n");
4425 goto error;
4426 }
4427 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4428 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4429 ok(pf_exists("msitest"), "File not installed\n");
4430
4431 /* nothing published */
4432 size = MAX_PATH;
4433 lstrcpyA(value, "aaa");
4434 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4435 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4436 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4437 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4438 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4439
4440 size = MAX_PATH;
4441 lstrcpyA(value, "aaa");
4442 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4443 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4444 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4445 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4446 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4447
4448 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
4449 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4450 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4451 ok(pf_exists("msitest"), "File not installed\n");
4452
4453 /* after RegisterProduct */
4454 size = MAX_PATH;
4455 lstrcpyA(value, "aaa");
4456 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4457 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4458 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4459 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4460 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4461
4462 size = MAX_PATH;
4463 lstrcpyA(value, "aaa");
4464 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4465 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4466 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4467 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4468 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4469
4470 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
4471 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4472 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4473 ok(pf_exists("msitest"), "File not installed\n");
4474
4475 /* after ProcessComponents */
4476 size = MAX_PATH;
4477 lstrcpyA(value, "aaa");
4478 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4479 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4480 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4481 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4482 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4483
4484 size = MAX_PATH;
4485 lstrcpyA(value, "aaa");
4486 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4487 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4488 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4489 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4490 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4491
4492 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
4493 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4494 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4495 ok(pf_exists("msitest"), "File not installed\n");
4496
4497 /* after PublishFeatures */
4498 size = MAX_PATH;
4499 lstrcpyA(value, "aaa");
4500 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4501 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4502 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4503 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4504 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4505
4506 size = MAX_PATH;
4507 lstrcpyA(value, "aaa");
4508 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4509 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4510 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4511 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4512 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4513
4514 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
4515 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4516 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4517 ok(pf_exists("msitest"), "File not installed\n");
4518
4519 /* after PublishProduct */
4520 size = MAX_PATH;
4521 lstrcpyA(value, "aaa");
4522 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4523 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4524 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4525 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
4526 ok(size == 11, "Expected 11, got %d\n", size);
4527
4528 size = MAX_PATH;
4529 lstrcpyA(value, "aaa");
4530 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4531 MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, value, &size);
4532 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4533 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
4534 ok(size == 0, "Expected 0, got %d\n", size);
4535
4536 size = MAX_PATH;
4537 lstrcpyA(value, "aaa");
4538 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4539 MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPTA, value, &size);
4540 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4541 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
4542 ok(size == 0, "Expected 0, got %d\n", size);
4543
4544 lstrcpyA(path, CURR_DIR);
4545 lstrcatA(path, "\\");
4546
4547 size = MAX_PATH;
4548 lstrcpyA(value, "aaa");
4549 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4550 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size);
4551 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4552 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
4553 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
4554
4555 size = MAX_PATH;
4556 lstrcpyA(value, "aaa");
4557 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4558 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size);
4559 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4560 ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
4561 ok(size == 1, "Expected 1, got %d\n", size);
4562
4563 size = MAX_PATH;
4564 lstrcpyA(value, "aaa");
4565 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4566 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4567 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4568 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
4569 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
4570
4571 size = MAX_PATH;
4572 lstrcpyA(value, "aaa");
4573 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4574 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
4575 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4576 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
4577 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
4578
4579 size = MAX_PATH;
4580 lstrcpyA(value, "aaa");
4581 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4582 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
4583 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4584 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
4585 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
4586
4587 /* complete uninstall */
4588 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4589 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4590 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4591 ok(!pf_exists("msitest"), "Directory not deleted\n");
4592
4593 /* make sure 'Program Files\msitest' is removed */
4594 delete_pfmsitest_files();
4595
4596 error:
4597 DeleteFileA(msifile);
4598 DeleteFileA("msitest\\maximus");
4599 RemoveDirectoryA("msitest");
4600 }
4601
4602 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
4603 {
4604 CHAR path[MAX_PATH];
4605
4606 lstrcpyA(path, PROG_FILES_DIR);
4607 lstrcatA(path, "\\");
4608 lstrcatA(path, file);
4609
4610 if (is_file)
4611 create_file_data(path, data, 500);
4612 else
4613 CreateDirectoryA(path, NULL);
4614 }
4615
4616 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
4617
4618 static void test_remove_files(void)
4619 {
4620 UINT r;
4621
4622 if (is_process_limited())
4623 {
4624 skip("process is limited\n");
4625 return;
4626 }
4627
4628 CreateDirectoryA("msitest", NULL);
4629 create_file("msitest\\hydrogen", 500);
4630 create_file("msitest\\helium", 500);
4631 create_file("msitest\\lithium", 500);
4632
4633 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
4634
4635 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4636
4637 r = MsiInstallProductA(msifile, NULL);
4638 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4639 {
4640 skip("Not enough rights to perform tests\n");
4641 goto error;
4642 }
4643 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4644 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4645 ok(!pf_exists("msitest\\helium"), "File installed\n");
4646 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4647 ok(pf_exists("msitest"), "File not installed\n");
4648
4649 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4650 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4651 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4652 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
4653 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4654 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4655
4656 create_pf("msitest", FALSE);
4657 create_pf("msitest\\hydrogen", TRUE);
4658 create_pf("msitest\\helium", TRUE);
4659 create_pf("msitest\\lithium", TRUE);
4660
4661 r = MsiInstallProductA(msifile, NULL);
4662 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4663 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4664 ok(pf_exists("msitest\\helium"), "File not installed\n");
4665 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4666 ok(pf_exists("msitest"), "File not installed\n");
4667
4668 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4669 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4670 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4671 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
4672 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4673 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4674
4675 create_pf("msitest", FALSE);
4676 create_pf("msitest\\furlong", TRUE);
4677 create_pf("msitest\\firkin", TRUE);
4678 create_pf("msitest\\fortnight", TRUE);
4679 create_pf("msitest\\becquerel", TRUE);
4680 create_pf("msitest\\dioptre", TRUE);
4681 create_pf("msitest\\attoparsec", TRUE);
4682 create_pf("msitest\\storeys", TRUE);
4683 create_pf("msitest\\block", TRUE);
4684 create_pf("msitest\\siriometer", TRUE);
4685 create_pf("msitest\\cabout", FALSE);
4686 create_pf("msitest\\cabout\\blocker", TRUE);
4687
4688 r = MsiInstallProductA(msifile, NULL);
4689 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4690 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4691 ok(!pf_exists("msitest\\helium"), "File installed\n");
4692 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4693 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
4694 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
4695 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
4696 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
4697 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
4698 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
4699 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
4700 ok(!pf_exists("msitest\\block"), "File not deleted\n");
4701 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
4702 ok(pf_exists("msitest\\cabout"), "Directory removed\n");
4703 ok(pf_exists("msitest"), "File not installed\n");
4704
4705 create_pf("msitest\\furlong", TRUE);
4706 create_pf("msitest\\firkin", TRUE);
4707 create_pf("msitest\\fortnight", TRUE);
4708 create_pf("msitest\\storeys", TRUE);
4709 create_pf("msitest\\block", TRUE);
4710 create_pf("msitest\\siriometer", TRUE);
4711
4712 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4713 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4714 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
4715 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
4716 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4717 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
4718 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
4719 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
4720 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
4721 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
4722 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
4723 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
4724 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
4725 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
4726 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4727 ok(pf_exists("msitest"), "Directory deleted\n");
4728
4729 r = MsiInstallProductA(msifile, NULL);
4730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4731 ok(delete_pf("msitest\\hydrogen", TRUE), "File not installed\n");
4732 ok(!delete_pf("msitest\\helium", TRUE), "File installed\n");
4733 ok(delete_pf("msitest\\lithium", TRUE), "File not installed\n");
4734 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4735 ok(pf_exists("msitest"), "Directory deleted\n");
4736
4737 delete_pf("msitest\\cabout\\blocker", TRUE);
4738
4739 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4740 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4741 ok(!delete_pf("msitest\\cabout", FALSE), "Directory not deleted\n");
4742 delete_pf("msitest", FALSE);
4743
4744 error:
4745 DeleteFileA(msifile);
4746 DeleteFileA("msitest\\hydrogen");
4747 DeleteFileA("msitest\\helium");
4748 DeleteFileA("msitest\\lithium");
4749 RemoveDirectoryA("msitest");
4750 }
4751
4752 static void test_move_files(void)
4753 {
4754 UINT r;
4755 char props[MAX_PATH];
4756
4757 if (is_process_limited())
4758 {
4759 skip("process is limited\n");
4760 return;
4761 }
4762
4763 CreateDirectoryA("msitest", NULL);
4764 create_file("msitest\\augustus", 100);
4765 create_file("cameroon", 100);
4766 create_file("djibouti", 100);
4767 create_file("egypt", 100);
4768 create_file("finland", 100);
4769 create_file("gambai", 100);
4770 create_file("honduras", 100);
4771 create_file("msitest\\india", 100);
4772 create_file("japan", 100);
4773 create_file("kenya", 100);
4774 CreateDirectoryA("latvia", NULL);
4775 create_file("nauru", 100);
4776 create_file("peru", 100);
4777 create_file("apple", 100);
4778 create_file("application", 100);
4779 create_file("ape", 100);
4780 create_file("foo", 100);
4781 create_file("fao", 100);
4782 create_file("fbod", 100);
4783 create_file("budding", 100);
4784 create_file("buddy", 100);
4785 create_file("bud", 100);
4786 create_file("bar", 100);
4787 create_file("bur", 100);
4788 create_file("bird", 100);
4789
4790 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
4791
4792 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4793
4794 /* if the source or dest property is not a full path,
4795 * windows tries to access it as a network resource
4796 */
4797
4798 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
4799 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
4800 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
4801
4802 r = MsiInstallProductA(msifile, props);
4803 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4804 {
4805 skip("Not enough rights to perform tests\n");
4806 goto error;
4807 }
4808 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4809 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4810 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
4811 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
4812 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
4813 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
4814 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
4815 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
4816 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
4817 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
4818 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
4819 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
4820 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
4821 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
4822 ok(delete_pf("msitest\\poland", TRUE), "File not moved\n");
4823 /* either apple or application will be moved depending on directory order */
4824 if (!delete_pf("msitest\\apple", TRUE))
4825 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
4826 else
4827 ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
4828 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
4829 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
4830 /* either fao or foo will be moved depending on directory order */
4831 if (delete_pf("msitest\\foo", TRUE))
4832 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
4833 else
4834 ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
4835 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
4836 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
4837 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
4838 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
4839 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
4840 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
4841 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
4842 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
4843 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4844 ok(DeleteFileA("cameroon"), "File moved\n");
4845 ok(!DeleteFileA("djibouti"), "File not moved\n");
4846 ok(DeleteFileA("egypt"), "File moved\n");
4847 ok(DeleteFileA("finland"), "File moved\n");
4848 ok(DeleteFileA("gambai"), "File moved\n");
4849 ok(!DeleteFileA("honduras"), "File not moved\n");
4850 ok(DeleteFileA("msitest\\india"), "File moved\n");
4851 ok(DeleteFileA("japan"), "File moved\n");
4852 ok(!DeleteFileA("kenya"), "File not moved\n");
4853 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
4854 ok(!DeleteFileA("nauru"), "File not moved\n");
4855 ok(!DeleteFileA("peru"), "File not moved\n");
4856 ok(!DeleteFileA("apple"), "File not moved\n");
4857 ok(!DeleteFileA("application"), "File not moved\n");
4858 ok(DeleteFileA("ape"), "File moved\n");
4859 ok(!DeleteFileA("foo"), "File not moved\n");
4860 ok(!DeleteFileA("fao"), "File not moved\n");
4861 ok(DeleteFileA("fbod"), "File moved\n");
4862 ok(!DeleteFileA("budding"), "File not moved\n");
4863 ok(!DeleteFileA("buddy"), "File not moved\n");
4864 ok(DeleteFileA("bud"), "File moved\n");
4865 ok(!DeleteFileA("bar"), "File not moved\n");
4866 ok(!DeleteFileA("bur"), "File not moved\n");
4867 ok(DeleteFileA("bird"), "File moved\n");
4868
4869 error:
4870 DeleteFileA("cameroon");
4871 DeleteFileA("djibouti");
4872 DeleteFileA("egypt");
4873 DeleteFileA("finland");
4874 DeleteFileA("gambai");
4875 DeleteFileA("honduras");
4876 DeleteFileA("japan");
4877 DeleteFileA("kenya");
4878 DeleteFileA("nauru");
4879 DeleteFileA("peru");
4880 DeleteFileA("apple");
4881 DeleteFileA("application");
4882 DeleteFileA("ape");
4883 DeleteFileA("foo");
4884 DeleteFileA("fao");
4885 DeleteFileA("fbod");
4886 DeleteFileA("budding");
4887 DeleteFileA("buddy");
4888 DeleteFileA("bud");
4889 DeleteFileA("bar");
4890 DeleteFileA("bur");
4891 DeleteFileA("bird");
4892 DeleteFileA("msitest\\india");
4893 DeleteFileA("msitest\\augustus");
4894 RemoveDirectoryA("latvia");
4895 RemoveDirectoryA("msitest");
4896 DeleteFileA(msifile);
4897 }
4898
4899 static void test_duplicate_files(void)
4900 {
4901 UINT r;
4902
4903 if (is_process_limited())
4904 {
4905 skip("process is limited\n");
4906 return;
4907 }
4908
4909 CreateDirectoryA("msitest", NULL);
4910 create_file("msitest\\maximus", 500);
4911 create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
4912
4913 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4914
4915 /* fails if the destination folder is not a valid property */
4916
4917 r = MsiInstallProductA(msifile, NULL);
4918 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4919 {
4920 skip("Not enough rights to perform tests\n");
4921 goto error;
4922 }
4923 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4924 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4925 ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
4926 ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
4927 ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "Directory not created\n");
4928 ok(delete_pf("msitest\\this\\doesnot", FALSE), "Directory not created\n");
4929 ok(delete_pf("msitest\\this", FALSE), "Directory not created\n");
4930 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4931
4932 error:
4933 DeleteFileA("msitest\\maximus");
4934 RemoveDirectoryA("msitest");
4935 DeleteFileA(msifile);
4936 }
4937
4938 static void test_write_registry_values(void)
4939 {
4940 UINT r;
4941 LONG res;
4942 HKEY hkey;
4943 DWORD type, size;
4944 CHAR path[MAX_PATH];
4945 BYTE buf[8];
4946
4947 if (is_process_limited())
4948 {
4949 skip("process is limited\n");
4950 return;
4951 }
4952
4953 CreateDirectoryA("msitest", NULL);
4954 create_file("msitest\\augustus", 500);
4955
4956 create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
4957
4958 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4959
4960 if (is_64bit)
4961 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Wine\\msitest", 0, NULL, 0,
4962 KEY_ALL_ACCESS, NULL, &hkey, NULL);
4963 else
4964 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", 0, NULL, 0, KEY_ALL_ACCESS,
4965 NULL, &hkey, NULL);
4966 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4967
4968 res = RegSetValueExA(hkey, "Value1", 0, REG_MULTI_SZ, (const BYTE *)"two\0", 5);
4969 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4970 res = RegSetValueExA(hkey, "Value2", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4971 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4972 res = RegSetValueExA(hkey, "Value3", 0, REG_MULTI_SZ, (const BYTE *)"two\0", 5);
4973 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4974 res = RegSetValueExA(hkey, "Value4", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4975 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4976 res = RegSetValueExA(hkey, "Value5", 0, REG_MULTI_SZ, (const BYTE *)"one\0two\0", 9);
4977 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4978 res = RegSetValueExA(hkey, "Value6", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4979 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4980 res = RegSetValueExA(hkey, "Value7", 0, REG_SZ, (const BYTE *)"one", 4);
4981 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4982 RegCloseKey(hkey);
4983
4984 r = MsiInstallProductA(msifile, NULL);
4985 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4986 {
4987 skip("Not enough rights to perform tests\n");
4988 goto error;
4989 }
4990 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4991 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4992 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4993
4994 if (is_64bit)
4995 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Wine\\msitest", 0, KEY_ALL_ACCESS, &hkey);
4996 else
4997 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", 0, KEY_ALL_ACCESS, &hkey);
4998 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4999
5000 size = MAX_PATH;
5001 type = 0xdeadbeef;
5002 memset(path, 'a', MAX_PATH);
5003 res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size);
5004 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5005 ok(!memcmp(path, "one\0two\0three\0\0", size), "Wrong multi-sz data\n");
5006 ok(size == 15, "Expected 15, got %d\n", size);
5007 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5008
5009 res = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL);
5010 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5011
5012 res = action_RegDeleteTreeA(hkey, "VisualStudio", KEY_ALL_ACCESS);
5013 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5014
5015 size = MAX_PATH;
5016 type = 0xdeadbeef;
5017 memset(path, 'a', MAX_PATH);
5018 res = RegQueryValueExA(hkey, "Value1", NULL, &type, (LPBYTE)path, &size);
5019 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5020 ok(!memcmp(path, "one\0", size), "Wrong multi-sz data\n");
5021 ok(size == 5, "Expected 5, got %d\n", size);
5022 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5023
5024 size = MAX_PATH;
5025 type = 0xdeadbeef;
5026 memset(path, 'a', MAX_PATH);
5027 res = RegQueryValueExA(hkey, "Value2", NULL, &type, (LPBYTE)path, &size);
5028 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5029 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
5030 ok(size == 9, "Expected 9, got %d\n", size);
5031 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5032
5033 size = MAX_PATH;
5034 type = 0xdeadbeef;
5035 memset(path, 'a', MAX_PATH);
5036 res = RegQueryValueExA(hkey, "Value3", NULL, &type, (LPBYTE)path, &size);
5037 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5038 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
5039 ok(size == 9, "Expected 9, got %d\n", size);
5040 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5041
5042 size = MAX_PATH;
5043 type = 0xdeadbeef;
5044 memset(path, 'a', MAX_PATH);
5045 res = RegQueryValueExA(hkey, "Value4", NULL, &type, (LPBYTE)path, &size);
5046 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5047 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
5048 ok(size == 9, "Expected 9, got %d\n", size);
5049 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5050
5051 size = MAX_PATH;
5052 type = 0xdeadbeef;
5053 memset(path, 'a', MAX_PATH);
5054 res = RegQueryValueExA(hkey, "Value5", NULL, &type, (LPBYTE)path, &size);
5055 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5056 ok(!memcmp(path, "one\0two\0three\0", size), "Wrong multi-sz data\n");
5057 ok(size == 15, "Expected 15, got %d\n", size);
5058 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5059
5060 size = MAX_PATH;
5061 type = 0xdeadbeef;
5062 memset(path, 'a', MAX_PATH);
5063 res = RegQueryValueExA(hkey, "Value6", NULL, &type, (LPBYTE)path, &size);
5064 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5065 ok(!memcmp(path, "", size), "Wrong multi-sz data\n");
5066 ok(size == 1, "Expected 1, got %d\n", size);
5067 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5068
5069 size = MAX_PATH;
5070 type = 0xdeadbeef;
5071 memset(path, 'a', MAX_PATH);
5072 res = RegQueryValueExA(hkey, "Value7", NULL, &type, (LPBYTE)path, &size);
5073 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5074 ok(!memcmp(path, "two\0", size), "Wrong multi-sz data\n");
5075 ok(size == 5, "Expected 5, got %d\n", size);
5076 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5077
5078 size = sizeof(buf);
5079 type = 0xdeadbeef;
5080 memset(buf, 0, size);
5081 res = RegQueryValueExA(hkey, "Value8", NULL, &type, buf, &size);
5082 ok(res == ERROR_SUCCESS, "got %u\n", res);
5083 ok(*(DWORD *)buf == 1, "got %u\n", *(DWORD *)buf);
5084 ok(size == 4, "got %u\n", size);
5085 ok(type == REG_DWORD, "got %u\n", type);
5086
5087 size = sizeof(buf);
5088 type = 0xdeadbeef;
5089 memset(buf, 0, size);
5090 res = RegQueryValueExA(hkey, "Value9", NULL, &type, buf, &size);
5091 ok(res == ERROR_SUCCESS, "got %u\n", res);
5092 ok(buf[0] == 1, "got %u\n", buf[0]);
5093 ok(size == 1, "got %u\n", size);
5094 ok(type == REG_BINARY, "got %u\n", type);
5095
5096 size = sizeof(buf);
5097 type = 0xdeadbeef;
5098 memset(buf, 0, size);
5099 res = RegQueryValueExA(hkey, "Value10", NULL, &type, buf, &size);
5100 ok(res == ERROR_SUCCESS, "got %u\n", res);
5101 ok(buf[0] == 1, "got %u\n", buf[0]);
5102 ok(size == 1, "got %u\n", size);
5103 ok(type == REG_BINARY, "got %u\n", type);
5104
5105 size = sizeof(buf);
5106 type = 0xdeadbeef;
5107 memset(buf, 0, size);
5108 res = RegQueryValueExA(hkey, "Value11", NULL, &type, buf, &size);
5109 ok(res == ERROR_SUCCESS, "got %u\n", res);
5110 ok(buf[0] == 1, "got %u\n", buf[0]);
5111 ok(size == 1, "got %u\n", size);
5112 ok(type == REG_BINARY, "got %u\n", type);
5113
5114 RegDeleteValueA(hkey, "Value");
5115 RegDeleteValueA(hkey, "Value1");
5116 RegDeleteValueA(hkey, "Value2");
5117 RegDeleteValueA(hkey, "Value3");
5118 RegDeleteValueA(hkey, "Value4");
5119 RegDeleteValueA(hkey, "Value5");
5120 RegDeleteValueA(hkey, "Value6");
5121 RegDeleteValueA(hkey, "Value7");
5122 RegDeleteValueA(hkey, "Value8");
5123 RegDeleteValueA(hkey, "Value9");
5124 RegDeleteValueA(hkey, "Value10");
5125 RegDeleteValueA(hkey, "Value11");
5126 RegCloseKey(hkey);
5127 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
5128
5129 error:
5130 DeleteFileA(msifile);
5131 DeleteFileA("msitest\\augustus");
5132 RemoveDirectoryA("msitest");
5133 }
5134
5135 static void test_envvar(void)
5136 {
5137 static const char *results[] =
5138 {
5139 "1;2", /* MSITESTVAR11 */
5140 "1", /* MSITESTVAR12 */
5141 "1;2", /* MSITESTVAR13 */
5142 ";1;", /* MSITESTVAR14 */
5143 ";;1;;", /* MSITESTVAR15 */
5144 " 1 ", /* MSITESTVAR16 */
5145 ";;2;;1", /* MSITESTVAR17 */
5146 "1;;2;;", /* MSITESTVAR18 */
5147 "1", /* MSITESTVAR19 */
5148 "1", /* MSITESTVAR20 */
5149 "1", /* MSITESTVAR21 */
5150 NULL
5151 };
5152 UINT r;
5153 HKEY env;
5154 LONG res;
5155 DWORD type, size;
5156 char buffer[16];
5157 UINT i;
5158
5159 if (is_process_limited())
5160 {
5161 skip("process is limited\n");
5162 return;
5163 }
5164
5165 create_test_files();
5166 create_database(msifile, env_tables, sizeof(env_tables) / sizeof(msi_table));
5167
5168 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Environment", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &env, NULL);
5169 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5170
5171 res = RegSetValueExA(env, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"0", 2);
5172 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5173
5174 res = RegSetValueExA(env, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"0", 2);
5175 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5176
5177 res = RegSetValueExA(env, "MSITESTVAR21", 0, REG_SZ, (const BYTE *)"1", 2);
5178 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5179
5180 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5181
5182 r = MsiInstallProductA(msifile, NULL);
5183 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5184 {
5185 skip("Not enough rights to perform tests\n");
5186 goto error;
5187 }
5188 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5189
5190 type = REG_NONE;
5191 size = sizeof(buffer);
5192 buffer[0] = 0;
5193 res = RegQueryValueExA(env, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
5194 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5195 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
5196 ok(!lstrcmpA(buffer, "1"), "Expected \"1\", got %s\n", buffer);
5197
5198 res = RegDeleteValueA(env, "MSITESTVAR1");
5199 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5200
5201 type = REG_NONE;
5202 size = sizeof(buffer);
5203 buffer[0] = 0;
5204 res = RegQueryValueExA(env, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
5205 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5206 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
5207 ok(!lstrcmpA(buffer, "1"), "Expected \"1\", got %s\n", buffer);
5208
5209 res = RegDeleteValueA(env, "MSITESTVAR2");
5210 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5211
5212 res = RegDeleteValueA(env, "MSITESTVAR3");
5213 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5214
5215 res = RegDeleteValueA(env, "MSITESTVAR4");
5216 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5217
5218 res = RegDeleteValueA(env, "MSITESTVAR5");
5219 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5220
5221 res = RegDeleteValueA(env, "MSITESTVAR6");
5222 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5223
5224 res = RegDeleteValueA(env, "MSITESTVAR7");
5225 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5226
5227 res = RegDeleteValueA(env, "MSITESTVAR8");
5228 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5229
5230 res = RegDeleteValueA(env, "MSITESTVAR9");
5231 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5232
5233 res = RegDeleteValueA(env, "MSITESTVAR10");
5234 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5235
5236 i = 11;
5237 while (results[i - 11])
5238 {
5239 char name[20];
5240 sprintf(name, "MSITESTVAR%d", i);
5241
5242 type = REG_NONE;
5243 size = sizeof(buffer);
5244 buffer[0] = 0;
5245 res = RegQueryValueExA(env, name, NULL, &type, (LPBYTE)buffer, &size);
5246 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
5247 ok(type == REG_SZ, "%d: Expected REG_SZ, got %u\n", i, type);
5248 ok(!lstrcmpA(buffer, results[i - 11]), "%d: Expected %s, got %s\n", i, results[i - 11], buffer);
5249
5250 res = RegDeleteValueA(env, name);
5251 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
5252 i++;
5253 }
5254
5255 delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
5256 delete_pf("msitest\\cabout\\new", FALSE);
5257 delete_pf("msitest\\cabout\\four.txt", TRUE);
5258 delete_pf("msitest\\cabout", FALSE);
5259 delete_pf("msitest\\changed\\three.txt", TRUE);
5260 delete_pf("msitest\\changed", FALSE);
5261 delete_pf("msitest\\first\\two.txt", TRUE);
5262 delete_pf("msitest\\first", FALSE);
5263 delete_pf("msitest\\filename", TRUE);
5264 delete_pf("msitest\\one.txt", TRUE);
5265 delete_pf("msitest\\service.exe", TRUE);
5266 delete_pf("msitest\\service2.exe", TRUE);
5267 delete_pf("msitest", FALSE);
5268
5269 error:
5270 RegDeleteValueA(env, "MSITESTVAR1");
5271 RegDeleteValueA(env, "MSITESTVAR2");
5272 RegDeleteValueA(env, "MSITESTVAR21");
5273 RegCloseKey(env);
5274
5275 delete_test_files();
5276 DeleteFileA(msifile);
5277 }
5278
5279 static void test_create_remove_folder(void)
5280 {
5281 UINT r;
5282
5283 if (is_process_limited())
5284 {
5285 skip("process is limited\n");
5286 return;
5287 }
5288
5289 CreateDirectoryA("msitest", NULL);
5290 CreateDirectoryA("msitest\\first", NULL);
5291 CreateDirectoryA("msitest\\second", NULL);
5292 create_file("msitest\\first\\one.txt", 1000);
5293 create_file("msitest\\second\\two.txt", 1000);
5294 create_database(msifile, cf_tables, sizeof(cf_tables) / sizeof(msi_table));
5295
5296 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5297
5298 r = MsiInstallProductA(msifile, NULL);
5299 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5300 {
5301 skip("Not enough rights to perform tests\n");
5302 goto error;
5303 }
5304 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5305
5306 ok(pf_exists("msitest\\first\\one.txt"), "file not installed\n");
5307 ok(pf_exists("msitest\\first"), "directory not created\n");
5308 ok(pf_exists("msitest\\second\\two.txt"), "file not installed\n");
5309 ok(pf_exists("msitest\\second"), "directory not created\n");
5310 ok(pf_exists("msitest\\third"), "directory not created\n");
5311 ok(pf_exists("msitest"), "directory not created\n");
5312
5313 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5314 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5315
5316 ok(!pf_exists("msitest\\first\\one.txt"), "file not removed\n");
5317 ok(!pf_exists("msitest\\first"), "directory not removed\n");
5318 ok(!pf_exists("msitest\\second\\two.txt"), "file not removed\n");
5319 ok(!pf_exists("msitest\\second"), "directory not removed\n");
5320 ok(!pf_exists("msitest\\third"), "directory not removed\n");
5321 todo_wine ok(!pf_exists("msitest"), "directory not removed\n");
5322
5323 error:
5324 DeleteFileA("msitest\\first\\one.txt");
5325 DeleteFileA("msitest\\second\\two.txt");
5326 RemoveDirectoryA("msitest\\first");
5327 RemoveDirectoryA("msitest\\second");
5328 RemoveDirectoryA("msitest");
5329 DeleteFileA(msifile);
5330 }
5331
5332 static void test_start_stop_services(void)
5333 {
5334 UINT r;
5335 SC_HANDLE scm, service;
5336 BOOL ret;
5337 DWORD error = ERROR_SUCCESS;
5338
5339 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5340 if (!scm && GetLastError() == ERROR_ACCESS_DENIED)
5341 {
5342 skip("Not enough rights to perform tests\n");
5343 return;
5344 }
5345 ok(scm != NULL, "Failed to open the SC Manager\n");
5346 if (!scm) return;
5347
5348 service = OpenServiceA(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
5349 if (!service && GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST)
5350 {
5351 win_skip("The 'Spooler' service does not exist\n");
5352 CloseServiceHandle(scm);
5353 return;
5354 }
5355 ok(service != NULL, "Failed to open Spooler, error %d\n", GetLastError());
5356 if (!service) {
5357 CloseServiceHandle(scm);
5358 return;
5359 }
5360
5361 ret = StartServiceA(service, 0, NULL);
5362 if (!ret && (error = GetLastError()) != ERROR_SERVICE_ALREADY_RUNNING)
5363 {
5364 skip("Spooler service not available, skipping test\n");
5365 CloseServiceHandle(service);
5366 CloseServiceHandle(scm);
5367 return;
5368 }
5369
5370 CloseServiceHandle(service);
5371 CloseServiceHandle(scm);
5372
5373 create_test_files();
5374 create_database(msifile, sss_tables, sizeof(sss_tables) / sizeof(msi_table));
5375
5376 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5377
5378 r = MsiInstallProductA(msifile, NULL);
5379 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5380
5381 if (error == ERROR_SUCCESS)
5382 {
5383 SERVICE_STATUS status;
5384
5385 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5386 service = OpenServiceA(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
5387
5388 ret = ControlService(service, SERVICE_CONTROL_STOP, &status);
5389 ok(ret, "ControlService failed %u\n", GetLastError());
5390
5391 CloseServiceHandle(service);
5392 CloseServiceHandle(scm);
5393 }
5394
5395 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5396 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5397
5398 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5399 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5400 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5401 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5402 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5403 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5404 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5405 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5406 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5407 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5408 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5409 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5410 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5411
5412 if (error == ERROR_SUCCESS)
5413 {
5414 SERVICE_STATUS status;
5415
5416 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5417 service = OpenServiceA(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
5418
5419 ret = ControlService(service, SERVICE_CONTROL_STOP, &status);
5420 ok(ret, "ControlService failed %u\n", GetLastError());
5421
5422 CloseServiceHandle(service);
5423 CloseServiceHandle(scm);
5424 }
5425
5426 delete_test_files();
5427 DeleteFileA(msifile);
5428 }
5429
5430 static void delete_TestService(void)
5431 {
5432 BOOL ret;
5433 SC_HANDLE manager, service;
5434
5435 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5436 ok(manager != NULL, "can't open service manager\n");
5437 if (!manager)
5438 return;
5439
5440 service = OpenServiceA(manager, "TestService", GENERIC_ALL);
5441 ok(service != NULL, "TestService doesn't exist\n");
5442
5443 if (service)
5444 {
5445 ret = DeleteService( service );
5446 ok( ret, "failed to delete service %u\n", GetLastError() );
5447
5448 CloseServiceHandle(service);
5449 }
5450 CloseServiceHandle(manager);
5451
5452 }
5453
5454 static void test_delete_services(void)
5455 {
5456 UINT r;
5457 SC_HANDLE manager, service;
5458 DWORD error;
5459
5460 if (is_process_limited())
5461 {
5462 skip("process is limited\n");
5463 return;
5464 }
5465
5466 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5467 ok(manager != NULL, "can't open service manager %u\n", GetLastError());
5468 if (!manager) return;
5469
5470 service = CreateServiceA(manager, "TestService3", "TestService3",
5471 SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_DEMAND_START,
5472 SERVICE_ERROR_NORMAL, "C:\\doesnt_exist.exe", NULL, NULL, NULL, NULL, NULL);
5473 ok(service != NULL, "can't create service %u\n", GetLastError());
5474 CloseServiceHandle(service);
5475 CloseServiceHandle(manager);
5476 if (!service) goto error;
5477
5478 create_test_files();
5479 create_database(msifile, sds_tables, sizeof(sds_tables) / sizeof(msi_table));
5480
5481 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5482
5483 r = MsiInstallProductA(msifile, NULL);
5484 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5485 {
5486 skip("Not enough rights to perform tests\n");
5487 goto error;
5488 }
5489 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5490
5491 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5492 ok(manager != NULL, "can't open service manager\n");
5493 if (!manager) goto error;
5494
5495 service = OpenServiceA(manager, "TestService3", GENERIC_ALL);
5496 error = GetLastError();
5497 ok(service == NULL, "TestService3 not deleted\n");
5498 ok(error == ERROR_SERVICE_DOES_NOT_EXIST, "wrong error %u\n", error);
5499 CloseServiceHandle(manager);
5500
5501 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5502 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5503
5504 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5505 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5506 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5507 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5508 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5509 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5510 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5511 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5512 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5513 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5514 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5515 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5516 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5517
5518 error:
5519 delete_TestService();
5520 delete_test_files();
5521 DeleteFileA(msifile);
5522 }
5523
5524 static void test_install_services(void)
5525 {
5526 UINT r;
5527 SC_HANDLE manager, service;
5528 LONG res;
5529 HKEY hKey;
5530 DWORD err_control, err_controlsize, err_controltype;
5531
5532 if (is_process_limited())
5533 {
5534 skip("process is limited\n");
5535 return;
5536 }
5537
5538 create_test_files();
5539 create_database(msifile, sis_tables, sizeof(sis_tables) / sizeof(msi_table));
5540
5541 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5542
5543 r = MsiInstallProductA(msifile, NULL);
5544 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5545 {
5546 skip("Not enough rights to perform tests\n");
5547 goto error;
5548 }
5549 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5550
5551 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5552 ok(manager != NULL, "can't open service manager\n");
5553 if (!manager) goto error;
5554
5555 service = OpenServiceA(manager, "TestService", GENERIC_ALL);
5556 ok(service != NULL, "TestService not installed\n");
5557 CloseServiceHandle(service);
5558
5559 service = OpenServiceA(manager, "TestService4", GENERIC_ALL);
5560 ok(service == NULL, "TestService4 installed\n");
5561 CloseServiceHandle(manager);
5562
5563 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Services\\TestService", &hKey);
5564 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5565
5566 if (res == ERROR_SUCCESS)
5567 {
5568 err_control = 0xBEEF;
5569 err_controltype = REG_DWORD;
5570 err_controlsize = sizeof(err_control);
5571 res = RegQueryValueExA(hKey, "ErrorControl", NULL, &err_controltype, (LPBYTE)&err_control, &err_controlsize);
5572 ok(err_control == 0, "TestService.ErrorControl wrong, expected 0, got %u\n", err_control);
5573 RegCloseKey(hKey);
5574 }
5575
5576 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5577 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5578
5579 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5580 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5581 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5582 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5583 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5584 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5585 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5586 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5587 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5588 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5589 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5590 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5591 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5592
5593 error:
5594 delete_TestService();
5595 delete_test_files();
5596 DeleteFileA(msifile);
5597 }
5598
5599 static void test_self_registration(void)
5600 {
5601 UINT r;
5602
5603 if (is_process_limited())
5604 {
5605 skip("process is limited\n");
5606 return;
5607 }
5608
5609 create_test_files();
5610 create_database(msifile, sr_tables, sizeof(sr_tables) / sizeof(msi_table));
5611
5612 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5613
5614 r = MsiInstallProductA(msifile, NULL);
5615 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5616 {
5617 skip("Not enough rights to perform tests\n");
5618 goto error;
5619 }
5620 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5621
5622 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5623 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5624 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5625 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5626 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5627 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5628 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5629 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5630 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5631 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5632 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5633 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5634 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5635
5636 error:
5637 delete_test_files();
5638 DeleteFileA(msifile);
5639 }
5640
5641 static void test_register_font(void)
5642 {
5643 static const char regfont1[] = "Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
5644 static const char regfont2[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Fonts";
5645 LONG ret;
5646 HKEY key;
5647 UINT r;
5648 REGSAM access = KEY_ALL_ACCESS;
5649
5650 if (is_process_limited())
5651 {
5652 skip("process is limited\n");
5653 return;
5654 }
5655
5656 create_test_files();
5657 create_file("msitest\\font.ttf", 1000);
5658 create_database(msifile, font_tables, sizeof(font_tables) / sizeof(msi_table));
5659
5660 if (is_wow64)
5661 access |= KEY_WOW64_64KEY;
5662
5663 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5664
5665 r = MsiInstallProductA(msifile, NULL);
5666 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5667 {
5668 skip("Not enough rights to perform tests\n");
5669 goto error;
5670 }
5671 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5672
5673 ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, regfont1, 0, access, &key);
5674 if (ret)
5675 RegOpenKeyExA(HKEY_LOCAL_MACHINE, regfont2, 0, access, &key);
5676
5677 ret = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
5678 ok(ret != ERROR_FILE_NOT_FOUND, "unexpected result %d\n", ret);
5679
5680 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5681 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5682
5683 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5684
5685 ret = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
5686 ok(ret == ERROR_FILE_NOT_FOUND, "unexpected result %d\n", ret);
5687
5688 RegDeleteValueA(key, "msi test font");
5689 RegCloseKey(key);
5690
5691 error:
5692 DeleteFileA("msitest\\font.ttf");
5693 delete_test_files();
5694 DeleteFileA(msifile);
5695 }
5696
5697 static void test_validate_product_id(void)
5698 {
5699 UINT r;
5700
5701 if (is_process_limited())
5702 {
5703 skip("process is limited\n");
5704 return;
5705 }
5706
5707 create_test_files();
5708 create_database(msifile, vp_tables, sizeof(vp_tables) / sizeof(msi_table));
5709
5710 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5711
5712 r = MsiInstallProductA(msifile, NULL);
5713 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5714 {
5715 skip("Not enough rights to perform tests\n");
5716 goto error;
5717 }
5718 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5719
5720 r = MsiInstallProductA(msifile, "SET_PRODUCT_ID=1");
5721 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5722
5723 r = MsiInstallProductA(msifile, "SET_PRODUCT_ID=2");
5724 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5725
5726 r = MsiInstallProductA(msifile, "PIDKEY=123-1234567");
5727 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5728
5729 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5730 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5731 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5732 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5733 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5734 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5735 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5736 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5737 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5738 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5739 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5740 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5741 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5742
5743 error:
5744 delete_test_files();
5745 DeleteFileA(msifile);
5746 }
5747
5748 static void test_install_remove_odbc(void)
5749 {
5750 UINT r;
5751
5752 if (is_process_limited())
5753 {
5754 skip("process is limited\n");
5755 return;
5756 }
5757
5758 create_test_files();
5759 create_file("msitest\\ODBCdriver.dll", 1000);
5760 create_file("msitest\\ODBCdriver2.dll", 1000);
5761 create_file("msitest\\ODBCtranslator.dll", 1000);
5762 create_file("msitest\\ODBCtranslator2.dll", 1000);
5763 create_file("msitest\\ODBCsetup.dll", 1000);
5764 create_database(msifile, odbc_tables, sizeof(odbc_tables) / sizeof(msi_table));
5765
5766 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5767
5768 r = MsiInstallProductA(msifile, NULL);
5769 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5770 {
5771 skip("Not enough rights to perform tests\n");
5772 goto error;
5773 }
5774 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5775
5776 ok(pf_exists("msitest\\ODBCdriver.dll"), "file not created\n");
5777 ok(pf_exists("msitest\\ODBCdriver2.dll"), "file not created\n");
5778 ok(pf_exists("msitest\\ODBCtranslator.dll"), "file not created\n");
5779 ok(pf_exists("msitest\\ODBCtranslator2.dll"), "file not created\n");
5780 ok(pf_exists("msitest\\ODBCsetup.dll"), "file not created\n");
5781
5782 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5783 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5784
5785 ok(!delete_pf("msitest\\ODBCdriver.dll", TRUE), "file not removed\n");
5786 ok(!delete_pf("msitest\\ODBCdriver2.dll", TRUE), "file not removed\n");
5787 ok(!delete_pf("msitest\\ODBCtranslator.dll", TRUE), "file not removed\n");
5788 ok(!delete_pf("msitest\\ODBCtranslator2.dll", TRUE), "file not removed\n");
5789 ok(!delete_pf("msitest\\ODBCsetup.dll", TRUE), "file not removed\n");
5790 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5791
5792 error:
5793 DeleteFileA("msitest\\ODBCdriver.dll");
5794 DeleteFileA("msitest\\ODBCdriver2.dll");
5795 DeleteFileA("msitest\\ODBCtranslator.dll");
5796 DeleteFileA("msitest\\ODBCtranslator2.dll");
5797 DeleteFileA("msitest\\ODBCsetup.dll");
5798 delete_test_files();
5799 DeleteFileA(msifile);
5800 }
5801
5802 static void test_register_typelib(void)
5803 {
5804 UINT r;
5805
5806 if (is_process_limited())
5807 {
5808 skip("process is limited\n");
5809 return;
5810 }
5811
5812 create_test_files();
5813 create_file("msitest\\typelib.dll", 1000);
5814 create_database(msifile, tl_tables, sizeof(tl_tables) / sizeof(msi_table));
5815
5816 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5817
5818 r = MsiInstallProductA(msifile, "REGISTER_TYPELIB=1");
5819 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5820 {
5821 skip("Not enough rights to perform tests\n");
5822 goto error;
5823 }
5824 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5825
5826 r = MsiInstallProductA(msifile, NULL);
5827 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5828
5829 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5830 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5831
5832 ok(!delete_pf("msitest\\typelib.dll", TRUE), "file not removed\n");
5833 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5834
5835 error:
5836 DeleteFileA("msitest\\typelib.dll");
5837 delete_test_files();
5838 DeleteFileA(msifile);
5839 }
5840
5841 static void test_create_remove_shortcut(void)
5842 {
5843 UINT r;
5844
5845 if (is_process_limited())
5846 {
5847 skip("process is limited\n");
5848 return;
5849 }
5850
5851 create_test_files();
5852 create_file("msitest\\target.txt", 1000);
5853 create_database(msifile, crs_tables, sizeof(crs_tables) / sizeof(msi_table));
5854
5855 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5856
5857 r = MsiInstallProductA(msifile, NULL);
5858 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5859 {
5860 skip("Not enough rights to perform tests\n");
5861 goto error;
5862 }
5863 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5864
5865 ok(pf_exists("msitest\\target.txt"), "file not created\n");
5866 ok(pf_exists("msitest\\shortcut.lnk"), "file not created\n");
5867
5868 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5869 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5870
5871 ok(!delete_pf("msitest\\shortcut.lnk", TRUE), "file not removed\n");
5872 ok(!delete_pf("msitest\\target.txt", TRUE), "file not removed\n");
5873 todo_wine ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5874
5875 error:
5876 DeleteFileA("msitest\\target.txt");
5877 delete_test_files();
5878 DeleteFileA(msifile);
5879 }
5880
5881 static void test_publish_components(void)
5882 {
5883 static const char keypath[] =
5884 "Software\\Microsoft\\Installer\\Components\\0CBCFA296AC907244845745CEEB2F8AA";
5885 static const char keypath2[] =
5886 "Software\\Classes\\Installer\\Components\\0CBCFA296AC907244845745CEEB2F8AA";
5887
5888 UINT r;
5889 LONG res;
5890 HKEY key;
5891 BYTE *data;
5892 DWORD size;
5893
5894 if (is_process_limited())
5895 {
5896 skip("process is limited\n");
5897 return;
5898 }
5899
5900 create_test_files();
5901 create_file("msitest\\english.txt", 1000);
5902 create_database(msifile, pub_tables, sizeof(pub_tables) / sizeof(msi_table));
5903
5904 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5905
5906 r = MsiInstallProductA(msifile, NULL);
5907 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5908 {
5909 skip("Not enough rights to perform tests\n");
5910 goto error;
5911 }
5912 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5913
5914 size = 0;
5915 r = MsiProvideQualifiedComponentA("{92AFCBC0-9CA6-4270-8454-47C5EE2B8FAA}",
5916 "english.txt", INSTALLMODE_DEFAULT, NULL, &size);
5917 ok(r == ERROR_SUCCESS, "MsiProvideQualifiedComponent returned %d\n", r);
5918
5919 res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
5920 ok(res == ERROR_SUCCESS, "components key not created %d\n", res);
5921
5922 res = RegQueryValueExA(key, "english.txt", NULL, NULL, NULL, &size);
5923 ok(res == ERROR_SUCCESS, "value not found %d\n", res);
5924
5925 data = HeapAlloc(GetProcessHeap(), 0, size);
5926 res = RegQueryValueExA(key, "english.txt", NULL, NULL, data, &size);
5927 ok(res == ERROR_SUCCESS, "value not found %d\n", res);
5928 RegCloseKey(key);
5929
5930 res = RegDeleteKeyA(HKEY_CURRENT_USER, keypath);
5931 ok(res == ERROR_SUCCESS, "RegDeleteKey failed %d\n", res);
5932
5933 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath2, 0, NULL, REG_OPTION_NON_VOLATILE,
5934 MAXIMUM_ALLOWED | KEY_WOW64_64KEY, NULL, &key, NULL );
5935 ok(res == ERROR_SUCCESS, "RegCreateKeyEx failed %d\n", res);
5936 res = RegSetValueExA(key, "english.txt", 0, REG_MULTI_SZ, data, size);
5937 ok(res == ERROR_SUCCESS, "RegSetValueEx failed %d\n", res);
5938 RegCloseKey(key);
5939
5940 size = 0;
5941 r = MsiProvideQualifiedComponentA("{92AFCBC0-9CA6-4270-8454-47C5EE2B8FAA}",
5942 "english.txt", INSTALLMODE_DEFAULT, NULL, &size);
5943 ok(r == ERROR_SUCCESS, "MsiProvideQualifiedComponent returned %d\n", r);
5944
5945 if (pRegDeleteKeyExA)
5946 res = pRegDeleteKeyExA(HKEY_LOCAL_MACHINE, keypath2, KEY_WOW64_64KEY, 0);
5947 else
5948 res = RegDeleteKeyA(HKEY_LOCAL_MACHINE, keypath2);
5949 ok(res == ERROR_SUCCESS, "RegDeleteKey failed %d\n", res);
5950
5951 res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &key);
5952 ok(res == ERROR_SUCCESS, "RegCreateKey failed %d\n", res);
5953
5954 res = RegSetValueExA(key, "english.txt", 0, REG_MULTI_SZ, data, size);
5955 ok(res == ERROR_SUCCESS, "RegSetValueEx failed %d\n", res);
5956 HeapFree(GetProcessHeap(), 0, data);
5957 RegCloseKey(key);
5958
5959 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5960 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5961
5962 res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
5963 ok(res == ERROR_FILE_NOT_FOUND, "unexpected result %d\n", res);
5964
5965 ok(!delete_pf("msitest\\english.txt", TRUE), "file not removed\n");
5966 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5967
5968 error:
5969 DeleteFileA("msitest\\english.txt");
5970 delete_test_files();
5971 DeleteFileA(msifile);
5972 }
5973
5974 static void test_remove_duplicate_files(void)
5975 {
5976 UINT r;
5977
5978 if (is_process_limited())
5979 {
5980 skip("process is limited\n");
5981 return;
5982 }
5983
5984 create_test_files();
5985 create_file("msitest\\original.txt", 1000);
5986 create_file("msitest\\original2.txt", 1000);
5987 create_file("msitest\\original3.txt", 1000);
5988 create_database(msifile, rd_tables, sizeof(rd_tables) / sizeof(msi_table));
5989
5990 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5991
5992 r = MsiInstallProductA(msifile, NULL);
5993 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5994 {
5995 skip("Not enough rights to perform tests\n");
5996 goto error;
5997 }
5998 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5999
6000 ok(pf_exists("msitest\\original.txt"), "file not created\n");
6001 ok(pf_exists("msitest\\original2.txt"), "file not created\n");
6002 ok(!pf_exists("msitest\\original3.txt"), "file created\n");
6003 ok(pf_exists("msitest\\duplicate.txt"), "file not created\n");
6004 ok(!pf_exists("msitest\\duplicate2.txt"), "file created\n");
6005
6006 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6007 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6008
6009 ok(delete_pf("msitest\\original.txt", TRUE), "file removed\n");
6010 ok(!delete_pf("msitest\\original2.txt", TRUE), "file not removed\n");
6011 ok(!delete_pf("msitest\\original3.txt", TRUE), "file not removed\n");
6012 ok(!delete_pf("msitest\\duplicate.txt", TRUE), "file not removed\n");
6013 ok(!delete_pf("msitest\\duplicate2.txt", TRUE), "file not removed\n");
6014 ok(delete_pf("msitest", FALSE), "directory removed\n");
6015
6016 error:
6017 DeleteFileA("msitest\\original.txt");
6018 DeleteFileA("msitest\\original2.txt");
6019 DeleteFileA("msitest\\original3.txt");
6020 delete_test_files();
6021 DeleteFileA(msifile);
6022 }
6023
6024 static void test_remove_registry_values(void)
6025 {
6026 UINT r;
6027 LONG res;
6028 HKEY key;
6029 REGSAM access = KEY_ALL_ACCESS;
6030
6031 if (is_process_limited())
6032 {
6033 skip("process is limited\n");
6034 return;
6035 }
6036
6037 create_test_files();
6038 create_file("msitest\\registry.txt", 1000);
6039 create_database(msifile, rrv_tables, sizeof(rrv_tables) / sizeof(msi_table));
6040
6041 if (is_wow64)
6042 access |= KEY_WOW64_64KEY;
6043
6044 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6045
6046 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, NULL, 0, access, NULL, &key, NULL);
6047 RegSetValueExA(key, "value1", 0, REG_SZ, (const BYTE *)"1", 2);
6048 RegCloseKey(key);
6049
6050 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, NULL, 0, access, NULL, &key, NULL);
6051 RegSetValueExA(key, "value2", 0, REG_SZ, (const BYTE *)"2", 2);
6052 RegCloseKey(key);
6053
6054 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", 0, NULL, 0, access, NULL, &key, NULL);
6055 RegSetValueExA(key, "", 0, REG_SZ, (const BYTE *)"default", 8);
6056 RegSetValueExA(key, "valueA", 0, REG_SZ, (const BYTE *)"A", 2);
6057 RegSetValueExA(key, "valueB", 0, REG_SZ, (const BYTE *)"B", 2);
6058 RegCloseKey(key);
6059
6060 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", 0, NULL, 0, access, NULL, &key, NULL);
6061 RegSetValueExA(key, "", 0, REG_SZ, (const BYTE *)"default", 8);
6062 RegSetValueExA(key, "valueB", 0, REG_SZ, (const BYTE *)"B", 2);
6063 RegCloseKey(key);
6064
6065 r = MsiInstallProductA(msifile, NULL);
6066 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6067 {
6068 skip("Not enough rights to perform tests\n");
6069 goto error;
6070 }
6071 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6072
6073 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, access, &key);
6074 ok(res == ERROR_SUCCESS, "key removed\n");
6075 RegCloseKey(key);
6076
6077 if (is_64bit)
6078 {
6079 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\key2", 0, KEY_ALL_ACCESS, &key);
6080 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6081 }
6082 else
6083 {
6084 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, KEY_ALL_ACCESS, &key);
6085 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6086 }
6087
6088 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, NULL, 0, access, NULL, &key, NULL);
6089 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6090 RegCloseKey(key);
6091
6092 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6093 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6094
6095 if (is_64bit)
6096 {
6097 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\key1", 0, KEY_ALL_ACCESS, &key);
6098 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6099 }
6100 else
6101 {
6102 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, KEY_ALL_ACCESS, &key);
6103 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6104 }
6105
6106 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, access, &key);
6107 ok(res == ERROR_SUCCESS, "key removed\n");
6108 RegCloseKey(key);
6109
6110 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", 0, access, &key);
6111 ok(res == ERROR_SUCCESS, "key removed\n");
6112 RegCloseKey(key);
6113
6114 if (is_64bit)
6115 {
6116 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\keyB", 0, KEY_ALL_ACCESS, &key);
6117 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6118 }
6119 else
6120 {
6121 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", 0, KEY_ALL_ACCESS, &key);
6122 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6123 }
6124
6125 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", access);
6126 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", access);
6127 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine", access);
6128
6129 ok(!delete_pf("msitest\\registry.txt", TRUE), "file not removed\n");
6130 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6131
6132 error:
6133 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", access);
6134 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", access);
6135 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", access);
6136 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", access);
6137
6138 DeleteFileA("msitest\\registry.txt");
6139 delete_test_files();
6140 DeleteFileA(msifile);
6141 }
6142
6143 static void test_find_related_products(void)
6144 {
6145 UINT r;
6146
6147 if (is_process_limited())
6148 {
6149 skip("process is limited\n");
6150 return;
6151 }
6152
6153 create_test_files();
6154 create_file("msitest\\product.txt", 1000);
6155 create_database(msifile, frp_tables, sizeof(frp_tables) / sizeof(msi_table));
6156
6157 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6158
6159 r = MsiInstallProductA(msifile, NULL);
6160 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6161 {
6162 skip("Not enough rights to perform tests\n");
6163 goto error;
6164 }
6165 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6166
6167 /* install again, so it finds the upgrade code */
6168 r = MsiInstallProductA(msifile, NULL);
6169 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6170
6171 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6172 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6173
6174 ok(!delete_pf("msitest\\product.txt", TRUE), "file not removed\n");
6175 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6176
6177 error:
6178 DeleteFileA("msitest\\product.txt");
6179 delete_test_files();
6180 DeleteFileA(msifile);
6181 }
6182
6183 static void test_remove_ini_values(void)
6184 {
6185 UINT r;
6186 DWORD len;
6187 char inifile[MAX_PATH], buf[0x10];
6188 HANDLE file;
6189 BOOL ret;
6190
6191 if (is_process_limited())
6192 {
6193 skip("process is limited\n");
6194 return;
6195 }
6196
6197 create_test_files();
6198 create_file("msitest\\inifile.txt", 1000);
6199 create_database(msifile, riv_tables, sizeof(riv_tables) / sizeof(msi_table));
6200
6201 lstrcpyA(inifile, PROG_FILES_DIR);
6202 lstrcatA(inifile, "\\msitest");
6203 ret = CreateDirectoryA(inifile, NULL);
6204 if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
6205 {
6206 skip("Not enough rights to perform tests\n");
6207 goto error;
6208 }
6209 lstrcatA(inifile, "\\test.ini");
6210 file = CreateFileA(inifile, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS, 0, NULL);
6211 CloseHandle(file);
6212
6213 ret = WritePrivateProfileStringA("section1", "key1", "value1", inifile);
6214 ok(ret, "failed to write profile string %u\n", GetLastError());
6215
6216 ret = WritePrivateProfileStringA("sectionA", "keyA", "valueA", inifile);
6217 ok(ret, "failed to write profile string %u\n", GetLastError());
6218
6219 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6220
6221 r = MsiInstallProductA(msifile, NULL);
6222 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6223
6224 len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), inifile);
6225 ok(len == 6, "got %u expected 6\n", len);
6226
6227 len = GetPrivateProfileStringA("sectionA", "keyA", NULL, buf, sizeof(buf), inifile);
6228 ok(!len, "got %u expected 0\n", len);
6229
6230 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6231 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6232
6233 len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), inifile);
6234 ok(!len, "got %u expected 0\n", len);
6235
6236 len = GetPrivateProfileStringA("sectionA", "keyA", NULL, buf, sizeof(buf), inifile);
6237 ok(!len, "got %u expected 0\n", len);
6238
6239 todo_wine ok(!delete_pf("msitest\\test.ini", TRUE), "file removed\n");
6240 ok(!delete_pf("msitest\\inifile.txt", TRUE), "file not removed\n");
6241 ok(delete_pf("msitest", FALSE), "directory removed\n");
6242
6243 error:
6244 DeleteFileA("msitest\\inifile.txt");
6245 delete_test_files();
6246 DeleteFileA(msifile);
6247 }
6248
6249 static void test_remove_env_strings(void)
6250 {
6251 UINT r;
6252 LONG res;
6253 HKEY key;
6254 DWORD type, size;
6255 char buffer[0x10];
6256
6257 if (is_process_limited())
6258 {
6259 skip("process is limited\n");
6260 return;
6261 }
6262
6263 create_test_files();
6264 create_file("msitest\\envvar.txt", 1000);
6265 create_database(msifile, res_tables, sizeof(res_tables) / sizeof(msi_table));
6266
6267 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6268
6269 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
6270 ok(!res, "failed to open environment key %d\n", res);
6271
6272 RegSetValueExA(key, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"1", 2);
6273 RegSetValueExA(key, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"1", 2);
6274 RegSetValueExA(key, "MSITESTVAR3", 0, REG_SZ, (const BYTE *)"1", 2);
6275 RegSetValueExA(key, "MSITESTVAR4", 0, REG_SZ, (const BYTE *)"1", 2);
6276 RegSetValueExA(key, "MSITESTVAR5", 0, REG_SZ, (const BYTE *)"1", 2);
6277 RegSetValueExA(key, "MSITESTVAR6", 0, REG_SZ, (const BYTE *)"1;2", 4);
6278 RegSetValueExA(key, "MSITESTVAR7", 0, REG_SZ, (const BYTE *)"1;2", 4);
6279 RegSetValueExA(key, "MSITESTVAR8", 0, REG_SZ, (const BYTE *)"2;1;0", 6);
6280 RegSetValueExA(key, "MSITESTVAR9", 0, REG_SZ, (const BYTE *)"0;1;2", 6);
6281 RegSetValueExA(key, "MSITESTVAR10", 0, REG_SZ, (const BYTE *)"1", 2);
6282 RegSetValueExA(key, "MSITESTVAR11", 0, REG_SZ, (const BYTE *)"1", 2);
6283
6284 RegCloseKey(key);
6285
6286 r = MsiInstallProductA(msifile, NULL);
6287 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6288 {
6289 skip("Not enough rights to perform tests\n");
6290 goto error;
6291 }
6292 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6293
6294 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
6295 ok(!res, "failed to open environment key %d\n", res);
6296
6297 type = REG_NONE;
6298 buffer[0] = 0;
6299 size = sizeof(buffer);
6300 res = RegQueryValueExA(key, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
6301 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6302 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6303 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6304
6305 type = REG_NONE;
6306 buffer[0] = 0;
6307 size = sizeof(buffer);
6308 res = RegQueryValueExA(key, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
6309 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6310 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6311 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6312
6313 type = REG_NONE;
6314 buffer[0] = 0;
6315 size = sizeof(buffer);
6316 res = RegQueryValueExA(key, "MSITESTVAR3", NULL, &type, (LPBYTE)buffer, &size);
6317 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6318 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6319 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6320
6321 type = REG_NONE;
6322 buffer[0] = 0;
6323 size = sizeof(buffer);
6324 res = RegQueryValueExA(key, "MSITESTVAR4", NULL, &type, (LPBYTE)buffer, &size);
6325 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6326 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6327 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6328
6329 type = REG_NONE;
6330 buffer[0] = 0;
6331 size = sizeof(buffer);
6332 res = RegQueryValueExA(key, "MSITESTVAR5", NULL, &type, (LPBYTE)buffer, &size);
6333 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6334 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6335 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6336
6337 RegCloseKey(key);
6338
6339 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6340 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6341
6342 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
6343 ok(!res, "failed to open environment key %d\n", res);
6344
6345 res = RegQueryValueExA(key, "MSITESTVAR1", NULL, NULL, NULL, NULL);
6346 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6347
6348 res = RegQueryValueExA(key, "MSITESTVAR2", NULL, NULL, NULL, NULL);
6349 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6350
6351 type = REG_NONE;
6352 buffer[0] = 0;
6353 size = sizeof(buffer);
6354 res = RegQueryValueExA(key, "MSITESTVAR3", NULL, &type, (LPBYTE)buffer, &size);
6355 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6356 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6357 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6358 RegDeleteValueA(key, "MSITESTVAR3");
6359
6360 res = RegQueryValueExA(key, "MSITESTVAR4", NULL, NULL, NULL, NULL);
6361 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6362
6363 type = REG_NONE;
6364 buffer[0] = 0;
6365 size = sizeof(buffer);
6366 res = RegQueryValueExA(key, "MSITESTVAR5", NULL, &type, (LPBYTE)buffer, &size);
6367 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6368 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6369 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6370 RegDeleteValueA(key, "MSITESTVAR5");
6371
6372 type = REG_NONE;
6373 buffer[0] = 0;
6374 size = sizeof(buffer);
6375 res = RegQueryValueExA(key, "MSITESTVAR6", NULL, &type, (LPBYTE)buffer, &size);
6376 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6377 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6378 ok(!lstrcmpA(buffer, "2"), "expected \"2\", got \"%s\"\n", buffer);
6379 RegDeleteValueA(key, "MSITESTVAR6");
6380
6381 type = REG_NONE;
6382 buffer[0] = 0;
6383 size = sizeof(buffer);
6384 res = RegQueryValueExA(key, "MSITESTVAR7", NULL, &type, (LPBYTE)buffer, &size);
6385 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6386 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6387 ok(!lstrcmpA(buffer, "2"), "expected \"2\", got \"%s\"\n", buffer);
6388 RegDeleteValueA(key, "MSITESTVAR7");
6389
6390 type = REG_NONE;
6391 buffer[0] = 0;
6392 size = sizeof(buffer);
6393 res = RegQueryValueExA(key, "MSITESTVAR8", NULL, &type, (LPBYTE)buffer, &size);
6394 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6395 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6396 ok(!lstrcmpA(buffer, "2;0"), "expected \"2;0\", got \"%s\"\n", buffer);
6397 RegDeleteValueA(key, "MSITESTVAR8");
6398
6399 type = REG_NONE;
6400 buffer[0] = 0;
6401 size = sizeof(buffer);
6402 res = RegQueryValueExA(key, "MSITESTVAR9", NULL, &type, (LPBYTE)buffer, &size);
6403 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6404 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6405 ok(!lstrcmpA(buffer, "0;2"), "expected \"0;2\", got \"%s\"\n", buffer);
6406 RegDeleteValueA(key, "MSITESTVAR9");
6407
6408 type = REG_NONE;
6409 buffer[0] = 0;
6410 size = sizeof(buffer);
6411 res = RegQueryValueExA(key, "MSITESTVAR10", NULL, &type, (LPBYTE)buffer, &size);
6412 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6413
6414 type = REG_NONE;
6415 buffer[0] = 0;
6416 size = sizeof(buffer);
6417 res = RegQueryValueExA(key, "MSITESTVAR11", NULL, &type, (LPBYTE)buffer, &size);
6418 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6419 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6420 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6421 RegDeleteValueA(key, "MSITESTVAR11");
6422
6423 ok(!delete_pf("msitest\\envvar.txt", TRUE), "file not removed\n");
6424 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6425
6426 error:
6427 RegDeleteValueA(key, "MSITESTVAR1");
6428 RegDeleteValueA(key, "MSITESTVAR2");
6429 RegDeleteValueA(key, "MSITESTVAR3");
6430 RegDeleteValueA(key, "MSITESTVAR4");
6431 RegDeleteValueA(key, "MSITESTVAR5");
6432 RegDeleteValueA(key, "MSITESTVAR6");
6433 RegDeleteValueA(key, "MSITESTVAR7");
6434 RegDeleteValueA(key, "MSITESTVAR8");
6435 RegDeleteValueA(key, "MSITESTVAR9");
6436 RegDeleteValueA(key, "MSITESTVAR10");
6437 RegDeleteValueA(key, "MSITESTVAR11");
6438 RegCloseKey(key);
6439
6440 DeleteFileA("msitest\\envvar.txt");
6441 delete_test_files();
6442 DeleteFileA(msifile);
6443 }
6444
6445 static void test_register_class_info(void)
6446 {
6447 UINT r;
6448 LONG res;
6449 HKEY hkey;
6450
6451 if (is_process_limited())
6452 {
6453 skip("process is limited\n");
6454 return;
6455 }
6456
6457 create_test_files();
6458 create_file("msitest\\class.txt", 1000);
6459 create_database(msifile, rci_tables, sizeof(rci_tables) / sizeof(msi_table));
6460
6461 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6462
6463 r = MsiInstallProductA(msifile, NULL);
6464 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6465 {
6466 skip("Not enough rights to perform tests\n");
6467 goto error;
6468 }
6469 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6470
6471 if (is_64bit)
6472 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6473 else
6474 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6475 ok(res == ERROR_SUCCESS, "key not created\n");
6476 RegCloseKey(hkey);
6477
6478 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6479 ok(res == ERROR_SUCCESS, "key not created\n");
6480 RegCloseKey(hkey);
6481
6482 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &hkey);
6483 ok(res == ERROR_SUCCESS, "key not created\n");
6484 RegCloseKey(hkey);
6485
6486 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6487 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6488
6489 if (is_64bit)
6490 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6491 else
6492 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6493 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6494
6495 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6496 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6497
6498 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &hkey);
6499 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6500
6501 ok(!delete_pf("msitest\\class.txt", TRUE), "file not removed\n");
6502 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6503
6504 error:
6505 DeleteFileA("msitest\\class.txt");
6506 delete_test_files();
6507 DeleteFileA(msifile);
6508 }
6509
6510 static void test_register_extension_info(void)
6511 {
6512 UINT r;
6513 LONG res;
6514 HKEY hkey;
6515
6516 if (is_process_limited())
6517 {
6518 skip("process is limited\n");
6519 return;
6520 }
6521
6522 create_test_files();
6523 create_file("msitest\\extension.txt", 1000);
6524 create_database(msifile, rei_tables, sizeof(rei_tables) / sizeof(msi_table));
6525
6526 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6527
6528 r = MsiInstallProductA(msifile, NULL);
6529 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6530 {
6531 skip("Not enough rights to perform tests\n");
6532 goto error;
6533 }
6534 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6535
6536 res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &hkey);
6537 ok(res == ERROR_SUCCESS, "key not created\n");
6538 RegCloseKey(hkey);
6539
6540 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1\\shell\\Open\\command", &hkey);
6541 ok(res == ERROR_SUCCESS, "key not created\n");
6542 RegCloseKey(hkey);
6543
6544 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6545 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6546
6547 res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &hkey);
6548 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6549
6550 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1", &hkey);
6551 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6552
6553 ok(!delete_pf("msitest\\extension.txt", TRUE), "file not removed\n");
6554 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6555
6556 error:
6557 DeleteFileA("msitest\\extension.txt");
6558 delete_test_files();
6559 DeleteFileA(msifile);
6560 }
6561
6562 static void test_register_progid_info(void)
6563 {
6564 UINT r;
6565 LONG res;
6566 HKEY hkey;
6567
6568 if (is_process_limited())
6569 {
6570 skip("process is limited\n");
6571 return;
6572 }
6573
6574 create_test_files();
6575 create_file("msitest\\progid.txt", 1000);
6576 create_database(msifile, rpi_tables, sizeof(rpi_tables) / sizeof(msi_table));
6577
6578 res = RegCreateKeyExA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", 0, NULL, 0,
6579 KEY_ALL_ACCESS, NULL, &hkey, NULL);
6580 ok(res == ERROR_SUCCESS, "key not created\n");
6581 RegCloseKey(hkey);
6582
6583 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6584
6585 r = MsiInstallProductA(msifile, NULL);
6586 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6587 {
6588 skip("Not enough rights to perform tests\n");
6589 goto error;
6590 }
6591 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6592
6593 if (is_64bit)
6594 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6595 else
6596 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6597 ok(res == ERROR_SUCCESS, "key not created\n");
6598 RegCloseKey(hkey);
6599
6600 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.1", &hkey);
6601 ok(res == ERROR_SUCCESS, "key not created\n");
6602 RegCloseKey(hkey);
6603
6604 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class", &hkey);
6605 ok(res == ERROR_SUCCESS, "key not created\n");
6606 RegCloseKey(hkey);
6607
6608 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.2", &hkey);
6609 ok(res == ERROR_SUCCESS, "key not created\n");
6610 RegCloseKey(hkey);
6611
6612 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass.1", &hkey);
6613 ok(res == ERROR_SUCCESS, "key not created\n");
6614 RegCloseKey(hkey);
6615
6616 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass", &hkey);
6617 ok(res == ERROR_SUCCESS, "key not created\n");
6618 RegCloseKey(hkey);
6619
6620 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass.1", &hkey);
6621 ok(res == ERROR_FILE_NOT_FOUND, "key created\n");
6622 if (res == ERROR_SUCCESS) RegCloseKey(hkey);
6623
6624 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass", &hkey);
6625 ok(res == ERROR_FILE_NOT_FOUND, "key created\n");
6626
6627 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", &hkey);
6628 ok(res == ERROR_SUCCESS, "key deleted\n");
6629 if (res == ERROR_SUCCESS) RegCloseKey(hkey);
6630
6631 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned2", &hkey);
6632 ok(res == ERROR_FILE_NOT_FOUND, "key created\n");
6633
6634 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Extension", &hkey);
6635 ok(res == ERROR_SUCCESS, "key not created\n");
6636 RegCloseKey(hkey);
6637
6638 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6639 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6640
6641 if (is_64bit)
6642 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6643 else
6644 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6645 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6646
6647 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.1", &hkey);
6648 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6649
6650 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class", &hkey);
6651 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6652
6653 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.2", &hkey);
6654 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6655
6656 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass.1", &hkey);
6657 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6658
6659 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass", &hkey);
6660 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6661
6662 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass.1", &hkey);
6663 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6664
6665 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass", &hkey);
6666 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6667
6668 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", &hkey);
6669 ok(res == ERROR_SUCCESS, "key deleted\n");
6670 if (res == ERROR_SUCCESS) RegCloseKey(hkey);
6671
6672 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned2", &hkey);
6673 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6674
6675 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Extension", &hkey);
6676 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6677
6678 ok(!delete_pf("msitest\\progid.txt", TRUE), "file not removed\n");
6679 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6680
6681 error:
6682 DeleteFileA("msitest\\progid.txt");
6683 delete_test_files();
6684 DeleteFileA(msifile);
6685 RegDeleteKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned");
6686 }
6687
6688 static void test_register_mime_info(void)
6689 {
6690 UINT r;
6691 LONG res;
6692 HKEY hkey;
6693
6694 if (is_process_limited())
6695 {
6696 skip("process is limited\n");
6697 return;
6698 }
6699
6700 create_test_files();
6701 create_file("msitest\\mime.txt", 1000);
6702 create_database(msifile, rmi_tables, sizeof(rmi_tables) / sizeof(msi_table));
6703
6704 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6705
6706 r = MsiInstallProductA(msifile, NULL);
6707 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6708 {
6709 skip("Not enough rights to perform tests\n");
6710 goto error;
6711 }
6712 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6713
6714 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &hkey);
6715 ok(res == ERROR_SUCCESS, "key not created\n");
6716 RegCloseKey(hkey);
6717
6718 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6719 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6720
6721 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &hkey);
6722 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6723
6724 ok(!delete_pf("msitest\\mime.txt", TRUE), "file not removed\n");
6725 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6726
6727 error:
6728 DeleteFileA("msitest\\mime.txt");
6729 delete_test_files();
6730 DeleteFileA(msifile);
6731 }
6732
6733 static void test_publish_assemblies(void)
6734 {
6735 static const char manifest[] =
6736 "<assemblyIdentity type=\"win32\" name=\"Wine.Win32.Assembly\" "
6737 "version=\"1.0.0.0\" publicKeyToken=\"abcdef0123456789\" "
6738 "processorArchitecture=\"x86\"/>";
6739 static const char manifest_local[] =
6740 "<assemblyIdentity type=\"win32\" name=\"Wine.Win32.Local.Assembly\" "
6741 "version=\"1.0.0.0\" publicKeyToken=\"abcdef0123456789\" "
6742 "processorArchitecture=\"x86\"/>";
6743 static const char classes_path_dotnet[] =
6744 "Installer\\Assemblies\\Global";
6745 static const char classes_path_dotnet_local[] =
6746 "Installer\\Assemblies\\C:|Program Files|msitest|application_dotnet.txt";
6747 static const char classes_path_dotnet_local_wow64[] =
6748 "Installer\\Assemblies\\C:|Program Files (x86)|msitest|application_dotnet.txt";
6749 static const char classes_path_win32[] =
6750 "Installer\\Win32Assemblies\\Global";
6751 static const char classes_path_win32_local[] =
6752 "Installer\\Win32Assemblies\\C:|Program Files|msitest|application_win32.txt";
6753 static const char classes_path_win32_local_wow64[] =
6754 "Installer\\Win32Assemblies\\C:|Program Files (x86)|msitest|application_win32.txt";
6755 static const char path_dotnet[] =
6756 "Software\\Microsoft\\Installer\\Assemblies\\Global";
6757 static const char path_dotnet_local[] =
6758 "Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files|msitest|application_dotnet.txt";
6759 static const char path_dotnet_local_wow64[] =
6760 "Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files (x86)|msitest|application_dotnet.txt";
6761 static const char path_win32[] =
6762 "Software\\Microsoft\\Installer\\Win32Assemblies\\Global";
6763 static const char path_win32_local[] =
6764 "Software\\Microsoft\\Installer\\Win32Assemblies\\C:|Program Files|msitest|application_win32.txt";
6765 static const char path_win32_local_wow64[] =
6766 "Software\\Microsoft\\Installer\\Win32Assemblies\\C:|Program Files (x86)|msitest|application_win32.txt";
6767 static const char name_dotnet[] =
6768 "Wine.Dotnet.Assembly,processorArchitecture=\"MSIL\",publicKeyToken=\"abcdef0123456789\","
6769 "version=\"1.0.0.0\",culture=\"neutral\"";
6770 static const char name_dotnet_local[] =
6771 "Wine.Dotnet.Local.Assembly,processorArchitecture=\"MSIL\",publicKeyToken=\"abcdef0123456789\","
6772 "version=\"1.0.0.0\",culture=\"neutral\"";
6773 static const char name_win32[] =
6774 "Wine.Win32.Assembly,processorArchitecture=\"x86\",publicKeyToken=\"abcdef0123456789\","
6775 "type=\"win32\",version=\"1.0.0.0\"";
6776 static const char name_win32_local[] =
6777 "Wine.Win32.Local.Assembly,processorArchitecture=\"x86\",publicKeyToken=\"abcdef0123456789\","
6778 "type=\"win32\",version=\"1.0.0.0\"";
6779 UINT r;
6780 LONG res;
6781 HKEY hkey;
6782 const char *path;
6783 int access;
6784
6785 if (is_process_limited())
6786 {
6787 skip("process is limited\n");
6788 return;
6789 }
6790
6791 create_test_files();
6792 create_file("msitest\\win32.txt", 1000);
6793 create_file("msitest\\win32_local.txt", 1000);
6794 create_file("msitest\\dotnet.txt", 1000);
6795 create_file("msitest\\dotnet_local.txt", 1000);
6796 create_file_data("msitest\\manifest.txt", manifest, 0);
6797 create_file_data("msitest\\manifest_local.txt", manifest_local, 0);
6798 create_file("msitest\\application_win32.txt", 1000);
6799 create_file("msitest\\application_dotnet.txt", 1000);
6800 create_database(msifile, pa_tables, sizeof(pa_tables) / sizeof(msi_table));
6801
6802 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6803
6804 r = MsiInstallProductA(msifile, NULL);
6805 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6806 {
6807 skip("Not enough rights to perform tests\n");
6808 goto done;
6809 }
6810 if (r == ERROR_INSTALL_FAILURE)
6811 {
6812 skip("No support for installing side-by-side assemblies\n");
6813 goto done;
6814 }
6815 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6816
6817 res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &hkey);
6818 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6819 CHECK_REG_STR(hkey, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
6820 RegCloseKey(hkey);
6821
6822 path = (is_wow64 || is_64bit) ? path_dotnet_local_wow64 : path_dotnet_local;
6823 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6824 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6825 CHECK_REG_STR(hkey, name_dotnet_local, "rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox");
6826 RegCloseKey(hkey);
6827
6828 res = RegOpenKeyA(HKEY_CURRENT_USER, path_win32, &hkey);
6829 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6830 "Expected ERROR_SUCCESS, got %d\n", res);
6831 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32, "rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%");
6832 RegCloseKey(hkey);
6833
6834 path = (is_wow64 || is_64bit) ? path_win32_local_wow64 : path_win32_local;
6835 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6836 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6837 "Expected ERROR_SUCCESS, got %d\n", res);
6838 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32_local, "rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
6839 RegCloseKey(hkey);
6840
6841 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6842 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6843
6844 res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &hkey);
6845 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6846 if (res == ERROR_SUCCESS)
6847 {
6848 res = RegDeleteValueA(hkey, name_dotnet);
6849 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6850 RegCloseKey(hkey);
6851 }
6852
6853 path = (is_wow64 || is_64bit) ? path_dotnet_local_wow64 : path_dotnet_local;
6854 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6855 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6856
6857 res = RegOpenKeyA(HKEY_CURRENT_USER, path_win32, &hkey);
6858 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6859 if (res == ERROR_SUCCESS)
6860 {
6861 res = RegDeleteValueA(hkey, name_win32);
6862 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6863 RegCloseKey(hkey);
6864 }
6865
6866 path = (is_wow64 || is_64bit) ? path_win32_local_wow64 : path_win32_local;
6867 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6868 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6869
6870 r = MsiInstallProductA(msifile, "ALLUSERS=1");
6871 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6872
6873 access = KEY_QUERY_VALUE;
6874 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_dotnet, 0, access, &hkey);
6875 if (res == ERROR_FILE_NOT_FOUND && is_wow64) /* Vista WOW64 */
6876 {
6877 trace("Using 64-bit registry view for HKCR\\Installer\n");
6878 access = KEY_QUERY_VALUE | KEY_WOW64_64KEY;
6879 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_dotnet, 0, access, &hkey);
6880 }
6881 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6882 CHECK_REG_STR(hkey, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
6883 RegCloseKey(hkey);
6884
6885 path = (is_wow64 || is_64bit) ? classes_path_dotnet_local_wow64 : classes_path_dotnet_local;
6886 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
6887 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6888 CHECK_REG_STR(hkey, name_dotnet_local, "rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox");
6889 RegCloseKey(hkey);
6890
6891 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_win32, 0, access, &hkey);
6892 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6893 "Expected ERROR_SUCCESS, got %d\n", res);
6894 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32, "rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%");
6895 RegCloseKey(hkey);
6896
6897 path = (is_wow64 || is_64bit) ? classes_path_win32_local_wow64 : classes_path_win32_local;
6898 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
6899 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6900 "Expected ERROR_SUCCESS, got %d\n", res);
6901 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32_local, "rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
6902 RegCloseKey(hkey);
6903
6904 r = MsiInstallProductA(msifile, "REMOVE=ALL ALLUSERS=1");
6905 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6906
6907 res = RegOpenKeyA(HKEY_CLASSES_ROOT, classes_path_dotnet, &hkey);
6908 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6909 if (res == ERROR_SUCCESS)
6910 {
6911 res = RegDeleteValueA(hkey, name_dotnet);
6912 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6913 RegCloseKey(hkey);
6914 }
6915
6916 path = (is_wow64 || is_64bit) ? classes_path_dotnet_local_wow64 : classes_path_dotnet_local;
6917 res = RegOpenKeyA(HKEY_CLASSES_ROOT, path, &hkey);
6918 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6919
6920 res = RegOpenKeyA(HKEY_CLASSES_ROOT, classes_path_win32, &hkey);
6921 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6922 if (res == ERROR_SUCCESS)
6923 {
6924 res = RegDeleteValueA(hkey, name_win32);
6925 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6926 RegCloseKey(hkey);
6927 }
6928
6929 path = (is_wow64 || is_64bit) ? classes_path_win32_local_wow64 : classes_path_win32_local;
6930 res = RegOpenKeyA(HKEY_CLASSES_ROOT, path, &hkey);
6931 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6932
6933 done:
6934 DeleteFileA("msitest\\win32.txt");
6935 DeleteFileA("msitest\\win32_local.txt");
6936 DeleteFileA("msitest\\dotnet.txt");
6937 DeleteFileA("msitest\\dotnet_local.txt");
6938 DeleteFileA("msitest\\manifest.txt");
6939 DeleteFileA("msitest\\manifest_local.txt");
6940 DeleteFileA("msitest\\application_win32.txt");
6941 DeleteFileA("msitest\\application_dotnet.txt");
6942 delete_test_files();
6943 DeleteFileA(msifile);
6944 }
6945
6946 static void test_remove_existing_products(void)
6947 {
6948 UINT r;
6949
6950 if (is_process_limited())
6951 {
6952 skip("process is limited\n");
6953 return;
6954 }
6955
6956 create_test_files();
6957 create_file("msitest\\rep.txt", 1000);
6958 create_database(msifile, rep_tables, sizeof(rep_tables) / sizeof(msi_table));
6959
6960 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6961
6962 r = MsiInstallProductA(msifile, NULL);
6963 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6964 {
6965 skip("Not enough rights to perform tests\n");
6966 goto error;
6967 }
6968 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6969
6970 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6971 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6972
6973 ok(!delete_pf("msitest\\rep.txt", TRUE), "file not removed\n");
6974 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6975
6976 error:
6977 DeleteFileA("msitest\\rep.txt");
6978 delete_test_files();
6979 DeleteFileA(msifile);
6980 }
6981
6982 START_TEST(action)
6983 {
6984 DWORD len;
6985 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6986 STATEMGRSTATUS status;
6987 BOOL ret = FALSE;
6988
6989 init_functionpointers();
6990
6991 if (pIsWow64Process)
6992 pIsWow64Process(GetCurrentProcess(), &is_wow64);
6993
6994 GetCurrentDirectoryA(MAX_PATH, prev_path);
6995 GetTempPathA(MAX_PATH, temp_path);
6996 SetCurrentDirectoryA(temp_path);
6997
6998 lstrcpyA(CURR_DIR, temp_path);
6999 len = lstrlenA(CURR_DIR);
7000
7001 if(len && (CURR_DIR[len - 1] == '\\'))
7002 CURR_DIR[len - 1] = 0;
7003
7004 ok(get_system_dirs(), "failed to retrieve system dirs\n");
7005 ok(get_user_dirs(), "failed to retrieve user dirs\n");
7006
7007 /* Create a restore point ourselves so we circumvent the multitude of restore points
7008 * that would have been created by all the installation and removal tests.
7009 *
7010 * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
7011 * creation of restore points.
7012 */
7013 if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
7014 {
7015 memset(&status, 0, sizeof(status));
7016 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
7017 }
7018
7019 /* Create only one log file and don't append. We have to pass something
7020 * for the log mode for this to work. The logfile needs to have an absolute
7021 * path otherwise we still end up with some extra logfiles as some tests
7022 * change the current directory.
7023 */
7024 lstrcpyA(log_file, temp_path);
7025 lstrcatA(log_file, "\\msitest.log");
7026 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
7027
7028 test_register_product();
7029 test_publish_product();
7030 test_publish_features();
7031 test_register_user();
7032 test_process_components();
7033 test_publish();
7034 test_publish_sourcelist();
7035 test_remove_files();
7036 test_move_files();
7037 test_duplicate_files();
7038 test_write_registry_values();
7039 test_envvar();
7040 test_create_remove_folder();
7041 test_start_stop_services();
7042 test_delete_services();
7043 test_install_services();
7044 test_self_registration();
7045 test_register_font();
7046 test_validate_product_id();
7047 test_install_remove_odbc();
7048 test_register_typelib();
7049 test_create_remove_shortcut();
7050 test_publish_components();
7051 test_remove_duplicate_files();
7052 test_remove_registry_values();
7053 test_find_related_products();
7054 test_remove_ini_values();
7055 test_remove_env_strings();
7056 test_register_class_info();
7057 test_register_extension_info();
7058 test_register_progid_info();
7059 test_register_mime_info();
7060 test_publish_assemblies();
7061 test_remove_existing_products();
7062
7063 DeleteFileA(log_file);
7064
7065 if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
7066 {
7067 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
7068 if (ret)
7069 remove_restore_point(status.llSequenceNumber);
7070 }
7071 FreeLibrary(hsrclient);
7072
7073 SetCurrentDirectoryA(prev_path);
7074 }