c60e01fefdc007b14a0b53bebedad5f3daeeb14f
[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_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
565 "s72\tS38\ts72\ti2\tS255\tS72\n"
566 "Component\tComponent\n"
567 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n";
568
569 static const CHAR ci2_feature_comp_dat[] = "Feature_\tComponent_\n"
570 "s38\ts72\n"
571 "FeatureComponents\tFeature_\tComponent_\n"
572 "feature\taugustus";
573
574 static const CHAR ci2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
575 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
576 "File\tFile\n"
577 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
578
579 static const CHAR pp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
580 "s72\tS255\tI2\n"
581 "InstallExecuteSequence\tAction\n"
582 "ValidateProductID\t\t700\n"
583 "CostInitialize\t\t800\n"
584 "FileCost\t\t900\n"
585 "CostFinalize\t\t1000\n"
586 "InstallValidate\t\t1400\n"
587 "InstallInitialize\t\t1500\n"
588 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
589 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
590 "RemoveFiles\t\t3500\n"
591 "InstallFiles\t\t4000\n"
592 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
593 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
594 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
595 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
596 "InstallFinalize\t\t6600";
597
598 static const CHAR tp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
599 "s72\tS38\ts72\ti2\tS255\tS72\n"
600 "Component\tComponent\n"
601 "augustus\t\tMSITESTDIR\t0\tprop=\"val\"\taugustus\n";
602
603 static const CHAR cwd_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
604 "s72\tS38\ts72\ti2\tS255\tS72\n"
605 "Component\tComponent\n"
606 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
607
608 static const CHAR adm_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
609 "s72\tS38\ts72\ti2\tS255\tS72\n"
610 "Component\tComponent\n"
611 "augustus\t\tMSITESTDIR\t0\tPOSTADMIN=1\taugustus";
612
613 static const CHAR adm_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
614 "s72\ti2\tS64\tS0\tS255\n"
615 "CustomAction\tAction\n"
616 "SetPOSTADMIN\t51\tPOSTADMIN\t1\t\n";
617
618 static const CHAR adm_admin_exec_seq_dat[] = "Action\tCondition\tSequence\n"
619 "s72\tS255\tI2\n"
620 "AdminExecuteSequence\tAction\n"
621 "CostFinalize\t\t1000\n"
622 "CostInitialize\t\t800\n"
623 "FileCost\t\t900\n"
624 "SetPOSTADMIN\t\t950\n"
625 "InstallFiles\t\t4000\n"
626 "InstallFinalize\t\t6600\n"
627 "InstallInitialize\t\t1500\n"
628 "InstallValidate\t\t1400\n"
629 "LaunchConditions\t\t100";
630
631 static const CHAR amp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
632 "s72\tS38\ts72\ti2\tS255\tS72\n"
633 "Component\tComponent\n"
634 "augustus\t\tMSITESTDIR\t0\tMYPROP=2718 and MyProp=42\taugustus\n";
635
636 static const CHAR rem_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
637 "s72\tS255\tI2\n"
638 "InstallExecuteSequence\tAction\n"
639 "ValidateProductID\t\t700\n"
640 "CostInitialize\t\t800\n"
641 "FileCost\t\t900\n"
642 "CostFinalize\t\t1000\n"
643 "InstallValidate\t\t1400\n"
644 "InstallInitialize\t\t1500\n"
645 "ProcessComponents\t\t1600\n"
646 "UnpublishFeatures\t\t1800\n"
647 "RemoveFiles\t\t3500\n"
648 "InstallFiles\t\t4000\n"
649 "RegisterProduct\t\t6100\n"
650 "PublishFeatures\t\t6300\n"
651 "PublishProduct\t\t6400\n"
652 "InstallFinalize\t\t6600";
653
654 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
655 "s72\tS38\ts72\ti2\tS255\tS72\n"
656 "Component\tComponent\n"
657 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
658 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
659 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
660 "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n"
661 "tiberius\t\tMSITESTDIR\t0\t\ttiberius\n";
662
663 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
664 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
665 "File\tFile\n"
666 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
667 "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
668 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
669 "gaius\tgaius\tgaius\t500\t\t\t16384\t4\n"
670 "tiberius\ttiberius\ttiberius\t500\t\t\t0\t5\n";
671
672 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
673 "i2\ti4\tL64\tS255\tS32\tS72\n"
674 "Media\tDiskId\n"
675 "1\t1\t\ttest1.cab\tDISK1\t\n"
676 "2\t2\t\ttest2.cab\tDISK2\t\n"
677 "3\t3\t\ttest3.cab\tDISK3\t\n"
678 "4\t4\t\ttest3.cab\tDISK3\t\n"
679 "5\t5\t\ttest4.cab\tDISK4\t\n";
680
681 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
682 "s72\ti2\ti4\ti4\ti4\ti4\n"
683 "MsiFileHash\tFile_\n"
684 "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
685
686 static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
687 "s72\tS38\ts72\ti2\tS255\tS72\n"
688 "Component\tComponent\n"
689 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
690
691 static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
692 "s72\tS38\ts72\ti2\tS255\tS72\n"
693 "Component\tComponent\n"
694 "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
695
696 static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
697 "s72\tS255\tI2\n"
698 "InstallExecuteSequence\tAction\n"
699 "ValidateProductID\t\t700\n"
700 "GoodSetProperty\t\t725\n"
701 "BadSetProperty\t\t750\n"
702 "CostInitialize\t\t800\n"
703 "ResolveSource\t\t810\n"
704 "FileCost\t\t900\n"
705 "SetSourceDir\tSRCDIR\t910\n"
706 "CostFinalize\t\t1000\n"
707 "InstallValidate\t\t1400\n"
708 "InstallInitialize\t\t1500\n"
709 "InstallFiles\t\t4000\n"
710 "InstallFinalize\t\t6600";
711
712 static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
713 "s72\ti2\tS64\tS0\n"
714 "CustomAction\tAction\n"
715 "GoodSetProperty\t51\tMYPROP\t42\n"
716 "BadSetProperty\t51\t\tMYPROP\n"
717 "SetSourceDir\t51\tSourceDir\t[SRCDIR]\n";
718
719 static const CHAR is_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
720 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
721 "Feature\tFeature\n"
722 "one\t\t\t\t2\t1\t\t0\n" /* favorLocal */
723 "two\t\t\t\t2\t1\t\t1\n" /* favorSource */
724 "three\t\t\t\t2\t1\t\t4\n" /* favorAdvertise */
725 "four\t\t\t\t2\t0\t\t0"; /* disabled */
726
727 static const CHAR is_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
728 "s72\tS38\ts72\ti2\tS255\tS72\n"
729 "Component\tComponent\n"
730 "alpha\t\tMSITESTDIR\t0\t\talpha_file\n" /* favorLocal:Local */
731 "beta\t\tMSITESTDIR\t1\t\tbeta_file\n" /* favorLocal:Source */
732 "gamma\t\tMSITESTDIR\t2\t\tgamma_file\n" /* favorLocal:Optional */
733 "theta\t\tMSITESTDIR\t0\t\ttheta_file\n" /* favorSource:Local */
734 "delta\t\tMSITESTDIR\t1\t\tdelta_file\n" /* favorSource:Source */
735 "epsilon\t\tMSITESTDIR\t2\t\tepsilon_file\n" /* favorSource:Optional */
736 "zeta\t\tMSITESTDIR\t0\t\tzeta_file\n" /* favorAdvertise:Local */
737 "iota\t\tMSITESTDIR\t1\t\tiota_file\n" /* favorAdvertise:Source */
738 "eta\t\tMSITESTDIR\t2\t\teta_file\n" /* favorAdvertise:Optional */
739 "kappa\t\tMSITESTDIR\t0\t\tkappa_file\n" /* disabled:Local */
740 "lambda\t\tMSITESTDIR\t1\t\tlambda_file\n" /* disabled:Source */
741 "mu\t\tMSITESTDIR\t2\t\tmu_file\n"; /* disabled:Optional */
742
743 static const CHAR is_feature_comp_dat[] = "Feature_\tComponent_\n"
744 "s38\ts72\n"
745 "FeatureComponents\tFeature_\tComponent_\n"
746 "one\talpha\n"
747 "one\tbeta\n"
748 "one\tgamma\n"
749 "two\ttheta\n"
750 "two\tdelta\n"
751 "two\tepsilon\n"
752 "three\tzeta\n"
753 "three\tiota\n"
754 "three\teta\n"
755 "four\tkappa\n"
756 "four\tlambda\n"
757 "four\tmu";
758
759 static const CHAR is_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
760 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
761 "File\tFile\n"
762 "alpha_file\talpha\talpha\t500\t\t\t8192\t1\n"
763 "beta_file\tbeta\tbeta\t500\t\t\t8291\t2\n"
764 "gamma_file\tgamma\tgamma\t500\t\t\t8192\t3\n"
765 "theta_file\ttheta\ttheta\t500\t\t\t8192\t4\n"
766 "delta_file\tdelta\tdelta\t500\t\t\t8192\t5\n"
767 "epsilon_file\tepsilon\tepsilon\t500\t\t\t8192\t6\n"
768 "zeta_file\tzeta\tzeta\t500\t\t\t8192\t7\n"
769 "iota_file\tiota\tiota\t500\t\t\t8192\t8\n"
770 "eta_file\teta\teta\t500\t\t\t8192\t9\n"
771 "kappa_file\tkappa\tkappa\t500\t\t\t8192\t10\n"
772 "lambda_file\tlambda\tlambda\t500\t\t\t8192\t11\n"
773 "mu_file\tmu\tmu\t500\t\t\t8192\t12";
774
775 static const CHAR is_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
776 "i2\ti4\tL64\tS255\tS32\tS72\n"
777 "Media\tDiskId\n"
778 "1\t12\t\t\tDISK1\t\n";
779
780 static const CHAR sp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
781 "s72\tS38\ts72\ti2\tS255\tS72\n"
782 "Component\tComponent\n"
783 "augustus\t\tTWODIR\t0\t\taugustus\n";
784
785 static const CHAR sp_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
786 "s72\tS72\tl255\n"
787 "Directory\tDirectory\n"
788 "TARGETDIR\t\tSourceDir\n"
789 "ProgramFilesFolder\tTARGETDIR\t.\n"
790 "MSITESTDIR\tProgramFilesFolder\tmsitest:.\n"
791 "ONEDIR\tMSITESTDIR\t.:shortone|longone\n"
792 "TWODIR\tONEDIR\t.:shorttwo|longtwo";
793
794 static const CHAR mcp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
795 "s72\tS38\ts72\ti2\tS255\tS72\n"
796 "Component\tComponent\n"
797 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t2\t\thydrogen\n"
798 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t2\t\thelium\n"
799 "lithium\t{4AF28FFC-71C7-4307-BDE4-B77C5338F56F}\tMSITESTDIR\t2\tPROPVAR=42\tlithium\n";
800
801 static const CHAR mcp_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
802 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
803 "Feature\tFeature\n"
804 "hydroxyl\t\thydroxyl\thydroxyl\t2\t1\tTARGETDIR\t0\n"
805 "heliox\t\theliox\theliox\t2\t5\tTARGETDIR\t0\n"
806 "lithia\t\tlithia\tlithia\t2\t10\tTARGETDIR\t0";
807
808 static const CHAR mcp_feature_comp_dat[] = "Feature_\tComponent_\n"
809 "s38\ts72\n"
810 "FeatureComponents\tFeature_\tComponent_\n"
811 "hydroxyl\thydrogen\n"
812 "heliox\thelium\n"
813 "lithia\tlithium";
814
815 static const CHAR mcp_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
816 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
817 "File\tFile\n"
818 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
819 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
820 "lithium\tlithium\tlithium\t0\t\t\t8192\t1\n"
821 "beryllium\tmissingcomp\tberyllium\t0\t\t\t8192\t1";
822
823 static const CHAR ai_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
824 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
825 "File\tFile\n"
826 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
827 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
828 "one.txt\tOne\tone.txt\t1000\t\t\t16384\t1\n"
829 "three.txt\tThree\tthree.txt\t1000\t\t\t16384\t3\n"
830 "two.txt\tTwo\ttwo.txt\t1000\t\t\t16384\t2\n"
831 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
832 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
833
834 static const CHAR ip_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
835 "s72\tS255\tI2\n"
836 "InstallExecuteSequence\tAction\n"
837 "CostFinalize\t\t1000\n"
838 "ValidateProductID\t\t700\n"
839 "CostInitialize\t\t800\n"
840 "FileCost\t\t900\n"
841 "RemoveFiles\t\t3500\n"
842 "InstallFiles\t\t4000\n"
843 "RegisterUser\t\t6000\n"
844 "RegisterProduct\t\t6100\n"
845 "PublishFeatures\t\t6300\n"
846 "PublishProduct\t\t6400\n"
847 "InstallFinalize\t\t6600\n"
848 "InstallInitialize\t\t1500\n"
849 "ProcessComponents\t\t1600\n"
850 "UnpublishFeatures\t\t1800\n"
851 "InstallValidate\t\t1400\n"
852 "LaunchConditions\t\t100\n"
853 "TestInstalledProp\tInstalled AND NOT REMOVE\t950\n";
854
855 static const CHAR ip_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
856 "s72\ti2\tS64\tS0\tS255\n"
857 "CustomAction\tAction\n"
858 "TestInstalledProp\t19\t\tTest failed\t\n";
859
860 static const CHAR aup_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
861 "s72\tS255\tI2\n"
862 "InstallExecuteSequence\tAction\n"
863 "CostFinalize\t\t1000\n"
864 "ValidateProductID\t\t700\n"
865 "CostInitialize\t\t800\n"
866 "FileCost\t\t900\n"
867 "RemoveFiles\t\t3500\n"
868 "InstallFiles\t\t4000\n"
869 "RegisterUser\t\t6000\n"
870 "RegisterProduct\t\t6100\n"
871 "PublishFeatures\t\t6300\n"
872 "PublishProduct\t\t6400\n"
873 "InstallFinalize\t\t6600\n"
874 "InstallInitialize\t\t1500\n"
875 "ProcessComponents\t\t1600\n"
876 "UnpublishFeatures\t\t1800\n"
877 "InstallValidate\t\t1400\n"
878 "LaunchConditions\t\t100\n"
879 "TestAllUsersProp\tALLUSERS AND NOT REMOVE\t50\n";
880
881 static const CHAR aup2_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
882 "s72\tS255\tI2\n"
883 "InstallExecuteSequence\tAction\n"
884 "CostFinalize\t\t1000\n"
885 "ValidateProductID\t\t700\n"
886 "CostInitialize\t\t800\n"
887 "FileCost\t\t900\n"
888 "RemoveFiles\t\t3500\n"
889 "InstallFiles\t\t4000\n"
890 "RegisterUser\t\t6000\n"
891 "RegisterProduct\t\t6100\n"
892 "PublishFeatures\t\t6300\n"
893 "PublishProduct\t\t6400\n"
894 "InstallFinalize\t\t6600\n"
895 "InstallInitialize\t\t1500\n"
896 "ProcessComponents\t\t1600\n"
897 "UnpublishFeatures\t\t1800\n"
898 "InstallValidate\t\t1400\n"
899 "LaunchConditions\t\t100\n"
900 "TestAllUsersProp\tALLUSERS=2 AND NOT REMOVE\t50\n";
901
902 static const CHAR aup3_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
903 "s72\tS255\tI2\n"
904 "InstallExecuteSequence\tAction\n"
905 "CostFinalize\t\t1000\n"
906 "ValidateProductID\t\t700\n"
907 "CostInitialize\t\t800\n"
908 "FileCost\t\t900\n"
909 "RemoveFiles\t\t3500\n"
910 "InstallFiles\t\t4000\n"
911 "RegisterUser\t\t6000\n"
912 "RegisterProduct\t\t6100\n"
913 "PublishFeatures\t\t6300\n"
914 "PublishProduct\t\t6400\n"
915 "InstallFinalize\t\t6600\n"
916 "InstallInitialize\t\t1500\n"
917 "ProcessComponents\t\t1600\n"
918 "UnpublishFeatures\t\t1800\n"
919 "InstallValidate\t\t1400\n"
920 "LaunchConditions\t\t100\n"
921 "TestAllUsersProp\tALLUSERS=1 AND NOT REMOVE\t50\n";
922
923 static const CHAR aup_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
924 "s72\ti2\tS64\tS0\tS255\n"
925 "CustomAction\tAction\n"
926 "TestAllUsersProp\t19\t\tTest failed\t\n";
927
928 static const CHAR fo_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
929 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
930 "File\tFile\n"
931 "override.txt\toverride\toverride.txt\t1000\t\t\t8192\t1\n"
932 "preselected.txt\tpreselected\tpreselected.txt\t1000\t\t\t8192\t2\n"
933 "notpreselected.txt\tnotpreselected\tnotpreselected.txt\t1000\t\t\t8192\t3\n";
934
935 static const CHAR fo_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
936 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
937 "Feature\tFeature\n"
938 "override\t\t\toverride feature\t1\t1\tMSITESTDIR\t0\n"
939 "preselected\t\t\tpreselected feature\t1\t1\tMSITESTDIR\t0\n"
940 "notpreselected\t\t\tnotpreselected feature\t1\t1\tMSITESTDIR\t0\n";
941
942 static const CHAR fo_condition_dat[] = "Feature_\tLevel\tCondition\n"
943 "s38\ti2\tS255\n"
944 "Condition\tFeature_\tLevel\n"
945 "preselected\t0\tPreselected\n"
946 "notpreselected\t0\tNOT Preselected\n";
947
948 static const CHAR fo_feature_comp_dat[] = "Feature_\tComponent_\n"
949 "s38\ts72\n"
950 "FeatureComponents\tFeature_\tComponent_\n"
951 "override\toverride\n"
952 "preselected\tpreselected\n"
953 "notpreselected\tnotpreselected\n";
954
955 static const CHAR fo_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
956 "s72\tS38\ts72\ti2\tS255\tS72\n"
957 "Component\tComponent\n"
958 "override\t{0A00FB1D-97B0-4B42-ADF0-BB8913416623}\tMSITESTDIR\t0\t\toverride.txt\n"
959 "preselected\t{44E1DB75-605A-43DD-8CF5-CAB17F1BBD60}\tMSITESTDIR\t0\t\tpreselected.txt\n"
960 "notpreselected\t{E1647733-5E75-400A-A92E-5E60B4D4EF9F}\tMSITESTDIR\t0\t\tnotpreselected.txt\n";
961
962 static const CHAR fo_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
963 "s72\ti2\tS64\tS0\tS255\n"
964 "CustomAction\tAction\n"
965 "SetPreselected\t51\tPreselected\t1\t\n";
966
967 static const CHAR fo_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
968 "s72\tS255\tI2\n"
969 "InstallExecuteSequence\tAction\n"
970 "LaunchConditions\t\t100\n"
971 "SetPreselected\tpreselect=1\t200\n"
972 "CostInitialize\t\t800\n"
973 "FileCost\t\t900\n"
974 "CostFinalize\t\t1000\n"
975 "InstallValidate\t\t1400\n"
976 "InstallInitialize\t\t1500\n"
977 "ProcessComponents\t\t1600\n"
978 "RemoveFiles\t\t1700\n"
979 "InstallFiles\t\t2000\n"
980 "RegisterProduct\t\t5000\n"
981 "PublishFeatures\t\t5100\n"
982 "PublishProduct\t\t5200\n"
983 "InstallFinalize\t\t6000\n";
984
985 static const CHAR uc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
986 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
987 "File\tFile\n"
988 "upgradecode.txt\tupgradecode\tupgradecode.txt\t1000\t\t\t8192\t1\n";
989
990 static const CHAR uc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
991 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
992 "Feature\tFeature\n"
993 "upgradecode\t\t\tupgradecode feature\t1\t2\tMSITESTDIR\t0\n";
994
995 static const CHAR uc_feature_comp_dat[] = "Feature_\tComponent_\n"
996 "s38\ts72\n"
997 "FeatureComponents\tFeature_\tComponent_\n"
998 "upgradecode\tupgradecode\n";
999
1000 static const CHAR uc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1001 "s72\tS38\ts72\ti2\tS255\tS72\n"
1002 "Component\tComponent\n"
1003 "upgradecode\t{6952B732-2FCB-4E47-976F-989FCBD7EDFB}\tMSITESTDIR\t0\t\tupgradecode.txt\n";
1004
1005 static const CHAR uc_property_dat[] = "Property\tValue\n"
1006 "s72\tl0\n"
1007 "Property\tProperty\n"
1008 "INSTALLLEVEL\t3\n"
1009 "ProductCode\t{E5FB1241-F547-4BA7-A60E-8E75797268D4}\n"
1010 "ProductName\tMSITEST\n"
1011 "ProductVersion\t1.1.1\n"
1012 "UpgradeCode\t#UPGEADECODE#\n"
1013 "MSIFASTINSTALL\t1\n";
1014
1015 static const CHAR uc_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1016 "s72\tS255\tI2\n"
1017 "InstallExecuteSequence\tAction\n"
1018 "LaunchConditions\t\t100\n"
1019 "CostInitialize\t\t200\n"
1020 "FileCost\t\t300\n"
1021 "CostFinalize\t\t400\n"
1022 "InstallInitialize\t\t500\n"
1023 "ProcessComponents\t\t600\n"
1024 "InstallValidate\t\t700\n"
1025 "RemoveFiles\t\t800\n"
1026 "InstallFiles\t\t900\n"
1027 "RegisterProduct\t\t1000\n"
1028 "PublishFeatures\t\t1100\n"
1029 "PublishProduct\t\t1200\n"
1030 "InstallFinalize\t\t1300\n";
1031
1032 static const char mixed_feature_dat[] =
1033 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1034 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1035 "Feature\tFeature\n"
1036 "feature1\t\t\t\t1\t2\tMSITESTDIR\t0\n"
1037 "feature2\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1038
1039 static const char mixed_feature_comp_dat[] =
1040 "Feature_\tComponent_\n"
1041 "s38\ts72\n"
1042 "FeatureComponents\tFeature_\tComponent_\n"
1043 "feature1\tcomp1\n"
1044 "feature2\tcomp2\n";
1045
1046 static const char mixed_component_dat[] =
1047 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1048 "s72\tS38\ts72\ti2\tS255\tS72\n"
1049 "Component\tComponent\n"
1050 "comp1\t{DE9F0EF4-0ED3-495A-8105-060C0EA457B8}\tTARGETDIR\t4\t\tregdata1\n"
1051 "comp2\t{4912DBE7-FC3A-4F91-BB5C-88F5C15C19A5}\tTARGETDIR\t260\t\tregdata2\n";
1052
1053 static const char mixed_registry_dat[] =
1054 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
1055 "s72\ti2\tl255\tL255\tL0\ts72\n"
1056 "Registry\tRegistry\n"
1057 "regdata1\t2\tSOFTWARE\\Wine\\msitest\ttest1\t\tcomp1\n"
1058 "regdata2\t2\tSOFTWARE\\Wine\\msitest\ttest2\t\tcomp2\n"
1059 "regdata3\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\t\tCLSID_Winetest32\tcomp1\n"
1060 "regdata4\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32\t\twinetest32.dll\tcomp1\n"
1061 "regdata5\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\t\tCLSID_Winetest64\tcomp2\n"
1062 "regdata6\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32\t\twinetest64.dll\tcomp2\n";
1063
1064 static const char mixed_install_exec_seq_dat[] =
1065 "Action\tCondition\tSequence\n"
1066 "s72\tS255\tI2\n"
1067 "InstallExecuteSequence\tAction\n"
1068 "LaunchConditions\t\t100\n"
1069 "CostInitialize\t\t200\n"
1070 "FileCost\t\t300\n"
1071 "CostFinalize\t\t400\n"
1072 "InstallValidate\t\t500\n"
1073 "InstallInitialize\t\t600\n"
1074 "ProcessComponents\t\t700\n"
1075 "UnpublishFeatures\t\t800\n"
1076 "RemoveRegistryValues\t\t900\n"
1077 "WriteRegistryValues\t\t1000\n"
1078 "RegisterProduct\t\t1100\n"
1079 "PublishFeatures\t\t1200\n"
1080 "PublishProduct\t\t1300\n"
1081 "InstallFinalize\t\t1400\n";
1082
1083 static const char vp_file_dat[] =
1084 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1085 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1086 "File\tFile\n"
1087 "volumeprop\tcomp\tvolumeprop.txt\t1000\t\t\t8192\t1\n";
1088
1089 static const char vp_feature_dat[] =
1090 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1091 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1092 "Feature\tFeature\n"
1093 "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1094
1095 static const char vp_feature_comp_dat[] =
1096 "Feature_\tComponent_\n"
1097 "s38\ts72\n"
1098 "FeatureComponents\tFeature_\tComponent_\n"
1099 "feature\tcomp\n";
1100
1101 static const char vp_component_dat[] =
1102 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1103 "s72\tS38\ts72\ti2\tS255\tS72\n"
1104 "Component\tComponent\n"
1105 "comp\t{24364AE7-5B7F-496C-AF5A-54893639C567}\tMSITESTDIR\t0\t\tvolumeprop\n";
1106
1107 static const char vp_custom_action_dat[] =
1108 "Action\tType\tSource\tTarget\tISComments\n"
1109 "s72\ti2\tS64\tS0\tS255\n"
1110 "CustomAction\tAction\n"
1111 "TestPrimaryVolumePath0\t19\t\tPrimaryVolumePath set before CostFinalize\t\n"
1112 "TestPrimaryVolumeSpaceAvailable0\t19\t\tPrimaryVolumeSpaceAvailable set before CostFinalize\t\n"
1113 "TestPrimaryVolumePath1\t19\t\tPrimaryVolumePath set before InstallValidate\t\n"
1114 "TestPrimaryVolumeSpaceAvailable1\t19\t\tPrimaryVolumeSpaceAvailable not set before InstallValidate\t\n"
1115 "TestPrimaryVolumePath2\t19\t\tPrimaryVolumePath not set after InstallValidate\t\n"
1116 "TestPrimaryVolumeSpaceAvailable2\t19\t\tPrimaryVolumeSpaceAvailable not set after InstallValidate\t\n";
1117
1118 static const char vp_install_exec_seq_dat[] =
1119 "Action\tCondition\tSequence\n"
1120 "s72\tS255\tI2\n"
1121 "InstallExecuteSequence\tAction\n"
1122 "LaunchConditions\t\t100\n"
1123 "CostInitialize\t\t200\n"
1124 "FileCost\t\t300\n"
1125 "TestPrimaryVolumePath0\tPrimaryVolumePath AND NOT REMOVE\t400\n"
1126 "TestPrimaryVolumeSpaceAvailable0\tPrimaryVolumeSpaceAvailable AND NOT REMOVE\t500\n"
1127 "CostFinalize\t\t600\n"
1128 "TestPrimaryVolumePath1\tPrimaryVolumePath AND NOT REMOVE\t600\n"
1129 "TestPrimaryVolumeSpaceAvailable1\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t800\n"
1130 "InstallValidate\t\t900\n"
1131 "TestPrimaryVolumePath2\tNOT PrimaryVolumePath AND NOT REMOVE\t1000\n"
1132 "TestPrimaryVolumeSpaceAvailable2\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t1100\n"
1133 "InstallInitialize\t\t1200\n"
1134 "ProcessComponents\t\t1300\n"
1135 "RemoveFiles\t\t1400\n"
1136 "InstallFiles\t\t1500\n"
1137 "RegisterProduct\t\t1600\n"
1138 "PublishFeatures\t\t1700\n"
1139 "PublishProduct\t\t1800\n"
1140 "InstallFinalize\t\t1900\n";
1141
1142 static const char shc_property_dat[] =
1143 "Property\tValue\n"
1144 "s72\tl0\n"
1145 "Property\tProperty\n"
1146 "INSTALLLEVEL\t3\n"
1147 "ProductCode\t{5CD99CD0-69C7-409B-9905-82DD743CC840}\n"
1148 "ProductName\tMSITEST\n"
1149 "ProductVersion\t1.1.1\n"
1150 "MSIFASTINSTALL\t1\n";
1151
1152 static const char shc2_property_dat[] =
1153 "Property\tValue\n"
1154 "s72\tl0\n"
1155 "Property\tProperty\n"
1156 "INSTALLLEVEL\t3\n"
1157 "ProductCode\t{4CEFADE5-DAFB-4C21-8EF2-4ED4F139F340}\n"
1158 "ProductName\tMSITEST2\n"
1159 "ProductVersion\t1.1.1\n"
1160 "MSIFASTINSTALL\t1\n";
1161
1162 static const char shc_file_dat[] =
1163 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1164 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1165 "File\tFile\n"
1166 "sharedcomponent\tsharedcomponent\tsharedcomponent.txt\t1000\t\t\t8192\t1\n";
1167
1168 static const char shc_feature_dat[] =
1169 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1170 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1171 "Feature\tFeature\n"
1172 "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1173
1174 static const char shc_feature_comp_dat[] =
1175 "Feature_\tComponent_\n"
1176 "s38\ts72\n"
1177 "FeatureComponents\tFeature_\tComponent_\n"
1178 "feature\tsharedcomponent\n";
1179
1180 static const char shc_component_dat[] =
1181 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1182 "s72\tS38\ts72\ti2\tS255\tS72\n"
1183 "Component\tComponent\n"
1184 "sharedcomponent\t{900A4ACB-DC6F-4795-A04B-81B530183D41}\tMSITESTDIR\t0\t\tsharedcomponent\n";
1185
1186 static const char shc_custom_action_dat[] =
1187 "Action\tType\tSource\tTarget\tISComments\n"
1188 "s72\ti2\tS64\tS0\tS255\n"
1189 "CustomAction\tAction\n"
1190 "TestComponentAction\t19\t\twrong component action on install\t\n";
1191
1192 static const char shc_install_exec_seq_dat[] =
1193 "Action\tCondition\tSequence\n"
1194 "s72\tS255\tI2\n"
1195 "InstallExecuteSequence\tAction\n"
1196 "LaunchConditions\t\t100\n"
1197 "CostInitialize\t\t200\n"
1198 "FileCost\t\t300\n"
1199 "CostFinalize\t\t600\n"
1200 "InstallValidate\t\t900\n"
1201 "InstallInitialize\t\t1200\n"
1202 "ProcessComponents\t\t1300\n"
1203 "RemoveFiles\t\t1400\n"
1204 "InstallFiles\t\t1500\n"
1205 "TestComponentAction\tNOT REMOVE AND ($sharedcomponent <> 3)\t1600\n"
1206 "RegisterProduct\t\t1700\n"
1207 "PublishFeatures\t\t1800\n"
1208 "PublishProduct\t\t1900\n"
1209 "InstallFinalize\t\t2000\n";
1210
1211 typedef struct _msi_table
1212 {
1213 const CHAR *filename;
1214 const CHAR *data;
1215 int size;
1216 } msi_table;
1217
1218 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
1219
1220 static const msi_table tables[] =
1221 {
1222 ADD_TABLE(component),
1223 ADD_TABLE(directory),
1224 ADD_TABLE(feature),
1225 ADD_TABLE(feature_comp),
1226 ADD_TABLE(file),
1227 ADD_TABLE(install_exec_seq),
1228 ADD_TABLE(media),
1229 ADD_TABLE(property),
1230 ADD_TABLE(registry),
1231 ADD_TABLE(service_install),
1232 ADD_TABLE(service_control)
1233 };
1234
1235 static const msi_table sc_tables[] =
1236 {
1237 ADD_TABLE(component),
1238 ADD_TABLE(directory),
1239 ADD_TABLE(feature),
1240 ADD_TABLE(feature_comp),
1241 ADD_TABLE(file),
1242 ADD_TABLE(install_exec_seq),
1243 ADD_TABLE(media),
1244 ADD_TABLE(property),
1245 ADD_TABLE(shortcut)
1246 };
1247
1248 static const msi_table ps_tables[] =
1249 {
1250 ADD_TABLE(component),
1251 ADD_TABLE(directory),
1252 ADD_TABLE(feature),
1253 ADD_TABLE(feature_comp),
1254 ADD_TABLE(file),
1255 ADD_TABLE(install_exec_seq),
1256 ADD_TABLE(media),
1257 ADD_TABLE(property),
1258 ADD_TABLE(condition)
1259 };
1260
1261 static const msi_table up_tables[] =
1262 {
1263 ADD_TABLE(component),
1264 ADD_TABLE(directory),
1265 ADD_TABLE(feature),
1266 ADD_TABLE(feature_comp),
1267 ADD_TABLE(file),
1268 ADD_TABLE(install_exec_seq),
1269 ADD_TABLE(media),
1270 ADD_TABLE(up_property),
1271 ADD_TABLE(registry),
1272 ADD_TABLE(service_install),
1273 ADD_TABLE(service_control)
1274 };
1275
1276 static const msi_table up2_tables[] =
1277 {
1278 ADD_TABLE(component),
1279 ADD_TABLE(directory),
1280 ADD_TABLE(feature),
1281 ADD_TABLE(feature_comp),
1282 ADD_TABLE(file),
1283 ADD_TABLE(install_exec_seq),
1284 ADD_TABLE(media),
1285 ADD_TABLE(up2_property),
1286 ADD_TABLE(registry),
1287 ADD_TABLE(service_install),
1288 ADD_TABLE(service_control)
1289 };
1290
1291 static const msi_table up3_tables[] =
1292 {
1293 ADD_TABLE(component),
1294 ADD_TABLE(directory),
1295 ADD_TABLE(feature),
1296 ADD_TABLE(feature_comp),
1297 ADD_TABLE(file),
1298 ADD_TABLE(install_exec_seq),
1299 ADD_TABLE(media),
1300 ADD_TABLE(up3_property),
1301 ADD_TABLE(registry),
1302 ADD_TABLE(service_install),
1303 ADD_TABLE(service_control)
1304 };
1305
1306 static const msi_table up4_tables[] =
1307 {
1308 ADD_TABLE(component),
1309 ADD_TABLE(directory),
1310 ADD_TABLE(feature),
1311 ADD_TABLE(feature_comp),
1312 ADD_TABLE(file),
1313 ADD_TABLE(pp_install_exec_seq),
1314 ADD_TABLE(media),
1315 ADD_TABLE(property),
1316 ADD_TABLE(registry),
1317 ADD_TABLE(service_install),
1318 ADD_TABLE(service_control)
1319 };
1320
1321 static const msi_table up5_tables[] =
1322 {
1323 ADD_TABLE(component),
1324 ADD_TABLE(directory),
1325 ADD_TABLE(feature),
1326 ADD_TABLE(feature_comp),
1327 ADD_TABLE(file),
1328 ADD_TABLE(pp_install_exec_seq),
1329 ADD_TABLE(media),
1330 ADD_TABLE(up_property),
1331 ADD_TABLE(registry),
1332 ADD_TABLE(service_install),
1333 ADD_TABLE(service_control)
1334 };
1335
1336 static const msi_table up6_tables[] =
1337 {
1338 ADD_TABLE(component),
1339 ADD_TABLE(directory),
1340 ADD_TABLE(feature),
1341 ADD_TABLE(feature_comp),
1342 ADD_TABLE(file),
1343 ADD_TABLE(pp_install_exec_seq),
1344 ADD_TABLE(media),
1345 ADD_TABLE(up2_property),
1346 ADD_TABLE(registry),
1347 ADD_TABLE(service_install),
1348 ADD_TABLE(service_control)
1349 };
1350
1351 static const msi_table up7_tables[] =
1352 {
1353 ADD_TABLE(component),
1354 ADD_TABLE(directory),
1355 ADD_TABLE(feature),
1356 ADD_TABLE(feature_comp),
1357 ADD_TABLE(file),
1358 ADD_TABLE(pp_install_exec_seq),
1359 ADD_TABLE(media),
1360 ADD_TABLE(up3_property),
1361 ADD_TABLE(registry),
1362 ADD_TABLE(service_install),
1363 ADD_TABLE(service_control)
1364 };
1365
1366 static const msi_table cc_tables[] =
1367 {
1368 ADD_TABLE(cc_component),
1369 ADD_TABLE(directory),
1370 ADD_TABLE(cc_feature),
1371 ADD_TABLE(cc_feature_comp),
1372 ADD_TABLE(cc_file),
1373 ADD_TABLE(install_exec_seq),
1374 ADD_TABLE(cc_media),
1375 ADD_TABLE(property),
1376 };
1377
1378 static const msi_table cc2_tables[] =
1379 {
1380 ADD_TABLE(cc2_component),
1381 ADD_TABLE(directory),
1382 ADD_TABLE(cc_feature),
1383 ADD_TABLE(cc_feature_comp),
1384 ADD_TABLE(cc2_file),
1385 ADD_TABLE(install_exec_seq),
1386 ADD_TABLE(cc_media),
1387 ADD_TABLE(property),
1388 };
1389
1390 static const msi_table cc3_tables[] =
1391 {
1392 ADD_TABLE(cc_component),
1393 ADD_TABLE(directory),
1394 ADD_TABLE(cc_feature),
1395 ADD_TABLE(cc_feature_comp),
1396 ADD_TABLE(cc_file),
1397 ADD_TABLE(install_exec_seq),
1398 ADD_TABLE(cc3_media),
1399 ADD_TABLE(property),
1400 };
1401
1402 static const msi_table co_tables[] =
1403 {
1404 ADD_TABLE(cc_component),
1405 ADD_TABLE(directory),
1406 ADD_TABLE(cc_feature),
1407 ADD_TABLE(cc_feature_comp),
1408 ADD_TABLE(co_file),
1409 ADD_TABLE(install_exec_seq),
1410 ADD_TABLE(co_media),
1411 ADD_TABLE(property),
1412 };
1413
1414 static const msi_table co2_tables[] =
1415 {
1416 ADD_TABLE(cc_component),
1417 ADD_TABLE(directory),
1418 ADD_TABLE(cc_feature),
1419 ADD_TABLE(cc_feature_comp),
1420 ADD_TABLE(cc_file),
1421 ADD_TABLE(install_exec_seq),
1422 ADD_TABLE(co2_media),
1423 ADD_TABLE(property),
1424 };
1425
1426 static const msi_table mm_tables[] =
1427 {
1428 ADD_TABLE(cc_component),
1429 ADD_TABLE(directory),
1430 ADD_TABLE(cc_feature),
1431 ADD_TABLE(cc_feature_comp),
1432 ADD_TABLE(mm_file),
1433 ADD_TABLE(install_exec_seq),
1434 ADD_TABLE(mm_media),
1435 ADD_TABLE(property),
1436 };
1437
1438 static const msi_table ss_tables[] =
1439 {
1440 ADD_TABLE(cc_component),
1441 ADD_TABLE(directory),
1442 ADD_TABLE(cc_feature),
1443 ADD_TABLE(cc_feature_comp),
1444 ADD_TABLE(cc_file),
1445 ADD_TABLE(install_exec_seq),
1446 ADD_TABLE(ss_media),
1447 ADD_TABLE(property),
1448 };
1449
1450 static const msi_table ui_tables[] =
1451 {
1452 ADD_TABLE(ui_component),
1453 ADD_TABLE(directory),
1454 ADD_TABLE(cc_feature),
1455 ADD_TABLE(cc_feature_comp),
1456 ADD_TABLE(cc_file),
1457 ADD_TABLE(install_exec_seq),
1458 ADD_TABLE(ui_install_ui_seq),
1459 ADD_TABLE(ui_custom_action),
1460 ADD_TABLE(cc_media),
1461 ADD_TABLE(property),
1462 };
1463
1464 static const msi_table rof_tables[] =
1465 {
1466 ADD_TABLE(rof_component),
1467 ADD_TABLE(directory),
1468 ADD_TABLE(rof_feature),
1469 ADD_TABLE(rof_feature_comp),
1470 ADD_TABLE(rof_file),
1471 ADD_TABLE(install_exec_seq),
1472 ADD_TABLE(rof_media),
1473 ADD_TABLE(property),
1474 };
1475
1476 static const msi_table rofc_tables[] =
1477 {
1478 ADD_TABLE(rof_component),
1479 ADD_TABLE(directory),
1480 ADD_TABLE(rof_feature),
1481 ADD_TABLE(rof_feature_comp),
1482 ADD_TABLE(rofc_file),
1483 ADD_TABLE(install_exec_seq),
1484 ADD_TABLE(rofc_media),
1485 ADD_TABLE(property),
1486 };
1487
1488 static const msi_table sdp_tables[] =
1489 {
1490 ADD_TABLE(rof_component),
1491 ADD_TABLE(directory),
1492 ADD_TABLE(rof_feature),
1493 ADD_TABLE(rof_feature_comp),
1494 ADD_TABLE(rof_file),
1495 ADD_TABLE(sdp_install_exec_seq),
1496 ADD_TABLE(sdp_custom_action),
1497 ADD_TABLE(rof_media),
1498 ADD_TABLE(property),
1499 };
1500
1501 static const msi_table cie_tables[] =
1502 {
1503 ADD_TABLE(cie_component),
1504 ADD_TABLE(directory),
1505 ADD_TABLE(cc_feature),
1506 ADD_TABLE(cie_feature_comp),
1507 ADD_TABLE(cie_file),
1508 ADD_TABLE(install_exec_seq),
1509 ADD_TABLE(cie_media),
1510 ADD_TABLE(property),
1511 };
1512
1513 static const msi_table tp_tables[] =
1514 {
1515 ADD_TABLE(tp_component),
1516 ADD_TABLE(directory),
1517 ADD_TABLE(rof_feature),
1518 ADD_TABLE(ci2_feature_comp),
1519 ADD_TABLE(ci2_file),
1520 ADD_TABLE(install_exec_seq),
1521 ADD_TABLE(rof_media),
1522 ADD_TABLE(property),
1523 };
1524
1525 static const msi_table cwd_tables[] =
1526 {
1527 ADD_TABLE(cwd_component),
1528 ADD_TABLE(directory),
1529 ADD_TABLE(rof_feature),
1530 ADD_TABLE(ci2_feature_comp),
1531 ADD_TABLE(ci2_file),
1532 ADD_TABLE(install_exec_seq),
1533 ADD_TABLE(rof_media),
1534 ADD_TABLE(property),
1535 };
1536
1537 static const msi_table adm_tables[] =
1538 {
1539 ADD_TABLE(adm_component),
1540 ADD_TABLE(directory),
1541 ADD_TABLE(rof_feature),
1542 ADD_TABLE(ci2_feature_comp),
1543 ADD_TABLE(ci2_file),
1544 ADD_TABLE(install_exec_seq),
1545 ADD_TABLE(rof_media),
1546 ADD_TABLE(property),
1547 ADD_TABLE(adm_custom_action),
1548 ADD_TABLE(adm_admin_exec_seq),
1549 };
1550
1551 static const msi_table amp_tables[] =
1552 {
1553 ADD_TABLE(amp_component),
1554 ADD_TABLE(directory),
1555 ADD_TABLE(rof_feature),
1556 ADD_TABLE(ci2_feature_comp),
1557 ADD_TABLE(ci2_file),
1558 ADD_TABLE(install_exec_seq),
1559 ADD_TABLE(rof_media),
1560 ADD_TABLE(property),
1561 };
1562
1563 static const msi_table mc_tables[] =
1564 {
1565 ADD_TABLE(mc_component),
1566 ADD_TABLE(directory),
1567 ADD_TABLE(cc_feature),
1568 ADD_TABLE(cie_feature_comp),
1569 ADD_TABLE(mc_file),
1570 ADD_TABLE(install_exec_seq),
1571 ADD_TABLE(mc_media),
1572 ADD_TABLE(property),
1573 ADD_TABLE(mc_file_hash),
1574 };
1575
1576 static const msi_table sf_tables[] =
1577 {
1578 ADD_TABLE(wrv_component),
1579 ADD_TABLE(directory),
1580 ADD_TABLE(rof_feature),
1581 ADD_TABLE(ci2_feature_comp),
1582 ADD_TABLE(ci2_file),
1583 ADD_TABLE(install_exec_seq),
1584 ADD_TABLE(rof_media),
1585 ADD_TABLE(property),
1586 };
1587
1588 static const msi_table ca51_tables[] =
1589 {
1590 ADD_TABLE(ca51_component),
1591 ADD_TABLE(directory),
1592 ADD_TABLE(rof_feature),
1593 ADD_TABLE(ci2_feature_comp),
1594 ADD_TABLE(ci2_file),
1595 ADD_TABLE(ca51_install_exec_seq),
1596 ADD_TABLE(rof_media),
1597 ADD_TABLE(property),
1598 ADD_TABLE(ca51_custom_action),
1599 };
1600
1601 static const msi_table is_tables[] =
1602 {
1603 ADD_TABLE(is_component),
1604 ADD_TABLE(directory),
1605 ADD_TABLE(is_feature),
1606 ADD_TABLE(is_feature_comp),
1607 ADD_TABLE(is_file),
1608 ADD_TABLE(install_exec_seq),
1609 ADD_TABLE(is_media),
1610 ADD_TABLE(property),
1611 };
1612
1613 static const msi_table sp_tables[] =
1614 {
1615 ADD_TABLE(sp_component),
1616 ADD_TABLE(sp_directory),
1617 ADD_TABLE(rof_feature),
1618 ADD_TABLE(ci2_feature_comp),
1619 ADD_TABLE(ci2_file),
1620 ADD_TABLE(install_exec_seq),
1621 ADD_TABLE(rof_media),
1622 ADD_TABLE(property),
1623 };
1624
1625 static const msi_table mcp_tables[] =
1626 {
1627 ADD_TABLE(mcp_component),
1628 ADD_TABLE(directory),
1629 ADD_TABLE(mcp_feature),
1630 ADD_TABLE(mcp_feature_comp),
1631 ADD_TABLE(mcp_file),
1632 ADD_TABLE(rem_install_exec_seq),
1633 ADD_TABLE(rof_media),
1634 ADD_TABLE(property),
1635 };
1636
1637 static const msi_table ai_tables[] =
1638 {
1639 ADD_TABLE(component),
1640 ADD_TABLE(directory),
1641 ADD_TABLE(feature),
1642 ADD_TABLE(feature_comp),
1643 ADD_TABLE(ai_file),
1644 ADD_TABLE(install_exec_seq),
1645 ADD_TABLE(media),
1646 ADD_TABLE(property)
1647 };
1648
1649 static const msi_table pc_tables[] =
1650 {
1651 ADD_TABLE(ca51_component),
1652 ADD_TABLE(directory),
1653 ADD_TABLE(rof_feature),
1654 ADD_TABLE(ci2_feature_comp),
1655 ADD_TABLE(ci2_file),
1656 ADD_TABLE(install_exec_seq),
1657 ADD_TABLE(rof_media),
1658 ADD_TABLE(property)
1659 };
1660
1661 static const msi_table ip_tables[] =
1662 {
1663 ADD_TABLE(component),
1664 ADD_TABLE(directory),
1665 ADD_TABLE(feature),
1666 ADD_TABLE(feature_comp),
1667 ADD_TABLE(file),
1668 ADD_TABLE(ip_install_exec_seq),
1669 ADD_TABLE(ip_custom_action),
1670 ADD_TABLE(media),
1671 ADD_TABLE(property)
1672 };
1673
1674 static const msi_table aup_tables[] =
1675 {
1676 ADD_TABLE(component),
1677 ADD_TABLE(directory),
1678 ADD_TABLE(feature),
1679 ADD_TABLE(feature_comp),
1680 ADD_TABLE(file),
1681 ADD_TABLE(aup_install_exec_seq),
1682 ADD_TABLE(aup_custom_action),
1683 ADD_TABLE(media),
1684 ADD_TABLE(property)
1685 };
1686
1687 static const msi_table aup2_tables[] =
1688 {
1689 ADD_TABLE(component),
1690 ADD_TABLE(directory),
1691 ADD_TABLE(feature),
1692 ADD_TABLE(feature_comp),
1693 ADD_TABLE(file),
1694 ADD_TABLE(aup2_install_exec_seq),
1695 ADD_TABLE(aup_custom_action),
1696 ADD_TABLE(media),
1697 ADD_TABLE(aup_property)
1698 };
1699
1700 static const msi_table aup3_tables[] =
1701 {
1702 ADD_TABLE(component),
1703 ADD_TABLE(directory),
1704 ADD_TABLE(feature),
1705 ADD_TABLE(feature_comp),
1706 ADD_TABLE(file),
1707 ADD_TABLE(aup2_install_exec_seq),
1708 ADD_TABLE(aup_custom_action),
1709 ADD_TABLE(media),
1710 ADD_TABLE(aup2_property)
1711 };
1712
1713 static const msi_table aup4_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(aup3_install_exec_seq),
1721 ADD_TABLE(aup_custom_action),
1722 ADD_TABLE(media),
1723 ADD_TABLE(aup2_property)
1724 };
1725
1726 static const msi_table fiu_tables[] =
1727 {
1728 ADD_TABLE(rof_component),
1729 ADD_TABLE(directory),
1730 ADD_TABLE(rof_feature),
1731 ADD_TABLE(rof_feature_comp),
1732 ADD_TABLE(rof_file),
1733 ADD_TABLE(pp_install_exec_seq),
1734 ADD_TABLE(rof_media),
1735 ADD_TABLE(property),
1736 };
1737
1738 static const msi_table fiuc_tables[] =
1739 {
1740 ADD_TABLE(rof_component),
1741 ADD_TABLE(directory),
1742 ADD_TABLE(rof_feature),
1743 ADD_TABLE(rof_feature_comp),
1744 ADD_TABLE(rofc_file),
1745 ADD_TABLE(pp_install_exec_seq),
1746 ADD_TABLE(rofc_media),
1747 ADD_TABLE(property),
1748 };
1749
1750 static const msi_table fo_tables[] =
1751 {
1752 ADD_TABLE(directory),
1753 ADD_TABLE(fo_file),
1754 ADD_TABLE(fo_component),
1755 ADD_TABLE(fo_feature),
1756 ADD_TABLE(fo_condition),
1757 ADD_TABLE(fo_feature_comp),
1758 ADD_TABLE(fo_custom_action),
1759 ADD_TABLE(fo_install_exec_seq),
1760 ADD_TABLE(media),
1761 ADD_TABLE(property)
1762 };
1763
1764 static const msi_table icon_base_tables[] =
1765 {
1766 ADD_TABLE(ci_component),
1767 ADD_TABLE(directory),
1768 ADD_TABLE(rof_feature),
1769 ADD_TABLE(rof_feature_comp),
1770 ADD_TABLE(rof_file),
1771 ADD_TABLE(pp_install_exec_seq),
1772 ADD_TABLE(rof_media),
1773 ADD_TABLE(icon_property),
1774 };
1775
1776 static const msi_table pv_tables[] =
1777 {
1778 ADD_TABLE(rof_component),
1779 ADD_TABLE(directory),
1780 ADD_TABLE(rof_feature),
1781 ADD_TABLE(rof_feature_comp),
1782 ADD_TABLE(rof_file),
1783 ADD_TABLE(pv_install_exec_seq),
1784 ADD_TABLE(rof_media),
1785 ADD_TABLE(property)
1786 };
1787
1788 static const msi_table uc_tables[] =
1789 {
1790 ADD_TABLE(directory),
1791 ADD_TABLE(uc_component),
1792 ADD_TABLE(uc_feature),
1793 ADD_TABLE(uc_feature_comp),
1794 ADD_TABLE(uc_file),
1795 ADD_TABLE(uc_install_exec_seq),
1796 ADD_TABLE(media),
1797 ADD_TABLE(uc_property)
1798 };
1799
1800 static const msi_table mixed_tables[] =
1801 {
1802 ADD_TABLE(directory),
1803 ADD_TABLE(mixed_component),
1804 ADD_TABLE(mixed_feature),
1805 ADD_TABLE(mixed_feature_comp),
1806 ADD_TABLE(mixed_install_exec_seq),
1807 ADD_TABLE(mixed_registry),
1808 ADD_TABLE(media),
1809 ADD_TABLE(property)
1810 };
1811
1812 static const msi_table vp_tables[] =
1813 {
1814 ADD_TABLE(directory),
1815 ADD_TABLE(vp_file),
1816 ADD_TABLE(vp_component),
1817 ADD_TABLE(vp_feature),
1818 ADD_TABLE(vp_feature_comp),
1819 ADD_TABLE(vp_custom_action),
1820 ADD_TABLE(vp_install_exec_seq),
1821 ADD_TABLE(media),
1822 ADD_TABLE(property)
1823 };
1824
1825 static const msi_table shc_tables[] =
1826 {
1827 ADD_TABLE(media),
1828 ADD_TABLE(directory),
1829 ADD_TABLE(shc_file),
1830 ADD_TABLE(shc_component),
1831 ADD_TABLE(shc_feature),
1832 ADD_TABLE(shc_feature_comp),
1833 ADD_TABLE(shc_custom_action),
1834 ADD_TABLE(shc_install_exec_seq),
1835 ADD_TABLE(shc_property)
1836 };
1837
1838 static const msi_table shc2_tables[] =
1839 {
1840 ADD_TABLE(media),
1841 ADD_TABLE(directory),
1842 ADD_TABLE(shc_file),
1843 ADD_TABLE(shc_component),
1844 ADD_TABLE(shc_feature),
1845 ADD_TABLE(shc_feature_comp),
1846 ADD_TABLE(shc_custom_action),
1847 ADD_TABLE(shc_install_exec_seq),
1848 ADD_TABLE(shc2_property)
1849 };
1850
1851 /* cabinet definitions */
1852
1853 /* make the max size large so there is only one cab file */
1854 #define MEDIA_SIZE 0x7FFFFFFF
1855 #define FOLDER_THRESHOLD 900000
1856
1857 /* the FCI callbacks */
1858
1859 static void * CDECL mem_alloc(ULONG cb)
1860 {
1861 return HeapAlloc(GetProcessHeap(), 0, cb);
1862 }
1863
1864 static void CDECL mem_free(void *memory)
1865 {
1866 HeapFree(GetProcessHeap(), 0, memory);
1867 }
1868
1869 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
1870 {
1871 sprintf(pccab->szCab, pv, pccab->iCab);
1872 return TRUE;
1873 }
1874
1875 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
1876 {
1877 return 0;
1878 }
1879
1880 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
1881 BOOL fContinuation, void *pv)
1882 {
1883 return 0;
1884 }
1885
1886 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
1887 {
1888 HANDLE handle;
1889 DWORD dwAccess = 0;
1890 DWORD dwShareMode = 0;
1891 DWORD dwCreateDisposition = OPEN_EXISTING;
1892
1893 dwAccess = GENERIC_READ | GENERIC_WRITE;
1894 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
1895 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
1896
1897 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
1898 dwCreateDisposition = OPEN_EXISTING;
1899 else
1900 dwCreateDisposition = CREATE_NEW;
1901
1902 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
1903 dwCreateDisposition, 0, NULL);
1904
1905 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
1906
1907 return (INT_PTR)handle;
1908 }
1909
1910 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1911 {
1912 HANDLE handle = (HANDLE)hf;
1913 DWORD dwRead;
1914 BOOL res;
1915
1916 res = ReadFile(handle, memory, cb, &dwRead, NULL);
1917 ok(res, "Failed to ReadFile\n");
1918
1919 return dwRead;
1920 }
1921
1922 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1923 {
1924 HANDLE handle = (HANDLE)hf;
1925 DWORD dwWritten;
1926 BOOL res;
1927
1928 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
1929 ok(res, "Failed to WriteFile\n");
1930
1931 return dwWritten;
1932 }
1933
1934 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
1935 {
1936 HANDLE handle = (HANDLE)hf;
1937 ok(CloseHandle(handle), "Failed to CloseHandle\n");
1938
1939 return 0;
1940 }
1941
1942 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
1943 {
1944 HANDLE handle = (HANDLE)hf;
1945 DWORD ret;
1946
1947 ret = SetFilePointer(handle, dist, NULL, seektype);
1948 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
1949
1950 return ret;
1951 }
1952
1953 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
1954 {
1955 BOOL ret = DeleteFileA(pszFile);
1956 ok(ret, "Failed to DeleteFile %s\n", pszFile);
1957
1958 return 0;
1959 }
1960
1961 static void init_functionpointers(void)
1962 {
1963 HMODULE hmsi = GetModuleHandleA("msi.dll");
1964 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
1965 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
1966
1967 #define GET_PROC(mod, func) \
1968 p ## func = (void*)GetProcAddress(mod, #func); \
1969 if(!p ## func) \
1970 trace("GetProcAddress(%s) failed\n", #func);
1971
1972 GET_PROC(hmsi, MsiQueryComponentStateA);
1973 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
1974 GET_PROC(hmsi, MsiGetComponentPathExA);
1975
1976 GET_PROC(hadvapi32, CheckTokenMembership);
1977 GET_PROC(hadvapi32, ConvertSidToStringSidA);
1978 GET_PROC(hadvapi32, OpenProcessToken);
1979 GET_PROC(hadvapi32, RegDeleteKeyExA)
1980 GET_PROC(hkernel32, IsWow64Process)
1981
1982 hsrclient = LoadLibraryA("srclient.dll");
1983 GET_PROC(hsrclient, SRRemoveRestorePoint);
1984 GET_PROC(hsrclient, SRSetRestorePointA);
1985
1986 #undef GET_PROC
1987 }
1988
1989 static BOOL is_process_limited(void)
1990 {
1991 SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
1992 PSID Group = NULL;
1993 BOOL IsInGroup;
1994 HANDLE token;
1995
1996 if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
1997
1998 if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
1999 DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
2000 !pCheckTokenMembership(NULL, Group, &IsInGroup))
2001 {
2002 trace("Could not check if the current user is an administrator\n");
2003 FreeSid(Group);
2004 return FALSE;
2005 }
2006 FreeSid(Group);
2007
2008 if (!IsInGroup)
2009 {
2010 /* Only administrators have enough privileges for these tests */
2011 return TRUE;
2012 }
2013
2014 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2015 {
2016 BOOL ret;
2017 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
2018 DWORD size;
2019
2020 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2021 CloseHandle(token);
2022 return (ret && type == TokenElevationTypeLimited);
2023 }
2024 return FALSE;
2025 }
2026
2027 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
2028 {
2029 CHAR buffer[0x20];
2030 UINT r;
2031 DWORD sz;
2032
2033 sz = sizeof buffer;
2034 r = MsiRecordGetStringA(rec, field, buffer, &sz);
2035 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
2036 }
2037
2038 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2039 {
2040 LPSTR tempname;
2041
2042 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2043 GetTempFileNameA(".", "xx", 0, tempname);
2044
2045 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2046 {
2047 lstrcpyA(pszTempName, tempname);
2048 HeapFree(GetProcessHeap(), 0, tempname);
2049 return TRUE;
2050 }
2051
2052 HeapFree(GetProcessHeap(), 0, tempname);
2053
2054 return FALSE;
2055 }
2056
2057 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2058 USHORT *pattribs, int *err, void *pv)
2059 {
2060 BY_HANDLE_FILE_INFORMATION finfo;
2061 FILETIME filetime;
2062 HANDLE handle;
2063 DWORD attrs;
2064 BOOL res;
2065
2066 handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2067 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2068
2069 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2070
2071 res = GetFileInformationByHandle(handle, &finfo);
2072 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2073
2074 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2075 FileTimeToDosDateTime(&filetime, pdate, ptime);
2076
2077 attrs = GetFileAttributesA(pszName);
2078 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2079
2080 return (INT_PTR)handle;
2081 }
2082
2083 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2084 {
2085 char path[MAX_PATH];
2086 char filename[MAX_PATH];
2087
2088 lstrcpyA(path, CURR_DIR);
2089 lstrcatA(path, "\\");
2090 lstrcatA(path, file);
2091
2092 lstrcpyA(filename, file);
2093
2094 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2095 progress, get_open_info, compress);
2096 }
2097
2098 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2099 {
2100 ZeroMemory(pCabParams, sizeof(CCAB));
2101
2102 pCabParams->cb = max_size;
2103 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2104 pCabParams->setID = 0xbeef;
2105 pCabParams->iCab = 1;
2106 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2107 lstrcatA(pCabParams->szCabPath, "\\");
2108 lstrcpyA(pCabParams->szCab, name);
2109 }
2110
2111 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2112 {
2113 CCAB cabParams;
2114 LPCSTR ptr;
2115 HFCI hfci;
2116 ERF erf;
2117 BOOL res;
2118
2119 set_cab_parameters(&cabParams, name, max_size);
2120
2121 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2122 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2123 get_temp_file, &cabParams, NULL);
2124
2125 ok(hfci != NULL, "Failed to create an FCI context\n");
2126
2127 ptr = files;
2128 while (*ptr)
2129 {
2130 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2131 ok(res, "Failed to add file: %s\n", ptr);
2132 ptr += lstrlenA(ptr) + 1;
2133 }
2134
2135 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2136 ok(res, "Failed to flush the cabinet\n");
2137
2138 res = FCIDestroy(hfci);
2139 ok(res, "Failed to destroy the cabinet\n");
2140 }
2141
2142 static BOOL get_user_dirs(void)
2143 {
2144 HKEY hkey;
2145 DWORD type, size;
2146
2147 if (RegOpenKeyA(HKEY_CURRENT_USER,
2148 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2149 return FALSE;
2150
2151 size = MAX_PATH;
2152 if(RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size)){
2153 RegCloseKey(hkey);
2154 return FALSE;
2155 }
2156
2157 RegCloseKey(hkey);
2158 return TRUE;
2159 }
2160
2161 static BOOL get_system_dirs(void)
2162 {
2163 HKEY hkey;
2164 DWORD type, size;
2165
2166 if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2167 return FALSE;
2168
2169 size = MAX_PATH;
2170 if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2171 RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size)) {
2172 RegCloseKey(hkey);
2173 return FALSE;
2174 }
2175
2176 size = MAX_PATH;
2177 if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2178 RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size)) {
2179 RegCloseKey(hkey);
2180 return FALSE;
2181 }
2182
2183 size = MAX_PATH;
2184 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR_NATIVE, &size)) {
2185 RegCloseKey(hkey);
2186 return FALSE;
2187 }
2188
2189 RegCloseKey(hkey);
2190
2191 if(!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH))
2192 return FALSE;
2193
2194 return TRUE;
2195 }
2196
2197 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2198 {
2199 HANDLE file;
2200 DWORD written;
2201
2202 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2203 if (file == INVALID_HANDLE_VALUE)
2204 return;
2205
2206 WriteFile(file, data, strlen(data), &written, NULL);
2207
2208 if (size)
2209 {
2210 SetFilePointer(file, size, NULL, FILE_BEGIN);
2211 SetEndOfFile(file);
2212 }
2213
2214 CloseHandle(file);
2215 }
2216
2217 #define create_file(name, size) create_file_data(name, name, size)
2218
2219 static void create_test_files(void)
2220 {
2221 CreateDirectoryA("msitest", NULL);
2222 create_file("msitest\\one.txt", 100);
2223 CreateDirectoryA("msitest\\first", NULL);
2224 create_file("msitest\\first\\two.txt", 100);
2225 CreateDirectoryA("msitest\\second", NULL);
2226 create_file("msitest\\second\\three.txt", 100);
2227
2228 create_file("four.txt", 100);
2229 create_file("five.txt", 100);
2230 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2231
2232 create_file("msitest\\filename", 100);
2233 create_file("msitest\\service.exe", 100);
2234
2235 DeleteFileA("four.txt");
2236 DeleteFileA("five.txt");
2237 }
2238
2239 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2240 {
2241 CHAR path[MAX_PATH];
2242
2243 lstrcpyA(path, PROG_FILES_DIR);
2244 lstrcatA(path, "\\");
2245 lstrcatA(path, rel_path);
2246
2247 if (is_file)
2248 return DeleteFileA(path);
2249 else
2250 return RemoveDirectoryA(path);
2251 }
2252
2253 static BOOL delete_pf_native(const CHAR *rel_path, BOOL is_file)
2254 {
2255 CHAR path[MAX_PATH];
2256
2257 lstrcpyA(path, PROG_FILES_DIR_NATIVE);
2258 lstrcatA(path, "\\");
2259 lstrcatA(path, rel_path);
2260
2261 if (is_file)
2262 return DeleteFileA(path);
2263 else
2264 return RemoveDirectoryA(path);
2265 }
2266
2267 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
2268 {
2269 CHAR path[MAX_PATH];
2270
2271 lstrcpyA(path, COMMON_FILES_DIR);
2272 lstrcatA(path, "\\");
2273 lstrcatA(path, rel_path);
2274
2275 if (is_file)
2276 return DeleteFileA(path);
2277 else
2278 return RemoveDirectoryA(path);
2279 }
2280
2281 static BOOL compare_pf_data(const char *filename, const char *data, DWORD size)
2282 {
2283 DWORD read;
2284 HANDLE handle;
2285 BOOL ret = FALSE;
2286 char *buffer, path[MAX_PATH];
2287
2288 lstrcpyA(path, PROG_FILES_DIR);
2289 lstrcatA(path, "\\");
2290 lstrcatA(path, filename);
2291
2292 handle = CreateFileA(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2293 buffer = HeapAlloc(GetProcessHeap(), 0, size);
2294 if (buffer)
2295 {
2296 ReadFile(handle, buffer, size, &read, NULL);
2297 if (read == size && !memcmp(data, buffer, size)) ret = TRUE;
2298 HeapFree(GetProcessHeap(), 0, buffer);
2299 }
2300 CloseHandle(handle);
2301 return ret;
2302 }
2303
2304 static void delete_test_files(void)
2305 {
2306 DeleteFileA("msitest.msi");
2307 DeleteFileA("msitest.cab");
2308 DeleteFileA("msitest\\second\\three.txt");
2309 DeleteFileA("msitest\\first\\two.txt");
2310 DeleteFileA("msitest\\one.txt");
2311 DeleteFileA("msitest\\service.exe");
2312 DeleteFileA("msitest\\filename");
2313 RemoveDirectoryA("msitest\\second");
2314 RemoveDirectoryA("msitest\\first");
2315 RemoveDirectoryA("msitest");
2316 }
2317
2318 static void write_file(const CHAR *filename, const char *data, int data_size)
2319 {
2320 DWORD size;
2321
2322 HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
2323 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2324 WriteFile(hf, data, data_size, &size, NULL);
2325 CloseHandle(hf);
2326 }
2327
2328 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount,
2329 const char *template, const char *packagecode)
2330 {
2331 MSIHANDLE summary;
2332 UINT r;
2333
2334 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2335 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2336
2337 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2338 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2339
2340 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL, packagecode);
2341 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2342
2343 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL);
2344 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2345
2346 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2347 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2348
2349 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2350 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2351
2352 /* write the summary changes back to the stream */
2353 r = MsiSummaryInfoPersist(summary);
2354 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2355
2356 MsiCloseHandle(summary);
2357 }
2358
2359 #define create_database(name, tables, num_tables) \
2360 create_database_wordcount(name, tables, num_tables, 100, 0, ";1033", \
2361 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2362
2363 #define create_database_template(name, tables, num_tables, version, template) \
2364 create_database_wordcount(name, tables, num_tables, version, 0, template, \
2365 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2366
2367 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2368 int num_tables, INT version, INT wordcount,
2369 const char *template, const char *packagecode)
2370 {
2371 MSIHANDLE db;
2372 UINT r;
2373 WCHAR *nameW;
2374 int j, len;
2375
2376 len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2377 if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
2378 MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2379
2380 r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
2381 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2382
2383 /* import the tables into the database */
2384 for (j = 0; j < num_tables; j++)
2385 {
2386 const msi_table *table = &tables[j];
2387
2388 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2389
2390 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2391 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2392
2393 DeleteFileA(table->filename);
2394 }
2395
2396 write_msi_summary_info(db, version, wordcount, template, packagecode);
2397
2398 r = MsiDatabaseCommit(db);
2399 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2400
2401 MsiCloseHandle(db);
2402 HeapFree( GetProcessHeap(), 0, nameW );
2403 }
2404
2405 static void check_service_is_installed(void)
2406 {
2407 SC_HANDLE scm, service;
2408 BOOL res;
2409
2410 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
2411 ok(scm != NULL, "Failed to open the SC Manager\n");
2412
2413 service = OpenServiceA(scm, "TestService", SC_MANAGER_ALL_ACCESS);
2414 ok(service != NULL, "Failed to open TestService\n");
2415
2416 res = DeleteService(service);
2417 ok(res, "Failed to delete TestService\n");
2418
2419 CloseServiceHandle(service);
2420 CloseServiceHandle(scm);
2421 }
2422
2423 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2424 {
2425 RESTOREPOINTINFOA spec;
2426
2427 spec.dwEventType = event_type;
2428 spec.dwRestorePtType = APPLICATION_INSTALL;
2429 spec.llSequenceNumber = status->llSequenceNumber;
2430 lstrcpyA(spec.szDescription, "msitest restore point");
2431
2432 return pSRSetRestorePointA(&spec, status);
2433 }
2434
2435 static void remove_restore_point(DWORD seq_number)
2436 {
2437 DWORD res;
2438
2439 res = pSRRemoveRestorePoint(seq_number);
2440 if (res != ERROR_SUCCESS)
2441 trace("Failed to remove the restore point : %08x\n", res);
2442 }
2443
2444 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
2445 {
2446 if (pRegDeleteKeyExA)
2447 return pRegDeleteKeyExA( key, subkey, access, 0 );
2448 return RegDeleteKeyA( key, subkey );
2449 }
2450
2451 static void test_MsiInstallProduct(void)
2452 {
2453 UINT r;
2454 CHAR path[MAX_PATH];
2455 LONG res;
2456 HKEY hkey;
2457 DWORD num, size, type;
2458 REGSAM access = KEY_ALL_ACCESS;
2459
2460 if (is_process_limited())
2461 {
2462 skip("process is limited\n");
2463 return;
2464 }
2465
2466 if (is_wow64)
2467 access |= KEY_WOW64_64KEY;
2468
2469 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2470
2471 /* szPackagePath is NULL */
2472 r = MsiInstallProductA(NULL, "INSTALL=ALL");
2473 ok(r == ERROR_INVALID_PARAMETER,
2474 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2475
2476 /* both szPackagePath and szCommandLine are NULL */
2477 r = MsiInstallProductA(NULL, NULL);
2478 ok(r == ERROR_INVALID_PARAMETER,
2479 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2480
2481 /* szPackagePath is empty */
2482 r = MsiInstallProductA("", "INSTALL=ALL");
2483 ok(r == ERROR_PATH_NOT_FOUND,
2484 "Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
2485
2486 create_test_files();
2487 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2488
2489 /* install, don't publish */
2490 r = MsiInstallProductA(msifile, NULL);
2491 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2492 {
2493 skip("Not enough rights to perform tests\n");
2494 goto error;
2495 }
2496 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2497
2498 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2499 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2500 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2501 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2502 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2503 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2504 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2505 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2506 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2507 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2508 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2509 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2510
2511 res = RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", 0, access, &hkey);
2512 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2513
2514 size = MAX_PATH;
2515 type = REG_SZ;
2516 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
2517 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2518 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
2519
2520 size = MAX_PATH;
2521 type = REG_SZ;
2522 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
2523 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2524
2525 size = sizeof(num);
2526 type = REG_DWORD;
2527 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
2528 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2529 ok(num == 314, "Expected 314, got %d\n", num);
2530
2531 size = MAX_PATH;
2532 type = REG_SZ;
2533 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
2534 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2535 ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
2536
2537 check_service_is_installed();
2538
2539 delete_key(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", access);
2540
2541 /* not published, reinstall */
2542 r = MsiInstallProductA(msifile, NULL);
2543 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2544
2545 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2546 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2547 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2548 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2549 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2550 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2551 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2552 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2553 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2554 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2555 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2556 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2557
2558 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2559 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2560 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2561
2562 create_database(msifile, up_tables, sizeof(up_tables) / sizeof(msi_table));
2563
2564 /* not published, RemovePreviousVersions set */
2565 r = MsiInstallProductA(msifile, NULL);
2566 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2567
2568 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2569 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2570 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2571 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2572 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2573 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2574 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2575 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2576 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2577 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2578 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2579 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2580
2581 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2582 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2583 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2584
2585 create_database(msifile, up2_tables, sizeof(up2_tables) / sizeof(msi_table));
2586
2587 /* not published, version number bumped */
2588 r = MsiInstallProductA(msifile, NULL);
2589 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2590
2591 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2592 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2593 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2594 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2595 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2596 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2597 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2598 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2599 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2600 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2601 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2602 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2603
2604 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2605 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2606 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2607
2608 create_database(msifile, up3_tables, sizeof(up3_tables) / sizeof(msi_table));
2609
2610 /* not published, RemovePreviousVersions set and version number bumped */
2611 r = MsiInstallProductA(msifile, NULL);
2612 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2613
2614 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2615 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2616 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2617 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2618 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2619 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2620 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2621 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2622 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2623 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2624 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2625 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2626
2627 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2628 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2629 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2630
2631 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2632
2633 /* install, publish product */
2634 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2635 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2636
2637 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2638 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2639 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2640 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2641 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2642 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2643 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2644 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2645 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2646 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2647 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2648 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2649
2650 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2651 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2652
2653 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2654
2655 /* published, reinstall */
2656 r = MsiInstallProductA(msifile, NULL);
2657 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2658
2659 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2660 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2661 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2662 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2663 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2664 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2665 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2666 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2667 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2668 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2669 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2670 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2671
2672 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2673 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2674
2675 create_database(msifile, up5_tables, sizeof(up5_tables) / sizeof(msi_table));
2676
2677 /* published product, RemovePreviousVersions set */
2678 r = MsiInstallProductA(msifile, NULL);
2679 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2680
2681 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2682 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2683 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2684 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2685 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2686 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2687 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2688 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2689 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2690 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2691 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2692 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2693
2694 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2695 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2696
2697 create_database(msifile, up6_tables, sizeof(up6_tables) / sizeof(msi_table));
2698
2699 /* published product, version number bumped */
2700 r = MsiInstallProductA(msifile, NULL);
2701 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2702
2703 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2704 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2705 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2706 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2707 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2708 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2709 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2710 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2711 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2712 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2713 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2714 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2715
2716 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2717 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2718
2719 create_database(msifile, up7_tables, sizeof(up7_tables) / sizeof(msi_table));
2720
2721 /* published product, RemovePreviousVersions set and version number bumped */
2722 r = MsiInstallProductA(msifile, NULL);
2723 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2724
2725 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2726 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2727 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2728 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2729 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2730 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2731 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2732 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2733 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2734 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2735 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2736 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2737
2738 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2739 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2740
2741 r = MsiInstallProductA(msifile, "REMOVE=ALL");
2742 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2743
2744 error:
2745 delete_test_files();
2746 DeleteFileA(msifile);
2747 }
2748
2749 static void test_MsiSetComponentState(void)
2750 {
2751 INSTALLSTATE installed, action;
2752 MSIHANDLE package;
2753 char path[MAX_PATH];
2754 UINT r;
2755
2756 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2757
2758 CoInitialize(NULL);
2759
2760 lstrcpyA(path, CURR_DIR);
2761 lstrcatA(path, "\\");
2762 lstrcatA(path, msifile);
2763
2764 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2765
2766 r = MsiOpenPackageA(path, &package);
2767 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2768 {
2769 skip("Not enough rights to perform tests\n");
2770 goto error;
2771 }
2772 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2773
2774 r = MsiDoActionA(package, "CostInitialize");
2775 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2776
2777 r = MsiDoActionA(package, "FileCost");
2778 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2779
2780 r = MsiDoActionA(package, "CostFinalize");
2781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2782
2783 r = MsiGetComponentStateA(package, "dangler", &installed, &action);
2784 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2785 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
2786 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2787
2788 r = MsiSetComponentStateA(package, "dangler", INSTALLSTATE_SOURCE);
2789 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2790
2791 MsiCloseHandle(package);
2792
2793 error:
2794 CoUninitialize();
2795 DeleteFileA(msifile);
2796 }
2797
2798 static void test_packagecoltypes(void)
2799 {
2800 MSIHANDLE hdb, view, rec;
2801 char path[MAX_PATH];
2802 WCHAR pathW[MAX_PATH];
2803 LPCSTR query;
2804 UINT r, count;
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 MultiByteToWideChar( CP_ACP, 0, path, -1, pathW, MAX_PATH );
2814
2815 r = MsiOpenDatabaseW(pathW, MSIDBOPEN_READONLY, &hdb);
2816 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2817
2818 query = "SELECT * FROM `Media`";
2819 r = MsiDatabaseOpenViewA( hdb, query, &view );
2820 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2821
2822 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
2823 count = MsiRecordGetFieldCount( rec );
2824 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2825 ok(count == 6, "Expected 6, got %d\n", count);
2826 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
2827 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
2828 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
2829 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
2830 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
2831 ok(check_record(rec, 6, "Source"), "wrong column label\n");
2832 MsiCloseHandle(rec);
2833
2834 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
2835 count