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