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