ReactOS  0.4.15-dev-4853-g3a72a52
install.c
Go to the documentation of this file.
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 #include <winsvc.h>
35 #include <shellapi.h>
36 
37 #include "wine/test.h"
38 #include "utils.h"
39 
40 static UINT (WINAPI *pMsiQueryComponentStateA)
42 static UINT (WINAPI *pMsiSourceListEnumSourcesA)
44 static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
46 
47 static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
48 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
49 static BOOL (WINAPI *pWow64DisableWow64FsRedirection)(void **);
50 static BOOL (WINAPI *pWow64RevertWow64FsRedirection)(void *);
51 
52 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
53 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
54 
55 static BOOL is_wow64;
56 static const BOOL is_64bit = sizeof(void *) > sizeof(int);
57 
58 static const char *msifile = "msitest.msi";
59 static const char *msifile2 = "winetest2.msi";
60 static const char *mstfile = "winetest.mst";
61 
62 static const WCHAR msifileW[] = L"msitest.msi";
63 static const WCHAR msifile2W[] = L"msitest2.msi";
64 
71 
72 static const char *customdll;
73 
74 /* msi database data */
75 
76 static const CHAR component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
77  "s72\tS38\ts72\ti2\tS255\tS72\n"
78  "Component\tComponent\n"
79  "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
80  "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
81  "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n"
82  "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
83  "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
84  "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
85  "component\t\tMSITESTDIR\t0\t1\tfile\n";
86 
87 static const CHAR directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
88  "s72\tS72\tl255\n"
89  "Directory\tDirectory\n"
90  "CABOUTDIR\tMSITESTDIR\tcabout\n"
91  "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
92  "FIRSTDIR\tMSITESTDIR\tfirst\n"
93  "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
94  "NEWDIR\tCABOUTDIR\tnew\n"
95  "ProgramFilesFolder\tTARGETDIR\t.\n"
96  "TARGETDIR\t\tSourceDir";
97 
98 static const CHAR feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
99  "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
100  "Feature\tFeature\n"
101  "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
102  "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
103  "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
104  "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
105  "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
106  "feature\t\t\t\t2\t1\tTARGETDIR\t0\n";
107 
108 static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
109  "s38\ts72\n"
110  "FeatureComponents\tFeature_\tComponent_\n"
111  "Five\tFive\n"
112  "Four\tFour\n"
113  "One\tOne\n"
114  "Three\tThree\n"
115  "Two\tTwo\n"
116  "feature\tcomponent\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 
128 static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
129  "s72\tS255\tI2\n"
130  "InstallExecuteSequence\tAction\n"
131  "AllocateRegistrySpace\tNOT Installed\t1550\n"
132  "CostFinalize\t\t1000\n"
133  "CostInitialize\t\t800\n"
134  "FileCost\t\t900\n"
135  "ResolveSource\t\t950\n"
136  "MoveFiles\t\t1700\n"
137  "InstallFiles\t\t4000\n"
138  "BindImage\t\t4100\n"
139  "DuplicateFiles\t\t4500\n"
140  "WriteEnvironmentStrings\t\t4550\n"
141  "CreateShortcuts\t\t4600\n"
142  "InstallFinalize\t\t6600\n"
143  "InstallInitialize\t\t1500\n"
144  "InstallValidate\t\t1400\n"
145  "LaunchConditions\t\t100\n"
146  "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
147 
148 static const CHAR media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
149  "i2\ti4\tL64\tS255\tS32\tS72\n"
150  "Media\tDiskId\n"
151  "1\t3\t\t\tDISK1\t\n"
152  "2\t5\t\tmsitest.cab\tDISK2\t\n";
153 
154 static const CHAR property_dat[] = "Property\tValue\n"
155  "s72\tl0\n"
156  "Property\tProperty\n"
157  "DefaultUIFont\tDlgFont8\n"
158  "HASUIRUN\t0\n"
159  "INSTALLLEVEL\t3\n"
160  "InstallMode\tTypical\n"
161  "Manufacturer\tWine\n"
162  "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
163  "PRIMARYFOLDER\tTARGETDIR\n"
164  "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
165  "ProductID\tnone\n"
166  "ProductLanguage\t1033\n"
167  "ProductName\tMSITEST\n"
168  "ProductVersion\t1.1.1\n"
169  "PROMPTROLLBACKCOST\tP\n"
170  "Setup\tSetup\n"
171  "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
172  "AdminProperties\tPOSTADMIN\n"
173  "ROOTDRIVE\tC:\\\n"
174  "MSIFASTINSTALL\t1\n";
175 
176 static const CHAR aup_property_dat[] = "Property\tValue\n"
177  "s72\tl0\n"
178  "Property\tProperty\n"
179  "DefaultUIFont\tDlgFont8\n"
180  "HASUIRUN\t0\n"
181  "ALLUSERS\t1\n"
182  "INSTALLLEVEL\t3\n"
183  "InstallMode\tTypical\n"
184  "Manufacturer\tWine\n"
185  "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
186  "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
187  "ProductID\tnone\n"
188  "ProductLanguage\t1033\n"
189  "ProductName\tMSITEST\n"
190  "ProductVersion\t1.1.1\n"
191  "PROMPTROLLBACKCOST\tP\n"
192  "Setup\tSetup\n"
193  "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
194  "AdminProperties\tPOSTADMIN\n"
195  "ROOTDRIVE\tC:\\\n"
196  "MSIFASTINSTALL\t1\n";
197 
198 static const CHAR aup2_property_dat[] = "Property\tValue\n"
199  "s72\tl0\n"
200  "Property\tProperty\n"
201  "DefaultUIFont\tDlgFont8\n"
202  "HASUIRUN\t0\n"
203  "ALLUSERS\t2\n"
204  "INSTALLLEVEL\t3\n"
205  "InstallMode\tTypical\n"
206  "Manufacturer\tWine\n"
207  "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
208  "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
209  "ProductID\tnone\n"
210  "ProductLanguage\t1033\n"
211  "ProductName\tMSITEST\n"
212  "ProductVersion\t1.1.1\n"
213  "PROMPTROLLBACKCOST\tP\n"
214  "Setup\tSetup\n"
215  "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
216  "AdminProperties\tPOSTADMIN\n"
217  "ROOTDRIVE\tC:\\\n"
218  "MSIFASTINSTALL\t1\n";
219 
220 static const CHAR icon_property_dat[] = "Property\tValue\n"
221  "s72\tl0\n"
222  "Property\tProperty\n"
223  "DefaultUIFont\tDlgFont8\n"
224  "HASUIRUN\t0\n"
225  "INSTALLLEVEL\t3\n"
226  "InstallMode\tTypical\n"
227  "Manufacturer\tWine\n"
228  "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
229  "ProductCode\t{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}\n"
230  "ProductID\tnone\n"
231  "ProductLanguage\t1033\n"
232  "ProductName\tMSITEST\n"
233  "ProductVersion\t1.1.1\n"
234  "PROMPTROLLBACKCOST\tP\n"
235  "Setup\tSetup\n"
236  "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
237  "AdminProperties\tPOSTADMIN\n"
238  "ROOTDRIVE\tC:\\\n"
239  "MSIFASTINSTALL\t1\n";
240 
241 static const CHAR shortcut_dat[] = "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
242  "s72\ts72\tl128\ts72\ts72\tS255\tL255\tI2\tS72\tI2\tI2\tS72\n"
243  "Shortcut\tShortcut\n"
244  "Shortcut\tMSITESTDIR\tShortcut\tcomponent\tShortcut\t\tShortcut\t\t\t\t\t\n";
245 
246 static const CHAR condition_dat[] = "Feature_\tLevel\tCondition\n"
247  "s38\ti2\tS255\n"
248  "Condition\tFeature_\tLevel\n"
249  "One\t4\t1\n";
250 
251 static const CHAR up_property_dat[] = "Property\tValue\n"
252  "s72\tl0\n"
253  "Property\tProperty\n"
254  "DefaultUIFont\tDlgFont8\n"
255  "HASUIRUN\t0\n"
256  "INSTALLLEVEL\t3\n"
257  "InstallMode\tTypical\n"
258  "Manufacturer\tWine\n"
259  "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
260  "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
261  "ProductID\tnone\n"
262  "ProductLanguage\t1033\n"
263  "ProductName\tMSITEST\n"
264  "ProductVersion\t1.1.1\n"
265  "PROMPTROLLBACKCOST\tP\n"
266  "Setup\tSetup\n"
267  "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
268  "AdminProperties\tPOSTADMIN\n"
269  "ROOTDRIVE\tC:\\\n"
270  "RemovePreviousVersions\t1\n"
271  "MSIFASTINSTALL\t1\n";
272 
273 static const CHAR up2_property_dat[] = "Property\tValue\n"
274  "s72\tl0\n"
275  "Property\tProperty\n"
276  "DefaultUIFont\tDlgFont8\n"
277  "HASUIRUN\t0\n"
278  "INSTALLLEVEL\t3\n"
279  "InstallMode\tTypical\n"
280  "Manufacturer\tWine\n"
281  "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
282  "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
283  "ProductID\tnone\n"
284  "ProductLanguage\t1033\n"
285  "ProductName\tMSITEST\n"
286  "ProductVersion\t1.1.2\n"
287  "PROMPTROLLBACKCOST\tP\n"
288  "Setup\tSetup\n"
289  "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
290  "AdminProperties\tPOSTADMIN\n"
291  "ROOTDRIVE\tC:\\\n"
292  "MSIFASTINSTALL\t1\n";
293 
294 static const CHAR up3_property_dat[] = "Property\tValue\n"
295  "s72\tl0\n"
296  "Property\tProperty\n"
297  "DefaultUIFont\tDlgFont8\n"
298  "HASUIRUN\t0\n"
299  "INSTALLLEVEL\t3\n"
300  "InstallMode\tTypical\n"
301  "Manufacturer\tWine\n"
302  "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
303  "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
304  "ProductID\tnone\n"
305  "ProductLanguage\t1033\n"
306  "ProductName\tMSITEST\n"
307  "ProductVersion\t1.1.2\n"
308  "PROMPTROLLBACKCOST\tP\n"
309  "Setup\tSetup\n"
310  "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
311  "AdminProperties\tPOSTADMIN\n"
312  "ROOTDRIVE\tC:\\\n"
313  "RemovePreviousVersions\t1\n"
314  "MSIFASTINSTALL\t1\n";
315 
316 static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
317  "s72\ti2\tl255\tL255\tL0\ts72\n"
318  "Registry\tRegistry\n"
319  "Apples\t1\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
320  "Oranges\t1\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
321  "regdata\t1\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
322  "OrderTest\t1\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
323 
324 /* tables for test_continuouscabs */
325 static const CHAR cc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
326  "s72\tS38\ts72\ti2\tS255\tS72\n"
327  "Component\tComponent\n"
328  "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
329  "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
330  "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
331 
332 static const CHAR cc2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
333  "s72\tS38\ts72\ti2\tS255\tS72\n"
334  "Component\tComponent\n"
335  "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
336  "augustus\t\tMSITESTDIR\t0\t0\taugustus\n"
337  "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
338 
339 static const CHAR cc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
340  "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
341  "Feature\tFeature\n"
342  "feature\t\t\t\t2\t1\tTARGETDIR\t0";
343 
344 static const CHAR cc_feature_comp_dat[] = "Feature_\tComponent_\n"
345  "s38\ts72\n"
346  "FeatureComponents\tFeature_\tComponent_\n"
347  "feature\tmaximus\n"
348  "feature\taugustus\n"
349  "feature\tcaesar";
350 
351 static const CHAR cc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
352  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
353  "File\tFile\n"
354  "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
355  "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
356  "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
357 
358 static const CHAR cc2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
359  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
360  "File\tFile\n"
361  "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
362  "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
363  "tiberius\tmaximus\ttiberius\t500\t\t\t16384\t3\n"
364  "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
365 
366 static const CHAR cc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
367  "i2\ti4\tL64\tS255\tS32\tS72\n"
368  "Media\tDiskId\n"
369  "1\t10\t\ttest1.cab\tDISK1\t\n"
370  "2\t2\t\ttest2.cab\tDISK2\t\n"
371  "3\t12\t\ttest3.cab\tDISK3\t\n";
372 
373 static const CHAR cc3_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
374  "i2\ti4\tL64\tS255\tS32\tS72\n"
375  "Media\tDiskId\n"
376  "1\t10\t\ttest1.cab\tDISK1\t\n"
377  "2\t2\t\ttest2_.cab\tDISK2\t\n"
378  "3\t12\t\ttest3.cab\tDISK3\t\n";
379 
380 static const CHAR co_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
381  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
382  "File\tFile\n"
383  "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
384  "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
385  "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
386 
387 static const CHAR co_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
388  "i2\ti4\tL64\tS255\tS32\tS72\n"
389  "Media\tDiskId\n"
390  "1\t10\t\ttest1.cab\tDISK1\t\n"
391  "2\t2\t\ttest2.cab\tDISK2\t\n"
392  "3\t3\t\ttest3.cab\tDISK3\t\n";
393 
394 static const CHAR co2_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
395  "i2\ti4\tL64\tS255\tS32\tS72\n"
396  "Media\tDiskId\n"
397  "1\t10\t\ttest1.cab\tDISK1\t\n"
398  "2\t12\t\ttest3.cab\tDISK3\t\n"
399  "3\t2\t\ttest2.cab\tDISK2\t\n";
400 
401 static const CHAR mm_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
402  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
403  "File\tFile\n"
404  "maximus\tmaximus\tmaximus\t500\t\t\t512\t1\n"
405  "augustus\taugustus\taugustus\t500\t\t\t512\t2\n"
406  "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
407 
408 static const CHAR mm_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
409  "i2\ti4\tL64\tS255\tS32\tS72\n"
410  "Media\tDiskId\n"
411  "1\t3\t\ttest1.cab\tDISK1\t\n";
412 
413 static const CHAR ss_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
414  "i2\ti4\tL64\tS255\tS32\tS72\n"
415  "Media\tDiskId\n"
416  "1\t2\t\ttest1.cab\tDISK1\t\n"
417  "2\t2\t\ttest2.cab\tDISK2\t\n"
418  "3\t12\t\ttest3.cab\tDISK3\t\n";
419 
420 /* tables for test_uiLevelFlags */
421 static const CHAR ui_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
422  "s72\tS38\ts72\ti2\tS255\tS72\n"
423  "Component\tComponent\n"
424  "maximus\t\tMSITESTDIR\t0\tHASUIRUN=1\tmaximus\n"
425  "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
426  "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
427 
428 static const CHAR ui_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
429  "s72\tS255\tI2\n"
430  "InstallUISequence\tAction\n"
431  "SetUIProperty\t\t5\n"
432  "ExecuteAction\t\t1100\n";
433 
434 static const CHAR ui_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
435  "s72\ti2\tS64\tS0\tS255\n"
436  "CustomAction\tAction\n"
437  "SetUIProperty\t51\tHASUIRUN\t1\t\n";
438 
439 static const CHAR rof_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
440  "s72\tS38\ts72\ti2\tS255\tS72\n"
441  "Component\tComponent\n"
442  "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
443 
444 static const CHAR rof_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
445  "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
446  "Feature\tFeature\n"
447  "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
448  "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
449 
450 static const CHAR rof_feature_comp_dat[] = "Feature_\tComponent_\n"
451  "s38\ts72\n"
452  "FeatureComponents\tFeature_\tComponent_\n"
453  "feature\tmaximus\n"
454  "montecristo\tmaximus";
455 
456 static const CHAR rof_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
457  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
458  "File\tFile\n"
459  "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
460 
461 static const CHAR rof_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
462  "i2\ti4\tL64\tS255\tS32\tS72\n"
463  "Media\tDiskId\n"
464  "1\t1\t\t\tDISK1\t\n";
465 
466 static const CHAR rofc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
467  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
468  "File\tFile\n"
469  "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1";
470 
471 static const CHAR rofc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
472  "i2\ti4\tL64\tS255\tS32\tS72\n"
473  "Media\tDiskId\n"
474  "1\t1\t\ttest1.cab\tDISK1\t\n";
475 
476 static const CHAR sdp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
477  "s72\tS255\tI2\n"
478  "InstallExecuteSequence\tAction\n"
479  "AllocateRegistrySpace\tNOT Installed\t1550\n"
480  "CostFinalize\t\t1000\n"
481  "CostInitialize\t\t800\n"
482  "FileCost\t\t900\n"
483  "InstallFiles\t\t4000\n"
484  "InstallFinalize\t\t6600\n"
485  "InstallInitialize\t\t1500\n"
486  "InstallValidate\t\t1400\n"
487  "LaunchConditions\t\t100\n"
488  "SetDirProperty\t\t950";
489 
490 static const CHAR sdp_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
491  "s72\ti2\tS64\tS0\tS255\n"
492  "CustomAction\tAction\n"
493  "SetDirProperty\t51\tMSITESTDIR\t[CommonFilesFolder]msitest\\\t\n";
494 
495 static const CHAR pv_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
496  "s72\tS255\tI2\n"
497  "InstallExecuteSequence\tAction\n"
498  "LaunchConditions\t\t100\n"
499  "CostInitialize\t\t800\n"
500  "FileCost\t\t900\n"
501  "CostFinalize\t\t1000\n"
502  "InstallValidate\t\t1400\n"
503  "InstallInitialize\t\t1500\n"
504  "InstallFiles\t\t4000\n"
505  "InstallFinalize\t\t6600\n";
506 
507 static const CHAR cie_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
508  "s72\tS38\ts72\ti2\tS255\tS72\n"
509  "Component\tComponent\n"
510  "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
511  "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
512  "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
513  "gaius\t\tMSITESTDIR\t0\t1\tgaius\n";
514 
515 static const CHAR cie_feature_comp_dat[] = "Feature_\tComponent_\n"
516  "s38\ts72\n"
517  "FeatureComponents\tFeature_\tComponent_\n"
518  "feature\tmaximus\n"
519  "feature\taugustus\n"
520  "feature\tcaesar\n"
521  "feature\tgaius";
522 
523 static const CHAR cie_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
524  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
525  "File\tFile\n"
526  "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
527  "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
528  "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12\n"
529  "gaius\tgaius\tgaius\t500\t\t\t8192\t11";
530 
531 static const CHAR cie_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
532  "i2\ti4\tL64\tS255\tS32\tS72\n"
533  "Media\tDiskId\n"
534  "1\t1\t\ttest1.cab\tDISK1\t\n"
535  "2\t2\t\ttest2.cab\tDISK2\t\n"
536  "3\t12\t\ttest3.cab\tDISK3\t\n";
537 
538 static const CHAR ci_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
539  "s72\tS38\ts72\ti2\tS255\tS72\n"
540  "Component\tComponent\n"
541  "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n";
542 
543 static const CHAR ci2_feature_comp_dat[] = "Feature_\tComponent_\n"
544  "s38\ts72\n"
545  "FeatureComponents\tFeature_\tComponent_\n"
546  "feature\taugustus";
547 
548 static const CHAR ci2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
549  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
550  "File\tFile\n"
551  "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
552 
553 static const CHAR pp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
554  "s72\tS255\tI2\n"
555  "InstallExecuteSequence\tAction\n"
556  "ValidateProductID\t\t700\n"
557  "CostInitialize\t\t800\n"
558  "FileCost\t\t900\n"
559  "CostFinalize\t\t1000\n"
560  "InstallValidate\t\t1400\n"
561  "InstallInitialize\t\t1500\n"
562  "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
563  "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
564  "RemoveFiles\t\t3500\n"
565  "InstallFiles\t\t4000\n"
566  "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
567  "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
568  "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
569  "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
570  "InstallFinalize\t\t6600";
571 
572 static const CHAR tp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
573  "s72\tS38\ts72\ti2\tS255\tS72\n"
574  "Component\tComponent\n"
575  "augustus\t\tMSITESTDIR\t0\tprop=\"val\"\taugustus\n";
576 
577 static const CHAR cwd_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
578  "s72\tS38\ts72\ti2\tS255\tS72\n"
579  "Component\tComponent\n"
580  "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
581 
582 static const CHAR adm_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
583  "s72\tS38\ts72\ti2\tS255\tS72\n"
584  "Component\tComponent\n"
585  "augustus\t\tMSITESTDIR\t0\tPOSTADMIN=1\taugustus";
586 
587 static const CHAR adm_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
588  "s72\ti2\tS64\tS0\tS255\n"
589  "CustomAction\tAction\n"
590  "SetPOSTADMIN\t51\tPOSTADMIN\t1\t\n";
591 
592 static const CHAR adm_admin_exec_seq_dat[] = "Action\tCondition\tSequence\n"
593  "s72\tS255\tI2\n"
594  "AdminExecuteSequence\tAction\n"
595  "CostFinalize\t\t1000\n"
596  "CostInitialize\t\t800\n"
597  "FileCost\t\t900\n"
598  "SetPOSTADMIN\t\t950\n"
599  "InstallFiles\t\t4000\n"
600  "InstallFinalize\t\t6600\n"
601  "InstallInitialize\t\t1500\n"
602  "InstallValidate\t\t1400\n"
603  "LaunchConditions\t\t100";
604 
605 static const CHAR amp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
606  "s72\tS38\ts72\ti2\tS255\tS72\n"
607  "Component\tComponent\n"
608  "augustus\t\tMSITESTDIR\t0\tMYPROP=2718 and MyProp=42\taugustus\n";
609 
610 static const CHAR rem_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
611  "s72\tS255\tI2\n"
612  "InstallExecuteSequence\tAction\n"
613  "ValidateProductID\t\t700\n"
614  "CostInitialize\t\t800\n"
615  "FileCost\t\t900\n"
616  "CostFinalize\t\t1000\n"
617  "InstallValidate\t\t1400\n"
618  "InstallInitialize\t\t1500\n"
619  "ProcessComponents\t\t1600\n"
620  "UnpublishFeatures\t\t1800\n"
621  "RemoveFiles\t\t3500\n"
622  "InstallFiles\t\t4000\n"
623  "RegisterProduct\t\t6100\n"
624  "PublishFeatures\t\t6300\n"
625  "PublishProduct\t\t6400\n"
626  "InstallFinalize\t\t6600";
627 
628 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
629  "s72\tS38\ts72\ti2\tS255\tS72\n"
630  "Component\tComponent\n"
631  "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
632  "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
633  "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
634  "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n"
635  "tiberius\t\tMSITESTDIR\t0\t\ttiberius\n";
636 
637 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
638  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
639  "File\tFile\n"
640  "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
641  "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
642  "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
643  "gaius\tgaius\tgaius\t500\t\t\t16384\t4\n"
644  "tiberius\ttiberius\ttiberius\t500\t\t\t0\t5\n";
645 
646 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
647  "i2\ti4\tL64\tS255\tS32\tS72\n"
648  "Media\tDiskId\n"
649  "1\t1\t\ttest1.cab\tDISK1\t\n"
650  "2\t2\t\ttest2.cab\tDISK2\t\n"
651  "3\t3\t\ttest3.cab\tDISK3\t\n"
652  "4\t4\t\ttest3.cab\tDISK3\t\n"
653  "5\t5\t\ttest4.cab\tDISK4\t\n";
654 
655 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
656  "s72\ti2\ti4\ti4\ti4\ti4\n"
657  "MsiFileHash\tFile_\n"
658  "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
659 
660 static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
661  "s72\tS38\ts72\ti2\tS255\tS72\n"
662  "Component\tComponent\n"
663  "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
664 
665 static const CHAR ca1_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
666  "s72\tS255\tI2\n"
667  "InstallExecuteSequence\tAction\n"
668  "CostInitialize\t\t100\n"
669  "FileCost\t\t200\n"
670  "CostFinalize\t\t300\n"
671  "InstallValidate\t\t400\n"
672  "InstallInitialize\t\t500\n"
673  "embednull\t\t600\n"
674  "maintest\tMAIN_TEST\t700\n"
675  "testretval\tTEST_RETVAL\t710\n"
676  "process1\tTEST_PROCESS\t720\n"
677  "process2\tTEST_PROCESS\t721\n"
678  "process_deferred\tTEST_PROCESS\t722\n"
679  "async1\tTEST_ASYNC\t730\n"
680  "async2\tTEST_ASYNC\t731\n"
681  "InstallFinalize\t\t800\n";
682 
683 static const CHAR ca1_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
684  "s72\ti2\tS64\tS0\n"
685  "CustomAction\tAction\n"
686  "embednull\t51\tembednullprop\ta[~]b\n"
687  "nested51\t51\tnested\t1\n"
688  "nested1\t1\tcustom.dll\tnested\n"
689  "maintest\t1\tcustom.dll\tmain_test\n"
690  "process1\t1\tcustom.dll\tprocess1\n"
691  "process2\t1\tcustom.dll\tprocess2\n"
692  "process_deferred\t1025\tcustom.dll\tprocess2\n"
693  "async1\t129\tcustom.dll\tasync1\n"
694  "async2\t1\tcustom.dll\tasync2\n"
695  "testretval\t1\tcustom.dll\ttest_retval\n";
696 
697 static const CHAR ca1_test_seq_dat[] = "Action\tCondition\tSequence\n"
698  "s72\tS255\tI2\n"
699  "TestSequence\tAction\n"
700  "nested1\t\t1\n"
701  "nested51\t\t2\n";
702 
703 static const CHAR ca1_test2_dat[] =
704  "A\tB\n"
705  "i2\ti2\n"
706  "test2\tA\n"
707  "1\t2\n";
708 
709 static const CHAR ca1__validation_dat[] =
710  "Table\tColumn\tNullable\tMinValue\tMaxValue\tKeyTable\tKeyColumn\tCategory\tSet\tDescription\n"
711  "s32\ts32\ts4\tI4\tI4\tS255\tI2\tS32\tS255\tS255\n"
712  "_Validation\tTable\tColumn\n"
713  "test2\tA\tN\t\t\t\t\t\t\t\n"
714  "test2\tB\tN\t\t\t\t\t\t\t\n";
715 
716 static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
717  "s72\tS38\ts72\ti2\tS255\tS72\n"
718  "Component\tComponent\n"
719  "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
720 
721 static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
722  "s72\tS255\tI2\n"
723  "InstallExecuteSequence\tAction\n"
724  "ValidateProductID\t\t700\n"
725  "GoodSetProperty\t\t725\n"
726  "BadSetProperty\t\t750\n"
727  "CostInitialize\t\t800\n"
728  "ResolveSource\t\t810\n"
729  "FileCost\t\t900\n"
730  "SetSourceDir\tSRCDIR\t910\n"
731  "CostFinalize\t\t1000\n"
732  "InstallValidate\t\t1400\n"
733  "InstallInitialize\t\t1500\n"
734  "InstallFiles\t\t4000\n"
735  "InstallFinalize\t\t6600";
736 
737 static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
738  "s72\ti2\tS64\tS0\n"
739  "CustomAction\tAction\n"
740  "GoodSetProperty\t51\tMYPROP\t42\n"
741  "BadSetProperty\t51\t\tMYPROP\n"
742  "SetSourceDir\t51\tSourceDir\t[SRCDIR]\n";
743 
744 static const CHAR is_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
745  "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
746  "Feature\tFeature\n"
747  "one\t\t\t\t2\t1\t\t0\n" /* favorLocal */
748  "two\t\t\t\t2\t1\t\t1\n" /* favorSource */
749  "three\t\t\t\t2\t1\t\t4\n" /* favorAdvertise */
750  "four\t\t\t\t2\t0\t\t0"; /* disabled */
751 
752 static const CHAR is_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
753  "s72\tS38\ts72\ti2\tS255\tS72\n"
754  "Component\tComponent\n"
755  "alpha\t\tMSITESTDIR\t0\t\talpha_file\n" /* favorLocal:Local */
756  "beta\t\tMSITESTDIR\t1\t\tbeta_file\n" /* favorLocal:Source */
757  "gamma\t\tMSITESTDIR\t2\t\tgamma_file\n" /* favorLocal:Optional */
758  "theta\t\tMSITESTDIR\t0\t\ttheta_file\n" /* favorSource:Local */
759  "delta\t\tMSITESTDIR\t1\t\tdelta_file\n" /* favorSource:Source */
760  "epsilon\t\tMSITESTDIR\t2\t\tepsilon_file\n" /* favorSource:Optional */
761  "zeta\t\tMSITESTDIR\t0\t\tzeta_file\n" /* favorAdvertise:Local */
762  "iota\t\tMSITESTDIR\t1\t\tiota_file\n" /* favorAdvertise:Source */
763  "eta\t\tMSITESTDIR\t2\t\teta_file\n" /* favorAdvertise:Optional */
764  "kappa\t\tMSITESTDIR\t0\t\tkappa_file\n" /* disabled:Local */
765  "lambda\t\tMSITESTDIR\t1\t\tlambda_file\n" /* disabled:Source */
766  "mu\t\tMSITESTDIR\t2\t\tmu_file\n"; /* disabled:Optional */
767 
768 static const CHAR is_feature_comp_dat[] = "Feature_\tComponent_\n"
769  "s38\ts72\n"
770  "FeatureComponents\tFeature_\tComponent_\n"
771  "one\talpha\n"
772  "one\tbeta\n"
773  "one\tgamma\n"
774  "two\ttheta\n"
775  "two\tdelta\n"
776  "two\tepsilon\n"
777  "three\tzeta\n"
778  "three\tiota\n"
779  "three\teta\n"
780  "four\tkappa\n"
781  "four\tlambda\n"
782  "four\tmu";
783 
784 static const CHAR is_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
785  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
786  "File\tFile\n"
787  "alpha_file\talpha\talpha\t500\t\t\t8192\t1\n"
788  "beta_file\tbeta\tbeta\t500\t\t\t8291\t2\n"
789  "gamma_file\tgamma\tgamma\t500\t\t\t8192\t3\n"
790  "theta_file\ttheta\ttheta\t500\t\t\t8192\t4\n"
791  "delta_file\tdelta\tdelta\t500\t\t\t8192\t5\n"
792  "epsilon_file\tepsilon\tepsilon\t500\t\t\t8192\t6\n"
793  "zeta_file\tzeta\tzeta\t500\t\t\t8192\t7\n"
794  "iota_file\tiota\tiota\t500\t\t\t8192\t8\n"
795  "eta_file\teta\teta\t500\t\t\t8192\t9\n"
796  "kappa_file\tkappa\tkappa\t500\t\t\t8192\t10\n"
797  "lambda_file\tlambda\tlambda\t500\t\t\t8192\t11\n"
798  "mu_file\tmu\tmu\t500\t\t\t8192\t12";
799 
800 static const CHAR is_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
801  "i2\ti4\tL64\tS255\tS32\tS72\n"
802  "Media\tDiskId\n"
803  "1\t12\t\t\tDISK1\t\n";
804 
805 static const CHAR sp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
806  "s72\tS38\ts72\ti2\tS255\tS72\n"
807  "Component\tComponent\n"
808  "augustus\t\tTWODIR\t0\t\taugustus\n";
809 
810 static const CHAR sp_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
811  "s72\tS72\tl255\n"
812  "Directory\tDirectory\n"
813  "TARGETDIR\t\tSourceDir\n"
814  "ProgramFilesFolder\tTARGETDIR\t.\n"
815  "MSITESTDIR\tProgramFilesFolder\tmsitest:.\n"
816  "ONEDIR\tMSITESTDIR\t.:shortone|longone\n"
817  "TWODIR\tONEDIR\t.:shorttwo|longtwo";
818 
819 static const CHAR mcp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
820  "s72\tS38\ts72\ti2\tS255\tS72\n"
821  "Component\tComponent\n"
822  "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t2\t\thydrogen\n"
823  "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t2\t\thelium\n"
824  "lithium\t{4AF28FFC-71C7-4307-BDE4-B77C5338F56F}\tMSITESTDIR\t2\tPROPVAR=42\tlithium\n";
825 
826 static const CHAR mcp_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
827  "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
828  "Feature\tFeature\n"
829  "hydroxyl\t\thydroxyl\thydroxyl\t2\t1\tTARGETDIR\t0\n"
830  "heliox\t\theliox\theliox\t2\t5\tTARGETDIR\t0\n"
831  "lithia\t\tlithia\tlithia\t2\t10\tTARGETDIR\t0";
832 
833 static const CHAR mcp_feature_comp_dat[] = "Feature_\tComponent_\n"
834  "s38\ts72\n"
835  "FeatureComponents\tFeature_\tComponent_\n"
836  "hydroxyl\thydrogen\n"
837  "heliox\thelium\n"
838  "lithia\tlithium";
839 
840 static const CHAR mcp_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
841  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
842  "File\tFile\n"
843  "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
844  "helium\thelium\thelium\t0\t\t\t8192\t1\n"
845  "lithium\tlithium\tlithium\t0\t\t\t8192\t1\n"
846  "beryllium\tmissingcomp\tberyllium\t0\t\t\t8192\t1";
847 
848 static const CHAR ai_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
849  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
850  "File\tFile\n"
851  "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
852  "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
853  "one.txt\tOne\tone.txt\t1000\t\t\t16384\t1\n"
854  "three.txt\tThree\tthree.txt\t1000\t\t\t16384\t3\n"
855  "two.txt\tTwo\ttwo.txt\t1000\t\t\t16384\t2\n"
856  "file\tcomponent\tfilename\t100\t\t\t8192\t1\n";
857 
858 static const CHAR ip_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
859  "s72\tS255\tI2\n"
860  "InstallExecuteSequence\tAction\n"
861  "CostFinalize\t\t1000\n"
862  "ValidateProductID\t\t700\n"
863  "CostInitialize\t\t800\n"
864  "FileCost\t\t900\n"
865  "RemoveFiles\t\t3500\n"
866  "InstallFiles\t\t4000\n"
867  "RegisterUser\t\t6000\n"
868  "RegisterProduct\t\t6100\n"
869  "PublishFeatures\t\t6300\n"
870  "PublishProduct\t\t6400\n"
871  "InstallFinalize\t\t6600\n"
872  "InstallInitialize\t\t1500\n"
873  "ProcessComponents\t\t1600\n"
874  "UnpublishFeatures\t\t1800\n"
875  "InstallValidate\t\t1400\n"
876  "LaunchConditions\t\t100\n"
877  "TestInstalledProp\tInstalled AND NOT REMOVE\t950\n";
878 
879 static const CHAR ip_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
880  "s72\ti2\tS64\tS0\tS255\n"
881  "CustomAction\tAction\n"
882  "TestInstalledProp\t19\t\tTest failed\t\n";
883 
884 static const CHAR aup_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
885  "s72\tS255\tI2\n"
886  "InstallExecuteSequence\tAction\n"
887  "CostFinalize\t\t1000\n"
888  "ValidateProductID\t\t700\n"
889  "CostInitialize\t\t800\n"
890  "FileCost\t\t900\n"
891  "RemoveFiles\t\t3500\n"
892  "InstallFiles\t\t4000\n"
893  "RegisterUser\t\t6000\n"
894  "RegisterProduct\t\t6100\n"
895  "PublishFeatures\t\t6300\n"
896  "PublishProduct\t\t6400\n"
897  "InstallFinalize\t\t6600\n"
898  "InstallInitialize\t\t1500\n"
899  "ProcessComponents\t\t1600\n"
900  "UnpublishFeatures\t\t1800\n"
901  "InstallValidate\t\t1400\n"
902  "LaunchConditions\t\t100\n"
903  "TestAllUsersProp\tALLUSERS AND NOT REMOVE\t50\n";
904 
905 static const CHAR aup2_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
906  "s72\tS255\tI2\n"
907  "InstallExecuteSequence\tAction\n"
908  "CostFinalize\t\t1000\n"
909  "ValidateProductID\t\t700\n"
910  "CostInitialize\t\t800\n"
911  "FileCost\t\t900\n"
912  "RemoveFiles\t\t3500\n"
913  "InstallFiles\t\t4000\n"
914  "RegisterUser\t\t6000\n"
915  "RegisterProduct\t\t6100\n"
916  "PublishFeatures\t\t6300\n"
917  "PublishProduct\t\t6400\n"
918  "InstallFinalize\t\t6600\n"
919  "InstallInitialize\t\t1500\n"
920  "ProcessComponents\t\t1600\n"
921  "UnpublishFeatures\t\t1800\n"
922  "InstallValidate\t\t1400\n"
923  "LaunchConditions\t\t100\n"
924  "TestAllUsersProp\tALLUSERS=2 AND NOT REMOVE\t50\n";
925 
926 static const CHAR aup3_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
927  "s72\tS255\tI2\n"
928  "InstallExecuteSequence\tAction\n"
929  "CostFinalize\t\t1000\n"
930  "ValidateProductID\t\t700\n"
931  "CostInitialize\t\t800\n"
932  "FileCost\t\t900\n"
933  "RemoveFiles\t\t3500\n"
934  "InstallFiles\t\t4000\n"
935  "RegisterUser\t\t6000\n"
936  "RegisterProduct\t\t6100\n"
937  "PublishFeatures\t\t6300\n"
938  "PublishProduct\t\t6400\n"
939  "InstallFinalize\t\t6600\n"
940  "InstallInitialize\t\t1500\n"
941  "ProcessComponents\t\t1600\n"
942  "UnpublishFeatures\t\t1800\n"
943  "InstallValidate\t\t1400\n"
944  "LaunchConditions\t\t100\n"
945  "TestAllUsersProp\tALLUSERS=1 AND NOT REMOVE\t50\n";
946 
947 static const CHAR aup_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
948  "s72\ti2\tS64\tS0\tS255\n"
949  "CustomAction\tAction\n"
950  "TestAllUsersProp\t19\t\tTest failed\t\n";
951 
952 static const CHAR fo_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
953  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
954  "File\tFile\n"
955  "override.txt\toverride\toverride.txt\t1000\t\t\t8192\t1\n"
956  "preselected.txt\tpreselected\tpreselected.txt\t1000\t\t\t8192\t2\n"
957  "notpreselected.txt\tnotpreselected\tnotpreselected.txt\t1000\t\t\t8192\t3\n";
958 
959 static const CHAR fo_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
960  "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
961  "Feature\tFeature\n"
962  "override\t\t\toverride feature\t1\t1\tMSITESTDIR\t0\n"
963  "preselected\t\t\tpreselected feature\t1\t1\tMSITESTDIR\t0\n"
964  "notpreselected\t\t\tnotpreselected feature\t1\t1\tMSITESTDIR\t0\n";
965 
966 static const CHAR fo_condition_dat[] = "Feature_\tLevel\tCondition\n"
967  "s38\ti2\tS255\n"
968  "Condition\tFeature_\tLevel\n"
969  "preselected\t0\tPreselected AND NOT REMOVE\n"
970  "notpreselected\t0\tNOT Preselected AND NOT REMOVE\n";
971 
972 static const CHAR fo_feature_comp_dat[] = "Feature_\tComponent_\n"
973  "s38\ts72\n"
974  "FeatureComponents\tFeature_\tComponent_\n"
975  "override\toverride\n"
976  "preselected\tpreselected\n"
977  "notpreselected\tnotpreselected\n";
978 
979 static const CHAR fo_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
980  "s72\tS38\ts72\ti2\tS255\tS72\n"
981  "Component\tComponent\n"
982  "override\t{0A00FB1D-97B0-4B42-ADF0-BB8913416623}\tMSITESTDIR\t0\t\toverride.txt\n"
983  "preselected\t{44E1DB75-605A-43DD-8CF5-CAB17F1BBD60}\tMSITESTDIR\t0\t\tpreselected.txt\n"
984  "notpreselected\t{E1647733-5E75-400A-A92E-5E60B4D4EF9F}\tMSITESTDIR\t0\t\tnotpreselected.txt\n";
985 
986 static const CHAR fo_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
987  "s72\ti2\tS64\tS0\tS255\n"
988  "CustomAction\tAction\n"
989  "SetPreselected\t51\tPreselected\t1\t\n";
990 
991 static const CHAR fo_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
992  "s72\tS255\tI2\n"
993  "InstallExecuteSequence\tAction\n"
994  "LaunchConditions\t\t100\n"
995  "SetPreselected\tpreselect=1\t200\n"
996  "CostInitialize\t\t800\n"
997  "FileCost\t\t900\n"
998  "CostFinalize\t\t1000\n"
999  "InstallValidate\t\t1400\n"
1000  "InstallInitialize\t\t1500\n"
1001  "ProcessComponents\t\t1600\n"
1002  "RemoveFiles\t\t1700\n"
1003  "InstallFiles\t\t2000\n"
1004  "RegisterProduct\t\t5000\n"
1005  "PublishFeatures\t\t5100\n"
1006  "PublishProduct\t\t5200\n"
1007  "UnpublishFeatures\t\t5300\n"
1008  "InstallFinalize\t\t6000\n";
1009 
1010 static const CHAR uc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1011  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1012  "File\tFile\n"
1013  "upgradecode.txt\tupgradecode\tupgradecode.txt\t1000\t\t\t8192\t1\n";
1014 
1015 static const CHAR uc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1016  "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1017  "Feature\tFeature\n"
1018  "upgradecode\t\t\tupgradecode feature\t1\t2\tMSITESTDIR\t0\n";
1019 
1020 static const CHAR uc_feature_comp_dat[] = "Feature_\tComponent_\n"
1021  "s38\ts72\n"
1022  "FeatureComponents\tFeature_\tComponent_\n"
1023  "upgradecode\tupgradecode\n";
1024 
1025 static const CHAR uc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1026  "s72\tS38\ts72\ti2\tS255\tS72\n"
1027  "Component\tComponent\n"
1028  "upgradecode\t{6952B732-2FCB-4E47-976F-989FCBD7EDFB}\tMSITESTDIR\t0\t\tupgradecode.txt\n";
1029 
1030 static const CHAR uc_property_dat[] = "Property\tValue\n"
1031  "s72\tl0\n"
1032  "Property\tProperty\n"
1033  "INSTALLLEVEL\t3\n"
1034  "ProductCode\t{E5FB1241-F547-4BA7-A60E-8E75797268D4}\n"
1035  "ProductName\tMSITEST\n"
1036  "ProductVersion\t1.1.1\n"
1037  "UpgradeCode\t#UPGEADECODE#\n"
1038  "MSIFASTINSTALL\t1\n";
1039 
1040 static const CHAR uc_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1041  "s72\tS255\tI2\n"
1042  "InstallExecuteSequence\tAction\n"
1043  "LaunchConditions\t\t100\n"
1044  "CostInitialize\t\t200\n"
1045  "FileCost\t\t300\n"
1046  "CostFinalize\t\t400\n"
1047  "InstallInitialize\t\t500\n"
1048  "ProcessComponents\t\t600\n"
1049  "InstallValidate\t\t700\n"
1050  "RemoveFiles\t\t800\n"
1051  "InstallFiles\t\t900\n"
1052  "RegisterProduct\t\t1000\n"
1053  "PublishFeatures\t\t1100\n"
1054  "PublishProduct\t\t1200\n"
1055  "UnpublishFeatures\t\t1250\n"
1056  "InstallFinalize\t\t1300\n";
1057 
1058 static const char mixed_feature_dat[] =
1059  "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1060  "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1061  "Feature\tFeature\n"
1062  "feature1\t\t\t\t1\t2\tMSITESTDIR\t0\n"
1063  "feature2\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1064 
1065 static const char mixed_feature_comp_dat[] =
1066  "Feature_\tComponent_\n"
1067  "s38\ts72\n"
1068  "FeatureComponents\tFeature_\tComponent_\n"
1069  "feature1\tcomp1\n"
1070  "feature2\tcomp2\n";
1071 
1072 static const char mixed_component_dat[] =
1073  "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1074  "s72\tS38\ts72\ti2\tS255\tS72\n"
1075  "Component\tComponent\n"
1076  "comp1\t{DE9F0EF4-0ED3-495A-8105-060C0EA457B8}\tTARGETDIR\t4\t\tregdata1\n"
1077  "comp2\t{4912DBE7-FC3A-4F91-BB5C-88F5C15C19A5}\tTARGETDIR\t260\t\tregdata2\n";
1078 
1079 static const char mixed_registry_dat[] =
1080  "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
1081  "s72\ti2\tl255\tL255\tL0\ts72\n"
1082  "Registry\tRegistry\n"
1083  "regdata1\t2\tSOFTWARE\\Wine\\msitest\ttest1\t\tcomp1\n"
1084  "regdata2\t2\tSOFTWARE\\Wine\\msitest\ttest2\t\tcomp2\n"
1085  "regdata3\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\t\tCLSID_Winetest32\tcomp1\n"
1086  "regdata4\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32\t\twinetest32.dll\tcomp1\n"
1087  "regdata5\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\t\tCLSID_Winetest64\tcomp2\n"
1088  "regdata6\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32\t\twinetest64.dll\tcomp2\n";
1089 
1090 static const char mixed_install_exec_seq_dat[] =
1091  "Action\tCondition\tSequence\n"
1092  "s72\tS255\tI2\n"
1093  "InstallExecuteSequence\tAction\n"
1094  "LaunchConditions\t\t100\n"
1095  "CostInitialize\t\t200\n"
1096  "FileCost\t\t300\n"
1097  "CostFinalize\t\t400\n"
1098  "InstallValidate\t\t500\n"
1099  "InstallInitialize\t\t600\n"
1100  "ProcessComponents\t\t700\n"
1101  "UnpublishFeatures\t\t800\n"
1102  "RemoveRegistryValues\t\t900\n"
1103  "WriteRegistryValues\t\t1000\n"
1104  "RegisterProduct\t\t1100\n"
1105  "PublishFeatures\t\t1200\n"
1106  "PublishProduct\t\t1300\n"
1107  "InstallFinalize\t\t1400\n";
1108 
1109 static const char vp_file_dat[] =
1110  "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1111  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1112  "File\tFile\n"
1113  "volumeprop\tcomp\tvolumeprop.txt\t1000\t\t\t8192\t1\n";
1114 
1115 static const char vp_feature_dat[] =
1116  "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1117  "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1118  "Feature\tFeature\n"
1119  "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1120 
1121 static const char vp_feature_comp_dat[] =
1122  "Feature_\tComponent_\n"
1123  "s38\ts72\n"
1124  "FeatureComponents\tFeature_\tComponent_\n"
1125  "feature\tcomp\n";
1126 
1127 static const char vp_component_dat[] =
1128  "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1129  "s72\tS38\ts72\ti2\tS255\tS72\n"
1130  "Component\tComponent\n"
1131  "comp\t{24364AE7-5B7F-496C-AF5A-54893639C567}\tMSITESTDIR\t0\t\tvolumeprop\n";
1132 
1133 static const char vp_custom_action_dat[] =
1134  "Action\tType\tSource\tTarget\tISComments\n"
1135  "s72\ti2\tS64\tS0\tS255\n"
1136  "CustomAction\tAction\n"
1137  "TestPrimaryVolumePath0\t19\t\tPrimaryVolumePath set before CostFinalize\t\n"
1138  "TestPrimaryVolumeSpaceAvailable0\t19\t\tPrimaryVolumeSpaceAvailable set before CostFinalize\t\n"
1139  "TestPrimaryVolumeSpaceRequired0\t19\t\tPrimaryVolumeSpaceRequired set before CostFinalize\t\n"
1140  "TestPrimaryVolumeSpaceRemaining0\t19\t\tPrimaryVolumeSpaceRemaining set before CostFinalize\t\n"
1141  "TestPrimaryVolumePath1\t19\t\tPrimaryVolumePath set before InstallValidate\t\n"
1142  "TestPrimaryVolumeSpaceAvailable1\t19\t\tPrimaryVolumeSpaceAvailable not set before InstallValidate\t\n"
1143  "TestPrimaryVolumeSpaceRequired1\t19\t\tPrimaryVolumeSpaceRequired not set before InstallValidate\t\n"
1144  "TestPrimaryVolumeSpaceRemaining1\t19\t\tPrimaryVolumeSpaceRemaining not set before InstallValidate\t\n"
1145  "TestPrimaryVolumePath2\t19\t\tPrimaryVolumePath not set after InstallValidate\t\n"
1146  "TestPrimaryVolumeSpaceAvailable2\t19\t\tPrimaryVolumeSpaceAvailable not set after InstallValidate\t\n"
1147  "TestPrimaryVolumeSpaceRequired2\t19\t\tPrimaryVolumeSpaceRequired not set after InstallValidate\t\n"
1148  "TestPrimaryVolumeSpaceRemaining2\t19\t\tPrimaryVolumeSpaceRemaining not set after InstallValidate\t\n";
1149 
1150 static const char vp_install_exec_seq_dat[] =
1151  "Action\tCondition\tSequence\n"
1152  "s72\tS255\tI2\n"
1153  "InstallExecuteSequence\tAction\n"
1154  "LaunchConditions\t\t100\n"
1155  "CostInitialize\t\t200\n"
1156  "FileCost\t\t300\n"
1157  "TestPrimaryVolumePath0\tPrimaryVolumePath AND NOT REMOVE\t400\n"
1158  "TestPrimaryVolumeSpaceAvailable0\tPrimaryVolumeSpaceAvailable AND NOT REMOVE\t500\n"
1159  "TestPrimaryVolumeSpaceRequired0\tPrimaryVolumeSpaceRequired AND NOT REMOVE\t510\n"
1160  "TestPrimaryVolumeSpaceRemaining0\tPrimaryVolumeSpaceRemaining AND NOT REMOVE\t520\n"
1161  "CostFinalize\t\t600\n"
1162  "TestPrimaryVolumePath1\tPrimaryVolumePath AND NOT REMOVE\t600\n"
1163  "TestPrimaryVolumeSpaceAvailable1\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t800\n"
1164  "TestPrimaryVolumeSpaceRequired1\tNOT PrimaryVolumeSpaceRequired AND NOT REMOVE\t810\n"
1165  "TestPrimaryVolumeSpaceRemaining1\tNOT PrimaryVolumeSpaceRemaining AND NOT REMOVE\t820\n"
1166  "InstallValidate\t\t900\n"
1167  "TestPrimaryVolumePath2\tNOT PrimaryVolumePath AND NOT REMOVE\t1000\n"
1168  "TestPrimaryVolumeSpaceAvailable2\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t1100\n"
1169  "TestPrimaryVolumeSpaceRequired2\tNOT PrimaryVolumeSpaceRequired AND NOT REMOVE\t1110\n"
1170  "TestPrimaryVolumeSpaceRemaining2\tNOT PrimaryVolumeSpaceRemaining AND NOT REMOVE\t1120\n"
1171  "InstallInitialize\t\t1200\n"
1172  "ProcessComponents\t\t1300\n"
1173  "RemoveFiles\t\t1400\n"
1174  "InstallFiles\t\t1500\n"
1175  "RegisterProduct\t\t1600\n"
1176  "PublishFeatures\t\t1700\n"
1177  "PublishProduct\t\t1800\n"
1178  "UnpublishFeatures\t\t1850\n"
1179  "InstallFinalize\t\t1900\n";
1180 
1181 static const char shc_property_dat[] =
1182  "Property\tValue\n"
1183  "s72\tl0\n"
1184  "Property\tProperty\n"
1185  "INSTALLLEVEL\t3\n"
1186  "ProductCode\t{5CD99CD0-69C7-409B-9905-82DD743CC840}\n"
1187  "ProductName\tMSITEST\n"
1188  "ProductVersion\t1.1.1\n"
1189  "MSIFASTINSTALL\t1\n";
1190 
1191 static const char shc2_property_dat[] =
1192  "Property\tValue\n"
1193  "s72\tl0\n"
1194  "Property\tProperty\n"
1195  "INSTALLLEVEL\t3\n"
1196  "ProductCode\t{4CEFADE5-DAFB-4C21-8EF2-4ED4F139F340}\n"
1197  "ProductName\tMSITEST2\n"
1198  "ProductVersion\t1.1.1\n"
1199  "MSIFASTINSTALL\t1\n";
1200 
1201 static const char shc_file_dat[] =
1202  "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1203  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1204  "File\tFile\n"
1205  "sharedcomponent\tsharedcomponent\tsharedcomponent.txt\t1000\t\t\t8192\t1\n";
1206 
1207 static const char shc_feature_dat[] =
1208  "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1209  "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1210  "Feature\tFeature\n"
1211  "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1212 
1213 static const char shc_feature_comp_dat[] =
1214  "Feature_\tComponent_\n"
1215  "s38\ts72\n"
1216  "FeatureComponents\tFeature_\tComponent_\n"
1217  "feature\tsharedcomponent\n";
1218 
1219 static const char shc_component_dat[] =
1220  "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1221  "s72\tS38\ts72\ti2\tS255\tS72\n"
1222  "Component\tComponent\n"
1223  "sharedcomponent\t{900A4ACB-DC6F-4795-A04B-81B530183D41}\tMSITESTDIR\t0\t\tsharedcomponent\n";
1224 
1225 static const char shc_custom_action_dat[] =
1226  "Action\tType\tSource\tTarget\tISComments\n"
1227  "s72\ti2\tS64\tS0\tS255\n"
1228  "CustomAction\tAction\n"
1229  "TestComponentAction\t19\t\twrong component action on install\t\n"
1230  "TestDisallowedAction\t19\t\twrong component action on disallowed remove\t\n"
1231  "TestRemoveAction\t19\t\twrong component action on remove\t\n";
1232 
1233 static const char shc_install_exec_seq_dat[] =
1234  "Action\tCondition\tSequence\n"
1235  "s72\tS255\tI2\n"
1236  "InstallExecuteSequence\tAction\n"
1237  "LaunchConditions\t\t100\n"
1238  "CostInitialize\t\t200\n"
1239  "FileCost\t\t300\n"
1240  "CostFinalize\t\t600\n"
1241  "TestDisallowedAction\tREMOVE AND ($sharedcomponent <> -1)\t700\n"
1242  "InstallValidate\t\t900\n"
1243  "InstallInitialize\t\t1200\n"
1244  "ProcessComponents\t\t1300\n"
1245  "RemoveFiles\t\t1400\n"
1246  "InstallFiles\t\t1500\n"
1247  "TestComponentAction\tNOT REMOVE AND ($sharedcomponent <> 3)\t1600\n"
1248  "RegisterProduct\t\t1700\n"
1249  "PublishFeatures\t\t1800\n"
1250  "PublishProduct\t\t1900\n"
1251  "UnpublishFeatures\t\t1950\n"
1252  "InstallFinalize\t\t2000\n";
1253 
1254 static const char shc2_install_exec_seq_dat[] =
1255  "Action\tCondition\tSequence\n"
1256  "s72\tS255\tI2\n"
1257  "InstallExecuteSequence\tAction\n"
1258  "LaunchConditions\t\t100\n"
1259  "CostInitialize\t\t200\n"
1260  "FileCost\t\t300\n"
1261  "CostFinalize\t\t600\n"
1262  "TestRemoveAction\tREMOVE AND ($sharedcomponent <> 2)\t700\n"
1263  "InstallValidate\t\t900\n"
1264  "InstallInitialize\t\t1200\n"
1265  "ProcessComponents\t\t1300\n"
1266  "RemoveFiles\t\t1400\n"
1267  "InstallFiles\t\t1500\n"
1268  "TestComponentAction\tNOT REMOVE AND ($sharedcomponent <> 3)\t1600\n"
1269  "RegisterProduct\t\t1700\n"
1270  "PublishFeatures\t\t1800\n"
1271  "PublishProduct\t\t1900\n"
1272  "UnpublishFeatures\t\t1950\n"
1273  "InstallFinalize\t\t2000\n";
1274 
1275 static const char ft_file_dat[] =
1276  "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1277  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1278  "File\tFile\n"
1279  "featuretree\tcomp\tfeaturetree.txt\t1000\t\t\t8192\t1\n";
1280 
1281 static const char ft_comp_dat[] =
1282  "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1283  "s72\tS38\ts72\ti2\tS255\tS72\n"
1284  "Component\tComponent\n"
1285  "comp\t{12345678-1234-1234-1234-222222222222}\tTARGETDIR\t0\t\t\n"
1286  "comp2\t{12345678-1234-1234-1234-333333333333}\tTARGETDIR\t0\t\tfeaturetree\n";
1287 
1288 static const char ft_feature_dat[] =
1289  "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1290  "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1291  "Feature\tFeature\n"
1292  "A\t\t\t\t2\t1\t\t0\n"
1293  "C\tB\t\t\t2\t1\t\t0\n"
1294  "B\tA\t\t\t4\t1\t\t0\n"
1295  "D\t\t\t\t2\t1\t\t0\n";
1296 
1297 static const char ft_feature_comp_dat[] =
1298  "Feature_\tComponent_\n"
1299  "s38\ts72\n"
1300  "FeatureComponents\tFeature_\tComponent_\n"
1301  "C\tcomp\n"
1302  "D\tcomp2\n";
1303 
1304 static const char ft_condition_dat[] =
1305  "Feature_\tLevel\tCondition\n"
1306  "s38\ti2\tS255\n"
1307  "Condition\tFeature_\tLevel\n"
1308  "A\t0\t\"0\"<>INSTALLTYPE\n";
1309 
1310 static const char ft_custom_action_dat[] =
1311  "Action\tType\tSource\tTarget\tISComments\n"
1312  "s72\ti2\tS64\tS0\tS255\n"
1313  "CustomAction\tAction\n"
1314  "Run A\t19\t\tA\t\n"
1315  "Run B\t19\t\tB\t\n"
1316  "Run C\t19\t\tC\t\n";
1317 
1318 static const char ft_install_exec_seq_dat[] =
1319  "Action\tCondition\tSequence\n"
1320  "s72\tS255\tI2\n"
1321  "InstallExecuteSequence\tAction\n"
1322  "CostInitialize\t\t100\n"
1323  "FileCost\t\t200\n"
1324  "CostFinalize\t\t300\n"
1325  "InstallValidate\t\t400\n"
1326  "InstallInitialize\t\t500\n"
1327  "Run C\t3 = &C AND NOT Installed\t600\n"
1328  "Run B\t3 = &B AND NOT Installed\t700\n"
1329  "Run A\t3 = &A AND NOT Installed\t800\n"
1330  "ProcessComponents\t\t900\n"
1331  "RemoveFiles\t\t1000\n"
1332  "InstallFiles\t\t1100\n"
1333  "RegisterProduct\t\t1200\n"
1334  "PublishFeatures\t\t1300\n"
1335  "PublishProduct\t\t1400\n"
1336  "UnpublishFeatures\t\t1450\n"
1337  "InstallFinalize\t\t1500\n";
1338 
1339 static const char da_custom_action_dat[] =
1340  "Action\tType\tSource\tTarget\n"
1341  "s72\ti2\tS64\tS0\n"
1342  "CustomAction\tAction\n"
1343  "setprop\t51\tdeferred\t[TESTPATH]\n"
1344  "immediate\t1\tcustom.dll\tda_immediate\n"
1345  "deferred\t1025\tcustom.dll\tda_deferred\n";
1346 
1347 static const char da_install_exec_seq_dat[] =
1348  "Action\tCondition\tSequence\n"
1349  "s72\tS255\tI2\n"
1350  "InstallExecuteSequence\tAction\n"
1351  "CostInitialize\t\t200\n"
1352  "FileCost\t\t300\n"
1353  "CostFinalize\t\t400\n"
1354  "InstallInitialize\t\t500\n"
1355  "setprop\t\t600\n"
1356  "deferred\t\t700\n"
1357  "immediate\t\t800\n"
1358  "InstallFinalize\t\t1100\n";
1359 
1360 static const CHAR x64_directory_dat[] =
1361  "Directory\tDirectory_Parent\tDefaultDir\n"
1362  "s72\tS72\tl255\n"
1363  "Directory\tDirectory\n"
1364  "CABOUTDIR\tMSITESTDIR\tcabout\n"
1365  "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
1366  "FIRSTDIR\tMSITESTDIR\tfirst\n"
1367  "MSITESTDIR\tProgramFiles64Folder\tmsitest\n"
1368  "NEWDIR\tCABOUTDIR\tnew\n"
1369  "ProgramFiles64Folder\tTARGETDIR\t.\n"
1370  "TARGETDIR\t\tSourceDir";
1371 
1373  "Action\tCondition\tSequence\n"
1374  "s72\tS255\tI2\n"
1375  "InstallExecuteSequence\tAction\n"
1376  "CostInitialize\t\t200\n"
1377  "FileCost\t\t300\n"
1378  "CostFinalize\t\t400\n"
1379  "InstallValidate\t\t500\n"
1380  "InstallInitialize\t\t600\n"
1381  "sourcedir_unset\tSourceDir\t700\n"
1382  "ResolveSource\tRESOLVE_SOURCE\t800\n"
1383  "ProcessComponents\tPROCESS_COMPONENTS\t800\n"
1384  "InstallFiles\tINSTALL_FILES\t800\n"
1385  "sourcedir_set\tNOT SourceDir\t900\n"
1386  "InstallFinalize\t\t1000\n";
1387 
1388 static const CHAR sr_custom_action_dat[] =
1389  "Action\tType\tSource\tTarget\n"
1390  "s72\ti2\tS64\tS0\n"
1391  "CustomAction\tAction\n"
1392  "sourcedir_unset\t19\t\tSourceDir should not be set\n"
1393  "sourcedir_set\t19\t\tSourceDir should be set\n";
1394 
1395 static const CHAR ai2_file_dat[] =
1396  "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1397  "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1398  "File\tFile\n"
1399  "five.txt\tFive\tfive.txt\t1000\t\t\t0\t5\n"
1400  "four.txt\tFour\tfour.txt\t1000\t\t\t0\t4\n";
1401 
1402 static const CHAR ai2_component_dat[] =
1403  "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1404  "s72\tS38\ts72\ti2\tS255\tS72\n"
1405  "Component\tComponent\n"
1406  "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
1407  "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n";
1408 
1409 static const CHAR ai2_feature_dat[] =
1410  "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1411  "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1412  "Feature\tFeature\n"
1413  "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
1414  "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n";
1415 
1416 static const CHAR ai2_feature_comp_dat[] =
1417  "Feature_\tComponent_\n"
1418  "s38\ts72\n"
1419  "FeatureComponents\tFeature_\tComponent_\n"
1420  "Five\tFive\n"
1421  "Four\tFour\n";
1422 
1423 static const msi_table tables[] =
1424 {
1425  ADD_TABLE(component),
1427  ADD_TABLE(feature),
1428  ADD_TABLE(feature_comp),
1429  ADD_TABLE(file),
1430  ADD_TABLE(install_exec_seq),
1431  ADD_TABLE(media),
1434 };
1435 
1436 static const msi_table sc_tables[] =
1437 {
1438  ADD_TABLE(component),
1440  ADD_TABLE(feature),
1441  ADD_TABLE(feature_comp),
1442  ADD_TABLE(file),
1443  ADD_TABLE(install_exec_seq),
1444  ADD_TABLE(media),
1446  ADD_TABLE(shortcut)
1447 };
1448 
1449 static const msi_table ps_tables[] =
1450 {
1451  ADD_TABLE(component),
1453  ADD_TABLE(feature),
1454  ADD_TABLE(feature_comp),
1455  ADD_TABLE(file),
1456  ADD_TABLE(install_exec_seq),
1457  ADD_TABLE(media),
1460 };
1461 
1462 static const msi_table up_tables[] =
1463 {
1464  ADD_TABLE(component),
1466  ADD_TABLE(feature),
1467  ADD_TABLE(feature_comp),
1468  ADD_TABLE(file),
1469  ADD_TABLE(install_exec_seq),
1470  ADD_TABLE(media),
1471  ADD_TABLE(up_property),
1473 };
1474 
1475 static const msi_table up2_tables[] =
1476 {
1477  ADD_TABLE(component),
1479  ADD_TABLE(feature),
1480  ADD_TABLE(feature_comp),
1481  ADD_TABLE(file),
1482  ADD_TABLE(install_exec_seq),
1483  ADD_TABLE(media),
1484  ADD_TABLE(up2_property),
1486 };
1487 
1488 static const msi_table up3_tables[] =
1489 {
1490  ADD_TABLE(component),
1492  ADD_TABLE(feature),
1493  ADD_TABLE(feature_comp),
1494  ADD_TABLE(file),
1495  ADD_TABLE(install_exec_seq),
1496  ADD_TABLE(media),
1497  ADD_TABLE(up3_property),
1499 };
1500 
1501 static const msi_table up4_tables[] =
1502 {
1503  ADD_TABLE(component),
1505  ADD_TABLE(feature),
1506  ADD_TABLE(feature_comp),
1507  ADD_TABLE(file),
1508  ADD_TABLE(pp_install_exec_seq),
1509  ADD_TABLE(media),
1512 };
1513 
1514 static const msi_table up5_tables[] =
1515 {
1516  ADD_TABLE(component),
1518  ADD_TABLE(feature),
1519  ADD_TABLE(feature_comp),
1520  ADD_TABLE(file),
1521  ADD_TABLE(pp_install_exec_seq),
1522  ADD_TABLE(media),
1523  ADD_TABLE(up_property),
1525 };
1526 
1527 static const msi_table up6_tables[] =
1528 {
1529  ADD_TABLE(component),
1531  ADD_TABLE(feature),
1532  ADD_TABLE(feature_comp),
1533  ADD_TABLE(file),
1534  ADD_TABLE(pp_install_exec_seq),
1535  ADD_TABLE(media),
1536  ADD_TABLE(up2_property),
1538 };
1539 
1540 static const msi_table up7_tables[] =
1541 {
1542  ADD_TABLE(component),
1544  ADD_TABLE(feature),
1545  ADD_TABLE(feature_comp),
1546  ADD_TABLE(file),
1547  ADD_TABLE(pp_install_exec_seq),
1548  ADD_TABLE(media),
1549  ADD_TABLE(up3_property),
1551 };
1552 
1553 static const msi_table cc_tables[] =
1554 {
1555  ADD_TABLE(cc_component),
1557  ADD_TABLE(cc_feature),
1558  ADD_TABLE(cc_feature_comp),
1559  ADD_TABLE(cc_file),
1560  ADD_TABLE(install_exec_seq),
1561  ADD_TABLE(cc_media),
1563 };
1564 
1565 static const msi_table cc2_tables[] =
1566 {
1567  ADD_TABLE(cc2_component),
1569  ADD_TABLE(cc_feature),
1570  ADD_TABLE(cc_feature_comp),
1571  ADD_TABLE(cc2_file),
1572  ADD_TABLE(install_exec_seq),
1573  ADD_TABLE(cc_media),
1575 };
1576 
1577 static const msi_table cc3_tables[] =
1578 {
1579  ADD_TABLE(cc_component),
1581  ADD_TABLE(cc_feature),
1582  ADD_TABLE(cc_feature_comp),
1583  ADD_TABLE(cc_file),
1584  ADD_TABLE(install_exec_seq),
1585  ADD_TABLE(cc3_media),
1587 };
1588 
1589 static const msi_table co_tables[] =
1590 {
1591  ADD_TABLE(cc_component),
1593  ADD_TABLE(cc_feature),
1594  ADD_TABLE(cc_feature_comp),
1595  ADD_TABLE(co_file),
1596  ADD_TABLE(install_exec_seq),
1597  ADD_TABLE(co_media),
1599 };
1600 
1601 static const msi_table co2_tables[] =
1602 {
1603  ADD_TABLE(cc_component),
1605  ADD_TABLE(cc_feature),
1606  ADD_TABLE(cc_feature_comp),
1607  ADD_TABLE(cc_file),
1608  ADD_TABLE(install_exec_seq),
1609  ADD_TABLE(co2_media),
1611 };
1612 
1613 static const msi_table mm_tables[] =
1614 {
1615  ADD_TABLE(cc_component),
1617  ADD_TABLE(cc_feature),
1618  ADD_TABLE(cc_feature_comp),
1619  ADD_TABLE(mm_file),
1620  ADD_TABLE(install_exec_seq),
1621  ADD_TABLE(mm_media),
1623 };
1624 
1625 static const msi_table ss_tables[] =
1626 {
1627  ADD_TABLE(cc_component),
1629  ADD_TABLE(cc_feature),
1630  ADD_TABLE(cc_feature_comp),
1631  ADD_TABLE(cc_file),
1632  ADD_TABLE(install_exec_seq),
1633  ADD_TABLE(ss_media),
1635 };
1636 
1637 static const msi_table ui_tables[] =
1638 {
1639  ADD_TABLE(ui_component),
1641  ADD_TABLE(cc_feature),
1642  ADD_TABLE(cc_feature_comp),
1643  ADD_TABLE(cc_file),
1644  ADD_TABLE(install_exec_seq),
1645  ADD_TABLE(ui_install_ui_seq),
1646  ADD_TABLE(ui_custom_action),
1647  ADD_TABLE(cc_media),
1649 };
1650 
1651 static const msi_table rof_tables[] =
1652 {
1653  ADD_TABLE(rof_component),
1655  ADD_TABLE(rof_feature),
1656  ADD_TABLE(rof_feature_comp),
1657  ADD_TABLE(rof_file),
1658  ADD_TABLE(install_exec_seq),
1659  ADD_TABLE(rof_media),
1661 };
1662 
1663 static const msi_table rofc_tables[] =
1664 {
1665  ADD_TABLE(rof_component),
1667  ADD_TABLE(rof_feature),
1668  ADD_TABLE(rof_feature_comp),
1669  ADD_TABLE(rofc_file),
1670  ADD_TABLE(install_exec_seq),
1671  ADD_TABLE(rofc_media),
1673 };
1674 
1675 static const msi_table sdp_tables[] =
1676 {
1677  ADD_TABLE(rof_component),
1679  ADD_TABLE(rof_feature),
1680  ADD_TABLE(rof_feature_comp),
1681  ADD_TABLE(rof_file),
1682  ADD_TABLE(sdp_install_exec_seq),
1683  ADD_TABLE(sdp_custom_action),
1684  ADD_TABLE(rof_media),
1686 };
1687 
1688 static const msi_table cie_tables[] =
1689 {
1690  ADD_TABLE(cie_component),
1692  ADD_TABLE(cc_feature),
1693  ADD_TABLE(cie_feature_comp),
1694  ADD_TABLE(cie_file),
1695  ADD_TABLE(install_exec_seq),
1696  ADD_TABLE(cie_media),
1698 };
1699 
1700 static const msi_table tp_tables[] =
1701 {
1702  ADD_TABLE(tp_component),
1704  ADD_TABLE(rof_feature),
1705  ADD_TABLE(ci2_feature_comp),
1706  ADD_TABLE(ci2_file),
1707  ADD_TABLE(install_exec_seq),
1708  ADD_TABLE(rof_media),
1710 };
1711 
1712 static const msi_table cwd_tables[] =
1713 {
1714  ADD_TABLE(cwd_component),
1716  ADD_TABLE(rof_feature),
1717  ADD_TABLE(ci2_feature_comp),
1718  ADD_TABLE(ci2_file),
1719  ADD_TABLE(install_exec_seq),
1720  ADD_TABLE(rof_media),
1722 };
1723 
1724 static const msi_table adm_tables[] =
1725 {
1726  ADD_TABLE(adm_component),
1728  ADD_TABLE(rof_feature),
1729  ADD_TABLE(ci2_feature_comp),
1730  ADD_TABLE(ci2_file),
1731  ADD_TABLE(install_exec_seq),
1732  ADD_TABLE(rof_media),
1734  ADD_TABLE(adm_custom_action),
1735  ADD_TABLE(adm_admin_exec_seq),
1736 };
1737 
1738 static const msi_table amp_tables[] =
1739 {
1740  ADD_TABLE(amp_component),
1742  ADD_TABLE(rof_feature),
1743  ADD_TABLE(ci2_feature_comp),
1744  ADD_TABLE(ci2_file),
1745  ADD_TABLE(install_exec_seq),
1746  ADD_TABLE(rof_media),
1748 };
1749 
1750 static const msi_table mc_tables[] =
1751 {
1752  ADD_TABLE(mc_component),
1754  ADD_TABLE(cc_feature),
1755  ADD_TABLE(cie_feature_comp),
1756  ADD_TABLE(mc_file),
1757  ADD_TABLE(install_exec_seq),
1758  ADD_TABLE(mc_media),
1760  ADD_TABLE(mc_file_hash),
1761 };
1762 
1763 static const msi_table sf_tables[] =
1764 {
1765  ADD_TABLE(wrv_component),
1767  ADD_TABLE(rof_feature),
1768  ADD_TABLE(ci2_feature_comp),
1769  ADD_TABLE(ci2_file),
1770  ADD_TABLE(install_exec_seq),
1771  ADD_TABLE(rof_media),
1773 };
1774 
1775 static const msi_table ca1_tables[] =
1776 {
1777  ADD_TABLE(component),
1779  ADD_TABLE(feature),
1780  ADD_TABLE(feature_comp),
1781  ADD_TABLE(file),
1784  ADD_TABLE(ca1_install_exec_seq),
1785  ADD_TABLE(ca1_custom_action),
1786  ADD_TABLE(ca1_test_seq),
1787  ADD_TABLE(ca1_test2),
1788  ADD_TABLE(ca1__validation),
1789 };
1790 
1791 static const msi_table ca51_tables[] =
1792 {
1793  ADD_TABLE(ca51_component),
1795  ADD_TABLE(rof_feature),
1796  ADD_TABLE(ci2_feature_comp),
1797  ADD_TABLE(ci2_file),
1798  ADD_TABLE(ca51_install_exec_seq),
1799  ADD_TABLE(rof_media),
1801  ADD_TABLE(ca51_custom_action),
1802 };
1803 
1804 static const msi_table is_tables[] =
1805 {
1806  ADD_TABLE(is_component),
1808  ADD_TABLE(is_feature),
1809  ADD_TABLE(is_feature_comp),
1810  ADD_TABLE(is_file),
1811  ADD_TABLE(install_exec_seq),
1812  ADD_TABLE(is_media),
1814 };
1815 
1816 static const msi_table sp_tables[] =
1817 {
1818  ADD_TABLE(sp_component),
1819  ADD_TABLE(sp_directory),
1820  ADD_TABLE(rof_feature),
1821  ADD_TABLE(ci2_feature_comp),
1822  ADD_TABLE(ci2_file),
1823  ADD_TABLE(install_exec_seq),
1824  ADD_TABLE(rof_media),
1826 };
1827 
1828 static const msi_table mcp_tables[] =
1829 {
1830  ADD_TABLE(mcp_component),
1832  ADD_TABLE(mcp_feature),
1833  ADD_TABLE(mcp_feature_comp),
1834  ADD_TABLE(mcp_file),
1835  ADD_TABLE(rem_install_exec_seq),
1836  ADD_TABLE(rof_media),
1838 };
1839 
1840 static const msi_table ai_tables[] =
1841 {
1842  ADD_TABLE(component),
1844  ADD_TABLE(feature),
1845  ADD_TABLE(feature_comp),
1846  ADD_TABLE(ai_file),
1847  ADD_TABLE(install_exec_seq),
1848  ADD_TABLE(media),
1850 };
1851 
1852 static const msi_table ai2_tables[] =
1853 {
1854  ADD_TABLE(ai2_component),
1856  ADD_TABLE(ai2_feature),
1857  ADD_TABLE(ai2_feature_comp),
1858  ADD_TABLE(ai2_file),
1859  ADD_TABLE(install_exec_seq),
1860  ADD_TABLE(media),
1862 };
1863 
1864 static const msi_table pc_tables[] =
1865 {
1866  ADD_TABLE(ca51_component),
1868  ADD_TABLE(rof_feature),
1869  ADD_TABLE(ci2_feature_comp),
1870  ADD_TABLE(ci2_file),
1871  ADD_TABLE(install_exec_seq),
1872  ADD_TABLE(rof_media),
1874 };
1875 
1876 static const msi_table ip_tables[] =
1877 {
1878  ADD_TABLE(component),
1880  ADD_TABLE(feature),
1881  ADD_TABLE(feature_comp),
1882  ADD_TABLE(file),
1883  ADD_TABLE(ip_install_exec_seq),
1884  ADD_TABLE(ip_custom_action),
1885  ADD_TABLE(media),
1887 };
1888 
1889 static const msi_table aup_tables[] =
1890 {
1891  ADD_TABLE(component),
1893  ADD_TABLE(feature),
1894  ADD_TABLE(feature_comp),
1895  ADD_TABLE(file),
1896  ADD_TABLE(aup_install_exec_seq),
1897  ADD_TABLE(aup_custom_action),
1898  ADD_TABLE(media),
1900 };
1901 
1902 static const msi_table aup2_tables[] =
1903 {
1904  ADD_TABLE(component),
1906  ADD_TABLE(feature),
1907  ADD_TABLE(feature_comp),
1908  ADD_TABLE(file),
1909  ADD_TABLE(aup2_install_exec_seq),
1910  ADD_TABLE(aup_custom_action),
1911  ADD_TABLE(media),
1912  ADD_TABLE(aup_property)
1913 };
1914 
1915 static const msi_table aup3_tables[] =
1916 {
1917  ADD_TABLE(component),
1919  ADD_TABLE(feature),
1920  ADD_TABLE(feature_comp),
1921  ADD_TABLE(file),
1922  ADD_TABLE(aup2_install_exec_seq),
1923  ADD_TABLE(aup_custom_action),
1924  ADD_TABLE(media),
1925  ADD_TABLE(aup2_property)
1926 };
1927 
1928 static const msi_table aup4_tables[] =
1929 {
1930  ADD_TABLE(component),
1932  ADD_TABLE(feature),
1933  ADD_TABLE(feature_comp),
1934  ADD_TABLE(file),
1935  ADD_TABLE(aup3_install_exec_seq),
1936  ADD_TABLE(aup_custom_action),
1937  ADD_TABLE(media),
1938  ADD_TABLE(aup2_property)
1939 };
1940 
1941 static const msi_table fiu_tables[] =
1942 {
1943  ADD_TABLE(rof_component),
1945  ADD_TABLE(rof_feature),
1946  ADD_TABLE(rof_feature_comp),
1947  ADD_TABLE(rof_file),
1948  ADD_TABLE(pp_install_exec_seq),
1949  ADD_TABLE(rof_media),
1951 };
1952 
1953 static const msi_table fiuc_tables[] =
1954 {
1955  ADD_TABLE(rof_component),
1957  ADD_TABLE(rof_feature),
1958  ADD_TABLE(rof_feature_comp),
1959  ADD_TABLE(rofc_file),
1960  ADD_TABLE(pp_install_exec_seq),
1961  ADD_TABLE(rofc_media),
1963 };
1964 
1965 static const msi_table fo_tables[] =
1966 {
1968  ADD_TABLE(fo_file),
1969  ADD_TABLE(fo_component),
1970  ADD_TABLE(fo_feature),
1971  ADD_TABLE(fo_condition),
1972  ADD_TABLE(fo_feature_comp),
1973  ADD_TABLE(fo_custom_action),
1974  ADD_TABLE(fo_install_exec_seq),
1975  ADD_TABLE(media),
1977 };
1978 
1979 static const msi_table icon_base_tables[] =
1980 {
1981  ADD_TABLE(ci_component),
1983  ADD_TABLE(rof_feature),
1984  ADD_TABLE(rof_feature_comp),
1985  ADD_TABLE(rof_file),
1986  ADD_TABLE(pp_install_exec_seq),
1987  ADD_TABLE(rof_media),
1988  ADD_TABLE(icon_property),
1989 };
1990 
1991 static const msi_table pv_tables[] =
1992 {
1993  ADD_TABLE(rof_component),
1995  ADD_TABLE(rof_feature),
1996  ADD_TABLE(rof_feature_comp),
1997  ADD_TABLE(rof_file),
1998  ADD_TABLE(pv_install_exec_seq),
1999  ADD_TABLE(rof_media),
2001 };
2002 
2003 static const msi_table uc_tables[] =
2004 {
2006  ADD_TABLE(uc_component),
2007  ADD_TABLE(uc_feature),
2008  ADD_TABLE(uc_feature_comp),
2009  ADD_TABLE(uc_file),
2010  ADD_TABLE(uc_install_exec_seq),
2011  ADD_TABLE(media),
2012  ADD_TABLE(uc_property)
2013 };
2014 
2015 static const msi_table mixed_tables[] =
2016 {
2018  ADD_TABLE(mixed_component),
2019  ADD_TABLE(mixed_feature),
2020  ADD_TABLE(mixed_feature_comp),
2021  ADD_TABLE(mixed_install_exec_seq),
2022  ADD_TABLE(mixed_registry),
2023  ADD_TABLE(media),
2025 };
2026 
2027 static const msi_table vp_tables[] =
2028 {
2030  ADD_TABLE(vp_file),
2031  ADD_TABLE(vp_component),
2032  ADD_TABLE(vp_feature),
2033  ADD_TABLE(vp_feature_comp),
2034  ADD_TABLE(vp_custom_action),
2035  ADD_TABLE(vp_install_exec_seq),
2036  ADD_TABLE(media),
2038 };
2039 
2040 static const msi_table shc_tables[] =
2041 {
2042  ADD_TABLE(media),
2044  ADD_TABLE(shc_file),
2045  ADD_TABLE(shc_component),
2046  ADD_TABLE(shc_feature),
2047  ADD_TABLE(shc_feature_comp),
2048  ADD_TABLE(shc_custom_action),
2049  ADD_TABLE(shc_install_exec_seq),
2050  ADD_TABLE(shc_property)
2051 };
2052 
2053 static const msi_table shc2_tables[] =
2054 {
2055  ADD_TABLE(media),
2057  ADD_TABLE(shc_file),
2058  ADD_TABLE(shc_component),
2059  ADD_TABLE(shc_feature),
2060  ADD_TABLE(shc_feature_comp),
2061  ADD_TABLE(shc_custom_action),
2062  ADD_TABLE(shc2_install_exec_seq),
2063  ADD_TABLE(shc2_property)
2064 };
2065 
2066 static const msi_table ft_tables[] =
2067 {
2068  ADD_TABLE(media),
2070  ADD_TABLE(ft_file),
2071  ADD_TABLE(ft_comp),
2072  ADD_TABLE(ft_feature),
2073  ADD_TABLE(ft_feature_comp),
2074  ADD_TABLE(ft_condition),
2075  ADD_TABLE(ft_custom_action),
2076  ADD_TABLE(ft_install_exec_seq),
2078 };
2079 
2080 static const msi_table da_tables[] =
2081 {
2082  ADD_TABLE(media),
2084  ADD_TABLE(file),
2085  ADD_TABLE(component),
2086  ADD_TABLE(feature),
2087  ADD_TABLE(feature_comp),
2089  ADD_TABLE(da_install_exec_seq),
2090  ADD_TABLE(da_custom_action),
2091 };
2092 
2093 static const msi_table x64_tables[] =
2094 {
2095  ADD_TABLE(media),
2096  ADD_TABLE(x64_directory),
2097  ADD_TABLE(file),
2098  ADD_TABLE(component),
2099  ADD_TABLE(feature),
2100  ADD_TABLE(feature_comp),
2102  ADD_TABLE(install_exec_seq),
2103 };
2104 
2105 static const msi_table sr_tables[] =
2106 {
2107  ADD_TABLE(media),
2109  ADD_TABLE(file),
2110  ADD_TABLE(component),
2111  ADD_TABLE(feature),
2112  ADD_TABLE(feature_comp),
2114  ADD_TABLE(sr_install_exec_seq),
2115  ADD_TABLE(sr_custom_action),
2116 };
2117 
2118 /* cabinet definitions */
2119 
2120 /* make the max size large so there is only one cab file */
2121 #define MEDIA_SIZE 0x7FFFFFFF
2122 #define FOLDER_THRESHOLD 900000
2123 
2124 /* the FCI callbacks */
2125 
2126 static void * CDECL mem_alloc(ULONG cb)
2127 {
2128  return malloc(cb);
2129 }
2130 
2131 static void CDECL mem_free(void *memory)
2132 {
2133  free(memory);
2134 }
2135 
2136 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
2137 {
2138  sprintf(pccab->szCab, pv, pccab->iCab);
2139  return TRUE;
2140 }
2141 
2142 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
2143 {
2144  return 0;
2145 }
2146 
2147 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
2148  BOOL fContinuation, void *pv)
2149 {
2150  return 0;
2151 }
2152 
2153 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
2154 {
2155  HANDLE handle;
2156  DWORD dwAccess = 0;
2157  DWORD dwShareMode = 0;
2158  DWORD dwCreateDisposition = OPEN_EXISTING;
2159 
2160  dwAccess = GENERIC_READ | GENERIC_WRITE;
2162 
2164  dwCreateDisposition = OPEN_EXISTING;
2165  else
2166  dwCreateDisposition = CREATE_NEW;
2167 
2168  handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
2169  dwCreateDisposition, 0, NULL);
2170 
2171  ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
2172 
2173  return (INT_PTR)handle;
2174 }
2175 
2176 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2177 {
2178  HANDLE handle = (HANDLE)hf;
2179  DWORD dwRead;
2180  BOOL res;
2181 
2182  res = ReadFile(handle, memory, cb, &dwRead, NULL);
2183  ok(res, "Failed to ReadFile\n");
2184 
2185  return dwRead;
2186 }
2187 
2188 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2189 {
2190  HANDLE handle = (HANDLE)hf;
2191  DWORD dwWritten;
2192  BOOL res;
2193 
2194  res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2195  ok(res, "Failed to WriteFile\n");
2196 
2197  return dwWritten;
2198 }
2199 
2200 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
2201 {
2202  HANDLE handle = (HANDLE)hf;
2203  ok(CloseHandle(handle), "Failed to CloseHandle\n");
2204 
2205  return 0;
2206 }
2207 
2208 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
2209 {
2210  HANDLE handle = (HANDLE)hf;
2211  DWORD ret;
2212 
2213  ret = SetFilePointer(handle, dist, NULL, seektype);
2214  ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2215 
2216  return ret;
2217 }
2218 
2219 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
2220 {
2221  BOOL ret = DeleteFileA(pszFile);
2222  ok(ret, "Failed to DeleteFile %s\n", pszFile);
2223 
2224  return 0;
2225 }
2226 
2227 static void init_functionpointers(void)
2228 {
2229  HMODULE hmsi = GetModuleHandleA("msi.dll");
2230  HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2231  HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2232  HMODULE hsrclient = LoadLibraryA("srclient.dll");
2233 
2234 #define GET_PROC(mod, func) \
2235  p ## func = (void*)GetProcAddress(mod, #func); \
2236  if(!p ## func) \
2237  trace("GetProcAddress(%s) failed\n", #func);
2238 
2242 
2243  GET_PROC(hadvapi32, RegDeleteKeyExA)
2247 
2248  GET_PROC(hsrclient, SRRemoveRestorePoint);
2249  GET_PROC(hsrclient, SRSetRestorePointA);
2250 
2251 #undef GET_PROC
2252 }
2253 
2255 {
2257  PSID Group = NULL;
2258  BOOL IsInGroup;
2259  HANDLE token;
2260 
2262  DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
2263  !CheckTokenMembership(NULL, Group, &IsInGroup))
2264  {
2265  trace("Could not check if the current user is an administrator\n");
2266  FreeSid(Group);
2267  return FALSE;
2268  }
2269  FreeSid(Group);
2270 
2271  if (!IsInGroup)
2272  {
2273  /* Only administrators have enough privileges for these tests */
2274  return TRUE;
2275  }
2276 
2278  {
2279  BOOL ret;
2281  DWORD size;
2282 
2284  CloseHandle(token);
2285  return (ret && type == TokenElevationTypeLimited);
2286  }
2287  return FALSE;
2288 }
2289 
2291 {
2292  CHAR buffer[0x20];
2293  UINT r;
2294  DWORD sz;
2295 
2296  sz = sizeof buffer;
2297  r = MsiRecordGetStringA(rec, field, buffer, &sz);
2298  return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
2299 }
2300 
2301 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2302 {
2303  LPSTR tempname;
2304 
2305  tempname = malloc(MAX_PATH);
2306  GetTempFileNameA(".", "xx", 0, tempname);
2307 
2308  if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2309  {
2310  lstrcpyA(pszTempName, tempname);
2311  free(tempname);
2312  return TRUE;
2313  }
2314 
2315  free(tempname);
2316  return FALSE;
2317 }
2318 
2319 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2320  USHORT *pattribs, int *err, void *pv)
2321 {
2324  HANDLE handle;
2325  DWORD attrs;
2326  BOOL res;
2327 
2330 
2331  ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2332 
2334  ok(res, "Expected GetFileInformationByHandle to succeed\n");
2335 
2337  FileTimeToDosDateTime(&filetime, pdate, ptime);
2338 
2339  attrs = GetFileAttributesA(pszName);
2340  ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2341 
2342  return (INT_PTR)handle;
2343 }
2344 
2345 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2346 {
2347  char path[MAX_PATH];
2348  char filename[MAX_PATH];
2349 
2351  lstrcatA(path, "\\");
2352  lstrcatA(path, file);
2353 
2355 
2356  return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2358 }
2359 
2360 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2361 {
2362  ZeroMemory(pCabParams, sizeof(CCAB));
2363 
2364  pCabParams->cb = max_size;
2365  pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2366  pCabParams->setID = 0xbeef;
2367  pCabParams->iCab = 1;
2368  lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2369  lstrcatA(pCabParams->szCabPath, "\\");
2370  lstrcpyA(pCabParams->szCab, name);
2371 }
2372 
2373 void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2374 {
2375  CCAB cabParams;
2376  LPCSTR ptr;
2377  HFCI hfci;
2378  ERF erf;
2379  BOOL res;
2380 
2381  set_cab_parameters(&cabParams, name, max_size);
2382 
2385  get_temp_file, &cabParams, NULL);
2386 
2387  ok(hfci != NULL, "Failed to create an FCI context\n");
2388 
2389  ptr = files;
2390  while (*ptr)
2391  {
2392  res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2393  ok(res, "Failed to add file: %s\n", ptr);
2394  ptr += lstrlenA(ptr) + 1;
2395  }
2396 
2398  ok(res, "Failed to flush the cabinet\n");
2399 
2400  res = FCIDestroy(hfci);
2401  ok(res, "Failed to destroy the cabinet\n");
2402 }
2403 
2405 {
2406  HKEY hkey;
2407  DWORD type, size;
2408 
2410  "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2411  return FALSE;
2412 
2413  size = MAX_PATH;
2414  if(RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size)){
2415  RegCloseKey(hkey);
2416  return FALSE;
2417  }
2418 
2419  RegCloseKey(hkey);
2420  return TRUE;
2421 }
2422 
2424 {
2425  HKEY hkey;
2426  DWORD type, size;
2427 
2428  if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion",
2429  0, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &hkey))
2430  return FALSE;
2431 
2432  size = MAX_PATH;
2433  if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2434  RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size)) {
2435  RegCloseKey(hkey);
2436  return FALSE;
2437  }
2438 
2439  size = MAX_PATH;
2440  if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2441  RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size)) {
2442  RegCloseKey(hkey);
2443  return FALSE;
2444  }
2445 
2446  size = MAX_PATH;
2447  if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR_NATIVE, &size)) {
2448  RegCloseKey(hkey);
2449  return FALSE;
2450  }
2451 
2452  RegCloseKey(hkey);
2453 
2455  return FALSE;
2456 
2457  return TRUE;
2458 }
2459 
2461 {
2462  HANDLE file;
2463  DWORD written;
2464 
2466  if (file == INVALID_HANDLE_VALUE)
2467  return;
2468 
2469  WriteFile(file, data, strlen(data), &written, NULL);
2470 
2471  if (size)
2472  {
2474  SetEndOfFile(file);
2475  }
2476 
2477  CloseHandle(file);
2478 }
2479 
2480 static void create_test_files(void)
2481 {
2482  CreateDirectoryA("msitest", NULL);
2483  create_file("msitest\\one.txt", 100);
2484  CreateDirectoryA("msitest\\first", NULL);
2485  create_file("msitest\\first\\two.txt", 100);
2486  CreateDirectoryA("msitest\\second", NULL);
2487  create_file("msitest\\second\\three.txt", 100);
2488 
2489  create_file("four.txt", 100);
2490  create_file("five.txt", 100);
2491  create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2492 
2493  create_file("msitest\\filename", 100);
2494 
2495  DeleteFileA("four.txt");
2496  DeleteFileA("five.txt");
2497 }
2498 
2499 BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2500 {
2501  CHAR path[MAX_PATH];
2502 
2504  lstrcatA(path, "\\");
2505  lstrcatA(path, rel_path);
2506 
2507  if (is_file)
2508  return DeleteFileA(path);
2509  else
2510  return RemoveDirectoryA(path);
2511 }
2512 
2513 static BOOL delete_pf_native(const CHAR *rel_path, BOOL is_file)
2514 {
2515  CHAR path[MAX_PATH];
2516 
2518  lstrcatA(path, "\\");
2519  lstrcatA(path, rel_path);
2520 
2521  if (is_file)
2522  return DeleteFileA(path);
2523  else
2524  return RemoveDirectoryA(path);
2525 }
2526 
2527 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
2528 {
2529  CHAR path[MAX_PATH];
2530 
2532  lstrcatA(path, "\\");
2533  lstrcatA(path, rel_path);
2534 
2535  if (is_file)
2536  return DeleteFileA(path);
2537  else
2538  return RemoveDirectoryA(path);
2539 }
2540 
2541 static BOOL compare_pf_data(const char *filename, const char *data, DWORD size)
2542 {
2543  DWORD read;
2544  HANDLE handle;
2545  BOOL ret = FALSE;
2546  char *buffer, path[MAX_PATH];
2547 
2549  lstrcatA(path, "\\");
2551 
2553  if ((buffer = malloc(size)))
2554  {
2556  if (read == size && !memcmp(data, buffer, size)) ret = TRUE;
2557  free(buffer);
2558  }
2560  return ret;
2561 }
2562 
2563 static void delete_test_files(void)
2564 {
2565  DeleteFileA("msitest.msi");
2566  DeleteFileA("msitest.cab");
2567  DeleteFileA("msitest\\second\\three.txt");
2568  DeleteFileA("msitest\\first\\two.txt");
2569  DeleteFileA("msitest\\one.txt");
2570  DeleteFileA("msitest\\filename");
2571  RemoveDirectoryA("msitest\\second");
2572  RemoveDirectoryA("msitest\\first");
2573  RemoveDirectoryA("msitest");
2574 }
2575 
2576 static void delete_pf_files(void)
2577 {
2578  ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2579  ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2580  ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2581  ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2582  ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2583  ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2584  ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2585  ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2586  ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2587  ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2588  ok(delete_pf("msitest", FALSE), "Directory not created\n");
2589 }
2590 
2591 static void write_file(const CHAR *filename, const char *data, int data_size)
2592 {
2593  DWORD size;
2594 
2597  WriteFile(hf, data, data_size, &size, NULL);
2598  CloseHandle(hf);
2599 }
2600 
2601 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount,
2602  const char *template, const char *packagecode)
2603 {
2604  MSIHANDLE summary;
2605  UINT r;
2606 
2607  r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2608  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2609 
2610  r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2611  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2612 
2613  r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL, packagecode);
2614  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2615 
2617  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2618 
2619  r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2620  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2621 
2622  r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2623  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2624 
2625  /* write the summary changes back to the stream */
2626  r = MsiSummaryInfoPersist(summary);
2627  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2628 
2629  MsiCloseHandle(summary);
2630 }
2631 
2632 static char *load_resource(const char *name)
2633 {
2634  static char path[MAX_PATH];
2635  DWORD written;
2636  HANDLE file;
2637  HRSRC res;
2638  void *ptr;
2639 
2640  GetTempFileNameA(".", name, 0, path);
2641 
2643  ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %lu\n", path, GetLastError());
2644 
2645  res = FindResourceA(NULL, name, "TESTDLL");
2646  ok( res != 0, "couldn't find resource\n" );
2649  ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" );
2650  CloseHandle( file );
2651 
2652  return path;
2653 }
2654 
2655 static INT CALLBACK ok_callback(void *context, UINT message_type, MSIHANDLE record)
2656 {
2657  if (message_type == INSTALLMESSAGE_USER)
2658  {
2659  char file[200];
2660  char msg[2000];
2661  DWORD len;
2662 
2663  len = sizeof(file);
2665  len = sizeof(msg);
2667 
2670 
2671  return 1;
2672  }
2673  return 0;
2674 }
2675 
2676 static void add_custom_dll(MSIHANDLE hdb)
2677 {
2678  MSIHANDLE record;
2679  UINT res;
2680 
2681  if (!customdll)
2682  customdll = load_resource("custom.dll");
2683 
2685 
2686  res = run_query(hdb, 0, "CREATE TABLE `Binary` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)");
2687  ok(res == ERROR_SUCCESS, "failed to create Binary table: %u\n", res);
2688 
2689  record = MsiCreateRecord(1);
2691  ok(res == ERROR_SUCCESS, "failed to add %s to stream: %u\n", customdll, res);
2692 
2693  res = run_query(hdb, record, "INSERT INTO `Binary` (`Name`, `Data`) VALUES ('custom.dll', ?)");
2694  ok(res == ERROR_SUCCESS, "failed to insert into Binary table: %u\n", res);
2695 
2697 }
2698 
2699 void create_database_wordcount(const CHAR *name, const msi_table *tables, int num_tables,
2700  INT version, INT wordcount, const char *template, const char *packagecode)
2701 {
2702  MSIHANDLE db;
2703  UINT r;
2704  WCHAR *nameW;
2705  int j, len;
2706 
2707  len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2708  if (!(nameW = malloc( len * sizeof(WCHAR) ))) return;
2709  MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2710 
2712  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2713 
2714  /* import the tables into the database */
2715  for (j = 0; j < num_tables; j++)
2716  {
2717  const msi_table *table = &tables[j];
2718 
2719  write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2720 
2721  r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2722  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2723 
2724  DeleteFileA(table->filename);
2725  }
2726 
2727  write_msi_summary_info(db, version, wordcount, template, packagecode);
2728  add_custom_dll(db);
2729 
2730  r = MsiDatabaseCommit(db);
2731  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2732 
2733  MsiCloseHandle(db);
2734  free( nameW );
2735 }
2736 
2738 {
2739  RESTOREPOINTINFOA spec;
2740 
2741  spec.dwEventType = event_type;
2743  spec.llSequenceNumber = status->llSequenceNumber;
2744  lstrcpyA(spec.szDescription, "msitest restore point");
2745 
2746  return pSRSetRestorePointA(&spec, status);
2747 }
2748 
2749 static void remove_restore_point(DWORD seq_number)
2750 {
2751  DWORD res;
2752 
2753  res = pSRRemoveRestorePoint(seq_number);
2754  if (res != ERROR_SUCCESS)
2755  trace("Failed to remove the restore point: %#lx\n", res);
2756 }
2757 
2759 {
2760  if (pRegDeleteKeyExA)
2761  return pRegDeleteKeyExA( key, subkey, access, 0 );
2762  return RegDeleteKeyA( key, subkey );
2763 }
2764 
2765 static void test_MsiInstallProduct(void)
2766 {
2767  UINT r;
2768  CHAR path[MAX_PATH];
2769  LONG res;
2770  HKEY hkey;
2771  DWORD num, size, type;
2773 
2774  if (is_process_limited())
2775  {
2776  skip("process is limited\n");
2777  return;
2778  }
2779 
2780  if (is_wow64)
2782 
2784 
2785  if (0) /* crashes on Win10 1709 */
2786  {
2787  r = MsiInstallProductA(NULL, "INSTALL=ALL");
2788  ok(r == ERROR_INVALID_PARAMETER, "got %u\n", r);
2789 
2791  ok(r == ERROR_INVALID_PARAMETER, "got %u\n", r);
2792  }
2793 
2794  /* szPackagePath is empty */
2795  r = MsiInstallProductA("", "INSTALL=ALL");
2797  "Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
2798 
2801 
2802  /* install, don't publish */
2805  {
2806  skip("Not enough rights to perform tests\n");
2807  goto error;
2808  }
2809  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2810 
2811  delete_pf_files();
2812 
2813  res = RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", 0, access, &hkey);
2814  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
2815 
2816  size = MAX_PATH;
2817  type = REG_SZ;
2818  res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
2819  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
2820  ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
2821 
2822  size = MAX_PATH;
2823  type = REG_SZ;
2824  res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
2825  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
2826 
2827  size = sizeof(num);
2828  type = REG_DWORD;
2829  res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
2830  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
2831  ok(num == 314, "Expected 314, got %lu\n", num);
2832 
2833  size = MAX_PATH;
2834  type = REG_SZ;
2835  res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
2836  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
2837  ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
2838 
2839  delete_key(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", access);
2840 
2841  /* not published, reinstall */
2843  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2844 
2845  delete_pf_files();
2846 
2847  res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2848  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
2849  RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2850 
2852 
2853  /* not published, RemovePreviousVersions set */
2855  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2856 
2857  delete_pf_files();
2858 
2859  res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2860  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
2861  RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2862 
2864 
2865  /* not published, version number bumped */
2867  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2868 
2869  delete_pf_files();
2870 
2871  res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2872  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
2873  RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2874 
2876 
2877  /* not published, RemovePreviousVersions set and version number bumped */
2879  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2880 
2881  delete_pf_files();
2882 
2883  res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2884  ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", res);
2885  RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2886 
2888 
2889  /* install, publish product */
2890  r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2891  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2892 
2893  delete_pf_files();
2894 
2895  res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2896  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
2897 
2899 
2900  /* published, reinstall */
2902  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2903 
2904  delete_pf_files();
2905 
2906  res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2907  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
2908 
2910 
2911  /* published product, RemovePreviousVersions set */
2913  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2914 
2915  delete_pf_files();
2916 
2917  res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2918  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
2919 
2921 
2922  /* published product, version number bumped */
2924  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2925 
2926  delete_pf_files();
2927 
2928  res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2929  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
2930 
2932 
2933  /* published product, RemovePreviousVersions set and version number bumped */
2935  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2936 
2937  delete_pf_files();
2938 
2939  res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2940  ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", res);
2941 
2942  r = MsiInstallProductA(msifile, "REMOVE=ALL FULL=1");
2943  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2944 
2945 error:
2948 }
2949 
2950 static void test_MsiSetComponentState(void)
2951 {
2952  INSTALLSTATE installed, action;
2953  MSIHANDLE package;
2954  char path[MAX_PATH];
2955  UINT r;
2956 
2958 
2959  CoInitialize(NULL);
2960 
2962  lstrcatA(path, "\\");
2963  lstrcatA(path, msifile);
2964 
2966 
2967  r = MsiOpenPackageA(path, &package);
2969  {
2970  skip("Not enough rights to perform tests\n");
2971  goto error;
2972  }
2973  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2974 
2975  r = MsiDoActionA(package, "CostInitialize");
2976  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2977 
2978  r = MsiDoActionA(package, "FileCost");
2979  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2980 
2981  r = MsiDoActionA(package, "CostFinalize");
2982  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2983 
2984  r = MsiGetComponentStateA(package, "dangler", &installed, &action);
2985  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2986  ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
2987  ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2988 
2989  r = MsiSetComponentStateA(package, "dangler", INSTALLSTATE_SOURCE);
2990  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2991 
2992  MsiCloseHandle(package);
2993 
2994 error:
2995  CoUninitialize();
2997 }
2998 
2999 static void test_packagecoltypes(void)
3000 {
3001  MSIHANDLE hdb, view, rec;
3002  char path[MAX_PATH];
3003  WCHAR pathW[MAX_PATH];
3004  LPCSTR query;
3005  UINT r, count;
3006 
3008 
3009  CoInitialize(NULL);
3010 
3012  lstrcatA(path, "\\");
3013  lstrcatA(path, msifile);
3014  MultiByteToWideChar( CP_ACP, 0, path, -1, pathW, MAX_PATH );
3015 
3016  r = MsiOpenDatabaseW(pathW, MSIDBOPEN_READONLY, &hdb);
3017  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3018 
3019  query = "SELECT * FROM `Media`";
3020  r = MsiDatabaseOpenViewA( hdb, query, &view );
3021  ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
3022 
3024  count = MsiRecordGetFieldCount( rec );
3025  ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
3026  ok(count == 6, "Expected 6, got %d\n", count);
3027  ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
3028  ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
3029  ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
3030  ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
3031  ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
3032  ok(check_record(rec, 6, "Source"), "wrong column label\n");
3033  MsiCloseHandle(rec);
3034 
3036  count = MsiRecordGetFieldCount( rec );
3037  ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
3038  ok(count == 6, "Expected 6, got %d\n", count);
3039  ok(check_record(rec, 1, "i2"), "wrong column label\n");
3040  ok(check_record(rec, 2, "i4"), "wrong column label\n");
3041  ok(check_record(rec, 3, "L64"), "wrong column label\n");
3042  ok(check_record(rec, 4, "S255"), "wrong column label\n");
3043  ok(check_record(rec, 5, "S32"), "wrong column label\n");
3044  ok(check_record(rec, 6, "S72"), "wrong column label\n");
3045 
3046  MsiCloseHandle(rec);
3048  MsiCloseHandle(hdb);
3049  CoUninitialize();
3050 
3052 }
3053 
3054 static void create_cc_test_files(void)
3055 {
3056  CCAB cabParams;
3057  HFCI hfci;
3058  ERF erf;
3059  static CHAR cab_context[] = "test%d.cab";
3060  BOOL res;
3061 
3062  create_file("maximus", 500);
3063  create_file("augustus", 50000);
3064  create_file("tiberius", 500);
3065  create_file("caesar", 500);
3066 
3067  set_cab_parameters(&cabParams, "test1.cab", 40000);
3068 
3071  get_temp_file, &cabParams, cab_context);
3072  ok(hfci != NULL, "Failed to create an FCI context\n");
3073 
3074  res = add_file(hfci, "maximus", tcompTYPE_NONE);
3075  ok(res, "Failed to add file maximus\n");
3076 
3077  res = add_file(hfci, "augustus", tcompTYPE_NONE);
3078  ok(res, "Failed to add file augustus\n");
3079 
3080  res = add_file(hfci, "tiberius", tcompTYPE_NONE);
3081  ok(res, "Failed to add file tiberius\n");
3082 
3084  ok(res, "Failed to flush the cabinet\n");
3085 
3086  res = FCIDestroy(hfci);
3087  ok(res, "Failed to destroy the cabinet\n");
3088 
3089  create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3090 
3091  DeleteFileA("maximus");
3092  DeleteFileA("augustus");
3093  DeleteFileA("tiberius");
3094  DeleteFileA("caesar");
3095 }
3096 
3098 {
3099  SHFILEOPSTRUCTA shfl;
3100  CHAR path[MAX_PATH+10];
3101 
3103  lstrcatA(path, "\\*.cab");
3104  path[strlen(path) + 1] = '\0';
3105 
3106  shfl.hwnd = NULL;
3107  shfl.wFunc = FO_DELETE;
3108  shfl.pFrom = path;
3109  shfl.pTo = NULL;
3111 
3112  SHFileOperationA(&shfl);
3113 }
3114 
3115 static void test_continuouscabs(void)
3116 {
3117  UINT r;
3118 
3119  if (is_process_limited())
3120  {
3121  skip("process is limited\n");
3122  return;
3123  }
3124 
3127 
3129 
3132  {
3133  skip("Not enough rights to perform tests\n");
3134  goto error;
3135  }
3136  else
3137  {
3138  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3139  ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3140  ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3141  ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3142  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3143  }
3144 
3145  delete_cab_files();
3147 
3150 
3152 
3155  {
3156  skip("Not enough rights to perform tests\n");
3157  }
3158  else
3159  {
3160  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3161  ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3162  ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3163  ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
3164  ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3165  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3166  }
3167 
3168  delete_cab_files();
3170 
3171  /* Tests to show that only msi cab filename is taken in case of mismatch with the one given by previous cab */
3172 
3173  /* Filename from cab is right and the one from msi is wrong */
3176 
3178 
3181  {
3182  skip("Not enough rights to perform tests\n");
3183  }
3184  else
3185  {
3186  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3187  todo_wine ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3188  ok(!delete_pf("msitest\\caesar", TRUE), "File installed\n");
3189  todo_wine ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
3190  todo_wine ok(!delete_pf("msitest", FALSE), "Directory created\n");
3191  }
3192 
3193  delete_cab_files();
3195 
3196  /* Filename from msi is right and the one from cab is wrong */
3198  ok(MoveFileA("test2.cab", "test2_.cab"), "Cannot rename test2.cab to test2_.cab\n");
3200 
3202 
3205  {
3206  skip("Not enough rights to perform tests\n");
3207  }
3208  else
3209  {
3210  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3211  ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3212  ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3213  ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3214  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3215  }
3216 
3217 error:
3218  delete_cab_files();
3220 }
3221 
3222 static void test_caborder(void)
3223 {
3224  UINT r;
3225 
3226  create_file("imperator", 100);
3227  create_file("maximus", 500);
3228  create_file("augustus", 50000);
3229  create_file("caesar", 500);
3230 
3232 
3234 
3235  create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3236  create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3237  create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3238 
3241  {
3242  skip("Not enough rights to perform tests\n");
3243  goto error;
3244  }
3245  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3246  ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3247  ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3248  todo_wine
3249  {
3250  ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3251  ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3252  }
3253 
3254  delete_cab_files();
3255 
3256  create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
3257  create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
3258  create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3259 
3261  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3262  ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3263  ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3264  ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3265  ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3266 
3267  delete_cab_files();
3269 
3272 
3274  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3275  ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3276  ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3277  todo_wine
3278  {
3279  ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3280  ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3281  }
3282 
3283  delete_cab_files();
3285 
3288 
3290  ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3291  ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3292  todo_wine
3293  {
3294  ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3295  ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3296  ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3297  }
3298 
3299 error:
3300  delete_cab_files();
3301  DeleteFileA("imperator");
3302  DeleteFileA("maximus");
3303  DeleteFileA("augustus");
3304  DeleteFileA("caesar");
3306 }
3307 
3308 static void test_mixedmedia(void)
3309 {
3310  UINT r;
3311 
3312  if (is_process_limited())
3313  {
3314  skip("process is limited\n");
3315  return;
3316  }
3317 
3318  CreateDirectoryA("msitest", NULL);
3319  create_file("msitest\\maximus", 500);
3320  create_file("msitest\\augustus", 500);
3321  create_file("caesar", 500);
3322 
3324 
3326 
3327  create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
3328 
3331  {
3332  skip("Not enough rights to perform tests\n");
3333  goto error;
3334  }
3335  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3336  ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3337  ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3338  ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3339  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3340 
3341 error:
3342  /* Delete the files in the temp (current) folder */
3343  DeleteFileA("msitest\\maximus");
3344  DeleteFileA("msitest\\augustus");
3345  RemoveDirectoryA("msitest");
3346  DeleteFileA("caesar");
3347  DeleteFileA("test1.cab");
3349 }
3350 
3351 static void test_samesequence(void)
3352 {
3353  UINT r;
3354 
3357 
3359 
3361  if (r == ERROR_INSTALL_FAILURE)
3362  {
3363  win_skip("unprivileged user?\n");
3364  goto error;
3365  }
3366  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3367  if (r == ERROR_SUCCESS)
3368  {
3369  ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3370  ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3371  ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3372  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3373  }
3374 
3375 error:
3376  delete_cab_files();
3378 }
3379 
3380 static void test_uiLevelFlags(void)
3381 {
3382  UINT r;
3383 
3386 
3388 
3390  if (r == ERROR_INSTALL_FAILURE)
3391  {
3392  win_skip("unprivileged user?\n");
3393  goto error;
3394  }
3395 
3396  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3397  if (r == ERROR_SUCCESS)
3398  {
3399  ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
3400  ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3401  ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3402  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3403  }
3404 
3405 error:
3406  delete_cab_files();
3408 }
3409 
3411 {
3412  CHAR buf[MAX_PATH];
3413  HANDLE file;
3414  DWORD size;
3415 
3417  NULL, OPEN_EXISTING, 0, NULL);
3419  ReadFile(file, buf, 15, &size, NULL);
3420  CloseHandle(file);
3421 
3422  return !lstrcmpA(buf, "msitest\\maximus");
3423 }
3424 
3425 static void test_readonlyfile(void)
3426 {
3427  UINT r;
3428  DWORD size;
3429  HANDLE file;
3430  CHAR path[MAX_PATH];
3431 
3432  if (is_process_limited())
3433  {
3434  skip("process is limited\n");
3435  return;
3436  }
3437 
3438  CreateDirectoryA("msitest", NULL);
3439  create_file("msitest\\maximus", 500);
3441 
3443 
3445  lstrcatA(path, "\\msitest");
3447 
3448  lstrcatA(path, "\\maximus");
3451 
3452  WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3453  CloseHandle(file);
3454 
3457  {
3458  skip("Not enough rights to perform tests\n");
3459  goto error;
3460  }
3461  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3462  ok(file_matches(path), "Expected file to be overwritten\n");
3463  ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3464  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3465 
3466 error:
3467  /* Delete the files in the temp (current) folder */
3468  DeleteFileA("msitest\\maximus");
3469  RemoveDirectoryA("msitest");
3471 }
3472 
3473 static void test_readonlyfile_cab(void)
3474 {
3475  UINT r;
3476  DWORD size;
3477  HANDLE file;
3478  CHAR path[MAX_PATH];
3479  CHAR buf[16];
3480 
3481  if (is_process_limited())
3482  {
3483  skip("process is limited\n");
3484  return;
3485  }
3486 
3487  CreateDirectoryA("msitest", NULL);
3488  create_file("maximus", 500);
3489  create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3490  DeleteFileA("maximus");
3491 
3493 
3495 
3497  lstrcatA(path, "\\msitest");
3499 
3500  lstrcatA(path, "\\maximus");
3503 
3504  WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3505  CloseHandle(file);
3506 
3509  {
3510  skip("Not enough rights to perform tests\n");
3511  goto error;
3512  }
3513  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3514 
3515  memset( buf, 0, sizeof(buf) );
3518  {
3519  ReadFile(file, buf, sizeof(buf) - 1, &size, NULL);
3520  CloseHandle(file);
3521  }
3522  ok(!memcmp( buf, "maximus", sizeof("maximus")-1 ), "Expected file to be overwritten, got '%s'\n", buf);
3523  ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3524  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3525 
3526 error:
3527  /* Delete the files in the temp (current) folder */
3528  delete_cab_files();
3529  DeleteFileA("msitest\\maximus");
3530  RemoveDirectoryA("msitest");
3532 }
3533 
3534 static void test_setdirproperty(void)
3535 {
3536  UINT r;
3537 
3538  if (is_process_limited())
3539  {
3540  skip("process is limited\n");
3541  return;
3542  }
3543 
3544  CreateDirectoryA("msitest", NULL);
3545  create_file("msitest\\maximus", 500);
3547 
3549 
3552  {
3553  skip("Not enough rights to perform tests\n");
3554  goto error;
3555  }
3556  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3557  ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
3558  ok(delete_cf("msitest", FALSE), "Directory not created\n");
3559 
3560 error:
3561  /* Delete the files in the temp (current) folder */
3563  DeleteFileA("msitest\\maximus");
3564  RemoveDirectoryA("msitest");
3565 }
3566 
3567 static void test_cabisextracted(void)
3568 {
3569  UINT r;
3570 
3571  if (is_process_limited())
3572  {
3573  skip("process is limited\n");
3574  return;
3575  }
3576 
3577  CreateDirectoryA("msitest", NULL);
3578  create_file("msitest\\gaius", 500);
3579  create_file("maximus", 500);
3580  create_file("augustus", 500);
3581  create_file("caesar", 500);
3582 
3583  create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3584  create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3585  create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3586 
3588 
3590 
3593  {
3594  skip("Not enough rights to perform tests\n");
3595  goto error;
3596  }
3597  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3598  ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3599  ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3600  ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3601  ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
3602  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3603 
3604 error:
3605  /* Delete the files in the temp (current) folder */
3606  delete_cab_files();
3608  DeleteFileA("maximus");
3609  DeleteFileA("augustus");
3610  DeleteFileA("caesar");
3611  DeleteFileA("msitest\\gaius");
3612  RemoveDirectoryA("msitest");
3613 }
3614 
3615 BOOL file_exists(const char *file)
3616 {
3618 }
3619 
3620 BOOL pf_exists(const char *file)
3621 {
3622  CHAR path[MAX_PATH];
3623 
3625  lstrcatA(path, "\\");
3626  lstrcatA(path, file);
3627 
3628  return file_exists(path);
3629 }
3630 
3631 static void delete_pfmsitest_files(void)
3632 {
3633  SHFILEOPSTRUCTA shfl;
3634  CHAR path[MAX_PATH+11];
3635 
3637  lstrcatA(path, "\\msitest\\*");
3638  path[strlen(path) + 1] = '\0';
3639 
3640  shfl.hwnd = NULL;
3641  shfl.wFunc = FO_DELETE;
3642  shfl.pFrom = path;
3643  shfl.pTo = NULL;
3645 
3646  SHFileOperationA(&shfl);
3647 
3649  lstrcatA(path, "\\msitest");
3651 }
3652 
3653 UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
3654 {
3655  MSIHANDLE hview = 0;
3656  UINT r;
3657 
3658  r = MsiDatabaseOpenViewA(hdb, query, &hview);
3659  if(r != ERROR_SUCCESS)
3660  return r;
3661 
3662  r = MsiViewExecute(hview, hrec);
3663  if(r == ERROR_SUCCESS)
3664  r = MsiViewClose(hview);
3665  MsiCloseHandle(hview);
3666  return r;
3667 }
3668 
3670 {
3671  UINT r;
3672  MSIHANDLE suminfo = 0;
3673 
3674  /* build summary info */
3676  ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
3677 
3679  ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3680 
3682  "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3683  "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3684  "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
3685  ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
3686 
3688  ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3689 
3691  ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
3692 
3694  ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
3695 }
3696 
3697 static void generate_transform(void)
3698 {
3699  MSIHANDLE hdb1, hdb2;
3700  LPCSTR query;
3701  UINT r;
3702 
3703  /* start with two identical databases */
3705 
3707  ok(r == ERROR_SUCCESS , "Failed to create database\n");
3708 
3709  r = MsiDatabaseCommit(hdb1);
3710  ok(r == ERROR_SUCCESS , "Failed to commit database\n");
3711 
3713  ok(r == ERROR_SUCCESS , "Failed to create database\n");
3714 
3715  query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
3716  r = run_query(hdb1, 0, query);
3717  ok(r == ERROR_SUCCESS, "failed to add property\n");
3718 
3719  /* database needs to be committed */
3720  MsiDatabaseCommit(hdb1);
3721 
3722  r = MsiDatabaseGenerateTransformA(hdb1, hdb2, mstfile, 0, 0);
3723  ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3724 
3725  r = MsiCreateTransformSummaryInfoA(hdb2, hdb2, mstfile, 0, 0);
3726  todo_wine ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3727 
3728  MsiCloseHandle(hdb1);
3729  MsiCloseHandle(hdb2);
3730 }
3731 
3732 /* data for generating a transform */
3733 
3734 /* tables transform names - encoded as they would be in an msi database file */
3735 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
3736 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
3737 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
3738 
3739 /* data in each table */
3740 static const char data1[] = /* _StringData */
3741  "propval"; /* all the strings squashed together */
3742 
3743 static const WCHAR data2[] = { /* _StringPool */
3744 /* len, refs */
3745  0, 0, /* string 0 '' */
3746  4, 1, /* string 1 'prop' */
3747  3, 1, /* string 2 'val' */
3748 };
3749 
3750 static const WCHAR data3[] = { /* Property */
3751  0x0201, 0x0001, 0x0002,
3752 };
3753 
3754 static const struct {
3756  const void *data;
3759 {
3760  { name1, data1, sizeof data1 - 1 },
3761  { name2, data2, sizeof data2 },
3762  { name3, data3, sizeof data3 },
3763 };
3764 
3765 static void generate_transform_manual(void)
3766 {
3767  IStorage *stg = NULL;
3768  IStream *stm;
3769  WCHAR name[0x20];
3770  HRESULT r;
3771  DWORD i, count;
3773 
3774  const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
3775 
3776  MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
3777 
3778  r = StgCreateDocfile(name, mode, 0, &stg);
3779  ok(r == S_OK, "failed to create storage\n");
3780  if (!stg)
3781  return;
3782 
3783  r = IStorage_SetClass(stg, &CLSID_MsiTransform);
3784  ok(r == S_OK, "failed to set storage type\n");
3785 
3786  for (i=0; i<ARRAY_SIZE(table_transform_data); i++)
3787  {
3788  r = IStorage_CreateStream(stg, table_transform_data[i].name,
3789  STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3790  if (FAILED(r))
3791  {
3792  ok(0, "failed to create stream %#lx\n", r);
3793  continue;
3794  }
3795 
3796  r = IStream_Write(stm, table_transform_data[i].data,
3798  if (FAILED(r) || count != table_transform_data[i].size)
3799  ok(0, "failed to write stream\n");
3800  IStream_Release(stm);
3801  }
3802 
3803  IStorage_Release(stg);
3804 
3806 }
3807 
3808 static void test_transformprop(void)
3809 {
3810  UINT r;
3811 
3812  if (is_process_limited())
3813  {
3814  skip("process is limited\n");
3815  return;
3816  }
3817 
3818  CreateDirectoryA("msitest", NULL);
3819  create_file("msitest\\augustus", 500);
3820 
3822 
3824 
3827  {
3828  skip("Not enough rights to perform tests\n");
3829  goto error;
3830  }
3831  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3832  ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3833  ok(!delete_pf("msitest", FALSE), "Directory created\n");
3834 
3835  if (0)
3837  else
3839 
3840  r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
3841  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3842  ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3843  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3844 
3845 error:
3846  /* Delete the files in the temp (current) folder */
3850  DeleteFileA("msitest\\augustus");
3851  RemoveDirectoryA("msitest");
3852 }
3853 
3854 static void test_currentworkingdir(void)
3855 {
3856  UINT r;
3857  CHAR drive[MAX_PATH], path[MAX_PATH + 12];
3858  LPSTR ptr;
3859 
3860  if (is_process_limited())
3861  {
3862  skip("process is limited\n");
3863  return;
3864  }
3865 
3866  CreateDirectoryA("msitest", NULL);
3867  create_file("msitest\\augustus", 500);
3868 
3870 
3872 
3873  CreateDirectoryA("diffdir", NULL);
3874  SetCurrentDirectoryA("diffdir");
3875 
3876  sprintf(path, "..\\%s", msifile);
3878  todo_wine
3879  {
3880  ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
3881  ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3882  ok(!delete_pf("msitest", FALSE), "Directory created\n");
3883  }
3884 
3885  sprintf(path, "%s\\%s", CURR_DIR, msifile);
3888  {
3889  skip("Not enough rights to perform tests\n");
3890  goto error;
3891  }
3892  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3893  ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3894  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3895 
3897  drive[2] = '\\';
3898  drive[3] = '\0';
3900 
3902  if (path[lstrlenA(path) - 1] != '\\') lstrcatA(path, "\\");
3903  lstrcatA(path, msifile);
3904  ptr = strchr(path, ':');
3905  ptr +=2;
3906 
3908  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3909  ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3910  ok(delete_pf("msitest", FALSE), "Directory not created\n");
3911 
3912 error:
3915  DeleteFileA("msitest\\augustus");
3916  RemoveDirectoryA("msitest");
3917  RemoveDirectoryA("diffdir");
3918 }
3919 
3920 static void set_admin_summary_info(const WCHAR *name)
3921 {
3922  MSIHANDLE db, summary;
3923  UINT r;
3924 
3926  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3927 
3928  r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
3929  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3930 
3932  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3933 
3934  /* write the summary changes back to the stream */
3935  r = MsiSummaryInfoPersist(summary);
3936  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3937 
3938  MsiCloseHandle(summary);
3939 
3940  r = MsiDatabaseCommit(db);
3941  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3942 
3943  MsiCloseHandle(db);
3944 }
3945 
3946 static void test_admin(void)
3947 {
3948  UINT r;
3949 
3950  CreateDirectoryA("msitest", NULL);
3951  create_file("msitest\\augustus", 500);
3952 
3955 
3957 
3960  {
3961  skip("Not enough rights to perform tests\n");
3962  goto error;
3963  }
3964  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3965  ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3966  ok(!delete_pf("msitest", FALSE), "Directory created\n");
3967  ok(!DeleteFileA("c:\\msitest\\augustus"), "File installed\n");
3968  ok(!RemoveDirectoryA("c:\\msitest"), "File installed\n");
3969 
3970  r = MsiInstallProductA(msifile, "ACTION=ADMIN");
3971  todo_wine
3972  ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3973  ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3974  ok(!delete_pf("msitest", FALSE), "Directory created\n");
3975  todo_wine
3976  {
3977  ok(DeleteFileA("c:\\msitest\\augustus"), "File not installed\n");
3978  ok(RemoveDirectoryA("c:\\msitest"), "File not installed\n");
3979  }