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