47a8ad9eff05ae025cfb6d90212c153a70bea0a4
[reactos.git] / modules / rostests / winetests / msi / install.c
1 /*
2 * Copyright (C) 2006 James Hawkins
3 *
4 * A test program for installing MSI products.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #define _WIN32_MSI 300
22 #define COBJMACROS
23
24 #include <stdio.h>
25
26 #include <windows.h>
27 #include <msiquery.h>
28 #include <msidefs.h>
29 #include <msi.h>
30 #include <fci.h>
31 #include <objidl.h>
32 #include <srrestoreptapi.h>
33 #include <shlobj.h>
34
35 #include "wine/test.h"
36
37 static UINT (WINAPI *pMsiQueryComponentStateA)
38 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*);
39 static UINT (WINAPI *pMsiSourceListEnumSourcesA)
40 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
41 static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
42 (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
43
44 static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL);
45 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
46 static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
47 static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
48 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
49
50 static HMODULE hsrclient = 0;
51 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
52 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
53
54 static BOOL is_wow64;
55 static const BOOL is_64bit = sizeof(void *) > sizeof(int);
56
57 static const char *msifile = "msitest.msi";
58 static const char *msifile2 = "winetest2.msi";
59 static const char *mstfile = "winetest.mst";
60
61 static const WCHAR msifileW[] = {'m','s','i','t','e','s','t','.','m','s','i',0};
62 static const WCHAR msifile2W[] = {'w','i','n','e','t','e','s','t','2','.','m','s','i',0};
63
64 static CHAR CURR_DIR[MAX_PATH];
65 static CHAR PROG_FILES_DIR[MAX_PATH];
66 static CHAR PROG_FILES_DIR_NATIVE[MAX_PATH];
67 static CHAR COMMON_FILES_DIR[MAX_PATH];
68 static CHAR APP_DATA_DIR[MAX_PATH];
69 static CHAR WINDOWS_DIR[MAX_PATH];
70
71 /* msi database data */
72
73 static const CHAR component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
74 "s72\tS38\ts72\ti2\tS255\tS72\n"
75 "Component\tComponent\n"
76 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
77 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
78 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n"
79 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
80 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
81 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
82 "component\t\tMSITESTDIR\t0\t1\tfile\n"
83 "service_comp\t\tMSITESTDIR\t0\t1\tservice_file";
84
85 static const CHAR directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
86 "s72\tS72\tl255\n"
87 "Directory\tDirectory\n"
88 "CABOUTDIR\tMSITESTDIR\tcabout\n"
89 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
90 "FIRSTDIR\tMSITESTDIR\tfirst\n"
91 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
92 "NEWDIR\tCABOUTDIR\tnew\n"
93 "ProgramFilesFolder\tTARGETDIR\t.\n"
94 "TARGETDIR\t\tSourceDir";
95
96 static const CHAR feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
97 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
98 "Feature\tFeature\n"
99 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
100 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
101 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
102 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
103 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
104 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
105 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
106
107 static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
108 "s38\ts72\n"
109 "FeatureComponents\tFeature_\tComponent_\n"
110 "Five\tFive\n"
111 "Four\tFour\n"
112 "One\tOne\n"
113 "Three\tThree\n"
114 "Two\tTwo\n"
115 "feature\tcomponent\n"
116 "service_feature\tservice_comp\n";
117
118 static const CHAR file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
119 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
120 "File\tFile\n"
121 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
122 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
123 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
124 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
125 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
126 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
127 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
128
129 static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
130 "s72\tS255\tI2\n"
131 "InstallExecuteSequence\tAction\n"
132 "AllocateRegistrySpace\tNOT Installed\t1550\n"
133 "CostFinalize\t\t1000\n"
134 "CostInitialize\t\t800\n"
135 "FileCost\t\t900\n"
136 "ResolveSource\t\t950\n"
137 "MoveFiles\t\t1700\n"
138 "InstallFiles\t\t4000\n"
139 "DuplicateFiles\t\t4500\n"
140 "WriteEnvironmentStrings\t\t4550\n"
141 "CreateShortcuts\t\t4600\n"
142 "InstallServices\t\t5000\n"
143 "InstallFinalize\t\t6600\n"
144 "InstallInitialize\t\t1500\n"
145 "InstallValidate\t\t1400\n"
146 "LaunchConditions\t\t100\n"
147 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
148
149 static const CHAR media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
150 "i2\ti4\tL64\tS255\tS32\tS72\n"
151 "Media\tDiskId\n"
152 "1\t3\t\t\tDISK1\t\n"
153 "2\t5\t\tmsitest.cab\tDISK2\t\n";
154
155 static const CHAR property_dat[] = "Property\tValue\n"
156 "s72\tl0\n"
157 "Property\tProperty\n"
158 "DefaultUIFont\tDlgFont8\n"
159 "HASUIRUN\t0\n"
160 "INSTALLLEVEL\t3\n"
161 "InstallMode\tTypical\n"
162 "Manufacturer\tWine\n"
163 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
164 "PRIMARYFOLDER\tTARGETDIR\n"
165 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
166 "ProductID\tnone\n"
167 "ProductLanguage\t1033\n"
168 "ProductName\tMSITEST\n"
169 "ProductVersion\t1.1.1\n"
170 "PROMPTROLLBACKCOST\tP\n"
171 "Setup\tSetup\n"
172 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
173 "AdminProperties\tPOSTADMIN\n"
174 "ROOTDRIVE\tC:\\\n"
175 "SERVNAME\tTestService\n"
176 "SERVDISP\tTestServiceDisp\n"
177 "MSIFASTINSTALL\t1\n";
178
179 static const CHAR aup_property_dat[] = "Property\tValue\n"
180 "s72\tl0\n"
181 "Property\tProperty\n"
182 "DefaultUIFont\tDlgFont8\n"
183 "HASUIRUN\t0\n"
184 "ALLUSERS\t1\n"
185 "INSTALLLEVEL\t3\n"
186 "InstallMode\tTypical\n"
187 "Manufacturer\tWine\n"
188 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
189 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
190 "ProductID\tnone\n"
191 "ProductLanguage\t1033\n"
192 "ProductName\tMSITEST\n"
193 "ProductVersion\t1.1.1\n"
194 "PROMPTROLLBACKCOST\tP\n"
195 "Setup\tSetup\n"
196 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
197 "AdminProperties\tPOSTADMIN\n"
198 "ROOTDRIVE\tC:\\\n"
199 "SERVNAME\tTestService\n"
200 "SERVDISP\tTestServiceDisp\n"
201 "MSIFASTINSTALL\t1\n";
202
203 static const CHAR aup2_property_dat[] = "Property\tValue\n"
204 "s72\tl0\n"
205 "Property\tProperty\n"
206 "DefaultUIFont\tDlgFont8\n"
207 "HASUIRUN\t0\n"
208 "ALLUSERS\t2\n"
209 "INSTALLLEVEL\t3\n"
210 "InstallMode\tTypical\n"
211 "Manufacturer\tWine\n"
212 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
213 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
214 "ProductID\tnone\n"
215 "ProductLanguage\t1033\n"
216 "ProductName\tMSITEST\n"
217 "ProductVersion\t1.1.1\n"
218 "PROMPTROLLBACKCOST\tP\n"
219 "Setup\tSetup\n"
220 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
221 "AdminProperties\tPOSTADMIN\n"
222 "ROOTDRIVE\tC:\\\n"
223 "SERVNAME\tTestService\n"
224 "SERVDISP\tTestServiceDisp\n"
225 "MSIFASTINSTALL\t1\n";
226
227 static const CHAR icon_property_dat[] = "Property\tValue\n"
228 "s72\tl0\n"
229 "Property\tProperty\n"
230 "DefaultUIFont\tDlgFont8\n"
231 "HASUIRUN\t0\n"
232 "INSTALLLEVEL\t3\n"
233 "InstallMode\tTypical\n"
234 "Manufacturer\tWine\n"
235 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
236 "ProductCode\t{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}\n"
237 "ProductID\tnone\n"
238 "ProductLanguage\t1033\n"
239 "ProductName\tMSITEST\n"
240 "ProductVersion\t1.1.1\n"
241 "PROMPTROLLBACKCOST\tP\n"
242 "Setup\tSetup\n"
243 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
244 "AdminProperties\tPOSTADMIN\n"
245 "ROOTDRIVE\tC:\\\n"
246 "SERVNAME\tTestService\n"
247 "SERVDISP\tTestServiceDisp\n"
248 "MSIFASTINSTALL\t1\n";
249
250 static const CHAR shortcut_dat[] = "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
251 "s72\ts72\tl128\ts72\ts72\tS255\tL255\tI2\tS72\tI2\tI2\tS72\n"
252 "Shortcut\tShortcut\n"
253 "Shortcut\tMSITESTDIR\tShortcut\tcomponent\tShortcut\t\tShortcut\t\t\t\t\t\n";
254
255 static const CHAR condition_dat[] = "Feature_\tLevel\tCondition\n"
256 "s38\ti2\tS255\n"
257 "Condition\tFeature_\tLevel\n"
258 "One\t4\t1\n";
259
260 static const CHAR up_property_dat[] = "Property\tValue\n"
261 "s72\tl0\n"
262 "Property\tProperty\n"
263 "DefaultUIFont\tDlgFont8\n"
264 "HASUIRUN\t0\n"
265 "INSTALLLEVEL\t3\n"
266 "InstallMode\tTypical\n"
267 "Manufacturer\tWine\n"
268 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
269 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
270 "ProductID\tnone\n"
271 "ProductLanguage\t1033\n"
272 "ProductName\tMSITEST\n"
273 "ProductVersion\t1.1.1\n"
274 "PROMPTROLLBACKCOST\tP\n"
275 "Setup\tSetup\n"
276 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
277 "AdminProperties\tPOSTADMIN\n"
278 "ROOTDRIVE\tC:\\\n"
279 "SERVNAME\tTestService\n"
280 "SERVDISP\tTestServiceDisp\n"
281 "RemovePreviousVersions\t1\n"
282 "MSIFASTINSTALL\t1\n";
283
284 static const CHAR up2_property_dat[] = "Property\tValue\n"
285 "s72\tl0\n"
286 "Property\tProperty\n"
287 "DefaultUIFont\tDlgFont8\n"
288 "HASUIRUN\t0\n"
289 "INSTALLLEVEL\t3\n"
290 "InstallMode\tTypical\n"
291 "Manufacturer\tWine\n"
292 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
293 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
294 "ProductID\tnone\n"
295 "ProductLanguage\t1033\n"
296 "ProductName\tMSITEST\n"
297 "ProductVersion\t1.1.2\n"
298 "PROMPTROLLBACKCOST\tP\n"
299 "Setup\tSetup\n"
300 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
301 "AdminProperties\tPOSTADMIN\n"
302 "ROOTDRIVE\tC:\\\n"
303 "SERVNAME\tTestService\n"
304 "SERVDISP\tTestServiceDisp\n"
305 "MSIFASTINSTALL\t1\n";
306
307 static const CHAR up3_property_dat[] = "Property\tValue\n"
308 "s72\tl0\n"
309 "Property\tProperty\n"
310 "DefaultUIFont\tDlgFont8\n"
311 "HASUIRUN\t0\n"
312 "INSTALLLEVEL\t3\n"
313 "InstallMode\tTypical\n"
314 "Manufacturer\tWine\n"
315 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
316 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
317 "ProductID\tnone\n"
318 "ProductLanguage\t1033\n"
319 "ProductName\tMSITEST\n"
320 "ProductVersion\t1.1.2\n"
321 "PROMPTROLLBACKCOST\tP\n"
322 "Setup\tSetup\n"
323 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
324 "AdminProperties\tPOSTADMIN\n"
325 "ROOTDRIVE\tC:\\\n"
326 "SERVNAME\tTestService\n"
327 "SERVDISP\tTestServiceDisp\n"
328 "RemovePreviousVersions\t1\n"
329 "MSIFASTINSTALL\t1\n";
330
331 static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
332 "s72\ti2\tl255\tL255\tL0\ts72\n"
333 "Registry\tRegistry\n"
334 "Apples\t1\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
335 "Oranges\t1\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
336 "regdata\t1\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
337 "OrderTest\t1\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
338
339 static const CHAR service_install_dat[] = "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
340 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
341 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
342 "ServiceInstall\tServiceInstall\n"
343 "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\t";
344
345 static const CHAR service_control_dat[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
346 "s72\tl255\ti2\tL255\tI2\ts72\n"
347 "ServiceControl\tServiceControl\n"
348 "ServiceControl\tTestService\t8\t\t0\tservice_comp";
349
350 /* tables for test_continuouscabs */
351 static const CHAR cc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
352 "s72\tS38\ts72\ti2\tS255\tS72\n"
353 "Component\tComponent\n"
354 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
355 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
356 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
357
358 static const CHAR cc2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
359 "s72\tS38\ts72\ti2\tS255\tS72\n"
360 "Component\tComponent\n"
361 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
362 "augustus\t\tMSITESTDIR\t0\t0\taugustus\n"
363 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
364
365 static const CHAR cc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
366 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
367 "Feature\tFeature\n"
368 "feature\t\t\t\t2\t1\tTARGETDIR\t0";
369
370 static const CHAR cc_feature_comp_dat[] = "Feature_\tComponent_\n"
371 "s38\ts72\n"
372 "FeatureComponents\tFeature_\tComponent_\n"
373 "feature\tmaximus\n"
374 "feature\taugustus\n"
375 "feature\tcaesar";
376
377 static const CHAR cc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
378 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
379 "File\tFile\n"
380 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
381 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
382 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
383
384 static const CHAR cc2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
385 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
386 "File\tFile\n"
387 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
388 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
389 "tiberius\tmaximus\ttiberius\t500\t\t\t16384\t3\n"
390 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
391
392 static const CHAR cc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
393 "i2\ti4\tL64\tS255\tS32\tS72\n"
394 "Media\tDiskId\n"
395 "1\t10\t\ttest1.cab\tDISK1\t\n"
396 "2\t2\t\ttest2.cab\tDISK2\t\n"
397 "3\t12\t\ttest3.cab\tDISK3\t\n";
398
399 static const CHAR cc3_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
400 "i2\ti4\tL64\tS255\tS32\tS72\n"
401 "Media\tDiskId\n"
402 "1\t10\t\ttest1.cab\tDISK1\t\n"
403 "2\t2\t\ttest2_.cab\tDISK2\t\n"
404 "3\t12\t\ttest3.cab\tDISK3\t\n";
405
406 static const CHAR co_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
407 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
408 "File\tFile\n"
409 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
410 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
411 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
412
413 static const CHAR co_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
414 "i2\ti4\tL64\tS255\tS32\tS72\n"
415 "Media\tDiskId\n"
416 "1\t10\t\ttest1.cab\tDISK1\t\n"
417 "2\t2\t\ttest2.cab\tDISK2\t\n"
418 "3\t3\t\ttest3.cab\tDISK3\t\n";
419
420 static const CHAR co2_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
421 "i2\ti4\tL64\tS255\tS32\tS72\n"
422 "Media\tDiskId\n"
423 "1\t10\t\ttest1.cab\tDISK1\t\n"
424 "2\t12\t\ttest3.cab\tDISK3\t\n"
425 "3\t2\t\ttest2.cab\tDISK2\t\n";
426
427 static const CHAR mm_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
428 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
429 "File\tFile\n"
430 "maximus\tmaximus\tmaximus\t500\t\t\t512\t1\n"
431 "augustus\taugustus\taugustus\t500\t\t\t512\t2\n"
432 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
433
434 static const CHAR mm_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
435 "i2\ti4\tL64\tS255\tS32\tS72\n"
436 "Media\tDiskId\n"
437 "1\t3\t\ttest1.cab\tDISK1\t\n";
438
439 static const CHAR ss_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
440 "i2\ti4\tL64\tS255\tS32\tS72\n"
441 "Media\tDiskId\n"
442 "1\t2\t\ttest1.cab\tDISK1\t\n"
443 "2\t2\t\ttest2.cab\tDISK2\t\n"
444 "3\t12\t\ttest3.cab\tDISK3\t\n";
445
446 /* tables for test_uiLevelFlags */
447 static const CHAR ui_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
448 "s72\tS38\ts72\ti2\tS255\tS72\n"
449 "Component\tComponent\n"
450 "maximus\t\tMSITESTDIR\t0\tHASUIRUN=1\tmaximus\n"
451 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
452 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
453
454 static const CHAR ui_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
455 "s72\tS255\tI2\n"
456 "InstallUISequence\tAction\n"
457 "SetUIProperty\t\t5\n"
458 "ExecuteAction\t\t1100\n";
459
460 static const CHAR ui_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
461 "s72\ti2\tS64\tS0\tS255\n"
462 "CustomAction\tAction\n"
463 "SetUIProperty\t51\tHASUIRUN\t1\t\n";
464
465 static const CHAR rof_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
466 "s72\tS38\ts72\ti2\tS255\tS72\n"
467 "Component\tComponent\n"
468 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
469
470 static const CHAR rof_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
471 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
472 "Feature\tFeature\n"
473 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
474 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
475
476 static const CHAR rof_feature_comp_dat[] = "Feature_\tComponent_\n"
477 "s38\ts72\n"
478 "FeatureComponents\tFeature_\tComponent_\n"
479 "feature\tmaximus\n"
480 "montecristo\tmaximus";
481
482 static const CHAR rof_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
483 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
484 "File\tFile\n"
485 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
486
487 static const CHAR rof_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
488 "i2\ti4\tL64\tS255\tS32\tS72\n"
489 "Media\tDiskId\n"
490 "1\t1\t\t\tDISK1\t\n";
491
492 static const CHAR rofc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
493 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
494 "File\tFile\n"
495 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1";
496
497 static const CHAR rofc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
498 "i2\ti4\tL64\tS255\tS32\tS72\n"
499 "Media\tDiskId\n"
500 "1\t1\t\ttest1.cab\tDISK1\t\n";
501
502 static const CHAR sdp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
503 "s72\tS255\tI2\n"
504 "InstallExecuteSequence\tAction\n"
505 "AllocateRegistrySpace\tNOT Installed\t1550\n"
506 "CostFinalize\t\t1000\n"
507 "CostInitialize\t\t800\n"
508 "FileCost\t\t900\n"
509 "InstallFiles\t\t4000\n"
510 "InstallFinalize\t\t6600\n"
511 "InstallInitialize\t\t1500\n"
512 "InstallValidate\t\t1400\n"
513 "LaunchConditions\t\t100\n"
514 "SetDirProperty\t\t950";
515
516 static const CHAR sdp_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
517 "s72\ti2\tS64\tS0\tS255\n"
518 "CustomAction\tAction\n"
519 "SetDirProperty\t51\tMSITESTDIR\t[CommonFilesFolder]msitest\\\t\n";
520
521 static const CHAR pv_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
522 "s72\tS255\tI2\n"
523 "InstallExecuteSequence\tAction\n"
524 "LaunchConditions\t\t100\n"
525 "CostInitialize\t\t800\n"
526 "FileCost\t\t900\n"
527 "CostFinalize\t\t1000\n"
528 "InstallValidate\t\t1400\n"
529 "InstallInitialize\t\t1500\n"
530 "InstallFiles\t\t4000\n"
531 "InstallFinalize\t\t6600\n";
532
533 static const CHAR cie_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
534 "s72\tS38\ts72\ti2\tS255\tS72\n"
535 "Component\tComponent\n"
536 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
537 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
538 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
539 "gaius\t\tMSITESTDIR\t0\t1\tgaius\n";
540
541 static const CHAR cie_feature_comp_dat[] = "Feature_\tComponent_\n"
542 "s38\ts72\n"
543 "FeatureComponents\tFeature_\tComponent_\n"
544 "feature\tmaximus\n"
545 "feature\taugustus\n"
546 "feature\tcaesar\n"
547 "feature\tgaius";
548
549 static const CHAR cie_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
550 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
551 "File\tFile\n"
552 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
553 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
554 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12\n"
555 "gaius\tgaius\tgaius\t500\t\t\t8192\t11";
556
557 static const CHAR cie_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
558 "i2\ti4\tL64\tS255\tS32\tS72\n"
559 "Media\tDiskId\n"
560 "1\t1\t\ttest1.cab\tDISK1\t\n"
561 "2\t2\t\ttest2.cab\tDISK2\t\n"
562 "3\t12\t\ttest3.cab\tDISK3\t\n";
563
564 static const CHAR ci_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
565 "s72\tS38\ts72\ti2\tS255\tS72\n"
566 "Component\tComponent\n"
567 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n";
568
569 static const CHAR ci2_feature_comp_dat[] = "Feature_\tComponent_\n"
570 "s38\ts72\n"
571 "FeatureComponents\tFeature_\tComponent_\n"
572 "feature\taugustus";
573
574 static const CHAR ci2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
575 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
576 "File\tFile\n"
577 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
578
579 static const CHAR pp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
580 "s72\tS255\tI2\n"
581 "InstallExecuteSequence\tAction\n"
582 "ValidateProductID\t\t700\n"
583 "CostInitialize\t\t800\n"
584 "FileCost\t\t900\n"
585 "CostFinalize\t\t1000\n"
586 "InstallValidate\t\t1400\n"
587 "InstallInitialize\t\t1500\n"
588 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
589 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
590 "RemoveFiles\t\t3500\n"
591 "InstallFiles\t\t4000\n"
592 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
593 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
594 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
595 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
596 "InstallFinalize\t\t6600";
597
598 static const CHAR tp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
599 "s72\tS38\ts72\ti2\tS255\tS72\n"
600 "Component\tComponent\n"
601 "augustus\t\tMSITESTDIR\t0\tprop=\"val\"\taugustus\n";
602
603 static const CHAR cwd_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
604 "s72\tS38\ts72\ti2\tS255\tS72\n"
605 "Component\tComponent\n"
606 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
607
608 static const CHAR adm_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
609 "s72\tS38\ts72\ti2\tS255\tS72\n"
610 "Component\tComponent\n"
611 "augustus\t\tMSITESTDIR\t0\tPOSTADMIN=1\taugustus";
612
613 static const CHAR adm_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
614 "s72\ti2\tS64\tS0\tS255\n"
615 "CustomAction\tAction\n"
616 "SetPOSTADMIN\t51\tPOSTADMIN\t1\t\n";
617
618 static const CHAR adm_admin_exec_seq_dat[] = "Action\tCondition\tSequence\n"
619 "s72\tS255\tI2\n"
620 "AdminExecuteSequence\tAction\n"
621 "CostFinalize\t\t1000\n"
622 "CostInitialize\t\t800\n"
623 "FileCost\t\t900\n"
624 "SetPOSTADMIN\t\t950\n"
625 "InstallFiles\t\t4000\n"
626 "InstallFinalize\t\t6600\n"
627 "InstallInitialize\t\t1500\n"
628 "InstallValidate\t\t1400\n"
629 "LaunchConditions\t\t100";
630
631 static const CHAR amp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
632 "s72\tS38\ts72\ti2\tS255\tS72\n"
633 "Component\tComponent\n"
634 "augustus\t\tMSITESTDIR\t0\tMYPROP=2718 and MyProp=42\taugustus\n";
635
636 static const CHAR rem_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
637 "s72\tS255\tI2\n"
638 "InstallExecuteSequence\tAction\n"
639 "ValidateProductID\t\t700\n"
640 "CostInitialize\t\t800\n"
641 "FileCost\t\t900\n"
642 "CostFinalize\t\t1000\n"
643 "InstallValidate\t\t1400\n"
644 "InstallInitialize\t\t1500\n"
645 "ProcessComponents\t\t1600\n"
646 "UnpublishFeatures\t\t1800\n"
647 "RemoveFiles\t\t3500\n"
648 "InstallFiles\t\t4000\n"
649 "RegisterProduct\t\t6100\n"
650 "PublishFeatures\t\t6300\n"
651 "PublishProduct\t\t6400\n"
652 "InstallFinalize\t\t6600";
653
654 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
655 "s72\tS38\ts72\ti2\tS255\tS72\n"
656 "Component\tComponent\n"
657 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
658 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
659 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
660 "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n"
661 "tiberius\t\tMSITESTDIR\t0\t\ttiberius\n";
662
663 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
664 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
665 "File\tFile\n"
666 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
667 "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
668 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
669 "gaius\tgaius\tgaius\t500\t\t\t16384\t4\n"
670 "tiberius\ttiberius\ttiberius\t500\t\t\t0\t5\n";
671
672 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
673 "i2\ti4\tL64\tS255\tS32\tS72\n"
674 "Media\tDiskId\n"
675 "1\t1\t\ttest1.cab\tDISK1\t\n"
676 "2\t2\t\ttest2.cab\tDISK2\t\n"
677 "3\t3\t\ttest3.cab\tDISK3\t\n"
678 "4\t4\t\ttest3.cab\tDISK3\t\n"
679 "5\t5\t\ttest4.cab\tDISK4\t\n";
680
681 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
682 "s72\ti2\ti4\ti4\ti4\ti4\n"
683 "MsiFileHash\tFile_\n"
684 "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
685
686 static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
687 "s72\tS38\ts72\ti2\tS255\tS72\n"
688 "Component\tComponent\n"
689 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
690
691 static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
692 "s72\tS38\ts72\ti2\tS255\tS72\n"
693 "Component\tComponent\n"
694 "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
695
696 static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
697 "s72\tS255\tI2\n"
698 "InstallExecuteSequence\tAction\n"
699 "ValidateProductID\t\t700\n"
700 "GoodSetProperty\t\t725\n"
701 "BadSetProperty\t\t750\n"
702 "CostInitialize\t\t800\n"
703 "ResolveSource\t\t810\n"
704 "FileCost\t\t900\n"
705 "SetSourceDir\tSRCDIR\t910\n"
706 "CostFinalize\t\t1000\n"
707 "InstallValidate\t\t1400\n"
708 "InstallInitialize\t\t1500\n"
709 "InstallFiles\t\t4000\n"
710 "InstallFinalize\t\t6600";
711
712 static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
713 "s72\ti2\tS64\tS0\n"
714 "CustomAction\tAction\n"
715 "GoodSetProperty\t51\tMYPROP\t42\n"
716 "BadSetProperty\t51\t\tMYPROP\n"
717 "SetSourceDir\t51\tSourceDir\t[SRCDIR]\n";
718
719 static const CHAR is_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
720 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
721 "Feature\tFeature\n"
722 "one\t\t\t\t2\t1\t\t0\n" /* favorLocal */
723 "two\t\t\t\t2\t1\t\t1\n" /* favorSource */
724 "three\t\t\t\t2\t1\t\t4\n" /* favorAdvertise */
725 "four\t\t\t\t2\t0\t\t0"; /* disabled */
726
727 static const CHAR is_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
728 "s72\tS38\ts72\ti2\tS255\tS72\n"
729 "Component\tComponent\n"
730 "alpha\t\tMSITESTDIR\t0\t\talpha_file\n" /* favorLocal:Local */
731 "beta\t\tMSITESTDIR\t1\t\tbeta_file\n" /* favorLocal:Source */
732 "gamma\t\tMSITESTDIR\t2\t\tgamma_file\n" /* favorLocal:Optional */
733 "theta\t\tMSITESTDIR\t0\t\ttheta_file\n" /* favorSource:Local */
734 "delta\t\tMSITESTDIR\t1\t\tdelta_file\n" /* favorSource:Source */
735 "epsilon\t\tMSITESTDIR\t2\t\tepsilon_file\n" /* favorSource:Optional */
736 "zeta\t\tMSITESTDIR\t0\t\tzeta_file\n" /* favorAdvertise:Local */
737 "iota\t\tMSITESTDIR\t1\t\tiota_file\n" /* favorAdvertise:Source */
738 "eta\t\tMSITESTDIR\t2\t\teta_file\n" /* favorAdvertise:Optional */
739 "kappa\t\tMSITESTDIR\t0\t\tkappa_file\n" /* disabled:Local */
740 "lambda\t\tMSITESTDIR\t1\t\tlambda_file\n" /* disabled:Source */
741 "mu\t\tMSITESTDIR\t2\t\tmu_file\n"; /* disabled:Optional */
742
743 static const CHAR is_feature_comp_dat[] = "Feature_\tComponent_\n"
744 "s38\ts72\n"
745 "FeatureComponents\tFeature_\tComponent_\n"
746 "one\talpha\n"
747 "one\tbeta\n"
748 "one\tgamma\n"
749 "two\ttheta\n"
750 "two\tdelta\n"
751 "two\tepsilon\n"
752 "three\tzeta\n"
753 "three\tiota\n"
754 "three\teta\n"
755 "four\tkappa\n"
756 "four\tlambda\n"
757 "four\tmu";
758
759 static const CHAR is_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
760 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
761 "File\tFile\n"
762 "alpha_file\talpha\talpha\t500\t\t\t8192\t1\n"
763 "beta_file\tbeta\tbeta\t500\t\t\t8291\t2\n"
764 "gamma_file\tgamma\tgamma\t500\t\t\t8192\t3\n"
765 "theta_file\ttheta\ttheta\t500\t\t\t8192\t4\n"
766 "delta_file\tdelta\tdelta\t500\t\t\t8192\t5\n"
767 "epsilon_file\tepsilon\tepsilon\t500\t\t\t8192\t6\n"
768 "zeta_file\tzeta\tzeta\t500\t\t\t8192\t7\n"
769 "iota_file\tiota\tiota\t500\t\t\t8192\t8\n"
770 "eta_file\teta\teta\t500\t\t\t8192\t9\n"
771 "kappa_file\tkappa\tkappa\t500\t\t\t8192\t10\n"
772 "lambda_file\tlambda\tlambda\t500\t\t\t8192\t11\n"
773 "mu_file\tmu\tmu\t500\t\t\t8192\t12";
774
775 static const CHAR is_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
776 "i2\ti4\tL64\tS255\tS32\tS72\n"
777 "Media\tDiskId\n"
778 "1\t12\t\t\tDISK1\t\n";
779
780 static const CHAR sp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
781 "s72\tS38\ts72\ti2\tS255\tS72\n"
782 "Component\tComponent\n"
783 "augustus\t\tTWODIR\t0\t\taugustus\n";
784
785 static const CHAR sp_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
786 "s72\tS72\tl255\n"
787 "Directory\tDirectory\n"
788 "TARGETDIR\t\tSourceDir\n"
789 "ProgramFilesFolder\tTARGETDIR\t.\n"
790 "MSITESTDIR\tProgramFilesFolder\tmsitest:.\n"
791 "ONEDIR\tMSITESTDIR\t.:shortone|longone\n"
792 "TWODIR\tONEDIR\t.:shorttwo|longtwo";
793
794 static const CHAR mcp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
795 "s72\tS38\ts72\ti2\tS255\tS72\n"
796 "Component\tComponent\n"
797 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t2\t\thydrogen\n"
798 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t2\t\thelium\n"
799 "lithium\t{4AF28FFC-71C7-4307-BDE4-B77C5338F56F}\tMSITESTDIR\t2\tPROPVAR=42\tlithium\n";
800
801 static const CHAR mcp_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
802 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
803 "Feature\tFeature\n"
804 "hydroxyl\t\thydroxyl\thydroxyl\t2\t1\tTARGETDIR\t0\n"
805 "heliox\t\theliox\theliox\t2\t5\tTARGETDIR\t0\n"
806 "lithia\t\tlithia\tlithia\t2\t10\tTARGETDIR\t0";
807
808 static const CHAR mcp_feature_comp_dat[] = "Feature_\tComponent_\n"
809 "s38\ts72\n"
810 "FeatureComponents\tFeature_\tComponent_\n"
811 "hydroxyl\thydrogen\n"
812 "heliox\thelium\n"
813 "lithia\tlithium";
814
815 static const CHAR mcp_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
816 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
817 "File\tFile\n"
818 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
819 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
820 "lithium\tlithium\tlithium\t0\t\t\t8192\t1\n"
821 "beryllium\tmissingcomp\tberyllium\t0\t\t\t8192\t1";
822
823 static const CHAR ai_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
824 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
825 "File\tFile\n"
826 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
827 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
828 "one.txt\tOne\tone.txt\t1000\t\t\t16384\t1\n"
829 "three.txt\tThree\tthree.txt\t1000\t\t\t16384\t3\n"
830 "two.txt\tTwo\ttwo.txt\t1000\t\t\t16384\t2\n"
831 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
832 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
833
834 static const CHAR ip_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
835 "s72\tS255\tI2\n"
836 "InstallExecuteSequence\tAction\n"
837 "CostFinalize\t\t1000\n"
838 "ValidateProductID\t\t700\n"
839 "CostInitialize\t\t800\n"
840 "FileCost\t\t900\n"
841 "RemoveFiles\t\t3500\n"
842 "InstallFiles\t\t4000\n"
843 "RegisterUser\t\t6000\n"
844 "RegisterProduct\t\t6100\n"
845 "PublishFeatures\t\t6300\n"
846 "PublishProduct\t\t6400\n"
847 "InstallFinalize\t\t6600\n"
848 "InstallInitialize\t\t1500\n"
849 "ProcessComponents\t\t1600\n"
850 "UnpublishFeatures\t\t1800\n"
851 "InstallValidate\t\t1400\n"
852 "LaunchConditions\t\t100\n"
853 "TestInstalledProp\tInstalled AND NOT REMOVE\t950\n";
854
855 static const CHAR ip_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
856 "s72\ti2\tS64\tS0\tS255\n"
857 "CustomAction\tAction\n"
858 "TestInstalledProp\t19\t\tTest failed\t\n";
859
860 static const CHAR aup_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
861 "s72\tS255\tI2\n"
862 "InstallExecuteSequence\tAction\n"
863 "CostFinalize\t\t1000\n"
864 "ValidateProductID\t\t700\n"
865 "CostInitialize\t\t800\n"
866 "FileCost\t\t900\n"
867 "RemoveFiles\t\t3500\n"
868 "InstallFiles\t\t4000\n"
869 "RegisterUser\t\t6000\n"
870 "RegisterProduct\t\t6100\n"
871 "PublishFeatures\t\t6300\n"
872 "PublishProduct\t\t6400\n"
873 "InstallFinalize\t\t6600\n"
874 "InstallInitialize\t\t1500\n"
875 "ProcessComponents\t\t1600\n"
876 "UnpublishFeatures\t\t1800\n"
877 "InstallValidate\t\t1400\n"
878 "LaunchConditions\t\t100\n"
879 "TestAllUsersProp\tALLUSERS AND NOT REMOVE\t50\n";
880
881 static const CHAR aup2_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
882 "s72\tS255\tI2\n"
883 "InstallExecuteSequence\tAction\n"
884 "CostFinalize\t\t1000\n"
885 "ValidateProductID\t\t700\n"
886 "CostInitialize\t\t800\n"
887 "FileCost\t\t900\n"
888 "RemoveFiles\t\t3500\n"
889 "InstallFiles\t\t4000\n"
890 "RegisterUser\t\t6000\n"
891 "RegisterProduct\t\t6100\n"
892 "PublishFeatures\t\t6300\n"
893 "PublishProduct\t\t6400\n"
894 "InstallFinalize\t\t6600\n"
895 "InstallInitialize\t\t1500\n"
896 "ProcessComponents\t\t1600\n"
897 "UnpublishFeatures\t\t1800\n"
898 "InstallValidate\t\t1400\n"
899 "LaunchConditions\t\t100\n"
900 "TestAllUsersProp\tALLUSERS=2 AND NOT REMOVE\t50\n";
901
902 static const CHAR aup3_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
903 "s72\tS255\tI2\n"
904 "InstallExecuteSequence\tAction\n"
905 "CostFinalize\t\t1000\n"
906 "ValidateProductID\t\t700\n"
907 "CostInitialize\t\t800\n"
908 "FileCost\t\t900\n"
909 "RemoveFiles\t\t3500\n"
910 "InstallFiles\t\t4000\n"
911 "RegisterUser\t\t6000\n"
912 "RegisterProduct\t\t6100\n"
913 "PublishFeatures\t\t6300\n"
914 "PublishProduct\t\t6400\n"
915 "InstallFinalize\t\t6600\n"
916 "InstallInitialize\t\t1500\n"
917 "ProcessComponents\t\t1600\n"
918 "UnpublishFeatures\t\t1800\n"
919 "InstallValidate\t\t1400\n"
920 "LaunchConditions\t\t100\n"
921 "TestAllUsersProp\tALLUSERS=1 AND NOT REMOVE\t50\n";
922
923 static const CHAR aup_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
924 "s72\ti2\tS64\tS0\tS255\n"
925 "CustomAction\tAction\n"
926 "TestAllUsersProp\t19\t\tTest failed\t\n";
927
928 static const CHAR fo_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
929 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
930 "File\tFile\n"
931 "override.txt\toverride\toverride.txt\t1000\t\t\t8192\t1\n"
932 "preselected.txt\tpreselected\tpreselected.txt\t1000\t\t\t8192\t2\n"
933 "notpreselected.txt\tnotpreselected\tnotpreselected.txt\t1000\t\t\t8192\t3\n";
934
935 static const CHAR fo_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
936 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
937 "Feature\tFeature\n"
938 "override\t\t\toverride feature\t1\t1\tMSITESTDIR\t0\n"
939 "preselected\t\t\tpreselected feature\t1\t1\tMSITESTDIR\t0\n"
940 "notpreselected\t\t\tnotpreselected feature\t1\t1\tMSITESTDIR\t0\n";
941
942 static const CHAR fo_condition_dat[] = "Feature_\tLevel\tCondition\n"
943 "s38\ti2\tS255\n"
944 "Condition\tFeature_\tLevel\n"
945 "preselected\t0\tPreselected\n"
946 "notpreselected\t0\tNOT Preselected\n";
947
948 static const CHAR fo_feature_comp_dat[] = "Feature_\tComponent_\n"
949 "s38\ts72\n"
950 "FeatureComponents\tFeature_\tComponent_\n"
951 "override\toverride\n"
952 "preselected\tpreselected\n"
953 "notpreselected\tnotpreselected\n";
954
955 static const CHAR fo_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
956 "s72\tS38\ts72\ti2\tS255\tS72\n"
957 "Component\tComponent\n"
958 "override\t{0A00FB1D-97B0-4B42-ADF0-BB8913416623}\tMSITESTDIR\t0\t\toverride.txt\n"
959 "preselected\t{44E1DB75-605A-43DD-8CF5-CAB17F1BBD60}\tMSITESTDIR\t0\t\tpreselected.txt\n"
960 "notpreselected\t{E1647733-5E75-400A-A92E-5E60B4D4EF9F}\tMSITESTDIR\t0\t\tnotpreselected.txt\n";
961
962 static const CHAR fo_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
963 "s72\ti2\tS64\tS0\tS255\n"
964 "CustomAction\tAction\n"
965 "SetPreselected\t51\tPreselected\t1\t\n";
966
967 static const CHAR fo_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
968 "s72\tS255\tI2\n"
969 "InstallExecuteSequence\tAction\n"
970 "LaunchConditions\t\t100\n"
971 "SetPreselected\tpreselect=1\t200\n"
972 "CostInitialize\t\t800\n"
973 "FileCost\t\t900\n"
974 "CostFinalize\t\t1000\n"
975 "InstallValidate\t\t1400\n"
976 "InstallInitialize\t\t1500\n"
977 "ProcessComponents\t\t1600\n"
978 "RemoveFiles\t\t1700\n"
979 "InstallFiles\t\t2000\n"
980 "RegisterProduct\t\t5000\n"
981 "PublishFeatures\t\t5100\n"
982 "PublishProduct\t\t5200\n"
983 "InstallFinalize\t\t6000\n";
984
985 static const CHAR uc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
986 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
987 "File\tFile\n"
988 "upgradecode.txt\tupgradecode\tupgradecode.txt\t1000\t\t\t8192\t1\n";
989
990 static const CHAR uc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
991 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
992 "Feature\tFeature\n"
993 "upgradecode\t\t\tupgradecode feature\t1\t2\tMSITESTDIR\t0\n";
994
995 static const CHAR uc_feature_comp_dat[] = "Feature_\tComponent_\n"
996 "s38\ts72\n"
997 "FeatureComponents\tFeature_\tComponent_\n"
998 "upgradecode\tupgradecode\n";
999
1000 static const CHAR uc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1001 "s72\tS38\ts72\ti2\tS255\tS72\n"
1002 "Component\tComponent\n"
1003 "upgradecode\t{6952B732-2FCB-4E47-976F-989FCBD7EDFB}\tMSITESTDIR\t0\t\tupgradecode.txt\n";
1004
1005 static const CHAR uc_property_dat[] = "Property\tValue\n"
1006 "s72\tl0\n"
1007 "Property\tProperty\n"
1008 "INSTALLLEVEL\t3\n"
1009 "ProductCode\t{E5FB1241-F547-4BA7-A60E-8E75797268D4}\n"
1010 "ProductName\tMSITEST\n"
1011 "ProductVersion\t1.1.1\n"
1012 "UpgradeCode\t#UPGEADECODE#\n"
1013 "MSIFASTINSTALL\t1\n";
1014
1015 static const CHAR uc_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1016 "s72\tS255\tI2\n"
1017 "InstallExecuteSequence\tAction\n"
1018 "LaunchConditions\t\t100\n"
1019 "CostInitialize\t\t200\n"
1020 "FileCost\t\t300\n"
1021 "CostFinalize\t\t400\n"
1022 "InstallInitialize\t\t500\n"
1023 "ProcessComponents\t\t600\n"
1024 "InstallValidate\t\t700\n"
1025 "RemoveFiles\t\t800\n"
1026 "InstallFiles\t\t900\n"
1027 "RegisterProduct\t\t1000\n"
1028 "PublishFeatures\t\t1100\n"
1029 "PublishProduct\t\t1200\n"
1030 "InstallFinalize\t\t1300\n";
1031
1032 static const char mixed_feature_dat[] =
1033 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1034 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1035 "Feature\tFeature\n"
1036 "feature1\t\t\t\t1\t2\tMSITESTDIR\t0\n"
1037 "feature2\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1038
1039 static const char mixed_feature_comp_dat[] =
1040 "Feature_\tComponent_\n"
1041 "s38\ts72\n"
1042 "FeatureComponents\tFeature_\tComponent_\n"
1043 "feature1\tcomp1\n"
1044 "feature2\tcomp2\n";
1045
1046 static const char mixed_component_dat[] =
1047 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1048 "s72\tS38\ts72\ti2\tS255\tS72\n"
1049 "Component\tComponent\n"
1050 "comp1\t{DE9F0EF4-0ED3-495A-8105-060C0EA457B8}\tTARGETDIR\t4\t\tregdata1\n"
1051 "comp2\t{4912DBE7-FC3A-4F91-BB5C-88F5C15C19A5}\tTARGETDIR\t260\t\tregdata2\n";
1052
1053 static const char mixed_registry_dat[] =
1054 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
1055 "s72\ti2\tl255\tL255\tL0\ts72\n"
1056 "Registry\tRegistry\n"
1057 "regdata1\t2\tSOFTWARE\\Wine\\msitest\ttest1\t\tcomp1\n"
1058 "regdata2\t2\tSOFTWARE\\Wine\\msitest\ttest2\t\tcomp2\n"
1059 "regdata3\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\t\tCLSID_Winetest32\tcomp1\n"
1060 "regdata4\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32\t\twinetest32.dll\tcomp1\n"
1061 "regdata5\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\t\tCLSID_Winetest64\tcomp2\n"
1062 "regdata6\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32\t\twinetest64.dll\tcomp2\n";
1063
1064 static const char mixed_install_exec_seq_dat[] =
1065 "Action\tCondition\tSequence\n"
1066 "s72\tS255\tI2\n"
1067 "InstallExecuteSequence\tAction\n"
1068 "LaunchConditions\t\t100\n"
1069 "CostInitialize\t\t200\n"
1070 "FileCost\t\t300\n"
1071 "CostFinalize\t\t400\n"
1072 "InstallValidate\t\t500\n"
1073 "InstallInitialize\t\t600\n"
1074 "ProcessComponents\t\t700\n"
1075 "UnpublishFeatures\t\t800\n"
1076 "RemoveRegistryValues\t\t900\n"
1077 "WriteRegistryValues\t\t1000\n"
1078 "RegisterProduct\t\t1100\n"
1079 "PublishFeatures\t\t1200\n"
1080 "PublishProduct\t\t1300\n"
1081 "InstallFinalize\t\t1400\n";
1082
1083 static const char vp_file_dat[] =
1084 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1085 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1086 "File\tFile\n"
1087 "volumeprop\tcomp\tvolumeprop.txt\t1000\t\t\t8192\t1\n";
1088
1089 static const char vp_feature_dat[] =
1090 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1091 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1092 "Feature\tFeature\n"
1093 "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1094
1095 static const char vp_feature_comp_dat[] =
1096 "Feature_\tComponent_\n"
1097 "s38\ts72\n"
1098 "FeatureComponents\tFeature_\tComponent_\n"
1099 "feature\tcomp\n";
1100
1101 static const char vp_component_dat[] =
1102 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1103 "s72\tS38\ts72\ti2\tS255\tS72\n"
1104 "Component\tComponent\n"
1105 "comp\t{24364AE7-5B7F-496C-AF5A-54893639C567}\tMSITESTDIR\t0\t\tvolumeprop\n";
1106
1107 static const char vp_custom_action_dat[] =
1108 "Action\tType\tSource\tTarget\tISComments\n"
1109 "s72\ti2\tS64\tS0\tS255\n"
1110 "CustomAction\tAction\n"
1111 "TestPrimaryVolumePath0\t19\t\tPrimaryVolumePath set before CostFinalize\t\n"
1112 "TestPrimaryVolumeSpaceAvailable0\t19\t\tPrimaryVolumeSpaceAvailable set before CostFinalize\t\n"
1113 "TestPrimaryVolumeSpaceRequired0\t19\t\tPrimaryVolumeSpaceRequired set before CostFinalize\t\n"
1114 "TestPrimaryVolumeSpaceRemaining0\t19\t\tPrimaryVolumeSpaceRemaining set before CostFinalize\t\n"
1115 "TestPrimaryVolumePath1\t19\t\tPrimaryVolumePath set before InstallValidate\t\n"
1116 "TestPrimaryVolumeSpaceAvailable1\t19\t\tPrimaryVolumeSpaceAvailable not set before InstallValidate\t\n"
1117 "TestPrimaryVolumeSpaceRequired1\t19\t\tPrimaryVolumeSpaceRequired not set before InstallValidate\t\n"
1118 "TestPrimaryVolumeSpaceRemaining1\t19\t\tPrimaryVolumeSpaceRemaining not set before InstallValidate\t\n"
1119 "TestPrimaryVolumePath2\t19\t\tPrimaryVolumePath not set after InstallValidate\t\n"
1120 "TestPrimaryVolumeSpaceAvailable2\t19\t\tPrimaryVolumeSpaceAvailable not set after InstallValidate\t\n"
1121 "TestPrimaryVolumeSpaceRequired2\t19\t\tPrimaryVolumeSpaceRequired not set after InstallValidate\t\n"
1122 "TestPrimaryVolumeSpaceRemaining2\t19\t\tPrimaryVolumeSpaceRemaining not set after InstallValidate\t\n";
1123
1124 static const char vp_install_exec_seq_dat[] =
1125 "Action\tCondition\tSequence\n"
1126 "s72\tS255\tI2\n"
1127 "InstallExecuteSequence\tAction\n"
1128 "LaunchConditions\t\t100\n"
1129 "CostInitialize\t\t200\n"
1130 "FileCost\t\t300\n"
1131 "TestPrimaryVolumePath0\tPrimaryVolumePath AND NOT REMOVE\t400\n"
1132 "TestPrimaryVolumeSpaceAvailable0\tPrimaryVolumeSpaceAvailable AND NOT REMOVE\t500\n"
1133 "TestPrimaryVolumeSpaceRequired0\tPrimaryVolumeSpaceRequired AND NOT REMOVE\t510\n"
1134 "TestPrimaryVolumeSpaceRemaining0\tPrimaryVolumeSpaceRemaining AND NOT REMOVE\t520\n"
1135 "CostFinalize\t\t600\n"
1136 "TestPrimaryVolumePath1\tPrimaryVolumePath AND NOT REMOVE\t600\n"
1137 "TestPrimaryVolumeSpaceAvailable1\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t800\n"
1138 "TestPrimaryVolumeSpaceRequired1\tNOT PrimaryVolumeSpaceRequired AND NOT REMOVE\t810\n"
1139 "TestPrimaryVolumeSpaceRemaining1\tNOT PrimaryVolumeSpaceRemaining AND NOT REMOVE\t820\n"
1140 "InstallValidate\t\t900\n"
1141 "TestPrimaryVolumePath2\tNOT PrimaryVolumePath AND NOT REMOVE\t1000\n"
1142 "TestPrimaryVolumeSpaceAvailable2\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t1100\n"
1143 "TestPrimaryVolumeSpaceRequired2\tNOT PrimaryVolumeSpaceRequired AND NOT REMOVE\t1110\n"
1144 "TestPrimaryVolumeSpaceRemaining2\tNOT PrimaryVolumeSpaceRemaining AND NOT REMOVE\t1120\n"
1145 "InstallInitialize\t\t1200\n"
1146 "ProcessComponents\t\t1300\n"
1147 "RemoveFiles\t\t1400\n"
1148 "InstallFiles\t\t1500\n"
1149 "RegisterProduct\t\t1600\n"
1150 "PublishFeatures\t\t1700\n"
1151 "PublishProduct\t\t1800\n"
1152 "InstallFinalize\t\t1900\n";
1153
1154 static const char shc_property_dat[] =
1155 "Property\tValue\n"
1156 "s72\tl0\n"
1157 "Property\tProperty\n"
1158 "INSTALLLEVEL\t3\n"
1159 "ProductCode\t{5CD99CD0-69C7-409B-9905-82DD743CC840}\n"
1160 "ProductName\tMSITEST\n"
1161 "ProductVersion\t1.1.1\n"
1162 "MSIFASTINSTALL\t1\n";
1163
1164 static const char shc2_property_dat[] =
1165 "Property\tValue\n"
1166 "s72\tl0\n"
1167 "Property\tProperty\n"
1168 "INSTALLLEVEL\t3\n"
1169 "ProductCode\t{4CEFADE5-DAFB-4C21-8EF2-4ED4F139F340}\n"
1170 "ProductName\tMSITEST2\n"
1171 "ProductVersion\t1.1.1\n"
1172 "MSIFASTINSTALL\t1\n";
1173
1174 static const char shc_file_dat[] =
1175 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1176 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1177 "File\tFile\n"
1178 "sharedcomponent\tsharedcomponent\tsharedcomponent.txt\t1000\t\t\t8192\t1\n";
1179
1180 static const char shc_feature_dat[] =
1181 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1182 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1183 "Feature\tFeature\n"
1184 "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1185
1186 static const char shc_feature_comp_dat[] =
1187 "Feature_\tComponent_\n"
1188 "s38\ts72\n"
1189 "FeatureComponents\tFeature_\tComponent_\n"
1190 "feature\tsharedcomponent\n";
1191
1192 static const char shc_component_dat[] =
1193 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1194 "s72\tS38\ts72\ti2\tS255\tS72\n"
1195 "Component\tComponent\n"
1196 "sharedcomponent\t{900A4ACB-DC6F-4795-A04B-81B530183D41}\tMSITESTDIR\t0\t\tsharedcomponent\n";
1197
1198 static const char shc_custom_action_dat[] =
1199 "Action\tType\tSource\tTarget\tISComments\n"
1200 "s72\ti2\tS64\tS0\tS255\n"
1201 "CustomAction\tAction\n"
1202 "TestComponentAction\t19\t\twrong component action on install\t\n";
1203
1204 static const char shc_install_exec_seq_dat[] =
1205 "Action\tCondition\tSequence\n"
1206 "s72\tS255\tI2\n"
1207 "InstallExecuteSequence\tAction\n"
1208 "LaunchConditions\t\t100\n"
1209 "CostInitialize\t\t200\n"
1210 "FileCost\t\t300\n"
1211 "CostFinalize\t\t600\n"
1212 "InstallValidate\t\t900\n"
1213 "InstallInitialize\t\t1200\n"
1214 "ProcessComponents\t\t1300\n"
1215 "RemoveFiles\t\t1400\n"
1216 "InstallFiles\t\t1500\n"
1217 "TestComponentAction\tNOT REMOVE AND ($sharedcomponent <> 3)\t1600\n"
1218 "RegisterProduct\t\t1700\n"
1219 "PublishFeatures\t\t1800\n"
1220 "PublishProduct\t\t1900\n"
1221 "InstallFinalize\t\t2000\n";
1222
1223 static const char ft_file_dat[] =
1224 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1225 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1226 "File\tFile\n"
1227 "featuretree\tcomp\tfeaturetree.txt\t1000\t\t\t8192\t1\n";
1228
1229 static const char ft_comp_dat[] =
1230 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1231 "s72\tS38\ts72\ti2\tS255\tS72\n"
1232 "Component\tComponent\n"
1233 "comp\t{12345678-1234-1234-1234-222222222222}\tTARGETDIR\t0\t\t\n"
1234 "comp2\t{12345678-1234-1234-1234-333333333333}\tTARGETDIR\t0\t\tfeaturetree\n";
1235
1236 static const char ft_feature_dat[] =
1237 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1238 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1239 "Feature\tFeature\n"
1240 "A\t\t\t\t2\t1\t\t0\n"
1241 "C\tB\t\t\t2\t1\t\t0\n"
1242 "B\tA\t\t\t4\t1\t\t0\n"
1243 "D\t\t\t\t2\t1\t\t0\n";
1244
1245 static const char ft_feature_comp_dat[] =
1246 "Feature_\tComponent_\n"
1247 "s38\ts72\n"
1248 "FeatureComponents\tFeature_\tComponent_\n"
1249 "C\tcomp\n"
1250 "D\tcomp2\n";
1251
1252 static const char ft_condition_dat[] =
1253 "Feature_\tLevel\tCondition\n"
1254 "s38\ti2\tS255\n"
1255 "Condition\tFeature_\tLevel\n"
1256 "A\t0\t\"0\"<>INSTALLTYPE\n";
1257
1258 static const char ft_custom_action_dat[] =
1259 "Action\tType\tSource\tTarget\tISComments\n"
1260 "s72\ti2\tS64\tS0\tS255\n"
1261 "CustomAction\tAction\n"
1262 "Run A\t19\t\tA\t\n"
1263 "Run B\t19\t\tB\t\n"
1264 "Run C\t19\t\tC\t\n";
1265
1266 static const char ft_install_exec_seq_dat[] =
1267 "Action\tCondition\tSequence\n"
1268 "s72\tS255\tI2\n"
1269 "InstallExecuteSequence\tAction\n"
1270 "CostInitialize\t\t100\n"
1271 "FileCost\t\t200\n"
1272 "CostFinalize\t\t300\n"
1273 "InstallValidate\t\t400\n"
1274 "InstallInitialize\t\t500\n"
1275 "Run C\t3 = &C AND NOT Installed\t600\n"
1276 "Run B\t3 = &B AND NOT Installed\t700\n"
1277 "Run A\t3 = &A AND NOT Installed\t800\n"
1278 "ProcessComponents\t\t900\n"
1279 "RemoveFiles\t\t1000\n"
1280 "InstallFiles\t\t1100\n"
1281 "RegisterProduct\t\t1200\n"
1282 "PublishFeatures\t\t1300\n"
1283 "PublishProduct\t\t1400\n"
1284 "InstallFinalize\t\t1500\n";
1285
1286 typedef struct _msi_table
1287 {
1288 const CHAR *filename;
1289 const CHAR *data;
1290 int size;
1291 } msi_table;
1292
1293 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
1294
1295 static const msi_table tables[] =
1296 {
1297 ADD_TABLE(component),
1298 ADD_TABLE(directory),
1299 ADD_TABLE(feature),
1300 ADD_TABLE(feature_comp),
1301 ADD_TABLE(file),
1302 ADD_TABLE(install_exec_seq),
1303 ADD_TABLE(media),
1304 ADD_TABLE(property),
1305 ADD_TABLE(registry),
1306 ADD_TABLE(service_install),
1307 ADD_TABLE(service_control)
1308 };
1309
1310 static const msi_table sc_tables[] =
1311 {
1312 ADD_TABLE(component),
1313 ADD_TABLE(directory),
1314 ADD_TABLE(feature),
1315 ADD_TABLE(feature_comp),
1316 ADD_TABLE(file),
1317 ADD_TABLE(install_exec_seq),
1318 ADD_TABLE(media),
1319 ADD_TABLE(property),
1320 ADD_TABLE(shortcut)
1321 };
1322
1323 static const msi_table ps_tables[] =
1324 {
1325 ADD_TABLE(component),
1326 ADD_TABLE(directory),
1327 ADD_TABLE(feature),
1328 ADD_TABLE(feature_comp),
1329 ADD_TABLE(file),
1330 ADD_TABLE(install_exec_seq),
1331 ADD_TABLE(media),
1332 ADD_TABLE(property),
1333 ADD_TABLE(condition)
1334 };
1335
1336 static const msi_table up_tables[] =
1337 {
1338 ADD_TABLE(component),
1339 ADD_TABLE(directory),
1340 ADD_TABLE(feature),
1341 ADD_TABLE(feature_comp),
1342 ADD_TABLE(file),
1343 ADD_TABLE(install_exec_seq),
1344 ADD_TABLE(media),
1345 ADD_TABLE(up_property),
1346 ADD_TABLE(registry),
1347 ADD_TABLE(service_install),
1348 ADD_TABLE(service_control)
1349 };
1350
1351 static const msi_table up2_tables[] =
1352 {
1353 ADD_TABLE(component),
1354 ADD_TABLE(directory),
1355 ADD_TABLE(feature),
1356 ADD_TABLE(feature_comp),
1357 ADD_TABLE(file),
1358 ADD_TABLE(install_exec_seq),
1359 ADD_TABLE(media),
1360 ADD_TABLE(up2_property),
1361 ADD_TABLE(registry),
1362 ADD_TABLE(service_install),
1363 ADD_TABLE(service_control)
1364 };
1365
1366 static const msi_table up3_tables[] =
1367 {
1368 ADD_TABLE(component),
1369 ADD_TABLE(directory),
1370 ADD_TABLE(feature),
1371 ADD_TABLE(feature_comp),
1372 ADD_TABLE(file),
1373 ADD_TABLE(install_exec_seq),
1374 ADD_TABLE(media),
1375 ADD_TABLE(up3_property),
1376 ADD_TABLE(registry),
1377 ADD_TABLE(service_install),
1378 ADD_TABLE(service_control)
1379 };
1380
1381 static const msi_table up4_tables[] =
1382 {
1383 ADD_TABLE(component),
1384 ADD_TABLE(directory),
1385 ADD_TABLE(feature),
1386 ADD_TABLE(feature_comp),
1387 ADD_TABLE(file),
1388 ADD_TABLE(pp_install_exec_seq),
1389 ADD_TABLE(media),
1390 ADD_TABLE(property),
1391 ADD_TABLE(registry),
1392 ADD_TABLE(service_install),
1393 ADD_TABLE(service_control)
1394 };
1395
1396 static const msi_table up5_tables[] =
1397 {
1398 ADD_TABLE(component),
1399 ADD_TABLE(directory),
1400 ADD_TABLE(feature),
1401 ADD_TABLE(feature_comp),
1402 ADD_TABLE(file),
1403 ADD_TABLE(pp_install_exec_seq),
1404 ADD_TABLE(media),
1405 ADD_TABLE(up_property),
1406 ADD_TABLE(registry),
1407 ADD_TABLE(service_install),
1408 ADD_TABLE(service_control)
1409 };
1410
1411 static const msi_table up6_tables[] =
1412 {
1413 ADD_TABLE(component),
1414 ADD_TABLE(directory),
1415 ADD_TABLE(feature),
1416 ADD_TABLE(feature_comp),
1417 ADD_TABLE(file),
1418 ADD_TABLE(pp_install_exec_seq),
1419 ADD_TABLE(media),
1420 ADD_TABLE(up2_property),
1421 ADD_TABLE(registry),
1422 ADD_TABLE(service_install),
1423 ADD_TABLE(service_control)
1424 };
1425
1426 static const msi_table up7_tables[] =
1427 {
1428 ADD_TABLE(component),
1429 ADD_TABLE(directory),
1430 ADD_TABLE(feature),
1431 ADD_TABLE(feature_comp),
1432 ADD_TABLE(file),
1433 ADD_TABLE(pp_install_exec_seq),
1434 ADD_TABLE(media),
1435 ADD_TABLE(up3_property),
1436 ADD_TABLE(registry),
1437 ADD_TABLE(service_install),
1438 ADD_TABLE(service_control)
1439 };
1440
1441 static const msi_table cc_tables[] =
1442 {
1443 ADD_TABLE(cc_component),
1444 ADD_TABLE(directory),
1445 ADD_TABLE(cc_feature),
1446 ADD_TABLE(cc_feature_comp),
1447 ADD_TABLE(cc_file),
1448 ADD_TABLE(install_exec_seq),
1449 ADD_TABLE(cc_media),
1450 ADD_TABLE(property),
1451 };
1452
1453 static const msi_table cc2_tables[] =
1454 {
1455 ADD_TABLE(cc2_component),
1456 ADD_TABLE(directory),
1457 ADD_TABLE(cc_feature),
1458 ADD_TABLE(cc_feature_comp),
1459 ADD_TABLE(cc2_file),
1460 ADD_TABLE(install_exec_seq),
1461 ADD_TABLE(cc_media),
1462 ADD_TABLE(property),
1463 };
1464
1465 static const msi_table cc3_tables[] =
1466 {
1467 ADD_TABLE(cc_component),
1468 ADD_TABLE(directory),
1469 ADD_TABLE(cc_feature),
1470 ADD_TABLE(cc_feature_comp),
1471 ADD_TABLE(cc_file),
1472 ADD_TABLE(install_exec_seq),
1473 ADD_TABLE(cc3_media),
1474 ADD_TABLE(property),
1475 };
1476
1477 static const msi_table co_tables[] =
1478 {
1479 ADD_TABLE(cc_component),
1480 ADD_TABLE(directory),
1481 ADD_TABLE(cc_feature),
1482 ADD_TABLE(cc_feature_comp),
1483 ADD_TABLE(co_file),
1484 ADD_TABLE(install_exec_seq),
1485 ADD_TABLE(co_media),
1486 ADD_TABLE(property),
1487 };
1488
1489 static const msi_table co2_tables[] =
1490 {
1491 ADD_TABLE(cc_component),
1492 ADD_TABLE(directory),
1493 ADD_TABLE(cc_feature),
1494 ADD_TABLE(cc_feature_comp),
1495 ADD_TABLE(cc_file),
1496 ADD_TABLE(install_exec_seq),
1497 ADD_TABLE(co2_media),
1498 ADD_TABLE(property),
1499 };
1500
1501 static const msi_table mm_tables[] =
1502 {
1503 ADD_TABLE(cc_component),
1504 ADD_TABLE(directory),
1505 ADD_TABLE(cc_feature),
1506 ADD_TABLE(cc_feature_comp),
1507 ADD_TABLE(mm_file),
1508 ADD_TABLE(install_exec_seq),
1509 ADD_TABLE(mm_media),
1510 ADD_TABLE(property),
1511 };
1512
1513 static const msi_table ss_tables[] =
1514 {
1515 ADD_TABLE(cc_component),
1516 ADD_TABLE(directory),
1517 ADD_TABLE(cc_feature),
1518 ADD_TABLE(cc_feature_comp),
1519 ADD_TABLE(cc_file),
1520 ADD_TABLE(install_exec_seq),
1521 ADD_TABLE(ss_media),
1522 ADD_TABLE(property),
1523 };
1524
1525 static const msi_table ui_tables[] =
1526 {
1527 ADD_TABLE(ui_component),
1528 ADD_TABLE(directory),
1529 ADD_TABLE(cc_feature),
1530 ADD_TABLE(cc_feature_comp),
1531 ADD_TABLE(cc_file),
1532 ADD_TABLE(install_exec_seq),
1533 ADD_TABLE(ui_install_ui_seq),
1534 ADD_TABLE(ui_custom_action),
1535 ADD_TABLE(cc_media),
1536 ADD_TABLE(property),
1537 };
1538
1539 static const msi_table rof_tables[] =
1540 {
1541 ADD_TABLE(rof_component),
1542 ADD_TABLE(directory),
1543 ADD_TABLE(rof_feature),
1544 ADD_TABLE(rof_feature_comp),
1545 ADD_TABLE(rof_file),
1546 ADD_TABLE(install_exec_seq),
1547 ADD_TABLE(rof_media),
1548 ADD_TABLE(property),
1549 };
1550
1551 static const msi_table rofc_tables[] =
1552 {
1553 ADD_TABLE(rof_component),
1554 ADD_TABLE(directory),
1555 ADD_TABLE(rof_feature),
1556 ADD_TABLE(rof_feature_comp),
1557 ADD_TABLE(rofc_file),
1558 ADD_TABLE(install_exec_seq),
1559 ADD_TABLE(rofc_media),
1560 ADD_TABLE(property),
1561 };
1562
1563 static const msi_table sdp_tables[] =
1564 {
1565 ADD_TABLE(rof_component),
1566 ADD_TABLE(directory),
1567 ADD_TABLE(rof_feature),
1568 ADD_TABLE(rof_feature_comp),
1569 ADD_TABLE(rof_file),
1570 ADD_TABLE(sdp_install_exec_seq),
1571 ADD_TABLE(sdp_custom_action),
1572 ADD_TABLE(rof_media),
1573 ADD_TABLE(property),
1574 };
1575
1576 static const msi_table cie_tables[] =
1577 {
1578 ADD_TABLE(cie_component),
1579 ADD_TABLE(directory),
1580 ADD_TABLE(cc_feature),
1581 ADD_TABLE(cie_feature_comp),
1582 ADD_TABLE(cie_file),
1583 ADD_TABLE(install_exec_seq),
1584 ADD_TABLE(cie_media),
1585 ADD_TABLE(property),
1586 };
1587
1588 static const msi_table tp_tables[] =
1589 {
1590 ADD_TABLE(tp_component),
1591 ADD_TABLE(directory),
1592 ADD_TABLE(rof_feature),
1593 ADD_TABLE(ci2_feature_comp),
1594 ADD_TABLE(ci2_file),
1595 ADD_TABLE(install_exec_seq),
1596 ADD_TABLE(rof_media),
1597 ADD_TABLE(property),
1598 };
1599
1600 static const msi_table cwd_tables[] =
1601 {
1602 ADD_TABLE(cwd_component),
1603 ADD_TABLE(directory),
1604 ADD_TABLE(rof_feature),
1605 ADD_TABLE(ci2_feature_comp),
1606 ADD_TABLE(ci2_file),
1607 ADD_TABLE(install_exec_seq),
1608 ADD_TABLE(rof_media),
1609 ADD_TABLE(property),
1610 };
1611
1612 static const msi_table adm_tables[] =
1613 {
1614 ADD_TABLE(adm_component),
1615 ADD_TABLE(directory),
1616 ADD_TABLE(rof_feature),
1617 ADD_TABLE(ci2_feature_comp),
1618 ADD_TABLE(ci2_file),
1619 ADD_TABLE(install_exec_seq),
1620 ADD_TABLE(rof_media),
1621 ADD_TABLE(property),
1622 ADD_TABLE(adm_custom_action),
1623 ADD_TABLE(adm_admin_exec_seq),
1624 };
1625
1626 static const msi_table amp_tables[] =
1627 {
1628 ADD_TABLE(amp_component),
1629 ADD_TABLE(directory),
1630 ADD_TABLE(rof_feature),
1631 ADD_TABLE(ci2_feature_comp),
1632 ADD_TABLE(ci2_file),
1633 ADD_TABLE(install_exec_seq),
1634 ADD_TABLE(rof_media),
1635 ADD_TABLE(property),
1636 };
1637
1638 static const msi_table mc_tables[] =
1639 {
1640 ADD_TABLE(mc_component),
1641 ADD_TABLE(directory),
1642 ADD_TABLE(cc_feature),
1643 ADD_TABLE(cie_feature_comp),
1644 ADD_TABLE(mc_file),
1645 ADD_TABLE(install_exec_seq),
1646 ADD_TABLE(mc_media),
1647 ADD_TABLE(property),
1648 ADD_TABLE(mc_file_hash),
1649 };
1650
1651 static const msi_table sf_tables[] =
1652 {
1653 ADD_TABLE(wrv_component),
1654 ADD_TABLE(directory),
1655 ADD_TABLE(rof_feature),
1656 ADD_TABLE(ci2_feature_comp),
1657 ADD_TABLE(ci2_file),
1658 ADD_TABLE(install_exec_seq),
1659 ADD_TABLE(rof_media),
1660 ADD_TABLE(property),
1661 };
1662
1663 static const msi_table ca51_tables[] =
1664 {
1665 ADD_TABLE(ca51_component),
1666 ADD_TABLE(directory),
1667 ADD_TABLE(rof_feature),
1668 ADD_TABLE(ci2_feature_comp),
1669 ADD_TABLE(ci2_file),
1670 ADD_TABLE(ca51_install_exec_seq),
1671 ADD_TABLE(rof_media),
1672 ADD_TABLE(property),
1673 ADD_TABLE(ca51_custom_action),
1674 };
1675
1676 static const msi_table is_tables[] =
1677 {
1678 ADD_TABLE(is_component),
1679 ADD_TABLE(directory),
1680 ADD_TABLE(is_feature),
1681 ADD_TABLE(is_feature_comp),
1682 ADD_TABLE(is_file),
1683 ADD_TABLE(install_exec_seq),
1684 ADD_TABLE(is_media),
1685 ADD_TABLE(property),
1686 };
1687
1688 static const msi_table sp_tables[] =
1689 {
1690 ADD_TABLE(sp_component),
1691 ADD_TABLE(sp_directory),
1692 ADD_TABLE(rof_feature),
1693 ADD_TABLE(ci2_feature_comp),
1694 ADD_TABLE(ci2_file),
1695 ADD_TABLE(install_exec_seq),
1696 ADD_TABLE(rof_media),
1697 ADD_TABLE(property),
1698 };
1699
1700 static const msi_table mcp_tables[] =
1701 {
1702 ADD_TABLE(mcp_component),
1703 ADD_TABLE(directory),
1704 ADD_TABLE(mcp_feature),
1705 ADD_TABLE(mcp_feature_comp),
1706 ADD_TABLE(mcp_file),
1707 ADD_TABLE(rem_install_exec_seq),
1708 ADD_TABLE(rof_media),
1709 ADD_TABLE(property),
1710 };
1711
1712 static const msi_table ai_tables[] =
1713 {
1714 ADD_TABLE(component),
1715 ADD_TABLE(directory),
1716 ADD_TABLE(feature),
1717 ADD_TABLE(feature_comp),
1718 ADD_TABLE(ai_file),
1719 ADD_TABLE(install_exec_seq),
1720 ADD_TABLE(media),
1721 ADD_TABLE(property)
1722 };
1723
1724 static const msi_table pc_tables[] =
1725 {
1726 ADD_TABLE(ca51_component),
1727 ADD_TABLE(directory),
1728 ADD_TABLE(rof_feature),
1729 ADD_TABLE(ci2_feature_comp),
1730 ADD_TABLE(ci2_file),
1731 ADD_TABLE(install_exec_seq),
1732 ADD_TABLE(rof_media),
1733 ADD_TABLE(property)
1734 };
1735
1736 static const msi_table ip_tables[] =
1737 {
1738 ADD_TABLE(component),
1739 ADD_TABLE(directory),
1740 ADD_TABLE(feature),
1741 ADD_TABLE(feature_comp),
1742 ADD_TABLE(file),
1743 ADD_TABLE(ip_install_exec_seq),
1744 ADD_TABLE(ip_custom_action),
1745 ADD_TABLE(media),
1746 ADD_TABLE(property)
1747 };
1748
1749 static const msi_table aup_tables[] =
1750 {
1751 ADD_TABLE(component),
1752 ADD_TABLE(directory),
1753 ADD_TABLE(feature),
1754 ADD_TABLE(feature_comp),
1755 ADD_TABLE(file),
1756 ADD_TABLE(aup_install_exec_seq),
1757 ADD_TABLE(aup_custom_action),
1758 ADD_TABLE(media),
1759 ADD_TABLE(property)
1760 };
1761
1762 static const msi_table aup2_tables[] =
1763 {
1764 ADD_TABLE(component),
1765 ADD_TABLE(directory),
1766 ADD_TABLE(feature),
1767 ADD_TABLE(feature_comp),
1768 ADD_TABLE(file),
1769 ADD_TABLE(aup2_install_exec_seq),
1770 ADD_TABLE(aup_custom_action),
1771 ADD_TABLE(media),
1772 ADD_TABLE(aup_property)
1773 };
1774
1775 static const msi_table aup3_tables[] =
1776 {
1777 ADD_TABLE(component),
1778 ADD_TABLE(directory),
1779 ADD_TABLE(feature),
1780 ADD_TABLE(feature_comp),
1781 ADD_TABLE(file),
1782 ADD_TABLE(aup2_install_exec_seq),
1783 ADD_TABLE(aup_custom_action),
1784 ADD_TABLE(media),
1785 ADD_TABLE(aup2_property)
1786 };
1787
1788 static const msi_table aup4_tables[] =
1789 {
1790 ADD_TABLE(component),
1791 ADD_TABLE(directory),
1792 ADD_TABLE(feature),
1793 ADD_TABLE(feature_comp),
1794 ADD_TABLE(file),
1795 ADD_TABLE(aup3_install_exec_seq),
1796 ADD_TABLE(aup_custom_action),
1797 ADD_TABLE(media),
1798 ADD_TABLE(aup2_property)
1799 };
1800
1801 static const msi_table fiu_tables[] =
1802 {
1803 ADD_TABLE(rof_component),
1804 ADD_TABLE(directory),
1805 ADD_TABLE(rof_feature),
1806 ADD_TABLE(rof_feature_comp),
1807 ADD_TABLE(rof_file),
1808 ADD_TABLE(pp_install_exec_seq),
1809 ADD_TABLE(rof_media),
1810 ADD_TABLE(property),
1811 };
1812
1813 static const msi_table fiuc_tables[] =
1814 {
1815 ADD_TABLE(rof_component),
1816 ADD_TABLE(directory),
1817 ADD_TABLE(rof_feature),
1818 ADD_TABLE(rof_feature_comp),
1819 ADD_TABLE(rofc_file),
1820 ADD_TABLE(pp_install_exec_seq),
1821 ADD_TABLE(rofc_media),
1822 ADD_TABLE(property),
1823 };
1824
1825 static const msi_table fo_tables[] =
1826 {
1827 ADD_TABLE(directory),
1828 ADD_TABLE(fo_file),
1829 ADD_TABLE(fo_component),
1830 ADD_TABLE(fo_feature),
1831 ADD_TABLE(fo_condition),
1832 ADD_TABLE(fo_feature_comp),
1833 ADD_TABLE(fo_custom_action),
1834 ADD_TABLE(fo_install_exec_seq),
1835 ADD_TABLE(media),
1836 ADD_TABLE(property)
1837 };
1838
1839 static const msi_table icon_base_tables[] =
1840 {
1841 ADD_TABLE(ci_component),
1842 ADD_TABLE(directory),
1843 ADD_TABLE(rof_feature),
1844 ADD_TABLE(rof_feature_comp),
1845 ADD_TABLE(rof_file),
1846 ADD_TABLE(pp_install_exec_seq),
1847 ADD_TABLE(rof_media),
1848 ADD_TABLE(icon_property),
1849 };
1850
1851 static const msi_table pv_tables[] =
1852 {
1853 ADD_TABLE(rof_component),
1854 ADD_TABLE(directory),
1855 ADD_TABLE(rof_feature),
1856 ADD_TABLE(rof_feature_comp),
1857 ADD_TABLE(rof_file),
1858 ADD_TABLE(pv_install_exec_seq),
1859 ADD_TABLE(rof_media),
1860 ADD_TABLE(property)
1861 };
1862
1863 static const msi_table uc_tables[] =
1864 {
1865 ADD_TABLE(directory),
1866 ADD_TABLE(uc_component),
1867 ADD_TABLE(uc_feature),
1868 ADD_TABLE(uc_feature_comp),
1869 ADD_TABLE(uc_file),
1870 ADD_TABLE(uc_install_exec_seq),
1871 ADD_TABLE(media),
1872 ADD_TABLE(uc_property)
1873 };
1874
1875 static const msi_table mixed_tables[] =
1876 {
1877 ADD_TABLE(directory),
1878 ADD_TABLE(mixed_component),
1879 ADD_TABLE(mixed_feature),
1880 ADD_TABLE(mixed_feature_comp),
1881 ADD_TABLE(mixed_install_exec_seq),
1882 ADD_TABLE(mixed_registry),
1883 ADD_TABLE(media),
1884 ADD_TABLE(property)
1885 };
1886
1887 static const msi_table vp_tables[] =
1888 {
1889 ADD_TABLE(directory),
1890 ADD_TABLE(vp_file),
1891 ADD_TABLE(vp_component),
1892 ADD_TABLE(vp_feature),
1893 ADD_TABLE(vp_feature_comp),
1894 ADD_TABLE(vp_custom_action),
1895 ADD_TABLE(vp_install_exec_seq),
1896 ADD_TABLE(media),
1897 ADD_TABLE(property)
1898 };
1899
1900 static const msi_table shc_tables[] =
1901 {
1902 ADD_TABLE(media),
1903 ADD_TABLE(directory),
1904 ADD_TABLE(shc_file),
1905 ADD_TABLE(shc_component),
1906 ADD_TABLE(shc_feature),
1907 ADD_TABLE(shc_feature_comp),
1908 ADD_TABLE(shc_custom_action),
1909 ADD_TABLE(shc_install_exec_seq),
1910 ADD_TABLE(shc_property)
1911 };
1912
1913 static const msi_table shc2_tables[] =
1914 {
1915 ADD_TABLE(media),
1916 ADD_TABLE(directory),
1917 ADD_TABLE(shc_file),
1918 ADD_TABLE(shc_component),
1919 ADD_TABLE(shc_feature),
1920 ADD_TABLE(shc_feature_comp),
1921 ADD_TABLE(shc_custom_action),
1922 ADD_TABLE(shc_install_exec_seq),
1923 ADD_TABLE(shc2_property)
1924 };
1925
1926 static const msi_table ft_tables[] =
1927 {
1928 ADD_TABLE(media),
1929 ADD_TABLE(directory),
1930 ADD_TABLE(ft_file),
1931 ADD_TABLE(ft_comp),
1932 ADD_TABLE(ft_feature),
1933 ADD_TABLE(ft_feature_comp),
1934 ADD_TABLE(ft_condition),
1935 ADD_TABLE(ft_custom_action),
1936 ADD_TABLE(ft_install_exec_seq),
1937 ADD_TABLE(property)
1938 };
1939
1940 /* cabinet definitions */
1941
1942 /* make the max size large so there is only one cab file */
1943 #define MEDIA_SIZE 0x7FFFFFFF
1944 #define FOLDER_THRESHOLD 900000
1945
1946 /* the FCI callbacks */
1947
1948 static void * CDECL mem_alloc(ULONG cb)
1949 {
1950 return HeapAlloc(GetProcessHeap(), 0, cb);
1951 }
1952
1953 static void CDECL mem_free(void *memory)
1954 {
1955 HeapFree(GetProcessHeap(), 0, memory);
1956 }
1957
1958 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
1959 {
1960 sprintf(pccab->szCab, pv, pccab->iCab);
1961 return TRUE;
1962 }
1963
1964 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
1965 {
1966 return 0;
1967 }
1968
1969 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
1970 BOOL fContinuation, void *pv)
1971 {
1972 return 0;
1973 }
1974
1975 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
1976 {
1977 HANDLE handle;
1978 DWORD dwAccess = 0;
1979 DWORD dwShareMode = 0;
1980 DWORD dwCreateDisposition = OPEN_EXISTING;
1981
1982 dwAccess = GENERIC_READ | GENERIC_WRITE;
1983 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
1984 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
1985
1986 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
1987 dwCreateDisposition = OPEN_EXISTING;
1988 else
1989 dwCreateDisposition = CREATE_NEW;
1990
1991 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
1992 dwCreateDisposition, 0, NULL);
1993
1994 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
1995
1996 return (INT_PTR)handle;
1997 }
1998
1999 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2000 {
2001 HANDLE handle = (HANDLE)hf;
2002 DWORD dwRead;
2003 BOOL res;
2004
2005 res = ReadFile(handle, memory, cb, &dwRead, NULL);
2006 ok(res, "Failed to ReadFile\n");
2007
2008 return dwRead;
2009 }
2010
2011 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2012 {
2013 HANDLE handle = (HANDLE)hf;
2014 DWORD dwWritten;
2015 BOOL res;
2016
2017 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2018 ok(res, "Failed to WriteFile\n");
2019
2020 return dwWritten;
2021 }
2022
2023 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
2024 {
2025 HANDLE handle = (HANDLE)hf;
2026 ok(CloseHandle(handle), "Failed to CloseHandle\n");
2027
2028 return 0;
2029 }
2030
2031 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
2032 {
2033 HANDLE handle = (HANDLE)hf;
2034 DWORD ret;
2035
2036 ret = SetFilePointer(handle, dist, NULL, seektype);
2037 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2038
2039 return ret;
2040 }
2041
2042 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
2043 {
2044 BOOL ret = DeleteFileA(pszFile);
2045 ok(ret, "Failed to DeleteFile %s\n", pszFile);
2046
2047 return 0;
2048 }
2049
2050 static void init_functionpointers(void)
2051 {
2052 HMODULE hmsi = GetModuleHandleA("msi.dll");
2053 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2054 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2055
2056 #define GET_PROC(mod, func) \
2057 p ## func = (void*)GetProcAddress(mod, #func); \
2058 if(!p ## func) \
2059 trace("GetProcAddress(%s) failed\n", #func);
2060
2061 GET_PROC(hmsi, MsiQueryComponentStateA);
2062 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
2063 GET_PROC(hmsi, MsiGetComponentPathExA);
2064
2065 GET_PROC(hadvapi32, CheckTokenMembership);
2066 GET_PROC(hadvapi32, ConvertSidToStringSidA);
2067 GET_PROC(hadvapi32, OpenProcessToken);
2068 GET_PROC(hadvapi32, RegDeleteKeyExA)
2069 GET_PROC(hkernel32, IsWow64Process)
2070
2071 hsrclient = LoadLibraryA("srclient.dll");
2072 GET_PROC(hsrclient, SRRemoveRestorePoint);
2073 GET_PROC(hsrclient, SRSetRestorePointA);
2074
2075 #undef GET_PROC
2076 }
2077
2078 static BOOL is_process_limited(void)
2079 {
2080 SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
2081 PSID Group = NULL;
2082 BOOL IsInGroup;
2083 HANDLE token;
2084
2085 if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
2086
2087 if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
2088 DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
2089 !pCheckTokenMembership(NULL, Group, &IsInGroup))
2090 {
2091 trace("Could not check if the current user is an administrator\n");
2092 FreeSid(Group);
2093 return FALSE;
2094 }
2095 FreeSid(Group);
2096
2097 if (!IsInGroup)
2098 {
2099 /* Only administrators have enough privileges for these tests */
2100 return TRUE;
2101 }
2102
2103 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2104 {
2105 BOOL ret;
2106 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
2107 DWORD size;
2108
2109 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2110 CloseHandle(token);
2111 return (ret && type == TokenElevationTypeLimited);
2112 }
2113 return FALSE;
2114 }
2115
2116 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
2117 {
2118 CHAR buffer[0x20];
2119 UINT r;
2120 DWORD sz;
2121
2122 sz = sizeof buffer;
2123 r = MsiRecordGetStringA(rec, field, buffer, &sz);
2124 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
2125 }
2126
2127 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2128 {
2129 LPSTR tempname;
2130
2131 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2132 GetTempFileNameA(".", "xx", 0, tempname);
2133
2134 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2135 {
2136 lstrcpyA(pszTempName, tempname);
2137 HeapFree(GetProcessHeap(), 0, tempname);
2138 return TRUE;
2139 }
2140
2141 HeapFree(GetProcessHeap(), 0, tempname);
2142
2143 return FALSE;
2144 }
2145
2146 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2147 USHORT *pattribs, int *err, void *pv)
2148 {
2149 BY_HANDLE_FILE_INFORMATION finfo;
2150 FILETIME filetime;
2151 HANDLE handle;
2152 DWORD attrs;
2153 BOOL res;
2154
2155 handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2156 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2157
2158 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2159
2160 res = GetFileInformationByHandle(handle, &finfo);
2161 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2162
2163 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2164 FileTimeToDosDateTime(&filetime, pdate, ptime);
2165
2166 attrs = GetFileAttributesA(pszName);
2167 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2168
2169 return (INT_PTR)handle;
2170 }
2171
2172 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2173 {
2174 char path[MAX_PATH];
2175 char filename[MAX_PATH];
2176
2177 lstrcpyA(path, CURR_DIR);
2178 lstrcatA(path, "\\");
2179 lstrcatA(path, file);
2180
2181 lstrcpyA(filename, file);
2182
2183 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2184 progress, get_open_info, compress);
2185 }
2186
2187 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2188 {
2189 ZeroMemory(pCabParams, sizeof(CCAB));
2190
2191 pCabParams->cb = max_size;
2192 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2193 pCabParams->setID = 0xbeef;
2194 pCabParams->iCab = 1;
2195 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2196 lstrcatA(pCabParams->szCabPath, "\\");
2197 lstrcpyA(pCabParams->szCab, name);
2198 }
2199
2200 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2201 {
2202 CCAB cabParams;
2203 LPCSTR ptr;
2204 HFCI hfci;
2205 ERF erf;
2206 BOOL res;
2207
2208 set_cab_parameters(&cabParams, name, max_size);
2209
2210 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2211 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2212 get_temp_file, &cabParams, NULL);
2213
2214 ok(hfci != NULL, "Failed to create an FCI context\n");
2215
2216 ptr = files;
2217 while (*ptr)
2218 {
2219 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2220 ok(res, "Failed to add file: %s\n", ptr);
2221 ptr += lstrlenA(ptr) + 1;
2222 }
2223
2224 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2225 ok(res, "Failed to flush the cabinet\n");
2226
2227 res = FCIDestroy(hfci);
2228 ok(res, "Failed to destroy the cabinet\n");
2229 }
2230
2231 static BOOL get_user_dirs(void)
2232 {
2233 HKEY hkey;
2234 DWORD type, size;
2235
2236 if (RegOpenKeyA(HKEY_CURRENT_USER,
2237 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2238 return FALSE;
2239
2240 size = MAX_PATH;
2241 if(RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size)){
2242 RegCloseKey(hkey);
2243 return FALSE;
2244 }
2245
2246 RegCloseKey(hkey);
2247 return TRUE;
2248 }
2249
2250 static BOOL get_system_dirs(void)
2251 {
2252 HKEY hkey;
2253 DWORD type, size;
2254
2255 if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2256 return FALSE;
2257
2258 size = MAX_PATH;
2259 if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2260 RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size)) {
2261 RegCloseKey(hkey);
2262 return FALSE;
2263 }
2264
2265 size = MAX_PATH;
2266 if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2267 RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size)) {
2268 RegCloseKey(hkey);
2269 return FALSE;
2270 }
2271
2272 size = MAX_PATH;
2273 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR_NATIVE, &size)) {
2274 RegCloseKey(hkey);
2275 return FALSE;
2276 }
2277
2278 RegCloseKey(hkey);
2279
2280 if(!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH))
2281 return FALSE;
2282
2283 return TRUE;
2284 }
2285
2286 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2287 {
2288 HANDLE file;
2289 DWORD written;
2290
2291 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2292 if (file == INVALID_HANDLE_VALUE)
2293 return;
2294
2295 WriteFile(file, data, strlen(data), &written, NULL);
2296
2297 if (size)
2298 {
2299 SetFilePointer(file, size, NULL, FILE_BEGIN);
2300 SetEndOfFile(file);
2301 }
2302
2303 CloseHandle(file);
2304 }
2305
2306 #define create_file(name, size) create_file_data(name, name, size)
2307
2308 static void create_test_files(void)
2309 {
2310 CreateDirectoryA("msitest", NULL);
2311 create_file("msitest\\one.txt", 100);
2312 CreateDirectoryA("msitest\\first", NULL);
2313 create_file("msitest\\first\\two.txt", 100);
2314 CreateDirectoryA("msitest\\second", NULL);
2315 create_file("msitest\\second\\three.txt", 100);
2316
2317 create_file("four.txt", 100);
2318 create_file("five.txt", 100);
2319 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2320
2321 create_file("msitest\\filename", 100);
2322 create_file("msitest\\service.exe", 100);
2323
2324 DeleteFileA("four.txt");
2325 DeleteFileA("five.txt");
2326 }
2327
2328 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2329 {
2330 CHAR path[MAX_PATH];
2331
2332 lstrcpyA(path, PROG_FILES_DIR);
2333 lstrcatA(path, "\\");
2334 lstrcatA(path, rel_path);
2335
2336 if (is_file)
2337 return DeleteFileA(path);
2338 else
2339 return RemoveDirectoryA(path);
2340 }
2341
2342 static BOOL delete_pf_native(const CHAR *rel_path, BOOL is_file)
2343 {
2344 CHAR path[MAX_PATH];
2345
2346 lstrcpyA(path, PROG_FILES_DIR_NATIVE);
2347 lstrcatA(path, "\\");
2348 lstrcatA(path, rel_path);
2349
2350 if (is_file)
2351 return DeleteFileA(path);
2352 else
2353 return RemoveDirectoryA(path);
2354 }
2355
2356 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
2357 {
2358 CHAR path[MAX_PATH];
2359
2360 lstrcpyA(path, COMMON_FILES_DIR);
2361 lstrcatA(path, "\\");
2362 lstrcatA(path, rel_path);
2363
2364 if (is_file)
2365 return DeleteFileA(path);
2366 else
2367 return RemoveDirectoryA(path);
2368 }
2369
2370 static BOOL compare_pf_data(const char *filename, const char *data, DWORD size)
2371 {
2372 DWORD read;
2373 HANDLE handle;
2374 BOOL ret = FALSE;
2375 char *buffer, path[MAX_PATH];
2376
2377 lstrcpyA(path, PROG_FILES_DIR);
2378 lstrcatA(path, "\\");
2379 lstrcatA(path, filename);
2380
2381 handle = CreateFileA(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2382 buffer = HeapAlloc(GetProcessHeap(), 0, size);
2383 if (buffer)
2384 {
2385 ReadFile(handle, buffer, size, &read, NULL);
2386 if (read == size && !memcmp(data, buffer, size)) ret = TRUE;
2387 HeapFree(GetProcessHeap(), 0, buffer);
2388 }
2389 CloseHandle(handle);
2390 return ret;
2391 }
2392
2393 static void delete_test_files(void)
2394 {
2395 DeleteFileA("msitest.msi");
2396 DeleteFileA("msitest.cab");
2397 DeleteFileA("msitest\\second\\three.txt");
2398 DeleteFileA("msitest\\first\\two.txt");
2399 DeleteFileA("msitest\\one.txt");
2400 DeleteFileA("msitest\\service.exe");
2401 DeleteFileA("msitest\\filename");
2402 RemoveDirectoryA("msitest\\second");
2403 RemoveDirectoryA("msitest\\first");
2404 RemoveDirectoryA("msitest");
2405 }
2406
2407 static void write_file(const CHAR *filename, const char *data, int data_size)
2408 {
2409 DWORD size;
2410
2411 HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
2412 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2413 WriteFile(hf, data, data_size, &size, NULL);
2414 CloseHandle(hf);
2415 }
2416
2417 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount,
2418 const char *template, const char *packagecode)
2419 {
2420 MSIHANDLE summary;
2421 UINT r;
2422
2423 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2424 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2425
2426 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2427 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2428
2429 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL, packagecode);
2430 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2431
2432 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL);
2433 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2434
2435 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2436 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2437
2438 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2439 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2440
2441 /* write the summary changes back to the stream */
2442 r = MsiSummaryInfoPersist(summary);
2443 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2444
2445 MsiCloseHandle(summary);
2446 }
2447
2448 #define create_database(name, tables, num_tables) \
2449 create_database_wordcount(name, tables, num_tables, 100, 0, ";1033", \
2450 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2451
2452 #define create_database_template(name, tables, num_tables, version, template) \
2453 create_database_wordcount(name, tables, num_tables, version, 0, template, \
2454 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2455
2456 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2457 int num_tables, INT version, INT wordcount,
2458 const char *template, const char *packagecode)
2459 {
2460 MSIHANDLE db;
2461 UINT r;
2462 WCHAR *nameW;
2463 int j, len;
2464
2465 len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2466 if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
2467 MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2468
2469 r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
2470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2471
2472 /* import the tables into the database */
2473 for (j = 0; j < num_tables; j++)
2474 {
2475 const msi_table *table = &tables[j];
2476
2477 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2478
2479 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2480 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2481
2482 DeleteFileA(table->filename);
2483 }
2484
2485 write_msi_summary_info(db, version, wordcount, template, packagecode);
2486
2487 r = MsiDatabaseCommit(db);
2488 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2489
2490 MsiCloseHandle(db);
2491 HeapFree( GetProcessHeap(), 0, nameW );
2492 }
2493
2494 static void check_service_is_installed(void)
2495 {
2496 SC_HANDLE scm, service;
2497 BOOL res;
2498
2499 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
2500 ok(scm != NULL, "Failed to open the SC Manager\n");
2501
2502 service = OpenServiceA(scm, "TestService", SC_MANAGER_ALL_ACCESS);
2503 ok(service != NULL, "Failed to open TestService\n");
2504
2505 res = DeleteService(service);
2506 ok(res, "Failed to delete TestService\n");
2507
2508 CloseServiceHandle(service);
2509 CloseServiceHandle(scm);
2510 }
2511
2512 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2513 {
2514 RESTOREPOINTINFOA spec;
2515
2516 spec.dwEventType = event_type;
2517 spec.dwRestorePtType = APPLICATION_INSTALL;
2518 spec.llSequenceNumber = status->llSequenceNumber;
2519 lstrcpyA(spec.szDescription, "msitest restore point");
2520
2521 return pSRSetRestorePointA(&spec, status);
2522 }
2523
2524 static void remove_restore_point(DWORD seq_number)
2525 {
2526 DWORD res;
2527
2528 res = pSRRemoveRestorePoint(seq_number);
2529 if (res != ERROR_SUCCESS)
2530 trace("Failed to remove the restore point : %08x\n", res);
2531 }
2532
2533 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
2534 {
2535 if (pRegDeleteKeyExA)
2536 return pRegDeleteKeyExA( key, subkey, access, 0 );
2537 return RegDeleteKeyA( key, subkey );
2538 }
2539
2540 static void test_MsiInstallProduct(void)
2541 {
2542 UINT r;
2543 CHAR path[MAX_PATH];
2544 LONG res;
2545 HKEY hkey;
2546 DWORD num, size, type;
2547 REGSAM access = KEY_ALL_ACCESS;
2548
2549 if (is_process_limited())
2550 {
2551 skip("process is limited\n");
2552 return;
2553 }
2554
2555 if (is_wow64)
2556 access |= KEY_WOW64_64KEY;
2557
2558 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2559
2560 /* szPackagePath is NULL */
2561 r = MsiInstallProductA(NULL, "INSTALL=ALL");
2562 ok(r == ERROR_INVALID_PARAMETER,
2563 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2564
2565 /* both szPackagePath and szCommandLine are NULL */
2566 r = MsiInstallProductA(NULL, NULL);
2567 ok(r == ERROR_INVALID_PARAMETER,
2568 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2569
2570 /* szPackagePath is empty */
2571 r = MsiInstallProductA("", "INSTALL=ALL");
2572 ok(r == ERROR_PATH_NOT_FOUND,
2573 "Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
2574
2575 create_test_files();
2576 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2577
2578 /* install, don't publish */
2579 r = MsiInstallProductA(msifile, NULL);
2580 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2581 {
2582 skip("Not enough rights to perform tests\n");
2583 goto error;
2584 }
2585 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2586
2587 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2588 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2589 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2590 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2591 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2592 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2593 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2594 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2595 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2596 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2597 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2598 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2599
2600 res = RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", 0, access, &hkey);
2601 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2602
2603 size = MAX_PATH;
2604 type = REG_SZ;
2605 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
2606 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2607 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
2608
2609 size = MAX_PATH;
2610 type = REG_SZ;
2611 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
2612 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2613
2614 size = sizeof(num);
2615 type = REG_DWORD;
2616 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
2617 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2618 ok(num == 314, "Expected 314, got %d\n", num);
2619
2620 size = MAX_PATH;
2621 type = REG_SZ;
2622 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
2623 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2624 ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
2625
2626 check_service_is_installed();
2627
2628 delete_key(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", access);
2629
2630 /* not published, reinstall */
2631 r = MsiInstallProductA(msifile, NULL);
2632 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2633
2634 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2635 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2636 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2637 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2638 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2639 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2640 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2641 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2642 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2643 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2644 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2645 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2646
2647 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2648 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2649 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2650
2651 create_database(msifile, up_tables, sizeof(up_tables) / sizeof(msi_table));
2652
2653 /* not published, RemovePreviousVersions set */
2654 r = MsiInstallProductA(msifile, NULL);
2655 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2656
2657 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2658 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2659 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2660 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2661 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2662 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2663 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2664 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2665 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2666 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2667 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2668 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2669
2670 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2671 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2672 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2673
2674 create_database(msifile, up2_tables, sizeof(up2_tables) / sizeof(msi_table));
2675
2676 /* not published, version number bumped */
2677 r = MsiInstallProductA(msifile, NULL);
2678 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2679
2680 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2681 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2682 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2683 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2684 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2685 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2686 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2687 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2688 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2689 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2690 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2691 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2692
2693 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2694 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2695 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2696
2697 create_database(msifile, up3_tables, sizeof(up3_tables) / sizeof(msi_table));
2698
2699 /* not published, RemovePreviousVersions set and version number bumped */
2700 r = MsiInstallProductA(msifile, NULL);
2701 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2702
2703 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2704 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2705 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2706 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2707 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2708 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2709 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2710 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2711 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2712 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2713 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2714 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2715
2716 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2717 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2718 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2719
2720 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2721
2722 /* install, publish product */
2723 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2724 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2725
2726 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2727 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2728 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2729 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2730 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2731 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2732 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2733 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2734 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2735 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2736 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2737 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2738
2739 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2740 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2741
2742 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2743
2744 /* published, reinstall */
2745 r = MsiInstallProductA(msifile, NULL);
2746 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2747
2748 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2749 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2750 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2751 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2752 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2753 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2754 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2755 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2756 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2757 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2758 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2759 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2760
2761 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2762 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2763
2764 create_database(msifile, up5_tables, sizeof(up5_tables) / sizeof(msi_table));
2765
2766 /* published product, RemovePreviousVersions set */
2767 r = MsiInstallProductA(msifile, NULL);
2768 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2769
2770 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2771 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2772 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2773 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2774 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2775 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2776 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2777 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2778 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2779 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2780 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2781 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2782
2783 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2784 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2785
2786 create_database(msifile, up6_tables, sizeof(up6_tables) / sizeof(msi_table));
2787
2788 /* published product, version number bumped */
2789 r = MsiInstallProductA(msifile, NULL);
2790 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2791
2792 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2793 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2794 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2795 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2796 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2797 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2798 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2799 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2800 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2801 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2802 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2803 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2804
2805 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2806 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2807
2808 create_database(msifile, up7_tables, sizeof(up7_tables) / sizeof(msi_table));
2809
2810 /* published product, RemovePreviousVersions set and version number bumped */
2811 r = MsiInstallProductA(msifile, NULL);
2812 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2813
2814 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2815 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2816 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2817 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2818 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2819 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2820 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2821 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2822 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2823 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2824 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2825 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2826
2827 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2828 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2829
2830 r = MsiInstallProductA(msifile, "REMOVE=ALL");
2831 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2832
2833 error:
2834 delete_test_files();
2835 DeleteFileA(msifile);
2836 }
2837
2838 static void test_MsiSetComponentState(void)
2839 {
2840 INSTALLSTATE installed, action;
2841 MSIHANDLE package;
2842 char path[MAX_PATH];
2843 UINT r;
2844
2845 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2846
2847 CoInitialize(NULL);
2848
2849 lstrcpyA(path, CURR_DIR);
2850 lstrcatA(path, "\\");
2851 lstrcatA(path, msifile);
2852
2853 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2854
2855 r = MsiOpenPackageA(path, &package);
2856 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2857 {
2858 skip("Not enough rights to perform tests\n");
2859 goto error;
2860 }
2861 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2862
2863 r = MsiDoActionA(package, "CostInitialize");
2864 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2865
2866 r = MsiDoActionA(package, "FileCost");
2867 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2868
2869 r = MsiDoActionA(package, "CostFinalize");
2870 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2871
2872 r = MsiGetComponentStateA(package, "dangler", &installed, &action);
2873 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2874 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
2875 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2876
2877 r = MsiSetComponentStateA(package, "dangler", INSTALLSTATE_SOURCE);
2878 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2879
2880 MsiCloseHandle(package);
2881
2882 error:
2883 CoUninitialize();
2884 DeleteFileA(msifile);
2885 }
2886
2887 static void test_packagecoltypes(void)
2888 {
2889 MSIHANDLE hdb, view, rec;
2890 char path[MAX_PATH];
2891 WCHAR pathW[MAX_PATH];
2892 LPCSTR query;
2893 UINT r, count;
2894
2895 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2896
2897 CoInitialize(NULL);
2898
2899 lstrcpyA(path, CURR_DIR);
2900 lstrcatA(path, "\\");
2901 lstrcatA(path, msifile);
2902 MultiByteToWideChar( CP_ACP, 0, path, -1, pathW, MAX_PATH );
2903
2904 r = MsiOpenDatabaseW(pathW, MSIDBOPEN_READONLY, &hdb);
2905 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2906
2907 query = "SELECT * FROM `Media`";
2908 r = MsiDatabaseOpenViewA( hdb, query, &view );
2909 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2910
2911 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
2912 count = MsiRecordGetFieldCount( rec );
2913 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2914 ok(count == 6, "Expected 6, got %d\n", count);
2915 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
2916 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
2917 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
2918 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
2919 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
2920 ok(check_record(rec, 6, "Source"), "wrong column label\n");
2921 MsiCloseHandle(rec);
2922
2923 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
2924 count = MsiRecordGetFieldCount( rec );
2925 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2926 ok(count == 6, "Expected 6, got %d\n", count);
2927 ok(check_record(rec, 1, "i2"), "wrong column label\n");
2928 ok(check_record(rec, 2, "i4"), "wrong column label\n");
2929 ok(check_record(rec, 3, "L64"), "wrong column label\n");
2930 ok(check_record(rec, 4, "S255"), "wrong column label\n");
2931 ok(check_record(rec, 5, "S32"), "wrong column label\n");
2932 ok(check_record(rec, 6, "S72"), "wrong column label\n");
2933
2934 MsiCloseHandle(rec);
2935 MsiCloseHandle(view);
2936 MsiCloseHandle(hdb);
2937 CoUninitialize();
2938
2939 DeleteFileA(msifile);
2940 }
2941
2942 static void create_cc_test_files(void)
2943 {
2944 CCAB cabParams;
2945 HFCI hfci;
2946 ERF erf;
2947 static CHAR cab_context[] = "test%d.cab";
2948 BOOL res;
2949
2950 create_file("maximus", 500);
2951 create_file("augustus", 50000);
2952 create_file("tiberius", 500);
2953 create_file("caesar", 500);
2954
2955 set_cab_parameters(&cabParams, "test1.cab", 40000);
2956
2957 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2958 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2959 get_temp_file, &cabParams, cab_context);
2960 ok(hfci != NULL, "Failed to create an FCI context\n");
2961
2962 res = add_file(hfci, "maximus", tcompTYPE_NONE);
2963 ok(res, "Failed to add file maximus\n");
2964
2965 res = add_file(hfci, "augustus", tcompTYPE_NONE);
2966 ok(res, "Failed to add file augustus\n");
2967
2968 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
2969 ok(res, "Failed to add file tiberius\n");
2970
2971 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2972 ok(res, "Failed to flush the cabinet\n");
2973
2974 res = FCIDestroy(hfci);
2975 ok(res, "Failed to destroy the cabinet\n");
2976
2977 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2978
2979 DeleteFileA("maximus");
2980 DeleteFileA("augustus");
2981 DeleteFileA("tiberius");
2982 DeleteFileA("caesar");
2983 }
2984
2985 static void delete_cab_files(void)
2986 {
2987 SHFILEOPSTRUCTA shfl;
2988 CHAR path[MAX_PATH+10];
2989
2990 lstrcpyA(path, CURR_DIR);
2991 lstrcatA(path, "\\*.cab");
2992 path[strlen(path) + 1] = '\0';
2993
2994 shfl.hwnd = NULL;
2995 shfl.wFunc = FO_DELETE;
2996 shfl.pFrom = path;
2997 shfl.pTo = NULL;
2998 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
2999
3000 SHFileOperationA(&shfl);
3001 }
3002
3003 static void test_continuouscabs(void)
3004 {
3005 UINT r;
3006
3007 if (is_process_limited())
3008 {
3009 skip("process is limited\n");
3010 return;
3011 }
3012
3013 create_cc_test_files();
3014 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
3015
3016 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3017
3018 r = MsiInstallProductA(msifile, NULL);
3019 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3020 {
3021 skip("Not enough rights to perform tests\n");
3022 goto error;
3023 }
3024 else
3025 {
3026 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3027 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3028 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3029 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3030 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3031 }
3032
3033 delete_cab_files();
3034 DeleteFileA(msifile);
3035
3036 create_cc_test_files();
3037 create_database(msifile, cc2_tables, sizeof(cc2_tables) / sizeof(msi_table));
3038
3039 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3040
3041 r = MsiInstallProductA(msifile, NULL);
3042 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3043 {
3044 skip("Not enough rights to perform tests\n");
3045 }
3046 else
3047 {
3048 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3049 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3050 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3051 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
3052 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3053 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3054 }
3055
3056 delete_cab_files();
3057 DeleteFileA(msifile);
3058
3059 /* Tests to show that only msi cab filename is taken in case of mismatch with the one given by previous cab */
3060
3061 /* Filename from cab is right and the one from msi is wrong */
3062 create_cc_test_files();
3063 create_database(msifile, cc3_tables, sizeof(cc3_tables) / sizeof(msi_table));
3064
3065 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3066
3067 r = MsiInstallProductA(msifile, NULL);
3068 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3069 {
3070 skip("Not enough rights to perform tests\n");
3071 }
3072 else
3073 {
3074 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3075 todo_wine ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3076 ok(!delete_pf("msitest\\caesar", TRUE), "File installed\n");
3077 todo_wine ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
3078 todo_wine ok(!delete_pf("msitest", FALSE), "Directory created\n");
3079 }
3080
3081 delete_cab_files();
3082 DeleteFileA(msifile);
3083
3084 /* Filename from msi is right and the one from cab is wrong */
3085 create_cc_test_files();
3086 ok(MoveFileA("test2.cab", "test2_.cab"), "Cannot rename test2.cab to test2_.cab\n");
3087 create_database(msifile, cc3_tables, sizeof(cc3_tables) / sizeof(msi_table));
3088
3089 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3090
3091 r = MsiInstallProductA(msifile, NULL);
3092 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3093 {
3094 skip("Not enough rights to perform tests\n");
3095 }
3096 else
3097 {
3098 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3099 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3100 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3101 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3102 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3103 }
3104
3105 error:
3106 delete_cab_files();
3107 DeleteFileA(msifile);
3108 }
3109
3110 static void test_caborder(void)
3111 {
3112 UINT r;
3113
3114 create_file("imperator", 100);
3115 create_file("maximus", 500);
3116 create_file("augustus", 50000);
3117 create_file("caesar", 500);
3118
3119 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
3120
3121 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3122
3123 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3124 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3125 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3126
3127 r = MsiInstallProductA(msifile, NULL);
3128 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3129 {
3130 skip("Not enough rights to perform tests\n");
3131 goto error;
3132 }
3133 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3134 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3135 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3136 todo_wine
3137 {
3138 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3139 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3140 }
3141
3142 delete_cab_files();
3143
3144 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
3145 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
3146 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3147
3148 r = MsiInstallProductA(msifile, NULL);
3149 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3150 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3151 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3152 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3153 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3154
3155 delete_cab_files();
3156 DeleteFileA(msifile);
3157
3158 create_cc_test_files();
3159 create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
3160
3161 r = MsiInstallProductA(msifile, NULL);
3162 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3163 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3164 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3165 todo_wine
3166 {
3167 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3168 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3169 }
3170
3171 delete_cab_files();
3172 DeleteFileA(msifile);
3173
3174 create_cc_test_files();
3175 create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
3176
3177 r = MsiInstallProductA(msifile, NULL);
3178 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3179 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3180 todo_wine
3181 {
3182 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3183 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3184 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3185 }
3186
3187 error:
3188 delete_cab_files();
3189 DeleteFileA("imperator");
3190 DeleteFileA("maximus");
3191 DeleteFileA("augustus");
3192 DeleteFileA("caesar");
3193 DeleteFileA(msifile);
3194 }
3195
3196 static void test_mixedmedia(void)
3197 {
3198 UINT r;
3199
3200 if (is_process_limited())
3201 {
3202 skip("process is limited\n");
3203 return;
3204 }
3205
3206 CreateDirectoryA("msitest", NULL);
3207 create_file("msitest\\maximus", 500);
3208 create_file("msitest\\augustus", 500);
3209 create_file("caesar", 500);
3210
3211 create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
3212
3213 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3214
3215 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
3216
3217 r = MsiInstallProductA(msifile, NULL);
3218 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3219 {
3220 skip("Not enough rights to perform tests\n");
3221 goto error;
3222 }
3223 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3224 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3225 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3226 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3227 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3228
3229 error:
3230 /* Delete the files in the temp (current) folder */
3231 DeleteFileA("msitest\\maximus");
3232 DeleteFileA("msitest\\augustus");
3233 RemoveDirectoryA("msitest");
3234 DeleteFileA("caesar");
3235 DeleteFileA("test1.cab");
3236 DeleteFileA(msifile);
3237 }
3238
3239 static void test_samesequence(void)
3240 {
3241 UINT r;
3242
3243 create_cc_test_files();
3244 create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
3245
3246 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3247
3248 r = MsiInstallProductA(msifile, NULL);
3249 if (r == ERROR_INSTALL_FAILURE)
3250 {
3251 win_skip("unprivileged user?\n");
3252 goto error;
3253 }
3254 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3255 if (r == ERROR_SUCCESS)
3256 {
3257 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3258 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3259 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3260 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3261 }
3262
3263 error:
3264 delete_cab_files();
3265 DeleteFileA(msifile);
3266 }
3267
3268 static void test_uiLevelFlags(void)
3269 {
3270 UINT r;
3271
3272 create_cc_test_files();
3273 create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
3274
3275 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
3276
3277 r = MsiInstallProductA(msifile, NULL);
3278 if (r == ERROR_INSTALL_FAILURE)
3279 {
3280 win_skip("unprivileged user?\n");
3281 goto error;
3282 }
3283
3284 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3285 if (r == ERROR_SUCCESS)
3286 {
3287 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
3288 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3289 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3290 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3291 }
3292
3293 error:
3294 delete_cab_files();
3295 DeleteFileA(msifile);
3296 }
3297
3298 static BOOL file_matches(LPSTR path)
3299 {
3300 CHAR buf[MAX_PATH];
3301 HANDLE file;
3302 DWORD size;
3303
3304 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3305 NULL, OPEN_EXISTING, 0, NULL);
3306 ZeroMemory(buf, MAX_PATH);
3307 ReadFile(file, buf, 15, &size, NULL);
3308 CloseHandle(file);
3309
3310 return !lstrcmpA(buf, "msitest\\maximus");
3311 }
3312
3313 static void test_readonlyfile(void)
3314 {
3315 UINT r;
3316 DWORD size;
3317 HANDLE file;
3318 CHAR path[MAX_PATH];
3319
3320 if (is_process_limited())
3321 {
3322 skip("process is limited\n");
3323 return;
3324 }
3325
3326 CreateDirectoryA("msitest", NULL);
3327 create_file("msitest\\maximus", 500);
3328 create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
3329
3330 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3331
3332 lstrcpyA(path, PROG_FILES_DIR);
3333 lstrcatA(path, "\\msitest");
3334 CreateDirectoryA(path, NULL);
3335
3336 lstrcatA(path, "\\maximus");
3337 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3338 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3339
3340 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3341 CloseHandle(file);
3342
3343 r = MsiInstallProductA(msifile, NULL);
3344 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3345 {
3346 skip("Not enough rights to perform tests\n");
3347 goto error;
3348 }
3349 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3350 ok(file_matches(path), "Expected file to be overwritten\n");
3351 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3352 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3353
3354 error:
3355 /* Delete the files in the temp (current) folder */
3356 DeleteFileA("msitest\\maximus");
3357 RemoveDirectoryA("msitest");
3358 DeleteFileA(msifile);
3359 }
3360
3361 static void test_readonlyfile_cab(void)
3362 {
3363 UINT r;
3364 DWORD size;
3365 HANDLE file;
3366 CHAR path[MAX_PATH];
3367 CHAR buf[16];
3368
3369 if (is_process_limited())
3370 {
3371 skip("process is limited\n");
3372 return;
3373 }
3374
3375 CreateDirectoryA("msitest", NULL);
3376 create_file("maximus", 500);
3377 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3378 DeleteFileA("maximus");
3379
3380 create_database(msifile, rofc_tables, sizeof(rofc_tables) / sizeof(msi_table));
3381
3382 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3383
3384 lstrcpyA(path, PROG_FILES_DIR);
3385 lstrcatA(path, "\\msitest");
3386 CreateDirectoryA(path, NULL);
3387
3388 lstrcatA(path, "\\maximus");
3389 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3390 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3391
3392 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3393 CloseHandle(file);
3394
3395 r = MsiInstallProductA(msifile, NULL);
3396 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3397 {
3398 skip("Not enough rights to perform tests\n");
3399 goto error;
3400 }
3401 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3402
3403 memset( buf, 0, sizeof(buf) );
3404 if ((file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3405 NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
3406 {
3407 ReadFile(file, buf, sizeof(buf) - 1, &size, NULL);
3408 CloseHandle(file);
3409 }
3410 ok(!memcmp( buf, "maximus", sizeof("maximus")-1 ), "Expected file to be overwritten, got '%s'\n", buf);
3411 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3412 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3413
3414 error:
3415 /* Delete the files in the temp (current) folder */
3416 delete_cab_files();
3417 DeleteFileA("msitest\\maximus");
3418 RemoveDirectoryA("msitest");
3419 DeleteFileA(msifile);
3420 }
3421
3422 static void test_setdirproperty(void)
3423 {
3424 UINT r;
3425
3426 if (is_process_limited())
3427 {
3428 skip("process is limited\n");
3429 return;
3430 }
3431
3432 CreateDirectoryA("msitest", NULL);
3433 create_file("msitest\\maximus", 500);
3434 create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
3435
3436 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3437
3438 r = MsiInstallProductA(msifile, NULL);
3439 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3440 {
3441 skip("Not enough rights to perform tests\n");
3442 goto error;
3443 }
3444 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3445 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
3446 ok(delete_cf("msitest", FALSE), "Directory not created\n");
3447
3448 error:
3449 /* Delete the files in the temp (current) folder */
3450 DeleteFileA(msifile);
3451 DeleteFileA("msitest\\maximus");
3452 RemoveDirectoryA("msitest");
3453 }
3454
3455 static void test_cabisextracted(void)
3456 {
3457 UINT r;
3458
3459 if (is_process_limited())
3460 {
3461 skip("process is limited\n");
3462 return;
3463 }
3464
3465 CreateDirectoryA("msitest", NULL);
3466 create_file("msitest\\gaius", 500);
3467 create_file("maximus", 500);
3468 create_file("augustus", 500);
3469 create_file("caesar", 500);
3470
3471 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3472 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3473 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3474
3475 create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
3476
3477 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3478
3479 r = MsiInstallProductA(msifile, NULL);
3480 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3481 {
3482 skip("Not enough rights to perform tests\n");
3483 goto error;
3484 }
3485 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3486 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3487 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3488 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3489 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
3490 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3491
3492 error:
3493 /* Delete the files in the temp (current) folder */
3494 delete_cab_files();
3495 DeleteFileA(msifile);
3496 DeleteFileA("maximus");
3497 DeleteFileA("augustus");
3498 DeleteFileA("caesar");
3499 DeleteFileA("msitest\\gaius");
3500 RemoveDirectoryA("msitest");
3501 }
3502
3503 static BOOL file_exists(LPCSTR file)
3504 {
3505 return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES;
3506 }
3507
3508 static BOOL pf_exists(LPCSTR file)
3509 {
3510 CHAR path[MAX_PATH];
3511
3512 lstrcpyA(path, PROG_FILES_DIR);
3513 lstrcatA(path, "\\");
3514 lstrcatA(path, file);
3515
3516 return file_exists(path);
3517 }
3518
3519 static void delete_pfmsitest_files(void)
3520 {
3521 SHFILEOPSTRUCTA shfl;
3522 CHAR path[MAX_PATH+11];
3523
3524 lstrcpyA(path, PROG_FILES_DIR);
3525 lstrcatA(path, "\\msitest\\*");
3526 path[strlen(path) + 1] = '\0';
3527
3528 shfl.hwnd = NULL;
3529 shfl.wFunc = FO_DELETE;
3530 shfl.pFrom = path;
3531 shfl.pTo = NULL;
3532 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT | FOF_NOERRORUI;
3533
3534 SHFileOperationA(&shfl);
3535
3536 lstrcpyA(path, PROG_FILES_DIR);
3537 lstrcatA(path, "\\msitest");
3538 RemoveDirectoryA(path);
3539 }
3540
3541 static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
3542 {
3543 MSIHANDLE hview = 0;
3544 UINT r;
3545
3546 r = MsiDatabaseOpenViewA(hdb, query, &hview);
3547 if(r != ERROR_SUCCESS)
3548 return r;
3549
3550 r = MsiViewExecute(hview, hrec);
3551 if(r == ERROR_SUCCESS)
3552 r = MsiViewClose(hview);
3553 MsiCloseHandle(hview);
3554 return r;
3555 }
3556
3557 static void set_transform_summary_info(void)
3558 {
3559 UINT r;
3560 MSIHANDLE suminfo = 0;
3561
3562 /* build summary info */
3563 r = MsiGetSummaryInformationA(0, mstfile, 3, &suminfo);
3564 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
3565
3566 r = MsiSummaryInfoSetPropertyA(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
3567 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3568
3569 r = MsiSummaryInfoSetPropertyA(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
3570 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3571 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3572 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
3573 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
3574
3575 r = MsiSummaryInfoSetPropertyA(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
3576 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3577
3578 r = MsiSummaryInfoPersist(suminfo);
3579 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
3580
3581 r = MsiCloseHandle(suminfo);
3582 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
3583 }
3584
3585 static void generate_transform(void)
3586 {
3587 MSIHANDLE hdb1, hdb2;
3588 LPCSTR query;
3589 UINT r;
3590
3591 /* start with two identical databases */
3592 CopyFileA(msifile, msifile2, FALSE);
3593
3594 r = MsiOpenDatabaseW(msifile2W, MSIDBOPEN_TRANSACT, &hdb1);
3595 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3596
3597 r = MsiDatabaseCommit(hdb1);
3598 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
3599
3600 r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_READONLY, &hdb2);
3601 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3602
3603 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
3604 r = run_query(hdb1, 0, query);
3605 ok(r == ERROR_SUCCESS, "failed to add property\n");
3606
3607 /* database needs to be committed */
3608 MsiDatabaseCommit(hdb1);
3609
3610 r = MsiDatabaseGenerateTransformA(hdb1, hdb2, mstfile, 0, 0);
3611 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3612
3613 r = MsiCreateTransformSummaryInfoA(hdb2, hdb2, mstfile, 0, 0);
3614 todo_wine ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3615
3616 MsiCloseHandle(hdb1);
3617 MsiCloseHandle(hdb2);
3618 }
3619
3620 /* data for generating a transform */
3621
3622 /* tables transform names - encoded as they would be in an msi database file */
3623 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
3624 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
3625 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
3626
3627 /* data in each table */
3628 static const char data1[] = /* _StringData */
3629 "propval"; /* all the strings squashed together */
3630
3631 static const WCHAR data2[] = { /* _StringPool */
3632 /* len, refs */
3633 0, 0, /* string 0 '' */
3634 4, 1, /* string 1 'prop' */
3635 3, 1, /* string 2 'val' */
3636 };
3637
3638 static const WCHAR data3[] = { /* Property */
3639 0x0201, 0x0001, 0x0002,
3640 };
3641
3642 static const struct {
3643 LPCWSTR name;
3644 const void *data;
3645 DWORD size;
3646 } table_transform_data[] =
3647 {
3648 { name1, data1, sizeof data1 - 1 },
3649 { name2, data2, sizeof data2 },
3650 { name3, data3, sizeof data3 },
3651 };
3652
3653 #define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
3654
3655 static void generate_transform_manual(void)
3656 {
3657 IStorage *stg = NULL;
3658 IStream *stm;
3659 WCHAR name[0x20];
3660 HRESULT r;
3661 DWORD i, count;
3662 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
3663
3664 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
3665
3666 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
3667
3668 r = StgCreateDocfile(name, mode, 0, &stg);
3669 ok(r == S_OK, "failed to create storage\n");
3670 if (!stg)
3671 return;
3672
3673 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
3674 ok(r == S_OK, "failed to set storage type\n");
3675
3676 for (i=0; i<NUM_TRANSFORM_TABLES; i++)
3677 {
3678 r = IStorage_CreateStream(stg, table_transform_data[i].name,
3679 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3680 if (FAILED(r))
3681 {
3682 ok(0, "failed to create stream %08x\n", r);
3683 continue;
3684 }
3685
3686 r = IStream_Write(stm, table_transform_data[i].data,
3687 table_transform_data[i].size, &count);
3688 if (FAILED(r) || count != table_transform_data[i].size)
3689 ok(0, "failed to write stream\n");
3690 IStream_Release(stm);
3691 }
3692
3693 IStorage_Release(stg);
3694
3695 set_transform_summary_info();
3696 }
3697
3698 static void test_transformprop(void)
3699 {
3700 UINT r;
3701
3702 if (is_process_limited())
3703 {
3704 skip("process is limited\n");
3705 return;
3706 }
3707
3708 CreateDirectoryA("msitest", NULL);
3709 create_file("msitest\\augustus", 500);
3710
3711 create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
3712
3713 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3714
3715 r = MsiInstallProductA(msifile, NULL);
3716 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3717 {
3718 skip("Not enough rights to perform tests\n");
3719 goto error;
3720 }
3721 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3722 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3723 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3724
3725 if (0)
3726 generate_transform();
3727 else
3728 generate_transform_manual();
3729
3730 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
3731 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3732 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3733 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3734
3735 error:
3736 /* Delete the files in the temp (current) folder */
3737 DeleteFileA(msifile);
3738 DeleteFileA(msifile2);
3739 DeleteFileA(mstfile);
3740 DeleteFileA("msitest\\augustus");
3741 RemoveDirectoryA("msitest");
3742 }
3743
3744 static void test_currentworkingdir(void)
3745 {
3746 UINT r;
3747 CHAR drive[MAX_PATH], path[MAX_PATH];
3748 LPSTR ptr;
3749
3750 if (is_process_limited())
3751 {
3752 skip("process is limited\n");
3753 return;
3754 }
3755
3756 CreateDirectoryA("msitest", NULL);
3757 create_file("msitest\\augustus", 500);
3758
3759 create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
3760
3761 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3762
3763 CreateDirectoryA("diffdir", NULL);
3764 SetCurrentDirectoryA("diffdir");
3765
3766 sprintf(path, "..\\%s", msifile);
3767 r = MsiInstallProductA(path, NULL);
3768 todo_wine
3769 {
3770 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
3771 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3772 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3773 }
3774
3775 sprintf(path, "%s\\%s", CURR_DIR, msifile);
3776 r = MsiInstallProductA(path, NULL);
3777 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3778 {
3779 skip("Not enough rights to perform tests\n");
3780 goto error;
3781 }
3782 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3783 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3784 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3785
3786 lstrcpyA(drive, CURR_DIR);
3787 drive[2] = '\\';
3788 drive[3] = '\0';
3789 SetCurrentDirectoryA(drive);
3790
3791 lstrcpyA(path, CURR_DIR);
3792 if (path[lstrlenA(path) - 1] != '\\') lstrcatA(path, "\\");
3793 lstrcatA(path, msifile);
3794 ptr = strchr(path, ':');
3795 ptr +=2;
3796
3797 r = MsiInstallProductA(ptr, NULL);
3798 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3799 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3800 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3801
3802 error:
3803 SetCurrentDirectoryA(CURR_DIR);
3804 DeleteFileA(msifile);
3805 DeleteFileA("msitest\\augustus");
3806 RemoveDirectoryA("msitest");
3807 RemoveDirectoryA("diffdir");
3808 }
3809
3810 static void set_admin_summary_info(const WCHAR *name)
3811 {
3812 MSIHANDLE db, summary;
3813 UINT r;
3814
3815 r = MsiOpenDatabaseW(name, MSIDBOPEN_DIRECT, &db);
3816 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3817
3818 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
3819 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3820
3821 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
3822 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3823
3824 /* write the summary changes back to the stream */
3825 r = MsiSummaryInfoPersist(summary);
3826 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3827
3828 MsiCloseHandle(summary);
3829
3830 r = MsiDatabaseCommit(db);
3831 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3832
3833 MsiCloseHandle(db);
3834 }
3835
3836 static void test_admin(void)
3837 {
3838 UINT r;
3839
3840 CreateDirectoryA("msitest", NULL);
3841 create_file("msitest\\augustus", 500);
3842
3843 create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
3844 set_admin_summary_info(msifileW);
3845
3846 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3847
3848 r = MsiInstallProductA(msifile, NULL);
3849 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3850 {
3851 skip("Not enough rights to perform tests\n");
3852 goto error;
3853 }
3854 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3855 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3856 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3857 ok(!DeleteFileA("c:\\msitest\\augustus"), "File installed\n");
3858 ok(!RemoveDirectoryA("c:\\msitest"), "File installed\n");
3859
3860 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
3861 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3862 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3863 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3864 todo_wine
3865 {
3866 ok(DeleteFileA("c:\\msitest\\augustus"), "File not installed\n");
3867 ok(RemoveDirectoryA("c:\\msitest"), "File not installed\n");
3868 }
3869
3870 error:
3871 DeleteFileA(msifile);
3872 DeleteFileA("msitest\\augustus");
3873 RemoveDirectoryA("msitest");
3874 }
3875
3876 static void set_admin_property_stream(LPCSTR file)
3877 {
3878 IStorage *stg;
3879 IStream *stm;
3880 WCHAR fileW[MAX_PATH];
3881 HRESULT hr;
3882 DWORD count;
3883 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
3884
3885 /* AdminProperties */
3886 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
3887 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',' ',
3888 'M','y','P','r','o','p','=','4','2',0};
3889
3890 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
3891
3892 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
3893 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3894 if (!stg)
3895 return;
3896
3897 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3898 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3899
3900 hr = IStream_Write(stm, data, sizeof(data), &count);
3901 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3902
3903 IStream_Release(stm);
3904 IStorage_Release(stg);
3905 }
3906
3907 static void test_adminprops(void)
3908 {
3909 UINT r;
3910
3911 if (is_process_limited())
3912 {
3913 skip("process is limited\n");
3914 return;
3915 }
3916
3917 CreateDirectoryA("msitest", NULL);
3918 create_file("msitest\\augustus", 500);
3919
3920 create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
3921 set_admin_summary_info(msifileW);
3922 set_admin_property_stream(msifile);
3923
3924 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3925
3926 r = MsiInstallProductA(msifile, NULL);
3927 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3928 {
3929 skip("Not enough rights to perform tests\n");
3930 goto error;
3931 }
3932 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3933 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
3934 ok(delete_pf("msitest", FALSE), "Directory created\n");
3935
3936 error:
3937 DeleteFileA(msifile);
3938 DeleteFileA("msitest\\augustus");
3939 RemoveDirectoryA("msitest");
3940 }
3941
3942 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
3943 {
3944 CHAR path[MAX_PATH];
3945
3946 lstrcpyA(path, PROG_FILES_DIR);
3947 lstrcatA(path, "\\");
3948 lstrcatA(path, file);
3949
3950 if (is_file)
3951 create_file_data(path, data, 500);
3952 else
3953 CreateDirectoryA(path, NULL);
3954 }
3955
3956 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
3957
3958 static void test_missingcab(void)
3959 {
3960 UINT r;
3961
3962 if (is_process_limited())
3963 {
3964 skip("process is limited\n");
3965 return;
3966 }
3967
3968 CreateDirectoryA("msitest", NULL);
3969 create_file("msitest\\augustus", 500);
3970 create_file("maximus", 500);
3971 create_file("tiberius", 500);
3972
3973 create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
3974
3975 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3976
3977 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3978 create_cab_file("test4.cab", MEDIA_SIZE, "tiberius\0");
3979
3980 create_pf("msitest", FALSE);
3981 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
3982 create_pf_data("msitest\\tiberius", "abcdefgh", TRUE);
3983
3984 r = MsiInstallProductA(msifile, NULL);
3985 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3986 {
3987 skip("Not enough rights to perform tests\n");
3988 goto error;
3989 }
3990 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3991 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3992 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3993 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3994 ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
3995 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
3996 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
3997 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3998
3999 create_pf("msitest", FALSE);
4000 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
4001 create_pf_data("msitest\\tiberius", "abcdefgh", TRUE);
4002 create_pf("msitest\\gaius", TRUE);
4003
4004 r = MsiInstallProductA(msifile, "GAIUS=1");
4005 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4006 todo_wine
4007 {
4008 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
4009 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4010 }
4011 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
4012 ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
4013 ok(delete_pf("msitest\\tiberius", TRUE), "File removed\n");
4014 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
4015 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4016
4017 error:
4018 delete_pf("msitest", FALSE);
4019 DeleteFileA("msitest\\augustus");
4020 RemoveDirectoryA("msitest");
4021 DeleteFileA("maximus");
4022 DeleteFileA("tiberius");
4023 DeleteFileA("test1.cab");
4024 DeleteFileA("test4.cab");
4025 DeleteFileA(msifile);
4026 }
4027
4028 static void test_sourcefolder(void)
4029 {
4030 UINT r;
4031
4032 if (is_process_limited())
4033 {
4034 skip("process is limited\n");
4035 return;
4036 }
4037
4038 CreateDirectoryA("msitest", NULL);
4039 create_file("augustus", 500);
4040
4041 create_database(msifile, sf_tables, sizeof(sf_tables) / sizeof(msi_table));
4042
4043 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4044
4045 r = MsiInstallProductA(msifile, NULL);
4046 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4047 {
4048 skip("Not enough rights to perform tests\n");
4049 goto error;
4050 }
4051 ok(r == ERROR_INSTALL_FAILURE,
4052 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4053 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4054 todo_wine
4055 {
4056 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4057 }
4058 RemoveDirectoryA("msitest");
4059
4060 r = MsiInstallProductA(msifile, NULL);
4061 ok(r == ERROR_INSTALL_FAILURE,
4062 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4063 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4064 todo_wine
4065 {
4066 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4067 }
4068
4069 error:
4070 DeleteFileA(msifile);
4071 DeleteFileA("augustus");
4072 }
4073
4074 static void test_customaction51(void)
4075 {
4076 UINT r;
4077
4078 if (is_process_limited())
4079 {
4080 skip("process is limited\n");
4081 return;
4082 }
4083
4084 CreateDirectoryA("msitest", NULL);
4085 create_file("msitest\\augustus", 500);
4086
4087 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
4088
4089 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4090
4091 r = MsiInstallProductA(msifile, NULL);
4092 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4093 {
4094 skip("Not enough rights to perform tests\n");
4095 goto error;
4096 }
4097 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4098 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4099 ok(delete_pf("msitest", FALSE), "Directory created\n");
4100
4101 error:
4102 DeleteFileA(msifile);
4103 DeleteFileA("msitest\\augustus");
4104 RemoveDirectoryA("msitest");
4105 }
4106
4107 static void test_installstate(void)
4108 {
4109 UINT r;
4110
4111 if (is_process_limited())
4112 {
4113 skip("process is limited\n");
4114 return;
4115 }
4116
4117 CreateDirectoryA("msitest", NULL);
4118 create_file("msitest\\alpha", 500);
4119 create_file("msitest\\beta", 500);
4120 create_file("msitest\\gamma", 500);
4121 create_file("msitest\\theta", 500);
4122 create_file("msitest\\delta", 500);
4123 create_file("msitest\\epsilon", 500);
4124 create_file("msitest\\zeta", 500);
4125 create_file("msitest\\iota", 500);
4126 create_file("msitest\\eta", 500);
4127 create_file("msitest\\kappa", 500);
4128 create_file("msitest\\lambda", 500);
4129 create_file("msitest\\mu", 500);
4130
4131 create_database(msifile, is_tables, sizeof(is_tables) / sizeof(msi_table));
4132
4133 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4134
4135 r = MsiInstallProductA(msifile, NULL);
4136 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4137 {
4138 skip("Not enough rights to perform tests\n");
4139 goto error;
4140 }
4141 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4142 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4143 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4144 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4145 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4146 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4147 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4148 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4149 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4150 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4151 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4152 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4153 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4154 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4155
4156 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
4157 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4158 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4159 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4160 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4161 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4162 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4163 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
4164 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4165 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4166 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
4167 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4168 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4169 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4170 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4171
4172 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
4173 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4174 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4175 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4176 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4177 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4178 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4179 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4180 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4181 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4182 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4183 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4184 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4185 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4186 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4187
4188 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
4189 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4190 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
4191 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4192 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4193 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
4194 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4195 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4196 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4197 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4198 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4199 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4200 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4201 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4202 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4203
4204 error:
4205 DeleteFileA(msifile);
4206 DeleteFileA("msitest\\alpha");
4207 DeleteFileA("msitest\\beta");
4208 DeleteFileA("msitest\\gamma");
4209 DeleteFileA("msitest\\theta");
4210 DeleteFileA("msitest\\delta");
4211 DeleteFileA("msitest\\epsilon");
4212 DeleteFileA("msitest\\zeta");
4213 DeleteFileA("msitest\\iota");
4214 DeleteFileA("msitest\\eta");
4215 DeleteFileA("msitest\\kappa");
4216 DeleteFileA("msitest\\lambda");
4217 DeleteFileA("msitest\\mu");
4218 RemoveDirectoryA("msitest");
4219 }
4220
4221 static const struct sourcepathmap
4222 {
4223 BOOL sost; /* shortone\shorttwo */
4224 BOOL solt; /* shortone\longtwo */
4225 BOOL lost; /* longone\shorttwo */
4226 BOOL lolt; /* longone\longtwo */
4227 BOOL soste; /* shortone\shorttwo source exists */
4228 BOOL solte; /* shortone\longtwo source exists */
4229 BOOL loste; /* longone\shorttwo source exists */
4230 BOOL lolte; /* longone\longtwo source exists */
4231 UINT err;
4232 DWORD size;
4233 } spmap[256] =
4234 {
4235 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4236 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4237 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4238 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4239 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4240 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4241 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4242 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4243 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4244 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4245 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4246 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4247 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4248 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4249 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4250 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4251 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4252 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4253 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4254 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4255 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4256 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4257 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4258 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4259 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4260 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4261 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4262 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4263 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4264 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4265 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4266 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4267 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4268 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4269 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4270 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4271 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4272 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4273 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4274 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4275 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4276 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4277 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4278 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4279 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4280 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4281 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4282 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4283 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4284 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4285 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4286 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4287 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4288 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4289 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4290 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4291 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4292 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4293 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4294 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4295 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4296 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4297 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4298 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4299 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4300 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4301 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4302 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4303 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4304 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4305 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4306 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4307 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4308 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4309 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4310 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4311 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4312 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4313 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4314 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4315 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4316 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4317 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4318 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4319 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4320 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4321 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4322 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4323 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4324 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4325 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4326 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4327 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4328 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4329 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4330 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4331 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4332 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4333 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4334 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4335 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4336 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4337 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4338 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4339 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4340 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4341 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4342 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4343 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4344 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4345 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4346 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4347 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4348 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4349 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4350 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4351 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4352 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4353 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4354 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4355 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4356 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4357 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4358 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4359 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4360 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4361 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4362 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4363 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4364 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4365 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4366 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4367 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4368 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4369 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4370 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4371 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4372 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4373 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4374 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4375 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4376 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4377 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4378 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4379 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4380 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4381 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4382 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4383 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4384 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4385 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4386 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4387 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4388 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4389 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4390 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4391 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4392 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4393 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4394 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4395 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4396 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4397 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4398 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4399 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4400 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4401 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4402 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4403 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4404 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4405 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4406 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4407 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4408 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4409 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4410 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4411 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4412 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4413 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4414 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4415 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4416 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4417 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4418 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4419 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4420 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4421 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4422 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4423 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4424 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4425 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4426 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4427 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4428 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4429 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4430 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4431 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4432 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4433 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4434 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4435 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4436 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4437 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4438 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4439 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4440 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4441 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4442 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4443 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4444 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4445 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4446 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4447 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4448 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4449 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4450 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4451 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4452 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4453 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4454 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4455 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4456 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4457 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4458 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4459 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4460 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4461 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4462 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4463 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4464 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4465 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4466 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4467 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4468 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4469 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4470 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4471 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4472 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4473 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4474 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4475 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4476 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4477 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4478 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4479 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4480 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4481 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4482 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4483 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4484 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4485 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4486 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4487 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4488 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4489 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4490 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4491 };
4492
4493 static DWORD get_pf_file_size(LPCSTR file)
4494 {
4495 CHAR path[MAX_PATH];
4496 HANDLE hfile;
4497 DWORD size;
4498
4499 lstrcpyA(path, PROG_FILES_DIR);
4500 lstrcatA(path, "\\");
4501 lstrcatA(path, file);
4502
4503 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
4504 if (hfile == INVALID_HANDLE_VALUE)
4505 return INVALID_FILE_SIZE;
4506
4507 size = GetFileSize(hfile, NULL);
4508 CloseHandle(hfile);
4509 return size;
4510 }
4511
4512 static void test_sourcepath(void)
4513 {
4514 UINT r, i;
4515
4516 if (!winetest_interactive)
4517 {
4518 skip("Run in interactive mode to run source path tests.\n");
4519 return;
4520 }
4521
4522 create_database(msifile, sp_tables, sizeof(sp_tables) / sizeof(msi_table));
4523
4524 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4525
4526 for (i = 0; i < sizeof(spmap) / sizeof(spmap[0]); i++)
4527 {
4528 if (spmap[i].sost)
4529 {
4530 CreateDirectoryA("shortone", NULL);
4531 CreateDirectoryA("shortone\\shorttwo", NULL);
4532 }
4533
4534 if (spmap[i].solt)
4535 {
4536 CreateDirectoryA("shortone", NULL);
4537 CreateDirectoryA("shortone\\longtwo", NULL);
4538 }
4539
4540 if (spmap[i].lost)
4541 {
4542 CreateDirectoryA("longone", NULL);
4543 CreateDirectoryA("longone\\shorttwo", NULL);
4544 }
4545
4546 if (spmap[i].lolt)
4547 {
4548 CreateDirectoryA("longone", NULL);
4549 CreateDirectoryA("longone\\longtwo", NULL);
4550 }
4551
4552 if (spmap[i].soste)
4553 create_file("shortone\\shorttwo\\augustus", 50);
4554 if (spmap[i].solte)
4555 create_file("shortone\\longtwo\\augustus", 100);
4556 if (spmap[i].loste)
4557 create_file("longone\\shorttwo\\augustus", 150);
4558 if (spmap[i].lolte)
4559 create_file("longone\\longtwo\\augustus", 200);
4560
4561 r = MsiInstallProductA(msifile, NULL);
4562 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
4563 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
4564 "%d: Expected %d, got %d\n", i, spmap[i].size,
4565 get_pf_file_size("msitest\\augustus"));
4566
4567 if (r == ERROR_SUCCESS)
4568 {
4569 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
4570 ok(delete_pf("msitest", FALSE), "%d: Directory not created\n", i);
4571 }
4572 else
4573 {
4574 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
4575 todo_wine ok(!delete_pf("msitest", FALSE), "%d: Directory installed\n", i);
4576 }
4577
4578 DeleteFileA("shortone\\shorttwo\\augustus");
4579 DeleteFileA("shortone\\longtwo\\augustus");
4580 DeleteFileA("longone\\shorttwo\\augustus");
4581 DeleteFileA("longone\\longtwo\\augustus");
4582 RemoveDirectoryA("shortone\\shorttwo");
4583 RemoveDirectoryA("shortone\\longtwo");
4584 RemoveDirectoryA("longone\\shorttwo");
4585 RemoveDirectoryA("longone\\longtwo");
4586 RemoveDirectoryA("shortone");
4587 RemoveDirectoryA("longone");
4588 }
4589
4590 DeleteFileA(msifile);
4591 }
4592
4593 static void test_missingcomponent(void)
4594 {
4595 UINT r;
4596
4597 if (is_process_limited())
4598 {
4599 skip("process is limited\n");
4600 return;
4601 }
4602
4603 CreateDirectoryA("msitest", NULL);
4604 create_file("msitest\\hydrogen", 500);
4605 create_file("msitest\\helium", 500);
4606 create_file("msitest\\lithium", 500);
4607 create_file("beryllium", 500);
4608
4609 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
4610
4611 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4612
4613 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
4614 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4615 {
4616 skip("Not enough rights to perform tests\n");
4617 goto error;
4618 }
4619 else if (r == ERROR_INSTALL_FAILURE)
4620 {
4621 win_skip("broken result\n");
4622 goto error;
4623 }
4624 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4625 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4626 ok(pf_exists("msitest\\helium"), "File not installed\n");
4627 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4628 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
4629 ok(pf_exists("msitest"), "File not installed\n");
4630
4631 r = MsiInstallProductA(msifile, "REMOVE=ALL INSTALLLEVEL=10 PROPVAR=42");
4632 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4633 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
4634 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
4635 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
4636 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
4637 ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
4638
4639 error:
4640 DeleteFileA(msifile);
4641 DeleteFileA("msitest\\hydrogen");
4642 DeleteFileA("msitest\\helium");
4643 DeleteFileA("msitest\\lithium");
4644 DeleteFileA("beryllium");
4645 RemoveDirectoryA("msitest");
4646 }
4647
4648 static void test_sourcedirprop(void)
4649 {
4650 UINT r;
4651 CHAR props[MAX_PATH];
4652
4653 if (is_process_limited())
4654 {
4655 skip("process is limited\n");
4656 return;
4657 }
4658
4659 CreateDirectoryA("msitest", NULL);
4660 create_file("msitest\\augustus", 500);
4661
4662 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
4663
4664 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4665
4666 r = MsiInstallProductA(msifile, NULL);
4667 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4668 {
4669 skip("Not enough rights to perform tests\n");
4670 goto error;
4671 }
4672 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4673 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4674 ok(delete_pf("msitest", FALSE), "Directory created\n");
4675
4676 DeleteFileA("msitest\\augustus");
4677 RemoveDirectoryA("msitest");
4678
4679 CreateDirectoryA("altsource", NULL);
4680 CreateDirectoryA("altsource\\msitest", NULL);
4681 create_file("altsource\\msitest\\augustus", 500);
4682
4683 sprintf(props, "SRCDIR=%s\\altsource\\", CURR_DIR);
4684
4685 r = MsiInstallProductA(msifile, props);
4686 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4687 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4688 ok(delete_pf("msitest", FALSE), "Directory created\n");
4689
4690 DeleteFileA("altsource\\msitest\\augustus");
4691 RemoveDirectoryA("altsource\\msitest");
4692 RemoveDirectoryA("altsource");
4693
4694 error:
4695 DeleteFileA("msitest\\augustus");
4696 RemoveDirectoryA("msitest");
4697 DeleteFileA(msifile);
4698 }
4699
4700 static void test_adminimage(void)
4701 {
4702 UINT r;
4703
4704 if (is_process_limited())
4705 {
4706 skip("process is limited\n");
4707 return;
4708 }
4709
4710 CreateDirectoryA("msitest", NULL);
4711 CreateDirectoryA("msitest\\first", NULL);
4712 CreateDirectoryA("msitest\\second", NULL);
4713 CreateDirectoryA("msitest\\cabout", NULL);
4714 CreateDirectoryA("msitest\\cabout\\new", NULL);
4715 create_file("msitest\\one.txt", 100);
4716 create_file("msitest\\first\\two.txt", 100);
4717 create_file("msitest\\second\\three.txt", 100);
4718 create_file("msitest\\cabout\\four.txt", 100);
4719 create_file("msitest\\cabout\\new\\five.txt", 100);
4720 create_file("msitest\\filename", 100);
4721 create_file("msitest\\service.exe", 100);
4722
4723 create_database_wordcount(msifile, ai_tables,
4724 sizeof(ai_tables) / sizeof(msi_table),
4725 100, msidbSumInfoSourceTypeAdminImage, ";1033",
4726 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
4727
4728 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4729
4730 r = MsiInstallProductA(msifile, NULL);
4731 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4732 {
4733 skip("Not enough rights to perform tests\n");
4734 goto error;
4735 }
4736 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4737
4738 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4739 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4740 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4741 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4742 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4743 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4744 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4745 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4746 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
4747 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4748 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4749 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4750
4751 error:
4752 DeleteFileA("msifile");
4753 DeleteFileA("msitest\\cabout\\new\\five.txt");
4754 DeleteFileA("msitest\\cabout\\four.txt");
4755 DeleteFileA("msitest\\second\\three.txt");
4756 DeleteFileA("msitest\\first\\two.txt");
4757 DeleteFileA("msitest\\one.txt");
4758 DeleteFileA("msitest\\service.exe");
4759 DeleteFileA("msitest\\filename");
4760 RemoveDirectoryA("msitest\\cabout\\new");
4761 RemoveDirectoryA("msitest\\cabout");
4762 RemoveDirectoryA("msitest\\second");
4763 RemoveDirectoryA("msitest\\first");
4764 RemoveDirectoryA("msitest");
4765 }
4766
4767 static void test_propcase(void)
4768 {
4769 UINT r;
4770
4771 if (is_process_limited())
4772 {
4773 skip("process is limited\n");
4774 return;
4775 }
4776
4777 CreateDirectoryA("msitest", NULL);
4778 create_file("msitest\\augustus", 500);
4779
4780 create_database(msifile, pc_tables, sizeof(pc_tables) / sizeof(msi_table));
4781
4782 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4783
4784 r = MsiInstallProductA(msifile, "MyProp=42");
4785 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4786 {
4787 skip("Not enough rights to perform tests\n");
4788 goto error;
4789 }
4790 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4791 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4792 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4793
4794 r = MsiInstallProductA(msifile, "Prop1=\"Copyright \"\"My Company\"\" 2015\" MyProp=42");
4795 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4796 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4797 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4798
4799 r = MsiInstallProductA(msifile, "Prop1=\"\"\"install.exe\"\" /Install\" MyProp=\"42\"");
4800 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4801 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4802 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4803
4804 error:
4805 DeleteFileA(msifile);
4806 DeleteFileA("msitest\\augustus");
4807 RemoveDirectoryA("msitest");
4808 }
4809
4810 static void test_int_widths( void )
4811 {
4812 static const WCHAR msitestW[] = {'m','s','i','t','e','s','t','.','m','s','i',0};
4813 static const WCHAR msitableW[] = {'m','s','i','t','a','b','l','e','.','i','d','t',0};
4814 static const WCHAR slashW[] = {'\\',0};
4815 static const char int0[] = "int0\ni0\nint0\tint0\n1";
4816 static const char int1[] = "int1\ni1\nint1\tint1\n1";
4817 static const char int2[] = "int2\ni2\nint2\tint2\n1";
4818 static const char int3[] = "int3\ni3\nint3\tint3\n1";
4819 static const char int4[] = "int4\ni4\nint4\tint4\n1";
4820 static const char int5[] = "int5\ni5\nint5\tint5\n1";
4821 static const char int8[] = "int8\ni8\nint8\tint8\n1";
4822 static const struct
4823 {
4824 const char *data;
4825 unsigned int size;
4826 UINT ret;
4827 }
4828 tests[] =
4829 {
4830 { int0, sizeof(int0) - 1, ERROR_SUCCESS },
4831 { int1, sizeof(int1) - 1, ERROR_SUCCESS },
4832 { int2, sizeof(int2) - 1, ERROR_SUCCESS },
4833 { int3, sizeof(int3) - 1, ERROR_FUNCTION_FAILED },
4834 { int4, sizeof(int4) - 1, ERROR_SUCCESS },
4835 { int5, sizeof(int5) - 1, ERROR_FUNCTION_FAILED },
4836 { int8, sizeof(int8) - 1, ERROR_FUNCTION_FAILED }
4837 };
4838 WCHAR tmpdir[MAX_PATH], msitable[MAX_PATH], msidb[MAX_PATH];
4839 MSIHANDLE db;
4840 UINT r, i;
4841
4842 GetTempPathW(MAX_PATH, tmpdir);
4843 CreateDirectoryW(tmpdir, NULL);
4844
4845 lstrcpyW(msitable, tmpdir);
4846 lstrcatW(msitable, slashW);
4847 lstrcatW(msitable, msitableW);
4848
4849 lstrcpyW(msidb, tmpdir);
4850 lstrcatW(msidb, slashW);
4851 lstrcatW(msidb, msitestW);
4852
4853 r = MsiOpenDatabaseW(msidb, MSIDBOPEN_CREATE, &db);
4854 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4855
4856 for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
4857 {
4858 DWORD count;
4859 HANDLE handle = CreateFileW(msitable, GENERIC_WRITE, 0, NULL,
4860 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
4861 WriteFile(handle, tests[i].data, tests[i].size, &count, NULL);
4862 CloseHandle(handle);
4863
4864 r = MsiDatabaseImportW(db, tmpdir, msitableW);
4865 ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r);
4866
4867 r = MsiDatabaseCommit(db);
4868 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4869 DeleteFileW(msitable);
4870 }
4871
4872 MsiCloseHandle(db);
4873 DeleteFileW(msidb);
4874 RemoveDirectoryW(tmpdir);
4875 }
4876
4877 static void test_shortcut(void)
4878 {
4879 UINT r;
4880 HRESULT hr;
4881
4882 if (is_process_limited())
4883 {
4884 skip("process is limited\n");
4885 return;
4886 }
4887
4888 create_test_files();
4889 create_database(msifile, sc_tables, sizeof(sc_tables) / sizeof(msi_table));
4890
4891 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4892
4893 r = MsiInstallProductA(msifile, NULL);
4894 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4895 {
4896 skip("Not enough rights to perform tests\n");
4897 goto error;
4898 }
4899 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4900
4901 hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
4902 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
4903
4904 r = MsiInstallProductA(msifile, NULL);
4905 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4906
4907 CoUninitialize();
4908
4909 hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
4910 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
4911
4912 r = MsiInstallProductA(msifile, NULL);
4913 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4914
4915 CoUninitialize();
4916
4917 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4918 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4919 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4920 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4921 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4922 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4923 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4924 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4925 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4926 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
4927 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4928 while (!delete_pf("msitest\\Shortcut.lnk", TRUE) && GetLastError() == ERROR_SHARING_VIOLATION) Sleep(1000);
4929 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4930
4931 error:
4932 delete_test_files();
4933 DeleteFileA(msifile);
4934 }
4935
4936 static void test_preselected(void)
4937 {
4938 UINT r;
4939
4940 if (is_process_limited())
4941 {
4942 skip("process is limited\n");
4943 return;
4944 }
4945
4946 create_test_files();
4947 create_database(msifile, ps_tables, sizeof(ps_tables) / sizeof(msi_table));
4948
4949 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4950
4951 r = MsiInstallProductA(msifile, "ADDLOCAL=One");
4952 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4953 {
4954 skip("Not enough rights to perform tests\n");
4955 goto error;
4956 }
4957 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4958
4959 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
4960 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
4961 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
4962 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
4963 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
4964 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
4965 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
4966 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
4967 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
4968 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
4969 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
4970 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4971
4972 r = MsiInstallProductA(msifile, NULL);
4973 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4974
4975 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4976 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4977 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4978 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4979 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4980 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4981 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4982 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4983 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4984 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
4985 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4986 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4987
4988 error:
4989 delete_test_files();
4990 DeleteFileA(msifile);
4991 }
4992
4993 static void test_installed_prop(void)
4994 {
4995 static const char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}";
4996 UINT r;
4997
4998 if (is_process_limited())
4999 {
5000 skip("process is limited\n");
5001 return;
5002 }
5003
5004 create_test_files();
5005 create_database(msifile, ip_tables, sizeof(ip_tables) / sizeof(msi_table));
5006
5007 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5008
5009 r = MsiInstallProductA(msifile, "FULL=1");
5010 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5011 {
5012 skip("Not enough rights to perform tests\n");
5013 goto error;
5014 }
5015 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5016
5017 r = MsiInstallProductA(msifile, "FULL=1");
5018 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5019
5020 r = MsiConfigureProductExA(prodcode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, "FULL=1");
5021 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5022
5023 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5024 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5025 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5026 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5027 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5028 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5029 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5030 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5031 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5032 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5033 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5034 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5035
5036 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5037 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5038
5039 error:
5040 delete_test_files();
5041 DeleteFileA(msifile);
5042 }
5043
5044 static void test_allusers_prop(void)
5045 {
5046 UINT r;
5047
5048 if (is_process_limited())
5049 {
5050 skip("process is limited\n");
5051 return;
5052 }
5053
5054 create_test_files();
5055 create_database(msifile, aup_tables, sizeof(aup_tables) / sizeof(msi_table));
5056
5057 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5058
5059 /* ALLUSERS property unset */
5060 r = MsiInstallProductA(msifile, "FULL=1");
5061 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5062 {
5063 skip("Not enough rights to perform tests\n");
5064 goto error;
5065 }
5066 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5067
5068 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5069 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5070 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5071 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5072 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5073 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5074 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5075 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5076 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5077 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5078 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5079 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5080
5081 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5082 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5083
5084 delete_test_files();
5085
5086 create_test_files();
5087 create_database(msifile, aup2_tables, sizeof(aup2_tables) / sizeof(msi_table));
5088
5089 /* ALLUSERS property set to 1 */
5090 r = MsiInstallProductA(msifile, "FULL=1");
5091 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5092
5093 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5094 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5095 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5096 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5097 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5098 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5099 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5100 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5101 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5102 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5103 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5104 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5105
5106 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5107 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5108
5109 delete_test_files();
5110
5111 create_test_files();
5112 create_database(msifile, aup3_tables, sizeof(aup3_tables) / sizeof(msi_table));
5113
5114 /* ALLUSERS property set to 2 */
5115 r = MsiInstallProductA(msifile, "FULL=1");
5116 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5117
5118 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5119 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5120 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5121 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5122 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5123 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5124 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5125 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5126 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5127 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5128 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5129 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5130
5131 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5132 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5133
5134 delete_test_files();
5135
5136 create_test_files();
5137 create_database(msifile, aup4_tables, sizeof(aup4_tables) / sizeof(msi_table));
5138
5139 /* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */
5140 r = MsiInstallProductA(msifile, "FULL=1");
5141 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5142
5143 error:
5144 delete_test_files();
5145 DeleteFileA(msifile);
5146 }
5147
5148 static const char session_manager[] = "System\\CurrentControlSet\\Control\\Session Manager";
5149 static const char rename_ops[] = "PendingFileRenameOperations";
5150
5151 static void process_pending_renames(HKEY hkey)
5152 {
5153 char *buf, *src, *dst, *buf2, *buf2ptr;
5154 DWORD size;
5155 LONG ret;
5156 BOOL found = FALSE;
5157
5158 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size);
5159 ok(!ret, "RegQueryValueExA failed %d\n", ret);
5160
5161 buf = HeapAlloc(GetProcessHeap(), 0, size + 1);
5162 buf2ptr = buf2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 1);
5163
5164 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size);
5165 buf[size] = 0;
5166 ok(!ret, "RegQueryValueExA failed %d\n", ret);
5167 if (ret) return;
5168
5169 for (src = buf; *src; src = dst + strlen(dst) + 1)
5170 {
5171 DWORD flags = MOVEFILE_COPY_ALLOWED;
5172 BOOL fileret;
5173
5174 dst = src + strlen(src) + 1;
5175
5176 if (!strstr(src, "msitest"))
5177 {
5178 lstrcpyA(buf2ptr, src);
5179 buf2ptr += strlen(src) + 1;
5180 lstrcpyA(buf2ptr, dst);
5181 buf2ptr += strlen(dst) + 1;
5182 continue;
5183 }
5184
5185 found = TRUE;
5186
5187 if (*dst == '!')
5188 {
5189 flags |= MOVEFILE_REPLACE_EXISTING;
5190 dst++;
5191 }
5192 if (src[0] == '\\' && src[1] == '?' && src[2] == '?' && src[3] == '\\') src += 4;
5193 if (*dst)
5194 {
5195 if (dst[0] == '\\' && dst[1] == '?' && dst[2] == '?' && dst[3] == '\\') dst += 4;
5196 fileret = MoveFileExA(src, dst, flags);
5197 ok(fileret, "Failed to move file %s -> %s (%u)\n", src, dst, GetLastError());
5198 }
5199 else
5200 {
5201 fileret = DeleteFileA(src);
5202 ok(fileret || broken(!fileret) /* win2k3 */, "Failed to delete file %s (%u)\n", src, GetLastError());
5203 }
5204 }
5205
5206 ok(found, "Expected a 'msitest' entry\n");
5207
5208 if (*buf2)
5209 RegSetValueExA(hkey, rename_ops, 0, REG_MULTI_SZ, (LPBYTE)buf2, buf2ptr + 1 - buf2);
5210 else
5211 RegDeleteValueA(hkey, rename_ops);
5212
5213 HeapFree(GetProcessHeap(), 0, buf);
5214 HeapFree(GetProcessHeap(), 0, buf2);
5215 }
5216
5217 static BOOL file_matches_data(LPCSTR file, LPCSTR data)
5218 {
5219 DWORD len, data_len = strlen(data);
5220 HANDLE handle;
5221 char buf[128];
5222
5223 handle = CreateFileA(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
5224 ok(handle != INVALID_HANDLE_VALUE, "failed to open %s (%u)\n", file, GetLastError());
5225
5226 if (ReadFile(handle, buf, sizeof(buf), &len, NULL) && len >= data_len)
5227 {
5228 CloseHandle(handle);
5229 return !memcmp(buf, data, data_len);
5230 }
5231 CloseHandle(handle);
5232 return FALSE;
5233 }
5234
5235 static void test_file_in_use(void)
5236 {
5237 UINT r;
5238 HANDLE file;
5239 HKEY hkey;
5240 char path[MAX_PATH];
5241
5242 if (is_process_limited())
5243 {
5244 skip("process is limited\n");
5245 return;
5246 }
5247
5248 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
5249
5250 CreateDirectoryA("msitest", NULL);
5251 create_file("msitest\\maximus", 500);
5252 create_database(msifile, fiu_tables, sizeof(fiu_tables) / sizeof(msi_table));
5253
5254 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5255
5256 lstrcpyA(path, PROG_FILES_DIR);
5257 lstrcatA(path, "\\msitest");
5258 CreateDirectoryA(path, NULL);
5259
5260 lstrcatA(path, "\\maximus");
5261 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
5262
5263 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
5264 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5265 {
5266 skip("Not enough rights to perform tests\n");
5267 goto error;
5268 }
5269 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
5270 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
5271 CloseHandle(file);
5272 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
5273
5274 process_pending_renames(hkey);
5275 RegCloseKey(hkey);
5276
5277 ok(file_matches_data(path, "msitest\\maximus"), "Expected file to match\n");
5278 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
5279 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
5280
5281 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5282 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5283
5284 error:
5285 RegCloseKey(hkey);
5286
5287 delete_pf("msitest\\maximus", TRUE);
5288 delete_pf("msitest", FALSE);
5289 DeleteFileA("msitest\\maximus");
5290 delete_test_files();
5291 DeleteFileA(msifile);
5292 }
5293
5294 static void test_file_in_use_cab(void)
5295 {
5296 UINT r;
5297 HANDLE file;
5298 HKEY hkey;
5299 char path[MAX_PATH];
5300
5301 if (is_process_limited())
5302 {
5303 skip("process is limited\n");
5304 return;
5305 }
5306
5307 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
5308
5309 CreateDirectoryA("msitest", NULL);
5310 create_file("maximus", 500);
5311 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
5312 DeleteFileA("maximus");
5313
5314 create_database(msifile, fiuc_tables, sizeof(fiuc_tables) / sizeof(msi_table));
5315
5316 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5317
5318 lstrcpyA(path, PROG_FILES_DIR);
5319 lstrcatA(path, "\\msitest");
5320 CreateDirectoryA(path, NULL);
5321
5322 lstrcatA(path, "\\maximus");
5323 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
5324
5325 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
5326 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5327 {
5328 skip("Not enough rights to perform tests\n");
5329 goto error;
5330 }
5331 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
5332 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
5333 CloseHandle(file);
5334 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
5335
5336 process_pending_renames(hkey);
5337 RegCloseKey(hkey);
5338
5339 ok(file_matches_data(path, "maximus"), "Expected file to match\n");
5340 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
5341 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
5342
5343 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5344 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5345
5346 error:
5347 RegCloseKey(hkey);
5348
5349 delete_pf("msitest\\maximus", TRUE);
5350 delete_pf("msitest", FALSE);
5351 DeleteFileA("msitest\\maximus");
5352 delete_cab_files();
5353 delete_test_files();
5354 DeleteFileA(msifile);
5355 }
5356
5357 static void test_feature_override(void)
5358 {
5359 UINT r;
5360 REGSAM access = KEY_ALL_ACCESS;
5361
5362 if (is_process_limited())
5363 {
5364 skip("process is limited\n");
5365 return;
5366 }
5367
5368 create_test_files();
5369 create_file("msitest\\override.txt", 1000);
5370 create_file("msitest\\preselected.txt", 1000);
5371 create_file("msitest\\notpreselected.txt", 1000);
5372 create_database(msifile, fo_tables, sizeof(fo_tables) / sizeof(msi_table));
5373
5374 if (is_wow64)
5375 access |= KEY_WOW64_64KEY;
5376
5377 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5378
5379 r = MsiInstallProductA(msifile, "ADDLOCAL=override");
5380 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5381 {
5382 skip("Not enough rights to perform tests\n");
5383 goto error;
5384 }
5385 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5386
5387 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5388 ok(!pf_exists("msitest\\preselected.txt"), "file installed\n");
5389 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5390
5391 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5392 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5393
5394 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5395
5396 r = MsiInstallProductA(msifile, "preselect=1");
5397 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5398
5399 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5400 ok(pf_exists("msitest\\preselected.txt"), "file not installed\n");
5401 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5402
5403 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5404 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5405
5406 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5407 todo_wine {
5408 ok(delete_pf("msitest\\preselected.txt", TRUE), "file removed\n");
5409 ok(delete_pf("msitest", FALSE), "directory removed\n");
5410 }
5411
5412 r = MsiInstallProductA(msifile, NULL);
5413 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5414
5415 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5416 ok(pf_exists("msitest\\preselected.txt"), "file not installed\n");
5417 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5418
5419 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5420 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5421
5422 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5423 todo_wine {
5424 ok(delete_pf("msitest\\preselected.txt", TRUE), "file removed\n");
5425 ok(delete_pf("msitest", FALSE), "directory removed\n");
5426 }
5427
5428 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", access);
5429
5430 error:
5431 DeleteFileA("msitest\\override.txt");
5432 DeleteFileA("msitest\\preselected.txt");
5433 DeleteFileA("msitest\\notpreselected.txt");
5434 delete_test_files();
5435 DeleteFileA(msifile);
5436 }
5437
5438 static void test_icon_table(void)
5439 {
5440 MSIHANDLE hdb = 0, record;
5441 LPCSTR query;
5442 UINT res;
5443 CHAR path[MAX_PATH];
5444 static const char prodcode[] = "{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}";
5445
5446 if (is_process_limited())
5447 {
5448 skip("process is limited\n");
5449 return;
5450 }
5451
5452 create_database(msifile, icon_base_tables, sizeof(icon_base_tables) / sizeof(msi_table));
5453
5454 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5455
5456 res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb);
5457 ok(res == ERROR_SUCCESS, "failed to open db: %d\n", res);
5458
5459 query = "CREATE TABLE `Icon` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)";
5460 res = run_query( hdb, 0, query );
5461 ok(res == ERROR_SUCCESS, "Can't create Icon table: %d\n", res);
5462
5463 create_file("icon.ico", 100);
5464 record = MsiCreateRecord(1);
5465 res = MsiRecordSetStreamA(record, 1, "icon.ico");
5466 ok(res == ERROR_SUCCESS, "Failed to add stream data to record: %d\n", res);
5467
5468 query = "INSERT INTO `Icon` (`Name`, `Data`) VALUES ('testicon', ?)";
5469 res = run_query(hdb, record, query);
5470 ok(res == ERROR_SUCCESS, "Insert into Icon table failed: %d\n", res);
5471
5472 res = MsiCloseHandle(record);
5473 ok(res == ERROR_SUCCESS, "Failed to close record handle: %d\n", res);
5474 DeleteFileA("icon.ico");
5475 res = MsiDatabaseCommit(hdb);
5476 ok(res == ERROR_SUCCESS, "Failed to commit database: %d\n", res);
5477 res = MsiCloseHandle(hdb);
5478 ok(res == ERROR_SUCCESS, "Failed to close database: %d\n", res);
5479
5480 /* per-user */
5481 res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
5482 if (res == ERROR_INSTALL_PACKAGE_REJECTED)
5483 {
5484 skip("Not enough rights to perform tests\n");
5485 DeleteFileA(msifile);
5486 return;
5487 }
5488 ok(res == ERROR_SUCCESS, "Failed to do per-user install: %d\n", res);
5489
5490 lstrcpyA(path, APP_DATA_DIR);
5491 lstrcatA(path, "\\");
5492 lstrcatA(path, "Microsoft\\Installer\\");
5493 lstrcatA(path, prodcode);
5494 lstrcatA(path, "\\testicon");
5495 ok(file_exists(path), "Per-user icon file isn't where it's expected (%s)\n", path);
5496
5497 res = MsiInstallProductA(msifile, "REMOVE=ALL");
5498 ok(res == ERROR_SUCCESS, "Failed to uninstall per-user\n");
5499 ok(!file_exists(path), "Per-user icon file not removed (%s)\n", path);
5500
5501 /* system-wide */
5502 res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
5503 ok(res == ERROR_SUCCESS, "Failed to system-wide install: %d\n", res);
5504
5505 lstrcpyA(path, WINDOWS_DIR);
5506 lstrcatA(path, "\\");
5507 lstrcatA(path, "Installer\\");
5508 lstrcatA(path, prodcode);
5509 lstrcatA(path, "\\testicon");
5510 ok(file_exists(path), "System-wide icon file isn't where it's expected (%s)\n", path);
5511
5512 res = MsiInstallProductA(msifile, "REMOVE=ALL");
5513 ok(res == ERROR_SUCCESS, "Failed to uninstall system-wide\n");
5514 ok(!file_exists(path), "System-wide icon file not removed (%s)\n", path);
5515
5516 delete_pfmsitest_files();
5517 DeleteFileA(msifile);
5518 }
5519
5520 static void test_package_validation(void)
5521 {
5522 UINT r;
5523
5524 if (is_process_limited())
5525 {
5526 skip("process is limited\n");
5527 return;
5528 }
5529
5530 CreateDirectoryA("msitest", NULL);
5531 create_file("msitest\\maximus", 500);
5532 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;1033");
5533
5534 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5535
5536 r = MsiInstallProductA(msifile, NULL);
5537 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5538 {
5539 skip("Not enough rights to perform tests\n");
5540 goto error;
5541 }
5542 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5543 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5544 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5545
5546 DeleteFileA(msifile);
5547 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,9999;9999");
5548
5549 r = MsiInstallProductA(msifile, NULL);
5550 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5551
5552 DeleteFileA(msifile);
5553 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,1033;9999");
5554
5555 r = MsiInstallProductA(msifile, NULL);
5556 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5557
5558 DeleteFileA(msifile);
5559 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,9999;1033");
5560
5561 r = MsiInstallProductA(msifile, NULL);
5562 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5563 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5564 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5565
5566 DeleteFileA(msifile);
5567 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel64,9999;1033");
5568
5569 r = MsiInstallProductA(msifile, NULL);
5570 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5571
5572 DeleteFileA(msifile);
5573 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel32,1033;1033");
5574
5575 r = MsiInstallProductA(msifile, NULL);
5576 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5577
5578 DeleteFileA(msifile);
5579 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel32,9999;1033");
5580
5581 r = MsiInstallProductA(msifile, NULL);
5582 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5583
5584 DeleteFileA(msifile);
5585 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;9999");
5586
5587 r = MsiInstallProductA(msifile, NULL);
5588 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5589 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5590 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5591
5592 if (GetSystemDefaultLangID() == MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ))
5593 {
5594 DeleteFileA(msifile);
5595 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;9");
5596 r = MsiInstallProductA(msifile, NULL);
5597 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5598 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5599 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5600
5601 DeleteFileA(msifile);
5602 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;1024");
5603 r = MsiInstallProductA(msifile, NULL);
5604 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5605 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5606 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5607 }
5608
5609 DeleteFileA(msifile);
5610 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel32;0");
5611
5612 r = MsiInstallProductA(msifile, NULL);
5613 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5614 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5615 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5616
5617 if (is_64bit && !is_wow64)
5618 {
5619 DeleteFileA(msifile);
5620 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5621
5622 r = MsiInstallProductA(msifile, NULL);
5623 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5624 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5625 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5626
5627 DeleteFileA(msifile);
5628 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5629
5630 r = MsiInstallProductA(msifile, NULL);
5631 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
5632 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5633 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5634
5635 DeleteFileA(msifile);
5636 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5637
5638 r = MsiInstallProductA(msifile, NULL);
5639 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5640 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5641 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5642 }
5643 else if (is_wow64)
5644 {
5645 DeleteFileA(msifile);
5646 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5647
5648 r = MsiInstallProductA(msifile, NULL);
5649 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5650 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5651 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5652
5653 DeleteFileA(msifile);
5654 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5655
5656 r = MsiInstallProductA(msifile, NULL);
5657 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
5658 ok(!delete_pf_native("msitest\\maximus", TRUE), "file exists\n");
5659 ok(!delete_pf_native("msitest", FALSE), "directory exists\n");
5660
5661 DeleteFileA(msifile);
5662 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5663
5664 r = MsiInstallProductA(msifile, NULL);
5665 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5666 ok(delete_pf_native("msitest\\maximus", TRUE), "file exists\n");
5667 ok(delete_pf_native("msitest", FALSE), "directory exists\n");
5668 }
5669 else
5670 {
5671 DeleteFileA(msifile);
5672 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5673
5674 r = MsiInstallProductA(msifile, NULL);
5675 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5676 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5677 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5678
5679 DeleteFileA(msifile);
5680 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Alpha,Beta,Intel;0");
5681
5682 r = MsiInstallProductA(msifile, NULL);
5683 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5684 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5685 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5686
5687 DeleteFileA(msifile);
5688 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5689
5690 r = MsiInstallProductA(msifile, NULL);
5691 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5692 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5693 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5694
5695 DeleteFileA(msifile);
5696 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5697
5698 r = MsiInstallProductA(msifile, NULL);
5699 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5700 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5701 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5702 }
5703
5704 error:
5705 /* Delete the files in the temp (current) folder */
5706 DeleteFileA(msifile);
5707 DeleteFileA("msitest\\maximus");
5708 RemoveDirectoryA("msitest");
5709 }
5710
5711 static void test_upgrade_code(void)
5712 {
5713 UINT r;
5714
5715 if (is_process_limited())
5716 {
5717 skip("process is limited\n");
5718 return;
5719 }
5720
5721 CreateDirectoryA("msitest", NULL);
5722 create_file("msitest\\upgradecode.txt", 1000);
5723 create_database(msifile, uc_tables, sizeof(uc_tables) / sizeof(msi_table));
5724
5725 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5726
5727 r = MsiInstallProductA(msifile, NULL);
5728 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5729
5730 ok(pf_exists("msitest\\upgradecode.txt"), "file not installed\n");
5731
5732 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5733 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5734
5735 ok(!delete_pf("msitest\\upgradecode.txt", TRUE), "file not removed\n");
5736 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5737
5738 DeleteFileA("msitest\\upgradecode.txt");
5739 RemoveDirectoryA("msitest");
5740 DeleteFileA(msifile);
5741 }
5742
5743 static void test_mixed_package(void)
5744 {
5745 UINT r;
5746 LONG res;
5747 HKEY hkey;
5748 char value[MAX_PATH];
5749 DWORD size;
5750
5751 if (is_process_limited())
5752 {
5753 skip("process is limited\n");
5754 return;
5755 }
5756 if (!is_wow64 && !is_64bit)
5757 {
5758 skip("this test must be run on 64-bit\n");
5759 return;
5760 }
5761 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5762 create_database_template(msifile, mixed_tables, sizeof(mixed_tables)/sizeof(msi_table), 200, "x64;1033");
5763
5764 r = MsiInstallProductA(msifile, NULL);
5765 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5766 {
5767 skip("Not enough rights to perform tests\n");
5768 goto error;
5769 }
5770 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5771
5772 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5773 ok(!res, "can't open 32-bit component key, got %d\n", res);
5774 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5775 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5776 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5777 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5778 RegCloseKey(hkey);
5779
5780 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5781 ok(!res, "can't open 64-bit component key, got %d\n", res);
5782 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5783 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5784 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5785 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5786 RegCloseKey(hkey);
5787
5788 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5789 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5790 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5791 ok(res == ERROR_SUCCESS, "can't open 32-bit CLSID key, got %d\n", res);
5792 if (res == ERROR_SUCCESS) {
5793 size = sizeof(value);
5794 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5795 ok(!strcmp(value, "winetest32.dll"), "got %s\n", value);
5796 RegCloseKey(hkey);
5797 }
5798
5799 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5800 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5801 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5802 ok(res == ERROR_SUCCESS, "can't open 64-bit CLSID key, got %d\n", res);
5803 if (res == ERROR_SUCCESS) {
5804 size = sizeof(value);
5805 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5806 ok(!strcmp(value, "winetest64.dll"), "got %s\n", value);
5807 RegCloseKey(hkey);
5808 }
5809
5810 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5811 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5812
5813 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5814 ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
5815
5816 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5817 ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
5818
5819 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5820 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5821 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5822 ok(res == ERROR_FILE_NOT_FOUND, "32-bit CLSID key not removed\n");
5823
5824 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5825 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5826 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5827 ok(res == ERROR_FILE_NOT_FOUND, "64-bit CLSID key not removed\n");
5828
5829 DeleteFileA( msifile );
5830 create_database_template(msifile, mixed_tables, sizeof(mixed_tables)/sizeof(msi_table), 200, "Intel;1033");
5831
5832 r = MsiInstallProductA(msifile, NULL);
5833 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5834
5835 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5836 ok(!res, "can't open 32-bit component key, got %d\n", res);
5837 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5838 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5839 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5840 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5841 RegCloseKey(hkey);
5842
5843 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5844 ok(!res, "can't open 64-bit component key, got %d\n", res);
5845 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5846 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5847 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5848 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5849 RegCloseKey(hkey);
5850
5851 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5852 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5853 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5854 ok(res == ERROR_SUCCESS, "can't open 32-bit CLSID key, got %d\n", res);
5855 if (res == ERROR_SUCCESS) {
5856 size = sizeof(value);
5857 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5858 ok(!strcmp(value, "winetest32.dll"), "got %s\n", value);
5859 RegCloseKey(hkey);
5860 }
5861
5862 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5863 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5864 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5865 ok(res == ERROR_SUCCESS, "can't open 64-bit CLSID key, got %d\n", res);
5866 if (res == ERROR_SUCCESS) {
5867 size = sizeof(value);
5868 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5869 ok(!strcmp(value, "winetest64.dll"), "got %s\n", value);
5870 RegCloseKey(hkey);
5871 }
5872
5873 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5874 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5875
5876 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5877 ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
5878
5879 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5880 ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
5881
5882 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5883 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5884 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5885 ok(res == ERROR_FILE_NOT_FOUND, "32-bit CLSID key not removed\n");
5886
5887 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5888 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5889 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5890 ok(res == ERROR_FILE_NOT_FOUND, "64-bit CLSID key not removed\n");
5891
5892 error:
5893 DeleteFileA( msifile );
5894 }
5895
5896 static void test_volume_props(void)
5897 {
5898 UINT r;
5899
5900 if (is_process_limited())
5901 {
5902 skip("process is limited\n");
5903 return;
5904 }
5905 CreateDirectoryA("msitest", NULL);
5906 create_file("msitest\\volumeprop.txt", 1000);
5907 create_database(msifile, vp_tables, sizeof(vp_tables)/sizeof(msi_table));
5908
5909 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5910
5911 r = MsiInstallProductA(msifile, NULL);
5912 ok(r == ERROR_SUCCESS, "got %u\n", r);
5913
5914 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5915 ok(r == ERROR_SUCCESS, "got %u\n", r);
5916
5917 DeleteFileA("msitest\\volumeprop.txt");
5918 RemoveDirectoryA("msitest");
5919 DeleteFileA(msifile);
5920 }
5921
5922 static void test_shared_component(void)
5923 {
5924 UINT r;
5925
5926 if (is_process_limited())
5927 {
5928 skip("process is limited\n");
5929 return;
5930 }
5931 CreateDirectoryA("msitest", NULL);
5932 create_file("msitest\\sharedcomponent.txt", 1000);
5933 create_database_wordcount(msifile, shc_tables, sizeof(shc_tables)/sizeof(shc_tables[0]),
5934 100, 0, ";", "{A8826420-FD72-4E61-9E15-C1944CF4CBE1}");
5935 create_database_wordcount(msifile2, shc2_tables, sizeof(shc2_tables)/sizeof(shc2_tables[0]),
5936 100, 0, ";", "{A8B50B30-0E8A-4ACD-B3CF-1A5DC58B2739}");
5937
5938 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5939
5940 r = MsiInstallProductA(msifile, NULL);
5941 ok(r == ERROR_SUCCESS, "got %u\n", r);
5942
5943 ok(pf_exists("msitest\\sharedcomponent.txt"), "file not installed\n");
5944
5945 r = MsiInstallProductA(msifile2, NULL);
5946 ok(r == ERROR_SUCCESS, "got %u\n", r);
5947
5948 ok(pf_exists("msitest\\sharedcomponent.txt"), "file not installed\n");
5949
5950 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5951 ok(r == ERROR_SUCCESS, "got %u\n", r);
5952
5953 ok(pf_exists("msitest\\sharedcomponent.txt"), "file removed\n");
5954
5955 r = MsiInstallProductA(msifile2, "REMOVE=ALL");
5956 ok(r == ERROR_SUCCESS, "got %u\n", r);
5957
5958 ok(!pf_exists("msitest\\sharedcomponent.txt"), "file not removed\n");
5959
5960 DeleteFileA("msitest\\sharedcomponent.txt");
5961 RemoveDirectoryA("msitest");
5962 DeleteFileA(msifile);
5963 DeleteFileA(msifile2);
5964 }
5965
5966 static void test_remove_upgrade_code(void)
5967 {
5968 UINT r;
5969 LONG res;
5970 HKEY hkey;
5971 REGSAM access = KEY_ALL_ACCESS;
5972 DWORD type, size;
5973 char buf[1];
5974
5975 if (is_process_limited())
5976 {
5977 skip( "process is limited\n" );
5978 return;
5979 }
5980 if (is_wow64) access |= KEY_WOW64_64KEY;
5981
5982 create_test_files();
5983 create_database( msifile, icon_base_tables, sizeof(icon_base_tables)/sizeof(icon_base_tables[0]) );
5984
5985 MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
5986
5987 r = MsiInstallProductA( msifile, "FULL=1" );
5988 ok(r == ERROR_SUCCESS, "got %u\n", r);
5989
5990 res = RegOpenKeyExA( HKEY_LOCAL_MACHINE,
5991 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2",
5992 0, access, &hkey );
5993 ok( res == ERROR_SUCCESS, "got %d\n", res );
5994
5995 type = 0xdeadbeef;
5996 buf[0] = 0x55;
5997 size = sizeof(buf);
5998 res = RegQueryValueExA( hkey, "94A88FD7F6998CE40A22FB59F6B9C2BB", NULL, &type, (BYTE *)buf, &size );
5999 ok( res == ERROR_SUCCESS, "got %d\n", res );
6000 ok( type == REG_SZ, "got %u\n", type );
6001 ok( size == 1, "got %u\n", size );
6002 ok( !buf[0], "wrong data\n" );
6003 RegCloseKey( hkey );
6004
6005 r = MsiInstallProductA( msifile, "REMOVE=ALL" );
6006 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6007
6008 res = RegOpenKeyExA( HKEY_LOCAL_MACHINE,
6009 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2",
6010 0, access, &hkey );
6011 ok( res == ERROR_FILE_NOT_FOUND, "got %d\n", res );
6012
6013 RemoveDirectoryA( "msitest" );
6014 DeleteFileA( msifile );
6015 }
6016
6017 static void test_feature_tree(void)
6018 {
6019 UINT r;
6020
6021 if (is_process_limited())
6022 {
6023 skip( "process is limited\n" );
6024 return;
6025 }
6026
6027 create_file( "msitest\\featuretree.txt", 1000 );
6028 create_database( msifile, ft_tables, sizeof(ft_tables)/sizeof(ft_tables[0]) );
6029
6030 MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
6031
6032 r = MsiInstallProductA( msifile, "INSTALLTYPE=\"0\"" );
6033 ok( r == ERROR_INSTALL_FAILURE, "got %u\n", r );
6034
6035 r = MsiInstallProductA( msifile, "INSTALLTYPE=\"1\"" );
6036 ok( r == ERROR_SUCCESS, "got %u\n", r );
6037
6038 r = MsiInstallProductA( msifile, "REMOVE=ALL" );
6039 ok( r == ERROR_SUCCESS, "got %u\n", r );
6040
6041 DeleteFileA( "msitest\\featuretree.txt" );
6042 RemoveDirectoryA( "msitest" );
6043 DeleteFileA( msifile );
6044 }
6045
6046 START_TEST(install)
6047 {
6048 DWORD len;
6049 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6050 STATEMGRSTATUS status;
6051 BOOL ret = FALSE;
6052
6053 init_functionpointers();
6054
6055 if (pIsWow64Process)
6056 pIsWow64Process(GetCurrentProcess(), &is_wow64);
6057
6058 GetCurrentDirectoryA(MAX_PATH, prev_path);
6059 GetTempPathA(MAX_PATH, temp_path);
6060 SetCurrentDirectoryA(temp_path);
6061
6062 lstrcpyA(CURR_DIR, temp_path);
6063 len = lstrlenA(CURR_DIR);
6064
6065 if(len && (CURR_DIR[len - 1] == '\\'))
6066 CURR_DIR[len - 1] = 0;
6067
6068 ok(get_system_dirs(), "failed to retrieve system dirs\n");
6069 ok(get_user_dirs(), "failed to retrieve user dirs\n");
6070
6071 /* Create a restore point ourselves so we circumvent the multitude of restore points
6072 * that would have been created by all the installation and removal tests.
6073 *
6074 * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
6075 * creation of restore points.
6076 */
6077 if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
6078 {
6079 memset(&status, 0, sizeof(status));
6080 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
6081 }
6082
6083 /* Create only one log file and don't append. We have to pass something
6084 * for the log mode for this to work. The logfile needs to have an absolute
6085 * path otherwise we still end up with some extra logfiles as some tests
6086 * change the current directory.
6087 */
6088 lstrcpyA(log_file, temp_path);
6089 lstrcatA(log_file, "\\msitest.log");
6090 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
6091
6092 if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */
6093 test_MsiInstallProduct();
6094 test_MsiSetComponentState();
6095 test_packagecoltypes();
6096 test_continuouscabs();
6097 test_caborder();
6098 test_mixedmedia();
6099 test_samesequence();
6100 test_uiLevelFlags();
6101 test_readonlyfile();
6102 test_readonlyfile_cab();
6103 test_setdirproperty();
6104 test_cabisextracted();
6105 test_transformprop();
6106 test_currentworkingdir();
6107 test_admin();
6108 test_adminprops();
6109 test_missingcab();
6110 test_sourcefolder();
6111 test_customaction51();
6112 test_installstate();
6113 test_sourcepath();
6114 test_missingcomponent();
6115 test_sourcedirprop();
6116 test_adminimage();
6117 test_propcase();
6118 test_int_widths();
6119 test_shortcut();
6120 test_preselected();
6121 test_installed_prop();
6122 test_file_in_use();
6123 test_file_in_use_cab();
6124 test_allusers_prop();
6125 test_feature_override();
6126 test_icon_table();
6127 test_package_validation();
6128 test_upgrade_code();
6129 test_mixed_package();
6130 test_volume_props();
6131 test_shared_component();
6132 test_remove_upgrade_code();
6133 test_feature_tree();
6134
6135 DeleteFileA(log_file);
6136
6137 if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
6138 {
6139 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
6140 if (ret)
6141 remove_restore_point(status.llSequenceNumber);
6142 }
6143 FreeLibrary(hsrclient);
6144
6145 SetCurrentDirectoryA(prev_path);
6146 }