Revert "msi: Correctly parse double quotes in the token value.".
[wine/multimedia.git] / dlls / msi / tests / install.c
blob6b86cd285015d27d7c4daf81f1afe78b8bd7db61
1 /*
2 * Copyright (C) 2006 James Hawkins
4 * A test program for installing MSI products.
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.
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.
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
21 #define _WIN32_MSI 300
22 #define COBJMACROS
24 #include <stdio.h>
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>
37 #include "wine/test.h"
39 static UINT (WINAPI *pMsiQueryComponentStateA)
40 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*);
41 static UINT (WINAPI *pMsiSourceListEnumSourcesA)
42 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
43 static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
44 (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
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);
52 static HMODULE hsrclient = 0;
53 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
54 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
56 static BOOL is_wow64;
57 static const BOOL is_64bit = sizeof(void *) > sizeof(int);
59 static const char *msifile = "msitest.msi";
60 static const char *msifile2 = "winetest2.msi";
61 static const char *mstfile = "winetest.mst";
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};
66 static CHAR CURR_DIR[MAX_PATH];
67 static CHAR PROG_FILES_DIR[MAX_PATH];
68 static CHAR PROG_FILES_DIR_NATIVE[MAX_PATH];
69 static CHAR COMMON_FILES_DIR[MAX_PATH];
70 static CHAR APP_DATA_DIR[MAX_PATH];
71 static CHAR WINDOWS_DIR[MAX_PATH];
73 /* msi database data */
75 static const CHAR component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
76 "s72\tS38\ts72\ti2\tS255\tS72\n"
77 "Component\tComponent\n"
78 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
79 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
80 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n"
81 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
82 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
83 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
84 "component\t\tMSITESTDIR\t0\t1\tfile\n"
85 "service_comp\t\tMSITESTDIR\t0\t1\tservice_file";
87 static const CHAR directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
88 "s72\tS72\tl255\n"
89 "Directory\tDirectory\n"
90 "CABOUTDIR\tMSITESTDIR\tcabout\n"
91 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
92 "FIRSTDIR\tMSITESTDIR\tfirst\n"
93 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
94 "NEWDIR\tCABOUTDIR\tnew\n"
95 "ProgramFilesFolder\tTARGETDIR\t.\n"
96 "TARGETDIR\t\tSourceDir";
98 static const CHAR feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
99 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
100 "Feature\tFeature\n"
101 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
102 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
103 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
104 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
105 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
106 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
107 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
109 static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
110 "s38\ts72\n"
111 "FeatureComponents\tFeature_\tComponent_\n"
112 "Five\tFive\n"
113 "Four\tFour\n"
114 "One\tOne\n"
115 "Three\tThree\n"
116 "Two\tTwo\n"
117 "feature\tcomponent\n"
118 "service_feature\tservice_comp\n";
120 static const CHAR file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
121 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
122 "File\tFile\n"
123 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
124 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
125 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
126 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
127 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
128 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
129 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
131 static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
132 "s72\tS255\tI2\n"
133 "InstallExecuteSequence\tAction\n"
134 "AllocateRegistrySpace\tNOT Installed\t1550\n"
135 "CostFinalize\t\t1000\n"
136 "CostInitialize\t\t800\n"
137 "FileCost\t\t900\n"
138 "ResolveSource\t\t950\n"
139 "MoveFiles\t\t1700\n"
140 "InstallFiles\t\t4000\n"
141 "DuplicateFiles\t\t4500\n"
142 "WriteEnvironmentStrings\t\t4550\n"
143 "CreateShortcuts\t\t4600\n"
144 "InstallServices\t\t5000\n"
145 "InstallFinalize\t\t6600\n"
146 "InstallInitialize\t\t1500\n"
147 "InstallValidate\t\t1400\n"
148 "LaunchConditions\t\t100\n"
149 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
151 static const CHAR media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
152 "i2\ti4\tL64\tS255\tS32\tS72\n"
153 "Media\tDiskId\n"
154 "1\t3\t\t\tDISK1\t\n"
155 "2\t5\t\tmsitest.cab\tDISK2\t\n";
157 static const CHAR property_dat[] = "Property\tValue\n"
158 "s72\tl0\n"
159 "Property\tProperty\n"
160 "DefaultUIFont\tDlgFont8\n"
161 "HASUIRUN\t0\n"
162 "INSTALLLEVEL\t3\n"
163 "InstallMode\tTypical\n"
164 "Manufacturer\tWine\n"
165 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
166 "PRIMARYFOLDER\tTARGETDIR\n"
167 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
168 "ProductID\tnone\n"
169 "ProductLanguage\t1033\n"
170 "ProductName\tMSITEST\n"
171 "ProductVersion\t1.1.1\n"
172 "PROMPTROLLBACKCOST\tP\n"
173 "Setup\tSetup\n"
174 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
175 "AdminProperties\tPOSTADMIN\n"
176 "ROOTDRIVE\tC:\\\n"
177 "SERVNAME\tTestService\n"
178 "SERVDISP\tTestServiceDisp\n"
179 "MSIFASTINSTALL\t1\n";
181 static const CHAR aup_property_dat[] = "Property\tValue\n"
182 "s72\tl0\n"
183 "Property\tProperty\n"
184 "DefaultUIFont\tDlgFont8\n"
185 "HASUIRUN\t0\n"
186 "ALLUSERS\t1\n"
187 "INSTALLLEVEL\t3\n"
188 "InstallMode\tTypical\n"
189 "Manufacturer\tWine\n"
190 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
191 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
192 "ProductID\tnone\n"
193 "ProductLanguage\t1033\n"
194 "ProductName\tMSITEST\n"
195 "ProductVersion\t1.1.1\n"
196 "PROMPTROLLBACKCOST\tP\n"
197 "Setup\tSetup\n"
198 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
199 "AdminProperties\tPOSTADMIN\n"
200 "ROOTDRIVE\tC:\\\n"
201 "SERVNAME\tTestService\n"
202 "SERVDISP\tTestServiceDisp\n"
203 "MSIFASTINSTALL\t1\n";
205 static const CHAR aup2_property_dat[] = "Property\tValue\n"
206 "s72\tl0\n"
207 "Property\tProperty\n"
208 "DefaultUIFont\tDlgFont8\n"
209 "HASUIRUN\t0\n"
210 "ALLUSERS\t2\n"
211 "INSTALLLEVEL\t3\n"
212 "InstallMode\tTypical\n"
213 "Manufacturer\tWine\n"
214 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
215 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
216 "ProductID\tnone\n"
217 "ProductLanguage\t1033\n"
218 "ProductName\tMSITEST\n"
219 "ProductVersion\t1.1.1\n"
220 "PROMPTROLLBACKCOST\tP\n"
221 "Setup\tSetup\n"
222 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
223 "AdminProperties\tPOSTADMIN\n"
224 "ROOTDRIVE\tC:\\\n"
225 "SERVNAME\tTestService\n"
226 "SERVDISP\tTestServiceDisp\n"
227 "MSIFASTINSTALL\t1\n";
229 static const CHAR icon_property_dat[] = "Property\tValue\n"
230 "s72\tl0\n"
231 "Property\tProperty\n"
232 "DefaultUIFont\tDlgFont8\n"
233 "HASUIRUN\t0\n"
234 "INSTALLLEVEL\t3\n"
235 "InstallMode\tTypical\n"
236 "Manufacturer\tWine\n"
237 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
238 "ProductCode\t{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}\n"
239 "ProductID\tnone\n"
240 "ProductLanguage\t1033\n"
241 "ProductName\tMSITEST\n"
242 "ProductVersion\t1.1.1\n"
243 "PROMPTROLLBACKCOST\tP\n"
244 "Setup\tSetup\n"
245 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
246 "AdminProperties\tPOSTADMIN\n"
247 "ROOTDRIVE\tC:\\\n"
248 "SERVNAME\tTestService\n"
249 "SERVDISP\tTestServiceDisp\n"
250 "MSIFASTINSTALL\t1\n";
252 static const CHAR shortcut_dat[] = "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
253 "s72\ts72\tl128\ts72\ts72\tS255\tL255\tI2\tS72\tI2\tI2\tS72\n"
254 "Shortcut\tShortcut\n"
255 "Shortcut\tMSITESTDIR\tShortcut\tcomponent\tShortcut\t\tShortcut\t\t\t\t\t\n";
257 static const CHAR condition_dat[] = "Feature_\tLevel\tCondition\n"
258 "s38\ti2\tS255\n"
259 "Condition\tFeature_\tLevel\n"
260 "One\t4\t1\n";
262 static const CHAR up_property_dat[] = "Property\tValue\n"
263 "s72\tl0\n"
264 "Property\tProperty\n"
265 "DefaultUIFont\tDlgFont8\n"
266 "HASUIRUN\t0\n"
267 "INSTALLLEVEL\t3\n"
268 "InstallMode\tTypical\n"
269 "Manufacturer\tWine\n"
270 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
271 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
272 "ProductID\tnone\n"
273 "ProductLanguage\t1033\n"
274 "ProductName\tMSITEST\n"
275 "ProductVersion\t1.1.1\n"
276 "PROMPTROLLBACKCOST\tP\n"
277 "Setup\tSetup\n"
278 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
279 "AdminProperties\tPOSTADMIN\n"
280 "ROOTDRIVE\tC:\\\n"
281 "SERVNAME\tTestService\n"
282 "SERVDISP\tTestServiceDisp\n"
283 "RemovePreviousVersions\t1\n"
284 "MSIFASTINSTALL\t1\n";
286 static const CHAR up2_property_dat[] = "Property\tValue\n"
287 "s72\tl0\n"
288 "Property\tProperty\n"
289 "DefaultUIFont\tDlgFont8\n"
290 "HASUIRUN\t0\n"
291 "INSTALLLEVEL\t3\n"
292 "InstallMode\tTypical\n"
293 "Manufacturer\tWine\n"
294 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
295 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
296 "ProductID\tnone\n"
297 "ProductLanguage\t1033\n"
298 "ProductName\tMSITEST\n"
299 "ProductVersion\t1.1.2\n"
300 "PROMPTROLLBACKCOST\tP\n"
301 "Setup\tSetup\n"
302 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
303 "AdminProperties\tPOSTADMIN\n"
304 "ROOTDRIVE\tC:\\\n"
305 "SERVNAME\tTestService\n"
306 "SERVDISP\tTestServiceDisp\n"
307 "MSIFASTINSTALL\t1\n";
309 static const CHAR up3_property_dat[] = "Property\tValue\n"
310 "s72\tl0\n"
311 "Property\tProperty\n"
312 "DefaultUIFont\tDlgFont8\n"
313 "HASUIRUN\t0\n"
314 "INSTALLLEVEL\t3\n"
315 "InstallMode\tTypical\n"
316 "Manufacturer\tWine\n"
317 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
318 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
319 "ProductID\tnone\n"
320 "ProductLanguage\t1033\n"
321 "ProductName\tMSITEST\n"
322 "ProductVersion\t1.1.2\n"
323 "PROMPTROLLBACKCOST\tP\n"
324 "Setup\tSetup\n"
325 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
326 "AdminProperties\tPOSTADMIN\n"
327 "ROOTDRIVE\tC:\\\n"
328 "SERVNAME\tTestService\n"
329 "SERVDISP\tTestServiceDisp\n"
330 "RemovePreviousVersions\t1\n"
331 "MSIFASTINSTALL\t1\n";
333 static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
334 "s72\ti2\tl255\tL255\tL0\ts72\n"
335 "Registry\tRegistry\n"
336 "Apples\t1\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
337 "Oranges\t1\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
338 "regdata\t1\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
339 "OrderTest\t1\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
341 static const CHAR service_install_dat[] = "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
342 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
343 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
344 "ServiceInstall\tServiceInstall\n"
345 "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\t";
347 static const CHAR service_control_dat[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
348 "s72\tl255\ti2\tL255\tI2\ts72\n"
349 "ServiceControl\tServiceControl\n"
350 "ServiceControl\tTestService\t8\t\t0\tservice_comp";
352 /* tables for test_continuouscabs */
353 static const CHAR cc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
354 "s72\tS38\ts72\ti2\tS255\tS72\n"
355 "Component\tComponent\n"
356 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
357 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
358 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
360 static const CHAR cc2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
361 "s72\tS38\ts72\ti2\tS255\tS72\n"
362 "Component\tComponent\n"
363 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
364 "augustus\t\tMSITESTDIR\t0\t0\taugustus\n"
365 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
367 static const CHAR cc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
368 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
369 "Feature\tFeature\n"
370 "feature\t\t\t\t2\t1\tTARGETDIR\t0";
372 static const CHAR cc_feature_comp_dat[] = "Feature_\tComponent_\n"
373 "s38\ts72\n"
374 "FeatureComponents\tFeature_\tComponent_\n"
375 "feature\tmaximus\n"
376 "feature\taugustus\n"
377 "feature\tcaesar";
379 static const CHAR cc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
380 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
381 "File\tFile\n"
382 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
383 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
384 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
386 static const CHAR cc2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
387 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
388 "File\tFile\n"
389 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
390 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
391 "tiberius\tmaximus\ttiberius\t500\t\t\t16384\t3\n"
392 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
394 static const CHAR cc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
395 "i2\ti4\tL64\tS255\tS32\tS72\n"
396 "Media\tDiskId\n"
397 "1\t10\t\ttest1.cab\tDISK1\t\n"
398 "2\t2\t\ttest2.cab\tDISK2\t\n"
399 "3\t12\t\ttest3.cab\tDISK3\t\n";
401 static const CHAR cc3_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
402 "i2\ti4\tL64\tS255\tS32\tS72\n"
403 "Media\tDiskId\n"
404 "1\t10\t\ttest1.cab\tDISK1\t\n"
405 "2\t2\t\ttest2_.cab\tDISK2\t\n"
406 "3\t12\t\ttest3.cab\tDISK3\t\n";
408 static const CHAR co_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
409 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
410 "File\tFile\n"
411 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
412 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
413 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
415 static const CHAR co_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
416 "i2\ti4\tL64\tS255\tS32\tS72\n"
417 "Media\tDiskId\n"
418 "1\t10\t\ttest1.cab\tDISK1\t\n"
419 "2\t2\t\ttest2.cab\tDISK2\t\n"
420 "3\t3\t\ttest3.cab\tDISK3\t\n";
422 static const CHAR co2_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
423 "i2\ti4\tL64\tS255\tS32\tS72\n"
424 "Media\tDiskId\n"
425 "1\t10\t\ttest1.cab\tDISK1\t\n"
426 "2\t12\t\ttest3.cab\tDISK3\t\n"
427 "3\t2\t\ttest2.cab\tDISK2\t\n";
429 static const CHAR mm_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
430 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
431 "File\tFile\n"
432 "maximus\tmaximus\tmaximus\t500\t\t\t512\t1\n"
433 "augustus\taugustus\taugustus\t500\t\t\t512\t2\n"
434 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
436 static const CHAR mm_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
437 "i2\ti4\tL64\tS255\tS32\tS72\n"
438 "Media\tDiskId\n"
439 "1\t3\t\ttest1.cab\tDISK1\t\n";
441 static const CHAR ss_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
442 "i2\ti4\tL64\tS255\tS32\tS72\n"
443 "Media\tDiskId\n"
444 "1\t2\t\ttest1.cab\tDISK1\t\n"
445 "2\t2\t\ttest2.cab\tDISK2\t\n"
446 "3\t12\t\ttest3.cab\tDISK3\t\n";
448 /* tables for test_uiLevelFlags */
449 static const CHAR ui_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
450 "s72\tS38\ts72\ti2\tS255\tS72\n"
451 "Component\tComponent\n"
452 "maximus\t\tMSITESTDIR\t0\tHASUIRUN=1\tmaximus\n"
453 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
454 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
456 static const CHAR ui_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
457 "s72\tS255\tI2\n"
458 "InstallUISequence\tAction\n"
459 "SetUIProperty\t\t5\n"
460 "ExecuteAction\t\t1100\n";
462 static const CHAR ui_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
463 "s72\ti2\tS64\tS0\tS255\n"
464 "CustomAction\tAction\n"
465 "SetUIProperty\t51\tHASUIRUN\t1\t\n";
467 static const CHAR rof_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
468 "s72\tS38\ts72\ti2\tS255\tS72\n"
469 "Component\tComponent\n"
470 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
472 static const CHAR rof_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
473 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
474 "Feature\tFeature\n"
475 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
476 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
478 static const CHAR rof_feature_comp_dat[] = "Feature_\tComponent_\n"
479 "s38\ts72\n"
480 "FeatureComponents\tFeature_\tComponent_\n"
481 "feature\tmaximus\n"
482 "montecristo\tmaximus";
484 static const CHAR rof_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
485 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
486 "File\tFile\n"
487 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
489 static const CHAR rof_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
490 "i2\ti4\tL64\tS255\tS32\tS72\n"
491 "Media\tDiskId\n"
492 "1\t1\t\t\tDISK1\t\n";
494 static const CHAR rofc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
495 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
496 "File\tFile\n"
497 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1";
499 static const CHAR rofc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
500 "i2\ti4\tL64\tS255\tS32\tS72\n"
501 "Media\tDiskId\n"
502 "1\t1\t\ttest1.cab\tDISK1\t\n";
504 static const CHAR sdp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
505 "s72\tS255\tI2\n"
506 "InstallExecuteSequence\tAction\n"
507 "AllocateRegistrySpace\tNOT Installed\t1550\n"
508 "CostFinalize\t\t1000\n"
509 "CostInitialize\t\t800\n"
510 "FileCost\t\t900\n"
511 "InstallFiles\t\t4000\n"
512 "InstallFinalize\t\t6600\n"
513 "InstallInitialize\t\t1500\n"
514 "InstallValidate\t\t1400\n"
515 "LaunchConditions\t\t100\n"
516 "SetDirProperty\t\t950";
518 static const CHAR sdp_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
519 "s72\ti2\tS64\tS0\tS255\n"
520 "CustomAction\tAction\n"
521 "SetDirProperty\t51\tMSITESTDIR\t[CommonFilesFolder]msitest\\\t\n";
523 static const CHAR pv_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
524 "s72\tS255\tI2\n"
525 "InstallExecuteSequence\tAction\n"
526 "LaunchConditions\t\t100\n"
527 "CostInitialize\t\t800\n"
528 "FileCost\t\t900\n"
529 "CostFinalize\t\t1000\n"
530 "InstallValidate\t\t1400\n"
531 "InstallInitialize\t\t1500\n"
532 "InstallFiles\t\t4000\n"
533 "InstallFinalize\t\t6600\n";
535 static const CHAR cie_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
536 "s72\tS38\ts72\ti2\tS255\tS72\n"
537 "Component\tComponent\n"
538 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
539 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
540 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
541 "gaius\t\tMSITESTDIR\t0\t1\tgaius\n";
543 static const CHAR cie_feature_comp_dat[] = "Feature_\tComponent_\n"
544 "s38\ts72\n"
545 "FeatureComponents\tFeature_\tComponent_\n"
546 "feature\tmaximus\n"
547 "feature\taugustus\n"
548 "feature\tcaesar\n"
549 "feature\tgaius";
551 static const CHAR cie_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
552 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
553 "File\tFile\n"
554 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
555 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
556 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12\n"
557 "gaius\tgaius\tgaius\t500\t\t\t8192\t11";
559 static const CHAR cie_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
560 "i2\ti4\tL64\tS255\tS32\tS72\n"
561 "Media\tDiskId\n"
562 "1\t1\t\ttest1.cab\tDISK1\t\n"
563 "2\t2\t\ttest2.cab\tDISK2\t\n"
564 "3\t12\t\ttest3.cab\tDISK3\t\n";
566 static const CHAR ci_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
567 "s72\tS38\ts72\ti2\tS255\tS72\n"
568 "Component\tComponent\n"
569 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n";
571 static const CHAR ci2_feature_comp_dat[] = "Feature_\tComponent_\n"
572 "s38\ts72\n"
573 "FeatureComponents\tFeature_\tComponent_\n"
574 "feature\taugustus";
576 static const CHAR ci2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
577 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
578 "File\tFile\n"
579 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
581 static const CHAR pp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
582 "s72\tS255\tI2\n"
583 "InstallExecuteSequence\tAction\n"
584 "ValidateProductID\t\t700\n"
585 "CostInitialize\t\t800\n"
586 "FileCost\t\t900\n"
587 "CostFinalize\t\t1000\n"
588 "InstallValidate\t\t1400\n"
589 "InstallInitialize\t\t1500\n"
590 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
591 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
592 "RemoveFiles\t\t3500\n"
593 "InstallFiles\t\t4000\n"
594 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
595 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
596 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
597 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
598 "InstallFinalize\t\t6600";
600 static const CHAR tp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
601 "s72\tS38\ts72\ti2\tS255\tS72\n"
602 "Component\tComponent\n"
603 "augustus\t\tMSITESTDIR\t0\tprop=\"val\"\taugustus\n";
605 static const CHAR cwd_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
606 "s72\tS38\ts72\ti2\tS255\tS72\n"
607 "Component\tComponent\n"
608 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
610 static const CHAR adm_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
611 "s72\tS38\ts72\ti2\tS255\tS72\n"
612 "Component\tComponent\n"
613 "augustus\t\tMSITESTDIR\t0\tPOSTADMIN=1\taugustus";
615 static const CHAR adm_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
616 "s72\ti2\tS64\tS0\tS255\n"
617 "CustomAction\tAction\n"
618 "SetPOSTADMIN\t51\tPOSTADMIN\t1\t\n";
620 static const CHAR adm_admin_exec_seq_dat[] = "Action\tCondition\tSequence\n"
621 "s72\tS255\tI2\n"
622 "AdminExecuteSequence\tAction\n"
623 "CostFinalize\t\t1000\n"
624 "CostInitialize\t\t800\n"
625 "FileCost\t\t900\n"
626 "SetPOSTADMIN\t\t950\n"
627 "InstallFiles\t\t4000\n"
628 "InstallFinalize\t\t6600\n"
629 "InstallInitialize\t\t1500\n"
630 "InstallValidate\t\t1400\n"
631 "LaunchConditions\t\t100";
633 static const CHAR amp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
634 "s72\tS38\ts72\ti2\tS255\tS72\n"
635 "Component\tComponent\n"
636 "augustus\t\tMSITESTDIR\t0\tMYPROP=2718 and MyProp=42\taugustus\n";
638 static const CHAR rem_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
639 "s72\tS255\tI2\n"
640 "InstallExecuteSequence\tAction\n"
641 "ValidateProductID\t\t700\n"
642 "CostInitialize\t\t800\n"
643 "FileCost\t\t900\n"
644 "CostFinalize\t\t1000\n"
645 "InstallValidate\t\t1400\n"
646 "InstallInitialize\t\t1500\n"
647 "ProcessComponents\t\t1600\n"
648 "UnpublishFeatures\t\t1800\n"
649 "RemoveFiles\t\t3500\n"
650 "InstallFiles\t\t4000\n"
651 "RegisterProduct\t\t6100\n"
652 "PublishFeatures\t\t6300\n"
653 "PublishProduct\t\t6400\n"
654 "InstallFinalize\t\t6600";
656 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
657 "s72\tS38\ts72\ti2\tS255\tS72\n"
658 "Component\tComponent\n"
659 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
660 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
661 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
662 "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n"
663 "tiberius\t\tMSITESTDIR\t0\t\ttiberius\n";
665 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
666 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
667 "File\tFile\n"
668 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
669 "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
670 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
671 "gaius\tgaius\tgaius\t500\t\t\t16384\t4\n"
672 "tiberius\ttiberius\ttiberius\t500\t\t\t0\t5\n";
674 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
675 "i2\ti4\tL64\tS255\tS32\tS72\n"
676 "Media\tDiskId\n"
677 "1\t1\t\ttest1.cab\tDISK1\t\n"
678 "2\t2\t\ttest2.cab\tDISK2\t\n"
679 "3\t3\t\ttest3.cab\tDISK3\t\n"
680 "4\t4\t\ttest3.cab\tDISK3\t\n"
681 "5\t5\t\ttest4.cab\tDISK4\t\n";
683 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
684 "s72\ti2\ti4\ti4\ti4\ti4\n"
685 "MsiFileHash\tFile_\n"
686 "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
688 static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
689 "s72\tS38\ts72\ti2\tS255\tS72\n"
690 "Component\tComponent\n"
691 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
693 static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
694 "s72\tS38\ts72\ti2\tS255\tS72\n"
695 "Component\tComponent\n"
696 "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
698 static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
699 "s72\tS255\tI2\n"
700 "InstallExecuteSequence\tAction\n"
701 "ValidateProductID\t\t700\n"
702 "GoodSetProperty\t\t725\n"
703 "BadSetProperty\t\t750\n"
704 "CostInitialize\t\t800\n"
705 "ResolveSource\t\t810\n"
706 "FileCost\t\t900\n"
707 "SetSourceDir\tSRCDIR\t910\n"
708 "CostFinalize\t\t1000\n"
709 "InstallValidate\t\t1400\n"
710 "InstallInitialize\t\t1500\n"
711 "InstallFiles\t\t4000\n"
712 "InstallFinalize\t\t6600";
714 static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
715 "s72\ti2\tS64\tS0\n"
716 "CustomAction\tAction\n"
717 "GoodSetProperty\t51\tMYPROP\t42\n"
718 "BadSetProperty\t51\t\tMYPROP\n"
719 "SetSourceDir\t51\tSourceDir\t[SRCDIR]\n";
721 static const CHAR is_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
722 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
723 "Feature\tFeature\n"
724 "one\t\t\t\t2\t1\t\t0\n" /* favorLocal */
725 "two\t\t\t\t2\t1\t\t1\n" /* favorSource */
726 "three\t\t\t\t2\t1\t\t4\n" /* favorAdvertise */
727 "four\t\t\t\t2\t0\t\t0"; /* disabled */
729 static const CHAR is_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
730 "s72\tS38\ts72\ti2\tS255\tS72\n"
731 "Component\tComponent\n"
732 "alpha\t\tMSITESTDIR\t0\t\talpha_file\n" /* favorLocal:Local */
733 "beta\t\tMSITESTDIR\t1\t\tbeta_file\n" /* favorLocal:Source */
734 "gamma\t\tMSITESTDIR\t2\t\tgamma_file\n" /* favorLocal:Optional */
735 "theta\t\tMSITESTDIR\t0\t\ttheta_file\n" /* favorSource:Local */
736 "delta\t\tMSITESTDIR\t1\t\tdelta_file\n" /* favorSource:Source */
737 "epsilon\t\tMSITESTDIR\t2\t\tepsilon_file\n" /* favorSource:Optional */
738 "zeta\t\tMSITESTDIR\t0\t\tzeta_file\n" /* favorAdvertise:Local */
739 "iota\t\tMSITESTDIR\t1\t\tiota_file\n" /* favorAdvertise:Source */
740 "eta\t\tMSITESTDIR\t2\t\teta_file\n" /* favorAdvertise:Optional */
741 "kappa\t\tMSITESTDIR\t0\t\tkappa_file\n" /* disabled:Local */
742 "lambda\t\tMSITESTDIR\t1\t\tlambda_file\n" /* disabled:Source */
743 "mu\t\tMSITESTDIR\t2\t\tmu_file\n"; /* disabled:Optional */
745 static const CHAR is_feature_comp_dat[] = "Feature_\tComponent_\n"
746 "s38\ts72\n"
747 "FeatureComponents\tFeature_\tComponent_\n"
748 "one\talpha\n"
749 "one\tbeta\n"
750 "one\tgamma\n"
751 "two\ttheta\n"
752 "two\tdelta\n"
753 "two\tepsilon\n"
754 "three\tzeta\n"
755 "three\tiota\n"
756 "three\teta\n"
757 "four\tkappa\n"
758 "four\tlambda\n"
759 "four\tmu";
761 static const CHAR is_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
762 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
763 "File\tFile\n"
764 "alpha_file\talpha\talpha\t500\t\t\t8192\t1\n"
765 "beta_file\tbeta\tbeta\t500\t\t\t8291\t2\n"
766 "gamma_file\tgamma\tgamma\t500\t\t\t8192\t3\n"
767 "theta_file\ttheta\ttheta\t500\t\t\t8192\t4\n"
768 "delta_file\tdelta\tdelta\t500\t\t\t8192\t5\n"
769 "epsilon_file\tepsilon\tepsilon\t500\t\t\t8192\t6\n"
770 "zeta_file\tzeta\tzeta\t500\t\t\t8192\t7\n"
771 "iota_file\tiota\tiota\t500\t\t\t8192\t8\n"
772 "eta_file\teta\teta\t500\t\t\t8192\t9\n"
773 "kappa_file\tkappa\tkappa\t500\t\t\t8192\t10\n"
774 "lambda_file\tlambda\tlambda\t500\t\t\t8192\t11\n"
775 "mu_file\tmu\tmu\t500\t\t\t8192\t12";
777 static const CHAR is_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
778 "i2\ti4\tL64\tS255\tS32\tS72\n"
779 "Media\tDiskId\n"
780 "1\t12\t\t\tDISK1\t\n";
782 static const CHAR sp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
783 "s72\tS38\ts72\ti2\tS255\tS72\n"
784 "Component\tComponent\n"
785 "augustus\t\tTWODIR\t0\t\taugustus\n";
787 static const CHAR sp_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
788 "s72\tS72\tl255\n"
789 "Directory\tDirectory\n"
790 "TARGETDIR\t\tSourceDir\n"
791 "ProgramFilesFolder\tTARGETDIR\t.\n"
792 "MSITESTDIR\tProgramFilesFolder\tmsitest:.\n"
793 "ONEDIR\tMSITESTDIR\t.:shortone|longone\n"
794 "TWODIR\tONEDIR\t.:shorttwo|longtwo";
796 static const CHAR mcp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
797 "s72\tS38\ts72\ti2\tS255\tS72\n"
798 "Component\tComponent\n"
799 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t2\t\thydrogen\n"
800 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t2\t\thelium\n"
801 "lithium\t{4AF28FFC-71C7-4307-BDE4-B77C5338F56F}\tMSITESTDIR\t2\tPROPVAR=42\tlithium\n";
803 static const CHAR mcp_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
804 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
805 "Feature\tFeature\n"
806 "hydroxyl\t\thydroxyl\thydroxyl\t2\t1\tTARGETDIR\t0\n"
807 "heliox\t\theliox\theliox\t2\t5\tTARGETDIR\t0\n"
808 "lithia\t\tlithia\tlithia\t2\t10\tTARGETDIR\t0";
810 static const CHAR mcp_feature_comp_dat[] = "Feature_\tComponent_\n"
811 "s38\ts72\n"
812 "FeatureComponents\tFeature_\tComponent_\n"
813 "hydroxyl\thydrogen\n"
814 "heliox\thelium\n"
815 "lithia\tlithium";
817 static const CHAR mcp_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
818 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
819 "File\tFile\n"
820 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
821 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
822 "lithium\tlithium\tlithium\t0\t\t\t8192\t1\n"
823 "beryllium\tmissingcomp\tberyllium\t0\t\t\t8192\t1";
825 static const CHAR ai_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
826 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
827 "File\tFile\n"
828 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
829 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
830 "one.txt\tOne\tone.txt\t1000\t\t\t16384\t1\n"
831 "three.txt\tThree\tthree.txt\t1000\t\t\t16384\t3\n"
832 "two.txt\tTwo\ttwo.txt\t1000\t\t\t16384\t2\n"
833 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
834 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
836 static const CHAR ip_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
837 "s72\tS255\tI2\n"
838 "InstallExecuteSequence\tAction\n"
839 "CostFinalize\t\t1000\n"
840 "ValidateProductID\t\t700\n"
841 "CostInitialize\t\t800\n"
842 "FileCost\t\t900\n"
843 "RemoveFiles\t\t3500\n"
844 "InstallFiles\t\t4000\n"
845 "RegisterUser\t\t6000\n"
846 "RegisterProduct\t\t6100\n"
847 "PublishFeatures\t\t6300\n"
848 "PublishProduct\t\t6400\n"
849 "InstallFinalize\t\t6600\n"
850 "InstallInitialize\t\t1500\n"
851 "ProcessComponents\t\t1600\n"
852 "UnpublishFeatures\t\t1800\n"
853 "InstallValidate\t\t1400\n"
854 "LaunchConditions\t\t100\n"
855 "TestInstalledProp\tInstalled AND NOT REMOVE\t950\n";
857 static const CHAR ip_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
858 "s72\ti2\tS64\tS0\tS255\n"
859 "CustomAction\tAction\n"
860 "TestInstalledProp\t19\t\tTest failed\t\n";
862 static const CHAR aup_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
863 "s72\tS255\tI2\n"
864 "InstallExecuteSequence\tAction\n"
865 "CostFinalize\t\t1000\n"
866 "ValidateProductID\t\t700\n"
867 "CostInitialize\t\t800\n"
868 "FileCost\t\t900\n"
869 "RemoveFiles\t\t3500\n"
870 "InstallFiles\t\t4000\n"
871 "RegisterUser\t\t6000\n"
872 "RegisterProduct\t\t6100\n"
873 "PublishFeatures\t\t6300\n"
874 "PublishProduct\t\t6400\n"
875 "InstallFinalize\t\t6600\n"
876 "InstallInitialize\t\t1500\n"
877 "ProcessComponents\t\t1600\n"
878 "UnpublishFeatures\t\t1800\n"
879 "InstallValidate\t\t1400\n"
880 "LaunchConditions\t\t100\n"
881 "TestAllUsersProp\tALLUSERS AND NOT REMOVE\t50\n";
883 static const CHAR aup2_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
884 "s72\tS255\tI2\n"
885 "InstallExecuteSequence\tAction\n"
886 "CostFinalize\t\t1000\n"
887 "ValidateProductID\t\t700\n"
888 "CostInitialize\t\t800\n"
889 "FileCost\t\t900\n"
890 "RemoveFiles\t\t3500\n"
891 "InstallFiles\t\t4000\n"
892 "RegisterUser\t\t6000\n"
893 "RegisterProduct\t\t6100\n"
894 "PublishFeatures\t\t6300\n"
895 "PublishProduct\t\t6400\n"
896 "InstallFinalize\t\t6600\n"
897 "InstallInitialize\t\t1500\n"
898 "ProcessComponents\t\t1600\n"
899 "UnpublishFeatures\t\t1800\n"
900 "InstallValidate\t\t1400\n"
901 "LaunchConditions\t\t100\n"
902 "TestAllUsersProp\tALLUSERS=2 AND NOT REMOVE\t50\n";
904 static const CHAR aup3_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
905 "s72\tS255\tI2\n"
906 "InstallExecuteSequence\tAction\n"
907 "CostFinalize\t\t1000\n"
908 "ValidateProductID\t\t700\n"
909 "CostInitialize\t\t800\n"
910 "FileCost\t\t900\n"
911 "RemoveFiles\t\t3500\n"
912 "InstallFiles\t\t4000\n"
913 "RegisterUser\t\t6000\n"
914 "RegisterProduct\t\t6100\n"
915 "PublishFeatures\t\t6300\n"
916 "PublishProduct\t\t6400\n"
917 "InstallFinalize\t\t6600\n"
918 "InstallInitialize\t\t1500\n"
919 "ProcessComponents\t\t1600\n"
920 "UnpublishFeatures\t\t1800\n"
921 "InstallValidate\t\t1400\n"
922 "LaunchConditions\t\t100\n"
923 "TestAllUsersProp\tALLUSERS=1 AND NOT REMOVE\t50\n";
925 static const CHAR aup_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
926 "s72\ti2\tS64\tS0\tS255\n"
927 "CustomAction\tAction\n"
928 "TestAllUsersProp\t19\t\tTest failed\t\n";
930 static const CHAR fo_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
931 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
932 "File\tFile\n"
933 "override.txt\toverride\toverride.txt\t1000\t\t\t8192\t1\n"
934 "preselected.txt\tpreselected\tpreselected.txt\t1000\t\t\t8192\t2\n"
935 "notpreselected.txt\tnotpreselected\tnotpreselected.txt\t1000\t\t\t8192\t3\n";
937 static const CHAR fo_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
938 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
939 "Feature\tFeature\n"
940 "override\t\t\toverride feature\t1\t1\tMSITESTDIR\t0\n"
941 "preselected\t\t\tpreselected feature\t1\t1\tMSITESTDIR\t0\n"
942 "notpreselected\t\t\tnotpreselected feature\t1\t1\tMSITESTDIR\t0\n";
944 static const CHAR fo_condition_dat[] = "Feature_\tLevel\tCondition\n"
945 "s38\ti2\tS255\n"
946 "Condition\tFeature_\tLevel\n"
947 "preselected\t0\tPreselected\n"
948 "notpreselected\t0\tNOT Preselected\n";
950 static const CHAR fo_feature_comp_dat[] = "Feature_\tComponent_\n"
951 "s38\ts72\n"
952 "FeatureComponents\tFeature_\tComponent_\n"
953 "override\toverride\n"
954 "preselected\tpreselected\n"
955 "notpreselected\tnotpreselected\n";
957 static const CHAR fo_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
958 "s72\tS38\ts72\ti2\tS255\tS72\n"
959 "Component\tComponent\n"
960 "override\t{0A00FB1D-97B0-4B42-ADF0-BB8913416623}\tMSITESTDIR\t0\t\toverride.txt\n"
961 "preselected\t{44E1DB75-605A-43DD-8CF5-CAB17F1BBD60}\tMSITESTDIR\t0\t\tpreselected.txt\n"
962 "notpreselected\t{E1647733-5E75-400A-A92E-5E60B4D4EF9F}\tMSITESTDIR\t0\t\tnotpreselected.txt\n";
964 static const CHAR fo_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
965 "s72\ti2\tS64\tS0\tS255\n"
966 "CustomAction\tAction\n"
967 "SetPreselected\t51\tPreselected\t1\t\n";
969 static const CHAR fo_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
970 "s72\tS255\tI2\n"
971 "InstallExecuteSequence\tAction\n"
972 "LaunchConditions\t\t100\n"
973 "SetPreselected\tpreselect=1\t200\n"
974 "CostInitialize\t\t800\n"
975 "FileCost\t\t900\n"
976 "CostFinalize\t\t1000\n"
977 "InstallValidate\t\t1400\n"
978 "InstallInitialize\t\t1500\n"
979 "ProcessComponents\t\t1600\n"
980 "RemoveFiles\t\t1700\n"
981 "InstallFiles\t\t2000\n"
982 "RegisterProduct\t\t5000\n"
983 "PublishFeatures\t\t5100\n"
984 "PublishProduct\t\t5200\n"
985 "InstallFinalize\t\t6000\n";
987 static const CHAR uc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
988 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
989 "File\tFile\n"
990 "upgradecode.txt\tupgradecode\tupgradecode.txt\t1000\t\t\t8192\t1\n";
992 static const CHAR uc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
993 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
994 "Feature\tFeature\n"
995 "upgradecode\t\t\tupgradecode feature\t1\t2\tMSITESTDIR\t0\n";
997 static const CHAR uc_feature_comp_dat[] = "Feature_\tComponent_\n"
998 "s38\ts72\n"
999 "FeatureComponents\tFeature_\tComponent_\n"
1000 "upgradecode\tupgradecode\n";
1002 static const CHAR uc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1003 "s72\tS38\ts72\ti2\tS255\tS72\n"
1004 "Component\tComponent\n"
1005 "upgradecode\t{6952B732-2FCB-4E47-976F-989FCBD7EDFB}\tMSITESTDIR\t0\t\tupgradecode.txt\n";
1007 static const CHAR uc_property_dat[] = "Property\tValue\n"
1008 "s72\tl0\n"
1009 "Property\tProperty\n"
1010 "INSTALLLEVEL\t3\n"
1011 "ProductCode\t{E5FB1241-F547-4BA7-A60E-8E75797268D4}\n"
1012 "ProductName\tMSITEST\n"
1013 "ProductVersion\t1.1.1\n"
1014 "UpgradeCode\t#UPGEADECODE#\n"
1015 "MSIFASTINSTALL\t1\n";
1017 static const CHAR uc_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1018 "s72\tS255\tI2\n"
1019 "InstallExecuteSequence\tAction\n"
1020 "LaunchConditions\t\t100\n"
1021 "CostInitialize\t\t200\n"
1022 "FileCost\t\t300\n"
1023 "CostFinalize\t\t400\n"
1024 "InstallInitialize\t\t500\n"
1025 "ProcessComponents\t\t600\n"
1026 "InstallValidate\t\t700\n"
1027 "RemoveFiles\t\t800\n"
1028 "InstallFiles\t\t900\n"
1029 "RegisterProduct\t\t1000\n"
1030 "PublishFeatures\t\t1100\n"
1031 "PublishProduct\t\t1200\n"
1032 "InstallFinalize\t\t1300\n";
1034 static const char mixed_feature_dat[] =
1035 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1036 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1037 "Feature\tFeature\n"
1038 "feature1\t\t\t\t1\t2\tMSITESTDIR\t0\n"
1039 "feature2\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1041 static const char mixed_feature_comp_dat[] =
1042 "Feature_\tComponent_\n"
1043 "s38\ts72\n"
1044 "FeatureComponents\tFeature_\tComponent_\n"
1045 "feature1\tcomp1\n"
1046 "feature2\tcomp2\n";
1048 static const char mixed_component_dat[] =
1049 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1050 "s72\tS38\ts72\ti2\tS255\tS72\n"
1051 "Component\tComponent\n"
1052 "comp1\t{DE9F0EF4-0ED3-495A-8105-060C0EA457B8}\tTARGETDIR\t4\t\tregdata1\n"
1053 "comp2\t{4912DBE7-FC3A-4F91-BB5C-88F5C15C19A5}\tTARGETDIR\t260\t\tregdata2\n";
1055 static const char mixed_registry_dat[] =
1056 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
1057 "s72\ti2\tl255\tL255\tL0\ts72\n"
1058 "Registry\tRegistry\n"
1059 "regdata1\t2\tSOFTWARE\\Wine\\msitest\ttest1\t\tcomp1\n"
1060 "regdata2\t2\tSOFTWARE\\Wine\\msitest\ttest2\t\tcomp2\n"
1061 "regdata3\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\t\tCLSID_Winetest32\tcomp1\n"
1062 "regdata4\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32\t\twinetest32.dll\tcomp1\n"
1063 "regdata5\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\t\tCLSID_Winetest64\tcomp2\n"
1064 "regdata6\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32\t\twinetest64.dll\tcomp2\n";
1066 static const char mixed_install_exec_seq_dat[] =
1067 "Action\tCondition\tSequence\n"
1068 "s72\tS255\tI2\n"
1069 "InstallExecuteSequence\tAction\n"
1070 "LaunchConditions\t\t100\n"
1071 "CostInitialize\t\t200\n"
1072 "FileCost\t\t300\n"
1073 "CostFinalize\t\t400\n"
1074 "InstallValidate\t\t500\n"
1075 "InstallInitialize\t\t600\n"
1076 "ProcessComponents\t\t700\n"
1077 "UnpublishFeatures\t\t800\n"
1078 "RemoveRegistryValues\t\t900\n"
1079 "WriteRegistryValues\t\t1000\n"
1080 "RegisterProduct\t\t1100\n"
1081 "PublishFeatures\t\t1200\n"
1082 "PublishProduct\t\t1300\n"
1083 "InstallFinalize\t\t1400\n";
1085 static const char vp_file_dat[] =
1086 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1087 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1088 "File\tFile\n"
1089 "volumeprop\tcomp\tvolumeprop.txt\t1000\t\t\t8192\t1\n";
1091 static const char vp_feature_dat[] =
1092 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1093 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1094 "Feature\tFeature\n"
1095 "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1097 static const char vp_feature_comp_dat[] =
1098 "Feature_\tComponent_\n"
1099 "s38\ts72\n"
1100 "FeatureComponents\tFeature_\tComponent_\n"
1101 "feature\tcomp\n";
1103 static const char vp_component_dat[] =
1104 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1105 "s72\tS38\ts72\ti2\tS255\tS72\n"
1106 "Component\tComponent\n"
1107 "comp\t{24364AE7-5B7F-496C-AF5A-54893639C567}\tMSITESTDIR\t0\t\tvolumeprop\n";
1109 static const char vp_custom_action_dat[] =
1110 "Action\tType\tSource\tTarget\tISComments\n"
1111 "s72\ti2\tS64\tS0\tS255\n"
1112 "CustomAction\tAction\n"
1113 "TestPrimaryVolumePath0\t19\t\tPrimaryVolumePath set before CostFinalize\t\n"
1114 "TestPrimaryVolumeSpaceAvailable0\t19\t\tPrimaryVolumeSpaceAvailable set before CostFinalize\t\n"
1115 "TestPrimaryVolumeSpaceRequired0\t19\t\tPrimaryVolumeSpaceRequired set before CostFinalize\t\n"
1116 "TestPrimaryVolumeSpaceRemaining0\t19\t\tPrimaryVolumeSpaceRemaining set before CostFinalize\t\n"
1117 "TestPrimaryVolumePath1\t19\t\tPrimaryVolumePath set before InstallValidate\t\n"
1118 "TestPrimaryVolumeSpaceAvailable1\t19\t\tPrimaryVolumeSpaceAvailable not set before InstallValidate\t\n"
1119 "TestPrimaryVolumeSpaceRequired1\t19\t\tPrimaryVolumeSpaceRequired not set before InstallValidate\t\n"
1120 "TestPrimaryVolumeSpaceRemaining1\t19\t\tPrimaryVolumeSpaceRemaining not set before InstallValidate\t\n"
1121 "TestPrimaryVolumePath2\t19\t\tPrimaryVolumePath not set after InstallValidate\t\n"
1122 "TestPrimaryVolumeSpaceAvailable2\t19\t\tPrimaryVolumeSpaceAvailable not set after InstallValidate\t\n"
1123 "TestPrimaryVolumeSpaceRequired2\t19\t\tPrimaryVolumeSpaceRequired not set after InstallValidate\t\n"
1124 "TestPrimaryVolumeSpaceRemaining2\t19\t\tPrimaryVolumeSpaceRemaining not set after InstallValidate\t\n";
1126 static const char vp_install_exec_seq_dat[] =
1127 "Action\tCondition\tSequence\n"
1128 "s72\tS255\tI2\n"
1129 "InstallExecuteSequence\tAction\n"
1130 "LaunchConditions\t\t100\n"
1131 "CostInitialize\t\t200\n"
1132 "FileCost\t\t300\n"
1133 "TestPrimaryVolumePath0\tPrimaryVolumePath AND NOT REMOVE\t400\n"
1134 "TestPrimaryVolumeSpaceAvailable0\tPrimaryVolumeSpaceAvailable AND NOT REMOVE\t500\n"
1135 "TestPrimaryVolumeSpaceRequired0\tPrimaryVolumeSpaceRequired AND NOT REMOVE\t510\n"
1136 "TestPrimaryVolumeSpaceRemaining0\tPrimaryVolumeSpaceRemaining AND NOT REMOVE\t520\n"
1137 "CostFinalize\t\t600\n"
1138 "TestPrimaryVolumePath1\tPrimaryVolumePath AND NOT REMOVE\t600\n"
1139 "TestPrimaryVolumeSpaceAvailable1\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t800\n"
1140 "TestPrimaryVolumeSpaceRequired1\tNOT PrimaryVolumeSpaceRequired AND NOT REMOVE\t810\n"
1141 "TestPrimaryVolumeSpaceRemaining1\tNOT PrimaryVolumeSpaceRemaining AND NOT REMOVE\t820\n"
1142 "InstallValidate\t\t900\n"
1143 "TestPrimaryVolumePath2\tNOT PrimaryVolumePath AND NOT REMOVE\t1000\n"
1144 "TestPrimaryVolumeSpaceAvailable2\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t1100\n"
1145 "TestPrimaryVolumeSpaceRequired2\tNOT PrimaryVolumeSpaceRequired AND NOT REMOVE\t1110\n"
1146 "TestPrimaryVolumeSpaceRemaining2\tNOT PrimaryVolumeSpaceRemaining AND NOT REMOVE\t1120\n"
1147 "InstallInitialize\t\t1200\n"
1148 "ProcessComponents\t\t1300\n"
1149 "RemoveFiles\t\t1400\n"
1150 "InstallFiles\t\t1500\n"
1151 "RegisterProduct\t\t1600\n"
1152 "PublishFeatures\t\t1700\n"
1153 "PublishProduct\t\t1800\n"
1154 "InstallFinalize\t\t1900\n";
1156 static const char shc_property_dat[] =
1157 "Property\tValue\n"
1158 "s72\tl0\n"
1159 "Property\tProperty\n"
1160 "INSTALLLEVEL\t3\n"
1161 "ProductCode\t{5CD99CD0-69C7-409B-9905-82DD743CC840}\n"
1162 "ProductName\tMSITEST\n"
1163 "ProductVersion\t1.1.1\n"
1164 "MSIFASTINSTALL\t1\n";
1166 static const char shc2_property_dat[] =
1167 "Property\tValue\n"
1168 "s72\tl0\n"
1169 "Property\tProperty\n"
1170 "INSTALLLEVEL\t3\n"
1171 "ProductCode\t{4CEFADE5-DAFB-4C21-8EF2-4ED4F139F340}\n"
1172 "ProductName\tMSITEST2\n"
1173 "ProductVersion\t1.1.1\n"
1174 "MSIFASTINSTALL\t1\n";
1176 static const char shc_file_dat[] =
1177 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1178 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1179 "File\tFile\n"
1180 "sharedcomponent\tsharedcomponent\tsharedcomponent.txt\t1000\t\t\t8192\t1\n";
1182 static const char shc_feature_dat[] =
1183 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1184 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1185 "Feature\tFeature\n"
1186 "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1188 static const char shc_feature_comp_dat[] =
1189 "Feature_\tComponent_\n"
1190 "s38\ts72\n"
1191 "FeatureComponents\tFeature_\tComponent_\n"
1192 "feature\tsharedcomponent\n";
1194 static const char shc_component_dat[] =
1195 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1196 "s72\tS38\ts72\ti2\tS255\tS72\n"
1197 "Component\tComponent\n"
1198 "sharedcomponent\t{900A4ACB-DC6F-4795-A04B-81B530183D41}\tMSITESTDIR\t0\t\tsharedcomponent\n";
1200 static const char shc_custom_action_dat[] =
1201 "Action\tType\tSource\tTarget\tISComments\n"
1202 "s72\ti2\tS64\tS0\tS255\n"
1203 "CustomAction\tAction\n"
1204 "TestComponentAction\t19\t\twrong component action on install\t\n";
1206 static const char shc_install_exec_seq_dat[] =
1207 "Action\tCondition\tSequence\n"
1208 "s72\tS255\tI2\n"
1209 "InstallExecuteSequence\tAction\n"
1210 "LaunchConditions\t\t100\n"
1211 "CostInitialize\t\t200\n"
1212 "FileCost\t\t300\n"
1213 "CostFinalize\t\t600\n"
1214 "InstallValidate\t\t900\n"
1215 "InstallInitialize\t\t1200\n"
1216 "ProcessComponents\t\t1300\n"
1217 "RemoveFiles\t\t1400\n"
1218 "InstallFiles\t\t1500\n"
1219 "TestComponentAction\tNOT REMOVE AND ($sharedcomponent <> 3)\t1600\n"
1220 "RegisterProduct\t\t1700\n"
1221 "PublishFeatures\t\t1800\n"
1222 "PublishProduct\t\t1900\n"
1223 "InstallFinalize\t\t2000\n";
1225 typedef struct _msi_table
1227 const CHAR *filename;
1228 const CHAR *data;
1229 int size;
1230 } msi_table;
1232 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
1234 static const msi_table tables[] =
1236 ADD_TABLE(component),
1237 ADD_TABLE(directory),
1238 ADD_TABLE(feature),
1239 ADD_TABLE(feature_comp),
1240 ADD_TABLE(file),
1241 ADD_TABLE(install_exec_seq),
1242 ADD_TABLE(media),
1243 ADD_TABLE(property),
1244 ADD_TABLE(registry),
1245 ADD_TABLE(service_install),
1246 ADD_TABLE(service_control)
1249 static const msi_table sc_tables[] =
1251 ADD_TABLE(component),
1252 ADD_TABLE(directory),
1253 ADD_TABLE(feature),
1254 ADD_TABLE(feature_comp),
1255 ADD_TABLE(file),
1256 ADD_TABLE(install_exec_seq),
1257 ADD_TABLE(media),
1258 ADD_TABLE(property),
1259 ADD_TABLE(shortcut)
1262 static const msi_table ps_tables[] =
1264 ADD_TABLE(component),
1265 ADD_TABLE(directory),
1266 ADD_TABLE(feature),
1267 ADD_TABLE(feature_comp),
1268 ADD_TABLE(file),
1269 ADD_TABLE(install_exec_seq),
1270 ADD_TABLE(media),
1271 ADD_TABLE(property),
1272 ADD_TABLE(condition)
1275 static const msi_table up_tables[] =
1277 ADD_TABLE(component),
1278 ADD_TABLE(directory),
1279 ADD_TABLE(feature),
1280 ADD_TABLE(feature_comp),
1281 ADD_TABLE(file),
1282 ADD_TABLE(install_exec_seq),
1283 ADD_TABLE(media),
1284 ADD_TABLE(up_property),
1285 ADD_TABLE(registry),
1286 ADD_TABLE(service_install),
1287 ADD_TABLE(service_control)
1290 static const msi_table up2_tables[] =
1292 ADD_TABLE(component),
1293 ADD_TABLE(directory),
1294 ADD_TABLE(feature),
1295 ADD_TABLE(feature_comp),
1296 ADD_TABLE(file),
1297 ADD_TABLE(install_exec_seq),
1298 ADD_TABLE(media),
1299 ADD_TABLE(up2_property),
1300 ADD_TABLE(registry),
1301 ADD_TABLE(service_install),
1302 ADD_TABLE(service_control)
1305 static const msi_table up3_tables[] =
1307 ADD_TABLE(component),
1308 ADD_TABLE(directory),
1309 ADD_TABLE(feature),
1310 ADD_TABLE(feature_comp),
1311 ADD_TABLE(file),
1312 ADD_TABLE(install_exec_seq),
1313 ADD_TABLE(media),
1314 ADD_TABLE(up3_property),
1315 ADD_TABLE(registry),
1316 ADD_TABLE(service_install),
1317 ADD_TABLE(service_control)
1320 static const msi_table up4_tables[] =
1322 ADD_TABLE(component),
1323 ADD_TABLE(directory),
1324 ADD_TABLE(feature),
1325 ADD_TABLE(feature_comp),
1326 ADD_TABLE(file),
1327 ADD_TABLE(pp_install_exec_seq),
1328 ADD_TABLE(media),
1329 ADD_TABLE(property),
1330 ADD_TABLE(registry),
1331 ADD_TABLE(service_install),
1332 ADD_TABLE(service_control)
1335 static const msi_table up5_tables[] =
1337 ADD_TABLE(component),
1338 ADD_TABLE(directory),
1339 ADD_TABLE(feature),
1340 ADD_TABLE(feature_comp),
1341 ADD_TABLE(file),
1342 ADD_TABLE(pp_install_exec_seq),
1343 ADD_TABLE(media),
1344 ADD_TABLE(up_property),
1345 ADD_TABLE(registry),
1346 ADD_TABLE(service_install),
1347 ADD_TABLE(service_control)
1350 static const msi_table up6_tables[] =
1352 ADD_TABLE(component),
1353 ADD_TABLE(directory),
1354 ADD_TABLE(feature),
1355 ADD_TABLE(feature_comp),
1356 ADD_TABLE(file),
1357 ADD_TABLE(pp_install_exec_seq),
1358 ADD_TABLE(media),
1359 ADD_TABLE(up2_property),
1360 ADD_TABLE(registry),
1361 ADD_TABLE(service_install),
1362 ADD_TABLE(service_control)
1365 static const msi_table up7_tables[] =
1367 ADD_TABLE(component),
1368 ADD_TABLE(directory),
1369 ADD_TABLE(feature),
1370 ADD_TABLE(feature_comp),
1371 ADD_TABLE(file),
1372 ADD_TABLE(pp_install_exec_seq),
1373 ADD_TABLE(media),
1374 ADD_TABLE(up3_property),
1375 ADD_TABLE(registry),
1376 ADD_TABLE(service_install),
1377 ADD_TABLE(service_control)
1380 static const msi_table cc_tables[] =
1382 ADD_TABLE(cc_component),
1383 ADD_TABLE(directory),
1384 ADD_TABLE(cc_feature),
1385 ADD_TABLE(cc_feature_comp),
1386 ADD_TABLE(cc_file),
1387 ADD_TABLE(install_exec_seq),
1388 ADD_TABLE(cc_media),
1389 ADD_TABLE(property),
1392 static const msi_table cc2_tables[] =
1394 ADD_TABLE(cc2_component),
1395 ADD_TABLE(directory),
1396 ADD_TABLE(cc_feature),
1397 ADD_TABLE(cc_feature_comp),
1398 ADD_TABLE(cc2_file),
1399 ADD_TABLE(install_exec_seq),
1400 ADD_TABLE(cc_media),
1401 ADD_TABLE(property),
1404 static const msi_table cc3_tables[] =
1406 ADD_TABLE(cc_component),
1407 ADD_TABLE(directory),
1408 ADD_TABLE(cc_feature),
1409 ADD_TABLE(cc_feature_comp),
1410 ADD_TABLE(cc_file),
1411 ADD_TABLE(install_exec_seq),
1412 ADD_TABLE(cc3_media),
1413 ADD_TABLE(property),
1416 static const msi_table co_tables[] =
1418 ADD_TABLE(cc_component),
1419 ADD_TABLE(directory),
1420 ADD_TABLE(cc_feature),
1421 ADD_TABLE(cc_feature_comp),
1422 ADD_TABLE(co_file),
1423 ADD_TABLE(install_exec_seq),
1424 ADD_TABLE(co_media),
1425 ADD_TABLE(property),
1428 static const msi_table co2_tables[] =
1430 ADD_TABLE(cc_component),
1431 ADD_TABLE(directory),
1432 ADD_TABLE(cc_feature),
1433 ADD_TABLE(cc_feature_comp),
1434 ADD_TABLE(cc_file),
1435 ADD_TABLE(install_exec_seq),
1436 ADD_TABLE(co2_media),
1437 ADD_TABLE(property),
1440 static const msi_table mm_tables[] =
1442 ADD_TABLE(cc_component),
1443 ADD_TABLE(directory),
1444 ADD_TABLE(cc_feature),
1445 ADD_TABLE(cc_feature_comp),
1446 ADD_TABLE(mm_file),
1447 ADD_TABLE(install_exec_seq),
1448 ADD_TABLE(mm_media),
1449 ADD_TABLE(property),
1452 static const msi_table ss_tables[] =
1454 ADD_TABLE(cc_component),
1455 ADD_TABLE(directory),
1456 ADD_TABLE(cc_feature),
1457 ADD_TABLE(cc_feature_comp),
1458 ADD_TABLE(cc_file),
1459 ADD_TABLE(install_exec_seq),
1460 ADD_TABLE(ss_media),
1461 ADD_TABLE(property),
1464 static const msi_table ui_tables[] =
1466 ADD_TABLE(ui_component),
1467 ADD_TABLE(directory),
1468 ADD_TABLE(cc_feature),
1469 ADD_TABLE(cc_feature_comp),
1470 ADD_TABLE(cc_file),
1471 ADD_TABLE(install_exec_seq),
1472 ADD_TABLE(ui_install_ui_seq),
1473 ADD_TABLE(ui_custom_action),
1474 ADD_TABLE(cc_media),
1475 ADD_TABLE(property),
1478 static const msi_table rof_tables[] =
1480 ADD_TABLE(rof_component),
1481 ADD_TABLE(directory),
1482 ADD_TABLE(rof_feature),
1483 ADD_TABLE(rof_feature_comp),
1484 ADD_TABLE(rof_file),
1485 ADD_TABLE(install_exec_seq),
1486 ADD_TABLE(rof_media),
1487 ADD_TABLE(property),
1490 static const msi_table rofc_tables[] =
1492 ADD_TABLE(rof_component),
1493 ADD_TABLE(directory),
1494 ADD_TABLE(rof_feature),
1495 ADD_TABLE(rof_feature_comp),
1496 ADD_TABLE(rofc_file),
1497 ADD_TABLE(install_exec_seq),
1498 ADD_TABLE(rofc_media),
1499 ADD_TABLE(property),
1502 static const msi_table sdp_tables[] =
1504 ADD_TABLE(rof_component),
1505 ADD_TABLE(directory),
1506 ADD_TABLE(rof_feature),
1507 ADD_TABLE(rof_feature_comp),
1508 ADD_TABLE(rof_file),
1509 ADD_TABLE(sdp_install_exec_seq),
1510 ADD_TABLE(sdp_custom_action),
1511 ADD_TABLE(rof_media),
1512 ADD_TABLE(property),
1515 static const msi_table cie_tables[] =
1517 ADD_TABLE(cie_component),
1518 ADD_TABLE(directory),
1519 ADD_TABLE(cc_feature),
1520 ADD_TABLE(cie_feature_comp),
1521 ADD_TABLE(cie_file),
1522 ADD_TABLE(install_exec_seq),
1523 ADD_TABLE(cie_media),
1524 ADD_TABLE(property),
1527 static const msi_table tp_tables[] =
1529 ADD_TABLE(tp_component),
1530 ADD_TABLE(directory),
1531 ADD_TABLE(rof_feature),
1532 ADD_TABLE(ci2_feature_comp),
1533 ADD_TABLE(ci2_file),
1534 ADD_TABLE(install_exec_seq),
1535 ADD_TABLE(rof_media),
1536 ADD_TABLE(property),
1539 static const msi_table cwd_tables[] =
1541 ADD_TABLE(cwd_component),
1542 ADD_TABLE(directory),
1543 ADD_TABLE(rof_feature),
1544 ADD_TABLE(ci2_feature_comp),
1545 ADD_TABLE(ci2_file),
1546 ADD_TABLE(install_exec_seq),
1547 ADD_TABLE(rof_media),
1548 ADD_TABLE(property),
1551 static const msi_table adm_tables[] =
1553 ADD_TABLE(adm_component),
1554 ADD_TABLE(directory),
1555 ADD_TABLE(rof_feature),
1556 ADD_TABLE(ci2_feature_comp),
1557 ADD_TABLE(ci2_file),
1558 ADD_TABLE(install_exec_seq),
1559 ADD_TABLE(rof_media),
1560 ADD_TABLE(property),
1561 ADD_TABLE(adm_custom_action),
1562 ADD_TABLE(adm_admin_exec_seq),
1565 static const msi_table amp_tables[] =
1567 ADD_TABLE(amp_component),
1568 ADD_TABLE(directory),
1569 ADD_TABLE(rof_feature),
1570 ADD_TABLE(ci2_feature_comp),
1571 ADD_TABLE(ci2_file),
1572 ADD_TABLE(install_exec_seq),
1573 ADD_TABLE(rof_media),
1574 ADD_TABLE(property),
1577 static const msi_table mc_tables[] =
1579 ADD_TABLE(mc_component),
1580 ADD_TABLE(directory),
1581 ADD_TABLE(cc_feature),
1582 ADD_TABLE(cie_feature_comp),
1583 ADD_TABLE(mc_file),
1584 ADD_TABLE(install_exec_seq),
1585 ADD_TABLE(mc_media),
1586 ADD_TABLE(property),
1587 ADD_TABLE(mc_file_hash),
1590 static const msi_table sf_tables[] =
1592 ADD_TABLE(wrv_component),
1593 ADD_TABLE(directory),
1594 ADD_TABLE(rof_feature),
1595 ADD_TABLE(ci2_feature_comp),
1596 ADD_TABLE(ci2_file),
1597 ADD_TABLE(install_exec_seq),
1598 ADD_TABLE(rof_media),
1599 ADD_TABLE(property),
1602 static const msi_table ca51_tables[] =
1604 ADD_TABLE(ca51_component),
1605 ADD_TABLE(directory),
1606 ADD_TABLE(rof_feature),
1607 ADD_TABLE(ci2_feature_comp),
1608 ADD_TABLE(ci2_file),
1609 ADD_TABLE(ca51_install_exec_seq),
1610 ADD_TABLE(rof_media),
1611 ADD_TABLE(property),
1612 ADD_TABLE(ca51_custom_action),
1615 static const msi_table is_tables[] =
1617 ADD_TABLE(is_component),
1618 ADD_TABLE(directory),
1619 ADD_TABLE(is_feature),
1620 ADD_TABLE(is_feature_comp),
1621 ADD_TABLE(is_file),
1622 ADD_TABLE(install_exec_seq),
1623 ADD_TABLE(is_media),
1624 ADD_TABLE(property),
1627 static const msi_table sp_tables[] =
1629 ADD_TABLE(sp_component),
1630 ADD_TABLE(sp_directory),
1631 ADD_TABLE(rof_feature),
1632 ADD_TABLE(ci2_feature_comp),
1633 ADD_TABLE(ci2_file),
1634 ADD_TABLE(install_exec_seq),
1635 ADD_TABLE(rof_media),
1636 ADD_TABLE(property),
1639 static const msi_table mcp_tables[] =
1641 ADD_TABLE(mcp_component),
1642 ADD_TABLE(directory),
1643 ADD_TABLE(mcp_feature),
1644 ADD_TABLE(mcp_feature_comp),
1645 ADD_TABLE(mcp_file),
1646 ADD_TABLE(rem_install_exec_seq),
1647 ADD_TABLE(rof_media),
1648 ADD_TABLE(property),
1651 static const msi_table ai_tables[] =
1653 ADD_TABLE(component),
1654 ADD_TABLE(directory),
1655 ADD_TABLE(feature),
1656 ADD_TABLE(feature_comp),
1657 ADD_TABLE(ai_file),
1658 ADD_TABLE(install_exec_seq),
1659 ADD_TABLE(media),
1660 ADD_TABLE(property)
1663 static const msi_table pc_tables[] =
1665 ADD_TABLE(ca51_component),
1666 ADD_TABLE(directory),
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),
1672 ADD_TABLE(property)
1675 static const msi_table ip_tables[] =
1677 ADD_TABLE(component),
1678 ADD_TABLE(directory),
1679 ADD_TABLE(feature),
1680 ADD_TABLE(feature_comp),
1681 ADD_TABLE(file),
1682 ADD_TABLE(ip_install_exec_seq),
1683 ADD_TABLE(ip_custom_action),
1684 ADD_TABLE(media),
1685 ADD_TABLE(property)
1688 static const msi_table aup_tables[] =
1690 ADD_TABLE(component),
1691 ADD_TABLE(directory),
1692 ADD_TABLE(feature),
1693 ADD_TABLE(feature_comp),
1694 ADD_TABLE(file),
1695 ADD_TABLE(aup_install_exec_seq),
1696 ADD_TABLE(aup_custom_action),
1697 ADD_TABLE(media),
1698 ADD_TABLE(property)
1701 static const msi_table aup2_tables[] =
1703 ADD_TABLE(component),
1704 ADD_TABLE(directory),
1705 ADD_TABLE(feature),
1706 ADD_TABLE(feature_comp),
1707 ADD_TABLE(file),
1708 ADD_TABLE(aup2_install_exec_seq),
1709 ADD_TABLE(aup_custom_action),
1710 ADD_TABLE(media),
1711 ADD_TABLE(aup_property)
1714 static const msi_table aup3_tables[] =
1716 ADD_TABLE(component),
1717 ADD_TABLE(directory),
1718 ADD_TABLE(feature),
1719 ADD_TABLE(feature_comp),
1720 ADD_TABLE(file),
1721 ADD_TABLE(aup2_install_exec_seq),
1722 ADD_TABLE(aup_custom_action),
1723 ADD_TABLE(media),
1724 ADD_TABLE(aup2_property)
1727 static const msi_table aup4_tables[] =
1729 ADD_TABLE(component),
1730 ADD_TABLE(directory),
1731 ADD_TABLE(feature),
1732 ADD_TABLE(feature_comp),
1733 ADD_TABLE(file),
1734 ADD_TABLE(aup3_install_exec_seq),
1735 ADD_TABLE(aup_custom_action),
1736 ADD_TABLE(media),
1737 ADD_TABLE(aup2_property)
1740 static const msi_table fiu_tables[] =
1742 ADD_TABLE(rof_component),
1743 ADD_TABLE(directory),
1744 ADD_TABLE(rof_feature),
1745 ADD_TABLE(rof_feature_comp),
1746 ADD_TABLE(rof_file),
1747 ADD_TABLE(pp_install_exec_seq),
1748 ADD_TABLE(rof_media),
1749 ADD_TABLE(property),
1752 static const msi_table fiuc_tables[] =
1754 ADD_TABLE(rof_component),
1755 ADD_TABLE(directory),
1756 ADD_TABLE(rof_feature),
1757 ADD_TABLE(rof_feature_comp),
1758 ADD_TABLE(rofc_file),
1759 ADD_TABLE(pp_install_exec_seq),
1760 ADD_TABLE(rofc_media),
1761 ADD_TABLE(property),
1764 static const msi_table fo_tables[] =
1766 ADD_TABLE(directory),
1767 ADD_TABLE(fo_file),
1768 ADD_TABLE(fo_component),
1769 ADD_TABLE(fo_feature),
1770 ADD_TABLE(fo_condition),
1771 ADD_TABLE(fo_feature_comp),
1772 ADD_TABLE(fo_custom_action),
1773 ADD_TABLE(fo_install_exec_seq),
1774 ADD_TABLE(media),
1775 ADD_TABLE(property)
1778 static const msi_table icon_base_tables[] =
1780 ADD_TABLE(ci_component),
1781 ADD_TABLE(directory),
1782 ADD_TABLE(rof_feature),
1783 ADD_TABLE(rof_feature_comp),
1784 ADD_TABLE(rof_file),
1785 ADD_TABLE(pp_install_exec_seq),
1786 ADD_TABLE(rof_media),
1787 ADD_TABLE(icon_property),
1790 static const msi_table pv_tables[] =
1792 ADD_TABLE(rof_component),
1793 ADD_TABLE(directory),
1794 ADD_TABLE(rof_feature),
1795 ADD_TABLE(rof_feature_comp),
1796 ADD_TABLE(rof_file),
1797 ADD_TABLE(pv_install_exec_seq),
1798 ADD_TABLE(rof_media),
1799 ADD_TABLE(property)
1802 static const msi_table uc_tables[] =
1804 ADD_TABLE(directory),
1805 ADD_TABLE(uc_component),
1806 ADD_TABLE(uc_feature),
1807 ADD_TABLE(uc_feature_comp),
1808 ADD_TABLE(uc_file),
1809 ADD_TABLE(uc_install_exec_seq),
1810 ADD_TABLE(media),
1811 ADD_TABLE(uc_property)
1814 static const msi_table mixed_tables[] =
1816 ADD_TABLE(directory),
1817 ADD_TABLE(mixed_component),
1818 ADD_TABLE(mixed_feature),
1819 ADD_TABLE(mixed_feature_comp),
1820 ADD_TABLE(mixed_install_exec_seq),
1821 ADD_TABLE(mixed_registry),
1822 ADD_TABLE(media),
1823 ADD_TABLE(property)
1826 static const msi_table vp_tables[] =
1828 ADD_TABLE(directory),
1829 ADD_TABLE(vp_file),
1830 ADD_TABLE(vp_component),
1831 ADD_TABLE(vp_feature),
1832 ADD_TABLE(vp_feature_comp),
1833 ADD_TABLE(vp_custom_action),
1834 ADD_TABLE(vp_install_exec_seq),
1835 ADD_TABLE(media),
1836 ADD_TABLE(property)
1839 static const msi_table shc_tables[] =
1841 ADD_TABLE(media),
1842 ADD_TABLE(directory),
1843 ADD_TABLE(shc_file),
1844 ADD_TABLE(shc_component),
1845 ADD_TABLE(shc_feature),
1846 ADD_TABLE(shc_feature_comp),
1847 ADD_TABLE(shc_custom_action),
1848 ADD_TABLE(shc_install_exec_seq),
1849 ADD_TABLE(shc_property)
1852 static const msi_table shc2_tables[] =
1854 ADD_TABLE(media),
1855 ADD_TABLE(directory),
1856 ADD_TABLE(shc_file),
1857 ADD_TABLE(shc_component),
1858 ADD_TABLE(shc_feature),
1859 ADD_TABLE(shc_feature_comp),
1860 ADD_TABLE(shc_custom_action),
1861 ADD_TABLE(shc_install_exec_seq),
1862 ADD_TABLE(shc2_property)
1865 /* cabinet definitions */
1867 /* make the max size large so there is only one cab file */
1868 #define MEDIA_SIZE 0x7FFFFFFF
1869 #define FOLDER_THRESHOLD 900000
1871 /* the FCI callbacks */
1873 static void * CDECL mem_alloc(ULONG cb)
1875 return HeapAlloc(GetProcessHeap(), 0, cb);
1878 static void CDECL mem_free(void *memory)
1880 HeapFree(GetProcessHeap(), 0, memory);
1883 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
1885 sprintf(pccab->szCab, pv, pccab->iCab);
1886 return TRUE;
1889 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
1891 return 0;
1894 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
1895 BOOL fContinuation, void *pv)
1897 return 0;
1900 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
1902 HANDLE handle;
1903 DWORD dwAccess = 0;
1904 DWORD dwShareMode = 0;
1905 DWORD dwCreateDisposition = OPEN_EXISTING;
1907 dwAccess = GENERIC_READ | GENERIC_WRITE;
1908 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
1909 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
1911 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
1912 dwCreateDisposition = OPEN_EXISTING;
1913 else
1914 dwCreateDisposition = CREATE_NEW;
1916 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
1917 dwCreateDisposition, 0, NULL);
1919 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
1921 return (INT_PTR)handle;
1924 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1926 HANDLE handle = (HANDLE)hf;
1927 DWORD dwRead;
1928 BOOL res;
1930 res = ReadFile(handle, memory, cb, &dwRead, NULL);
1931 ok(res, "Failed to ReadFile\n");
1933 return dwRead;
1936 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1938 HANDLE handle = (HANDLE)hf;
1939 DWORD dwWritten;
1940 BOOL res;
1942 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
1943 ok(res, "Failed to WriteFile\n");
1945 return dwWritten;
1948 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
1950 HANDLE handle = (HANDLE)hf;
1951 ok(CloseHandle(handle), "Failed to CloseHandle\n");
1953 return 0;
1956 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
1958 HANDLE handle = (HANDLE)hf;
1959 DWORD ret;
1961 ret = SetFilePointer(handle, dist, NULL, seektype);
1962 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
1964 return ret;
1967 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
1969 BOOL ret = DeleteFileA(pszFile);
1970 ok(ret, "Failed to DeleteFile %s\n", pszFile);
1972 return 0;
1975 static void init_functionpointers(void)
1977 HMODULE hmsi = GetModuleHandleA("msi.dll");
1978 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
1979 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
1981 #define GET_PROC(mod, func) \
1982 p ## func = (void*)GetProcAddress(mod, #func); \
1983 if(!p ## func) \
1984 trace("GetProcAddress(%s) failed\n", #func);
1986 GET_PROC(hmsi, MsiQueryComponentStateA);
1987 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
1988 GET_PROC(hmsi, MsiGetComponentPathExA);
1990 GET_PROC(hadvapi32, CheckTokenMembership);
1991 GET_PROC(hadvapi32, ConvertSidToStringSidA);
1992 GET_PROC(hadvapi32, OpenProcessToken);
1993 GET_PROC(hadvapi32, RegDeleteKeyExA)
1994 GET_PROC(hkernel32, IsWow64Process)
1996 hsrclient = LoadLibraryA("srclient.dll");
1997 GET_PROC(hsrclient, SRRemoveRestorePoint);
1998 GET_PROC(hsrclient, SRSetRestorePointA);
2000 #undef GET_PROC
2003 static BOOL is_process_limited(void)
2005 SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
2006 PSID Group = NULL;
2007 BOOL IsInGroup;
2008 HANDLE token;
2010 if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
2012 if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
2013 DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
2014 !pCheckTokenMembership(NULL, Group, &IsInGroup))
2016 trace("Could not check if the current user is an administrator\n");
2017 FreeSid(Group);
2018 return FALSE;
2020 FreeSid(Group);
2022 if (!IsInGroup)
2024 /* Only administrators have enough privileges for these tests */
2025 return TRUE;
2028 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2030 BOOL ret;
2031 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
2032 DWORD size;
2034 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2035 CloseHandle(token);
2036 return (ret && type == TokenElevationTypeLimited);
2038 return FALSE;
2041 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
2043 CHAR buffer[0x20];
2044 UINT r;
2045 DWORD sz;
2047 sz = sizeof buffer;
2048 r = MsiRecordGetStringA(rec, field, buffer, &sz);
2049 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
2052 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2054 LPSTR tempname;
2056 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2057 GetTempFileNameA(".", "xx", 0, tempname);
2059 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2061 lstrcpyA(pszTempName, tempname);
2062 HeapFree(GetProcessHeap(), 0, tempname);
2063 return TRUE;
2066 HeapFree(GetProcessHeap(), 0, tempname);
2068 return FALSE;
2071 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2072 USHORT *pattribs, int *err, void *pv)
2074 BY_HANDLE_FILE_INFORMATION finfo;
2075 FILETIME filetime;
2076 HANDLE handle;
2077 DWORD attrs;
2078 BOOL res;
2080 handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2081 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2083 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2085 res = GetFileInformationByHandle(handle, &finfo);
2086 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2088 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2089 FileTimeToDosDateTime(&filetime, pdate, ptime);
2091 attrs = GetFileAttributesA(pszName);
2092 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2094 return (INT_PTR)handle;
2097 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2099 char path[MAX_PATH];
2100 char filename[MAX_PATH];
2102 lstrcpyA(path, CURR_DIR);
2103 lstrcatA(path, "\\");
2104 lstrcatA(path, file);
2106 lstrcpyA(filename, file);
2108 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2109 progress, get_open_info, compress);
2112 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2114 ZeroMemory(pCabParams, sizeof(CCAB));
2116 pCabParams->cb = max_size;
2117 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2118 pCabParams->setID = 0xbeef;
2119 pCabParams->iCab = 1;
2120 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2121 lstrcatA(pCabParams->szCabPath, "\\");
2122 lstrcpyA(pCabParams->szCab, name);
2125 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2127 CCAB cabParams;
2128 LPCSTR ptr;
2129 HFCI hfci;
2130 ERF erf;
2131 BOOL res;
2133 set_cab_parameters(&cabParams, name, max_size);
2135 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2136 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2137 get_temp_file, &cabParams, NULL);
2139 ok(hfci != NULL, "Failed to create an FCI context\n");
2141 ptr = files;
2142 while (*ptr)
2144 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2145 ok(res, "Failed to add file: %s\n", ptr);
2146 ptr += lstrlenA(ptr) + 1;
2149 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2150 ok(res, "Failed to flush the cabinet\n");
2152 res = FCIDestroy(hfci);
2153 ok(res, "Failed to destroy the cabinet\n");
2156 static BOOL get_user_dirs(void)
2158 HKEY hkey;
2159 DWORD type, size;
2161 if (RegOpenKeyA(HKEY_CURRENT_USER,
2162 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2163 return FALSE;
2165 size = MAX_PATH;
2166 if(RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size)){
2167 RegCloseKey(hkey);
2168 return FALSE;
2171 RegCloseKey(hkey);
2172 return TRUE;
2175 static BOOL get_system_dirs(void)
2177 HKEY hkey;
2178 DWORD type, size;
2180 if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2181 return FALSE;
2183 size = MAX_PATH;
2184 if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2185 RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size)) {
2186 RegCloseKey(hkey);
2187 return FALSE;
2190 size = MAX_PATH;
2191 if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2192 RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size)) {
2193 RegCloseKey(hkey);
2194 return FALSE;
2197 size = MAX_PATH;
2198 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR_NATIVE, &size)) {
2199 RegCloseKey(hkey);
2200 return FALSE;
2203 RegCloseKey(hkey);
2205 if(!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH))
2206 return FALSE;
2208 return TRUE;
2211 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2213 HANDLE file;
2214 DWORD written;
2216 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2217 if (file == INVALID_HANDLE_VALUE)
2218 return;
2220 WriteFile(file, data, strlen(data), &written, NULL);
2222 if (size)
2224 SetFilePointer(file, size, NULL, FILE_BEGIN);
2225 SetEndOfFile(file);
2228 CloseHandle(file);
2231 #define create_file(name, size) create_file_data(name, name, size)
2233 static void create_test_files(void)
2235 CreateDirectoryA("msitest", NULL);
2236 create_file("msitest\\one.txt", 100);
2237 CreateDirectoryA("msitest\\first", NULL);
2238 create_file("msitest\\first\\two.txt", 100);
2239 CreateDirectoryA("msitest\\second", NULL);
2240 create_file("msitest\\second\\three.txt", 100);
2242 create_file("four.txt", 100);
2243 create_file("five.txt", 100);
2244 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2246 create_file("msitest\\filename", 100);
2247 create_file("msitest\\service.exe", 100);
2249 DeleteFileA("four.txt");
2250 DeleteFileA("five.txt");
2253 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2255 CHAR path[MAX_PATH];
2257 lstrcpyA(path, PROG_FILES_DIR);
2258 lstrcatA(path, "\\");
2259 lstrcatA(path, rel_path);
2261 if (is_file)
2262 return DeleteFileA(path);
2263 else
2264 return RemoveDirectoryA(path);
2267 static BOOL delete_pf_native(const CHAR *rel_path, BOOL is_file)
2269 CHAR path[MAX_PATH];
2271 lstrcpyA(path, PROG_FILES_DIR_NATIVE);
2272 lstrcatA(path, "\\");
2273 lstrcatA(path, rel_path);
2275 if (is_file)
2276 return DeleteFileA(path);
2277 else
2278 return RemoveDirectoryA(path);
2281 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
2283 CHAR path[MAX_PATH];
2285 lstrcpyA(path, COMMON_FILES_DIR);
2286 lstrcatA(path, "\\");
2287 lstrcatA(path, rel_path);
2289 if (is_file)
2290 return DeleteFileA(path);
2291 else
2292 return RemoveDirectoryA(path);
2295 static BOOL compare_pf_data(const char *filename, const char *data, DWORD size)
2297 DWORD read;
2298 HANDLE handle;
2299 BOOL ret = FALSE;
2300 char *buffer, path[MAX_PATH];
2302 lstrcpyA(path, PROG_FILES_DIR);
2303 lstrcatA(path, "\\");
2304 lstrcatA(path, filename);
2306 handle = CreateFileA(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2307 buffer = HeapAlloc(GetProcessHeap(), 0, size);
2308 if (buffer)
2310 ReadFile(handle, buffer, size, &read, NULL);
2311 if (read == size && !memcmp(data, buffer, size)) ret = TRUE;
2312 HeapFree(GetProcessHeap(), 0, buffer);
2314 CloseHandle(handle);
2315 return ret;
2318 static void delete_test_files(void)
2320 DeleteFileA("msitest.msi");
2321 DeleteFileA("msitest.cab");
2322 DeleteFileA("msitest\\second\\three.txt");
2323 DeleteFileA("msitest\\first\\two.txt");
2324 DeleteFileA("msitest\\one.txt");
2325 DeleteFileA("msitest\\service.exe");
2326 DeleteFileA("msitest\\filename");
2327 RemoveDirectoryA("msitest\\second");
2328 RemoveDirectoryA("msitest\\first");
2329 RemoveDirectoryA("msitest");
2332 static void write_file(const CHAR *filename, const char *data, int data_size)
2334 DWORD size;
2336 HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
2337 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2338 WriteFile(hf, data, data_size, &size, NULL);
2339 CloseHandle(hf);
2342 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount,
2343 const char *template, const char *packagecode)
2345 MSIHANDLE summary;
2346 UINT r;
2348 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2349 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2351 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2352 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2354 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL, packagecode);
2355 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2357 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL);
2358 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2360 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2361 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2363 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2364 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2366 /* write the summary changes back to the stream */
2367 r = MsiSummaryInfoPersist(summary);
2368 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2370 MsiCloseHandle(summary);
2373 #define create_database(name, tables, num_tables) \
2374 create_database_wordcount(name, tables, num_tables, 100, 0, ";1033", \
2375 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2377 #define create_database_template(name, tables, num_tables, version, template) \
2378 create_database_wordcount(name, tables, num_tables, version, 0, template, \
2379 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2381 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2382 int num_tables, INT version, INT wordcount,
2383 const char *template, const char *packagecode)
2385 MSIHANDLE db;
2386 UINT r;
2387 WCHAR *nameW;
2388 int j, len;
2390 len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2391 if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
2392 MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2394 r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
2395 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2397 /* import the tables into the database */
2398 for (j = 0; j < num_tables; j++)
2400 const msi_table *table = &tables[j];
2402 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2404 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2405 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2407 DeleteFileA(table->filename);
2410 write_msi_summary_info(db, version, wordcount, template, packagecode);
2412 r = MsiDatabaseCommit(db);
2413 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2415 MsiCloseHandle(db);
2416 HeapFree( GetProcessHeap(), 0, nameW );
2419 static void check_service_is_installed(void)
2421 SC_HANDLE scm, service;
2422 BOOL res;
2424 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
2425 ok(scm != NULL, "Failed to open the SC Manager\n");
2427 service = OpenServiceA(scm, "TestService", SC_MANAGER_ALL_ACCESS);
2428 ok(service != NULL, "Failed to open TestService\n");
2430 res = DeleteService(service);
2431 ok(res, "Failed to delete TestService\n");
2433 CloseServiceHandle(service);
2434 CloseServiceHandle(scm);
2437 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2439 RESTOREPOINTINFOA spec;
2441 spec.dwEventType = event_type;
2442 spec.dwRestorePtType = APPLICATION_INSTALL;
2443 spec.llSequenceNumber = status->llSequenceNumber;
2444 lstrcpyA(spec.szDescription, "msitest restore point");
2446 return pSRSetRestorePointA(&spec, status);
2449 static void remove_restore_point(DWORD seq_number)
2451 DWORD res;
2453 res = pSRRemoveRestorePoint(seq_number);
2454 if (res != ERROR_SUCCESS)
2455 trace("Failed to remove the restore point : %08x\n", res);
2458 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
2460 if (pRegDeleteKeyExA)
2461 return pRegDeleteKeyExA( key, subkey, access, 0 );
2462 return RegDeleteKeyA( key, subkey );
2465 static void test_MsiInstallProduct(void)
2467 UINT r;
2468 CHAR path[MAX_PATH];
2469 LONG res;
2470 HKEY hkey;
2471 DWORD num, size, type;
2472 REGSAM access = KEY_ALL_ACCESS;
2474 if (is_process_limited())
2476 skip("process is limited\n");
2477 return;
2480 if (is_wow64)
2481 access |= KEY_WOW64_64KEY;
2483 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2485 /* szPackagePath is NULL */
2486 r = MsiInstallProductA(NULL, "INSTALL=ALL");
2487 ok(r == ERROR_INVALID_PARAMETER,
2488 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2490 /* both szPackagePath and szCommandLine are NULL */
2491 r = MsiInstallProductA(NULL, NULL);
2492 ok(r == ERROR_INVALID_PARAMETER,
2493 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2495 /* szPackagePath is empty */
2496 r = MsiInstallProductA("", "INSTALL=ALL");
2497 ok(r == ERROR_PATH_NOT_FOUND,
2498 "Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
2500 create_test_files();
2501 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2503 /* install, don't publish */
2504 r = MsiInstallProductA(msifile, NULL);
2505 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2507 skip("Not enough rights to perform tests\n");
2508 goto error;
2510 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2512 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2513 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2514 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2515 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2516 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2517 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2518 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2519 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2520 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2521 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2522 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2523 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2525 res = RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", 0, access, &hkey);
2526 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2528 size = MAX_PATH;
2529 type = REG_SZ;
2530 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
2531 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2532 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
2534 size = MAX_PATH;
2535 type = REG_SZ;
2536 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
2537 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2539 size = sizeof(num);
2540 type = REG_DWORD;
2541 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
2542 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2543 ok(num == 314, "Expected 314, got %d\n", num);
2545 size = MAX_PATH;
2546 type = REG_SZ;
2547 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
2548 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2549 ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
2551 check_service_is_installed();
2553 delete_key(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", access);
2555 /* not published, reinstall */
2556 r = MsiInstallProductA(msifile, NULL);
2557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2559 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2560 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2561 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2562 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2563 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2564 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2565 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2566 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2567 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2568 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2569 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2570 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2572 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2573 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2574 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2576 create_database(msifile, up_tables, sizeof(up_tables) / sizeof(msi_table));
2578 /* not published, RemovePreviousVersions set */
2579 r = MsiInstallProductA(msifile, NULL);
2580 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2582 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2583 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2584 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2585 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2586 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2587 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2588 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2589 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2590 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2591 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2592 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2593 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2595 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2596 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2597 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2599 create_database(msifile, up2_tables, sizeof(up2_tables) / sizeof(msi_table));
2601 /* not published, version number bumped */
2602 r = MsiInstallProductA(msifile, NULL);
2603 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2605 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2606 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2607 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2608 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2609 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2610 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2611 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2612 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2613 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2614 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2615 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2616 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2618 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2619 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2620 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2622 create_database(msifile, up3_tables, sizeof(up3_tables) / sizeof(msi_table));
2624 /* not published, RemovePreviousVersions set and version number bumped */
2625 r = MsiInstallProductA(msifile, NULL);
2626 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2628 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2629 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2630 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2631 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2632 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2633 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2634 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2635 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2636 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2637 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2638 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2639 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2641 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2642 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2643 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2645 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2647 /* install, publish product */
2648 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2649 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2651 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2652 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2653 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2654 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2655 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2656 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2657 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2658 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2659 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2660 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2661 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2662 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2664 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2665 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2667 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2669 /* published, reinstall */
2670 r = MsiInstallProductA(msifile, NULL);
2671 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2673 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2674 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2675 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2676 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2677 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2678 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2679 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2680 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2681 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2682 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2683 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2684 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2686 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2687 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2689 create_database(msifile, up5_tables, sizeof(up5_tables) / sizeof(msi_table));
2691 /* published product, RemovePreviousVersions set */
2692 r = MsiInstallProductA(msifile, NULL);
2693 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2695 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2696 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2697 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2698 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2699 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2700 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2701 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2702 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2703 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2704 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2705 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2706 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2708 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2709 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2711 create_database(msifile, up6_tables, sizeof(up6_tables) / sizeof(msi_table));
2713 /* published product, version number bumped */
2714 r = MsiInstallProductA(msifile, NULL);
2715 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2717 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2718 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2719 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2720 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2721 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2722 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2723 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2724 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2725 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2726 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2727 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2728 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2730 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2731 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2733 create_database(msifile, up7_tables, sizeof(up7_tables) / sizeof(msi_table));
2735 /* published product, RemovePreviousVersions set and version number bumped */
2736 r = MsiInstallProductA(msifile, NULL);
2737 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2739 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2740 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2741 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2742 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2743 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2744 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2745 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2746 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2747 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2748 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2749 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2750 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2752 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2753 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2755 r = MsiInstallProductA(msifile, "REMOVE=ALL");
2756 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2758 error:
2759 delete_test_files();
2760 DeleteFileA(msifile);
2763 static void test_MsiSetComponentState(void)
2765 INSTALLSTATE installed, action;
2766 MSIHANDLE package;
2767 char path[MAX_PATH];
2768 UINT r;
2770 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2772 CoInitialize(NULL);
2774 lstrcpyA(path, CURR_DIR);
2775 lstrcatA(path, "\\");
2776 lstrcatA(path, msifile);
2778 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2780 r = MsiOpenPackageA(path, &package);
2781 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2783 skip("Not enough rights to perform tests\n");
2784 goto error;
2786 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2788 r = MsiDoActionA(package, "CostInitialize");
2789 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2791 r = MsiDoActionA(package, "FileCost");
2792 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2794 r = MsiDoActionA(package, "CostFinalize");
2795 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2797 r = MsiGetComponentStateA(package, "dangler", &installed, &action);
2798 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2799 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
2800 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2802 r = MsiSetComponentStateA(package, "dangler", INSTALLSTATE_SOURCE);
2803 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2805 MsiCloseHandle(package);
2807 error:
2808 CoUninitialize();
2809 DeleteFileA(msifile);
2812 static void test_packagecoltypes(void)
2814 MSIHANDLE hdb, view, rec;
2815 char path[MAX_PATH];
2816 WCHAR pathW[MAX_PATH];
2817 LPCSTR query;
2818 UINT r, count;
2820 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2822 CoInitialize(NULL);
2824 lstrcpyA(path, CURR_DIR);
2825 lstrcatA(path, "\\");
2826 lstrcatA(path, msifile);
2827 MultiByteToWideChar( CP_ACP, 0, path, -1, pathW, MAX_PATH );
2829 r = MsiOpenDatabaseW(pathW, MSIDBOPEN_READONLY, &hdb);
2830 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2832 query = "SELECT * FROM `Media`";
2833 r = MsiDatabaseOpenViewA( hdb, query, &view );
2834 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2836 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
2837 count = MsiRecordGetFieldCount( rec );
2838 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2839 ok(count == 6, "Expected 6, got %d\n", count);
2840 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
2841 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
2842 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
2843 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
2844 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
2845 ok(check_record(rec, 6, "Source"), "wrong column label\n");
2846 MsiCloseHandle(rec);
2848 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
2849 count = MsiRecordGetFieldCount( rec );
2850 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2851 ok(count == 6, "Expected 6, got %d\n", count);
2852 ok(check_record(rec, 1, "i2"), "wrong column label\n");
2853 ok(check_record(rec, 2, "i4"), "wrong column label\n");
2854 ok(check_record(rec, 3, "L64"), "wrong column label\n");
2855 ok(check_record(rec, 4, "S255"), "wrong column label\n");
2856 ok(check_record(rec, 5, "S32"), "wrong column label\n");
2857 ok(check_record(rec, 6, "S72"), "wrong column label\n");
2859 MsiCloseHandle(rec);
2860 MsiCloseHandle(view);
2861 MsiCloseHandle(hdb);
2862 CoUninitialize();
2864 DeleteFileA(msifile);
2867 static void create_cc_test_files(void)
2869 CCAB cabParams;
2870 HFCI hfci;
2871 ERF erf;
2872 static CHAR cab_context[] = "test%d.cab";
2873 BOOL res;
2875 create_file("maximus", 500);
2876 create_file("augustus", 50000);
2877 create_file("tiberius", 500);
2878 create_file("caesar", 500);
2880 set_cab_parameters(&cabParams, "test1.cab", 40000);
2882 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2883 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2884 get_temp_file, &cabParams, cab_context);
2885 ok(hfci != NULL, "Failed to create an FCI context\n");
2887 res = add_file(hfci, "maximus", tcompTYPE_NONE);
2888 ok(res, "Failed to add file maximus\n");
2890 res = add_file(hfci, "augustus", tcompTYPE_NONE);
2891 ok(res, "Failed to add file augustus\n");
2893 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
2894 ok(res, "Failed to add file tiberius\n");
2896 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2897 ok(res, "Failed to flush the cabinet\n");
2899 res = FCIDestroy(hfci);
2900 ok(res, "Failed to destroy the cabinet\n");
2902 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2904 DeleteFileA("maximus");
2905 DeleteFileA("augustus");
2906 DeleteFileA("tiberius");
2907 DeleteFileA("caesar");
2910 static void delete_cab_files(void)
2912 SHFILEOPSTRUCTA shfl;
2913 CHAR path[MAX_PATH+10];
2915 lstrcpyA(path, CURR_DIR);
2916 lstrcatA(path, "\\*.cab");
2917 path[strlen(path) + 1] = '\0';
2919 shfl.hwnd = NULL;
2920 shfl.wFunc = FO_DELETE;
2921 shfl.pFrom = path;
2922 shfl.pTo = NULL;
2923 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
2925 SHFileOperationA(&shfl);
2928 static void test_continuouscabs(void)
2930 UINT r;
2932 if (is_process_limited())
2934 skip("process is limited\n");
2935 return;
2938 create_cc_test_files();
2939 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
2941 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2943 r = MsiInstallProductA(msifile, NULL);
2944 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2946 skip("Not enough rights to perform tests\n");
2947 goto error;
2949 else
2951 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2952 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2953 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2954 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2955 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2958 delete_cab_files();
2959 DeleteFileA(msifile);
2961 create_cc_test_files();
2962 create_database(msifile, cc2_tables, sizeof(cc2_tables) / sizeof(msi_table));
2964 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2966 r = MsiInstallProductA(msifile, NULL);
2967 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2969 skip("Not enough rights to perform tests\n");
2971 else
2973 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2974 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2975 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
2976 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
2977 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2978 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2981 delete_cab_files();
2982 DeleteFileA(msifile);
2984 /* Tests to show that only msi cab filename is taken in case of mismatch with the one given by previous cab */
2986 /* Filename from cab is right and the one from msi is wrong */
2987 create_cc_test_files();
2988 create_database(msifile, cc3_tables, sizeof(cc3_tables) / sizeof(msi_table));
2990 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2992 r = MsiInstallProductA(msifile, NULL);
2993 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2995 skip("Not enough rights to perform tests\n");
2997 else
2999 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAIRE, got %u\n", r);
3000 todo_wine ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3001 ok(!delete_pf("msitest\\caesar", TRUE), "File installed\n");
3002 todo_wine ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
3003 todo_wine ok(!delete_pf("msitest", FALSE), "Directory created\n");
3006 delete_cab_files();
3007 DeleteFileA(msifile);
3009 /* Filename from msi is right and the one from cab is wrong */
3010 create_cc_test_files();
3011 ok(MoveFileA("test2.cab", "test2_.cab"), "Cannot rename test2.cab to test2_.cab\n");
3012 create_database(msifile, cc3_tables, sizeof(cc3_tables) / sizeof(msi_table));
3014 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3016 r = MsiInstallProductA(msifile, NULL);
3017 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3019 skip("Not enough rights to perform tests\n");
3021 else
3023 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3024 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3025 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3026 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3027 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3030 error:
3031 delete_cab_files();
3032 DeleteFileA(msifile);
3035 static void test_caborder(void)
3037 UINT r;
3039 create_file("imperator", 100);
3040 create_file("maximus", 500);
3041 create_file("augustus", 50000);
3042 create_file("caesar", 500);
3044 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
3046 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3048 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3049 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3050 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3052 r = MsiInstallProductA(msifile, NULL);
3053 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3055 skip("Not enough rights to perform tests\n");
3056 goto error;
3058 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3059 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3060 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3061 todo_wine
3063 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3064 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3067 delete_cab_files();
3069 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
3070 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
3071 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3073 r = MsiInstallProductA(msifile, NULL);
3074 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3075 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3076 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3077 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3078 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3080 delete_cab_files();
3081 DeleteFileA(msifile);
3083 create_cc_test_files();
3084 create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
3086 r = MsiInstallProductA(msifile, NULL);
3087 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3088 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3089 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3090 todo_wine
3092 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3093 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3096 delete_cab_files();
3097 DeleteFileA(msifile);
3099 create_cc_test_files();
3100 create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
3102 r = MsiInstallProductA(msifile, NULL);
3103 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3104 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3105 todo_wine
3107 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3108 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3109 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3112 error:
3113 delete_cab_files();
3114 DeleteFileA("imperator");
3115 DeleteFileA("maximus");
3116 DeleteFileA("augustus");
3117 DeleteFileA("caesar");
3118 DeleteFileA(msifile);
3121 static void test_mixedmedia(void)
3123 UINT r;
3125 if (is_process_limited())
3127 skip("process is limited\n");
3128 return;
3131 CreateDirectoryA("msitest", NULL);
3132 create_file("msitest\\maximus", 500);
3133 create_file("msitest\\augustus", 500);
3134 create_file("caesar", 500);
3136 create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
3138 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3140 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
3142 r = MsiInstallProductA(msifile, NULL);
3143 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3145 skip("Not enough rights to perform tests\n");
3146 goto error;
3148 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3149 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3150 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3151 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3152 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3154 error:
3155 /* Delete the files in the temp (current) folder */
3156 DeleteFileA("msitest\\maximus");
3157 DeleteFileA("msitest\\augustus");
3158 RemoveDirectoryA("msitest");
3159 DeleteFileA("caesar");
3160 DeleteFileA("test1.cab");
3161 DeleteFileA(msifile);
3164 static void test_samesequence(void)
3166 UINT r;
3168 create_cc_test_files();
3169 create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
3171 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3173 r = MsiInstallProductA(msifile, NULL);
3174 if (r == ERROR_INSTALL_FAILURE)
3176 win_skip("unprivileged user?\n");
3177 goto error;
3179 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3180 if (r == ERROR_SUCCESS)
3182 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3183 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3184 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3185 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3188 error:
3189 delete_cab_files();
3190 DeleteFileA(msifile);
3193 static void test_uiLevelFlags(void)
3195 UINT r;
3197 create_cc_test_files();
3198 create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
3200 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
3202 r = MsiInstallProductA(msifile, NULL);
3203 if (r == ERROR_INSTALL_FAILURE)
3205 win_skip("unprivileged user?\n");
3206 goto error;
3209 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3210 if (r == ERROR_SUCCESS)
3212 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
3213 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3214 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3215 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3218 error:
3219 delete_cab_files();
3220 DeleteFileA(msifile);
3223 static BOOL file_matches(LPSTR path)
3225 CHAR buf[MAX_PATH];
3226 HANDLE file;
3227 DWORD size;
3229 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3230 NULL, OPEN_EXISTING, 0, NULL);
3231 ZeroMemory(buf, MAX_PATH);
3232 ReadFile(file, buf, 15, &size, NULL);
3233 CloseHandle(file);
3235 return !lstrcmpA(buf, "msitest\\maximus");
3238 static void test_readonlyfile(void)
3240 UINT r;
3241 DWORD size;
3242 HANDLE file;
3243 CHAR path[MAX_PATH];
3245 if (is_process_limited())
3247 skip("process is limited\n");
3248 return;
3251 CreateDirectoryA("msitest", NULL);
3252 create_file("msitest\\maximus", 500);
3253 create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
3255 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3257 lstrcpyA(path, PROG_FILES_DIR);
3258 lstrcatA(path, "\\msitest");
3259 CreateDirectoryA(path, NULL);
3261 lstrcatA(path, "\\maximus");
3262 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3263 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3265 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3266 CloseHandle(file);
3268 r = MsiInstallProductA(msifile, NULL);
3269 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3271 skip("Not enough rights to perform tests\n");
3272 goto error;
3274 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3275 ok(file_matches(path), "Expected file to be overwritten\n");
3276 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3277 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3279 error:
3280 /* Delete the files in the temp (current) folder */
3281 DeleteFileA("msitest\\maximus");
3282 RemoveDirectoryA("msitest");
3283 DeleteFileA(msifile);
3286 static void test_readonlyfile_cab(void)
3288 UINT r;
3289 DWORD size;
3290 HANDLE file;
3291 CHAR path[MAX_PATH];
3292 CHAR buf[16];
3294 if (is_process_limited())
3296 skip("process is limited\n");
3297 return;
3300 CreateDirectoryA("msitest", NULL);
3301 create_file("maximus", 500);
3302 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3303 DeleteFileA("maximus");
3305 create_database(msifile, rofc_tables, sizeof(rofc_tables) / sizeof(msi_table));
3307 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3309 lstrcpyA(path, PROG_FILES_DIR);
3310 lstrcatA(path, "\\msitest");
3311 CreateDirectoryA(path, NULL);
3313 lstrcatA(path, "\\maximus");
3314 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3315 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3317 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3318 CloseHandle(file);
3320 r = MsiInstallProductA(msifile, NULL);
3321 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3323 skip("Not enough rights to perform tests\n");
3324 goto error;
3326 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3328 memset( buf, 0, sizeof(buf) );
3329 if ((file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3330 NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
3332 ReadFile(file, buf, sizeof(buf) - 1, &size, NULL);
3333 CloseHandle(file);
3335 ok(!memcmp( buf, "maximus", sizeof("maximus")-1 ), "Expected file to be overwritten, got '%s'\n", buf);
3336 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3337 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3339 error:
3340 /* Delete the files in the temp (current) folder */
3341 delete_cab_files();
3342 DeleteFileA("msitest\\maximus");
3343 RemoveDirectoryA("msitest");
3344 DeleteFileA(msifile);
3347 static void test_setdirproperty(void)
3349 UINT r;
3351 if (is_process_limited())
3353 skip("process is limited\n");
3354 return;
3357 CreateDirectoryA("msitest", NULL);
3358 create_file("msitest\\maximus", 500);
3359 create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
3361 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3363 r = MsiInstallProductA(msifile, NULL);
3364 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3366 skip("Not enough rights to perform tests\n");
3367 goto error;
3369 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3370 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
3371 ok(delete_cf("msitest", FALSE), "Directory not created\n");
3373 error:
3374 /* Delete the files in the temp (current) folder */
3375 DeleteFileA(msifile);
3376 DeleteFileA("msitest\\maximus");
3377 RemoveDirectoryA("msitest");
3380 static void test_cabisextracted(void)
3382 UINT r;
3384 if (is_process_limited())
3386 skip("process is limited\n");
3387 return;
3390 CreateDirectoryA("msitest", NULL);
3391 create_file("msitest\\gaius", 500);
3392 create_file("maximus", 500);
3393 create_file("augustus", 500);
3394 create_file("caesar", 500);
3396 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3397 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3398 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3400 create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
3402 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3404 r = MsiInstallProductA(msifile, NULL);
3405 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3407 skip("Not enough rights to perform tests\n");
3408 goto error;
3410 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3411 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3412 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3413 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3414 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
3415 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3417 error:
3418 /* Delete the files in the temp (current) folder */
3419 delete_cab_files();
3420 DeleteFileA(msifile);
3421 DeleteFileA("maximus");
3422 DeleteFileA("augustus");
3423 DeleteFileA("caesar");
3424 DeleteFileA("msitest\\gaius");
3425 RemoveDirectoryA("msitest");
3428 static BOOL file_exists(LPCSTR file)
3430 return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES;
3433 static BOOL pf_exists(LPCSTR file)
3435 CHAR path[MAX_PATH];
3437 lstrcpyA(path, PROG_FILES_DIR);
3438 lstrcatA(path, "\\");
3439 lstrcatA(path, file);
3441 return file_exists(path);
3444 static void delete_pfmsitest_files(void)
3446 SHFILEOPSTRUCTA shfl;
3447 CHAR path[MAX_PATH+11];
3449 lstrcpyA(path, PROG_FILES_DIR);
3450 lstrcatA(path, "\\msitest\\*");
3451 path[strlen(path) + 1] = '\0';
3453 shfl.hwnd = NULL;
3454 shfl.wFunc = FO_DELETE;
3455 shfl.pFrom = path;
3456 shfl.pTo = NULL;
3457 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT | FOF_NOERRORUI;
3459 SHFileOperationA(&shfl);
3461 lstrcpyA(path, PROG_FILES_DIR);
3462 lstrcatA(path, "\\msitest");
3463 RemoveDirectoryA(path);
3466 static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
3468 MSIHANDLE hview = 0;
3469 UINT r;
3471 r = MsiDatabaseOpenViewA(hdb, query, &hview);
3472 if(r != ERROR_SUCCESS)
3473 return r;
3475 r = MsiViewExecute(hview, hrec);
3476 if(r == ERROR_SUCCESS)
3477 r = MsiViewClose(hview);
3478 MsiCloseHandle(hview);
3479 return r;
3482 static void set_transform_summary_info(void)
3484 UINT r;
3485 MSIHANDLE suminfo = 0;
3487 /* build summary info */
3488 r = MsiGetSummaryInformationA(0, mstfile, 3, &suminfo);
3489 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
3491 r = MsiSummaryInfoSetPropertyA(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
3492 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3494 r = MsiSummaryInfoSetPropertyA(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
3495 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3496 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3497 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
3498 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
3500 r = MsiSummaryInfoSetPropertyA(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
3501 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3503 r = MsiSummaryInfoPersist(suminfo);
3504 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
3506 r = MsiCloseHandle(suminfo);
3507 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
3510 static void generate_transform(void)
3512 MSIHANDLE hdb1, hdb2;
3513 LPCSTR query;
3514 UINT r;
3516 /* start with two identical databases */
3517 CopyFileA(msifile, msifile2, FALSE);
3519 r = MsiOpenDatabaseW(msifile2W, MSIDBOPEN_TRANSACT, &hdb1);
3520 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3522 r = MsiDatabaseCommit(hdb1);
3523 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
3525 r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_READONLY, &hdb2);
3526 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3528 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
3529 r = run_query(hdb1, 0, query);
3530 ok(r == ERROR_SUCCESS, "failed to add property\n");
3532 /* database needs to be committed */
3533 MsiDatabaseCommit(hdb1);
3535 r = MsiDatabaseGenerateTransformA(hdb1, hdb2, mstfile, 0, 0);
3536 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3538 r = MsiCreateTransformSummaryInfoA(hdb2, hdb2, mstfile, 0, 0);
3539 todo_wine ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3541 MsiCloseHandle(hdb1);
3542 MsiCloseHandle(hdb2);
3545 /* data for generating a transform */
3547 /* tables transform names - encoded as they would be in an msi database file */
3548 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
3549 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
3550 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
3552 /* data in each table */
3553 static const char data1[] = /* _StringData */
3554 "propval"; /* all the strings squashed together */
3556 static const WCHAR data2[] = { /* _StringPool */
3557 /* len, refs */
3558 0, 0, /* string 0 '' */
3559 4, 1, /* string 1 'prop' */
3560 3, 1, /* string 2 'val' */
3563 static const WCHAR data3[] = { /* Property */
3564 0x0201, 0x0001, 0x0002,
3567 static const struct {
3568 LPCWSTR name;
3569 const void *data;
3570 DWORD size;
3571 } table_transform_data[] =
3573 { name1, data1, sizeof data1 - 1 },
3574 { name2, data2, sizeof data2 },
3575 { name3, data3, sizeof data3 },
3578 #define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
3580 static void generate_transform_manual(void)
3582 IStorage *stg = NULL;
3583 IStream *stm;
3584 WCHAR name[0x20];
3585 HRESULT r;
3586 DWORD i, count;
3587 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
3589 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
3591 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
3593 r = StgCreateDocfile(name, mode, 0, &stg);
3594 ok(r == S_OK, "failed to create storage\n");
3595 if (!stg)
3596 return;
3598 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
3599 ok(r == S_OK, "failed to set storage type\n");
3601 for (i=0; i<NUM_TRANSFORM_TABLES; i++)
3603 r = IStorage_CreateStream(stg, table_transform_data[i].name,
3604 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3605 if (FAILED(r))
3607 ok(0, "failed to create stream %08x\n", r);
3608 continue;
3611 r = IStream_Write(stm, table_transform_data[i].data,
3612 table_transform_data[i].size, &count);
3613 if (FAILED(r) || count != table_transform_data[i].size)
3614 ok(0, "failed to write stream\n");
3615 IStream_Release(stm);
3618 IStorage_Release(stg);
3620 set_transform_summary_info();
3623 static void test_transformprop(void)
3625 UINT r;
3627 if (is_process_limited())
3629 skip("process is limited\n");
3630 return;
3633 CreateDirectoryA("msitest", NULL);
3634 create_file("msitest\\augustus", 500);
3636 create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
3638 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3640 r = MsiInstallProductA(msifile, NULL);
3641 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3643 skip("Not enough rights to perform tests\n");
3644 goto error;
3646 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3647 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3648 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3650 if (0)
3651 generate_transform();
3652 else
3653 generate_transform_manual();
3655 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
3656 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3657 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3658 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3660 error:
3661 /* Delete the files in the temp (current) folder */
3662 DeleteFileA(msifile);
3663 DeleteFileA(msifile2);
3664 DeleteFileA(mstfile);
3665 DeleteFileA("msitest\\augustus");
3666 RemoveDirectoryA("msitest");
3669 static void test_currentworkingdir(void)
3671 UINT r;
3672 CHAR drive[MAX_PATH], path[MAX_PATH];
3673 LPSTR ptr;
3675 if (is_process_limited())
3677 skip("process is limited\n");
3678 return;
3681 CreateDirectoryA("msitest", NULL);
3682 create_file("msitest\\augustus", 500);
3684 create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
3686 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3688 CreateDirectoryA("diffdir", NULL);
3689 SetCurrentDirectoryA("diffdir");
3691 sprintf(path, "..\\%s", msifile);
3692 r = MsiInstallProductA(path, NULL);
3693 todo_wine
3695 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
3696 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3697 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3700 sprintf(path, "%s\\%s", CURR_DIR, msifile);
3701 r = MsiInstallProductA(path, NULL);
3702 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3704 skip("Not enough rights to perform tests\n");
3705 goto error;
3707 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3708 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3709 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3711 lstrcpyA(drive, CURR_DIR);
3712 drive[2] = '\\';
3713 drive[3] = '\0';
3714 SetCurrentDirectoryA(drive);
3716 lstrcpyA(path, CURR_DIR);
3717 if (path[lstrlenA(path) - 1] != '\\') lstrcatA(path, "\\");
3718 lstrcatA(path, msifile);
3719 ptr = strchr(path, ':');
3720 ptr +=2;
3722 r = MsiInstallProductA(ptr, NULL);
3723 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3724 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3725 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3727 error:
3728 SetCurrentDirectoryA(CURR_DIR);
3729 DeleteFileA(msifile);
3730 DeleteFileA("msitest\\augustus");
3731 RemoveDirectoryA("msitest");
3732 RemoveDirectoryA("diffdir");
3735 static void set_admin_summary_info(const WCHAR *name)
3737 MSIHANDLE db, summary;
3738 UINT r;
3740 r = MsiOpenDatabaseW(name, MSIDBOPEN_DIRECT, &db);
3741 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3743 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
3744 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3746 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
3747 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3749 /* write the summary changes back to the stream */
3750 r = MsiSummaryInfoPersist(summary);
3751 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3753 MsiCloseHandle(summary);
3755 r = MsiDatabaseCommit(db);
3756 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3758 MsiCloseHandle(db);
3761 static void test_admin(void)
3763 UINT r;
3765 CreateDirectoryA("msitest", NULL);
3766 create_file("msitest\\augustus", 500);
3768 create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
3769 set_admin_summary_info(msifileW);
3771 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3773 r = MsiInstallProductA(msifile, NULL);
3774 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3776 skip("Not enough rights to perform tests\n");
3777 goto error;
3779 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3780 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3781 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3782 ok(!DeleteFileA("c:\\msitest\\augustus"), "File installed\n");
3783 ok(!RemoveDirectoryA("c:\\msitest"), "File installed\n");
3785 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
3786 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3787 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3788 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3789 todo_wine
3791 ok(DeleteFileA("c:\\msitest\\augustus"), "File not installed\n");
3792 ok(RemoveDirectoryA("c:\\msitest"), "File not installed\n");
3795 error:
3796 DeleteFileA(msifile);
3797 DeleteFileA("msitest\\augustus");
3798 RemoveDirectoryA("msitest");
3801 static void set_admin_property_stream(LPCSTR file)
3803 IStorage *stg;
3804 IStream *stm;
3805 WCHAR fileW[MAX_PATH];
3806 HRESULT hr;
3807 DWORD count;
3808 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
3810 /* AdminProperties */
3811 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
3812 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',' ',
3813 'M','y','P','r','o','p','=','4','2',0};
3815 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
3817 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
3818 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3819 if (!stg)
3820 return;
3822 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3823 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3825 hr = IStream_Write(stm, data, sizeof(data), &count);
3826 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3828 IStream_Release(stm);
3829 IStorage_Release(stg);
3832 static void test_adminprops(void)
3834 UINT r;
3836 if (is_process_limited())
3838 skip("process is limited\n");
3839 return;
3842 CreateDirectoryA("msitest", NULL);
3843 create_file("msitest\\augustus", 500);
3845 create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
3846 set_admin_summary_info(msifileW);
3847 set_admin_property_stream(msifile);
3849 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3851 r = MsiInstallProductA(msifile, NULL);
3852 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3854 skip("Not enough rights to perform tests\n");
3855 goto error;
3857 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3858 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
3859 ok(delete_pf("msitest", FALSE), "Directory created\n");
3861 error:
3862 DeleteFileA(msifile);
3863 DeleteFileA("msitest\\augustus");
3864 RemoveDirectoryA("msitest");
3867 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
3869 CHAR path[MAX_PATH];
3871 lstrcpyA(path, PROG_FILES_DIR);
3872 lstrcatA(path, "\\");
3873 lstrcatA(path, file);
3875 if (is_file)
3876 create_file_data(path, data, 500);
3877 else
3878 CreateDirectoryA(path, NULL);
3881 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
3883 static void test_missingcab(void)
3885 UINT r;
3887 if (is_process_limited())
3889 skip("process is limited\n");
3890 return;
3893 CreateDirectoryA("msitest", NULL);
3894 create_file("msitest\\augustus", 500);
3895 create_file("maximus", 500);
3896 create_file("tiberius", 500);
3898 create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
3900 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3902 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3903 create_cab_file("test4.cab", MEDIA_SIZE, "tiberius\0");
3905 create_pf("msitest", FALSE);
3906 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
3907 create_pf_data("msitest\\tiberius", "abcdefgh", TRUE);
3909 r = MsiInstallProductA(msifile, NULL);
3910 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3912 skip("Not enough rights to perform tests\n");
3913 goto error;
3915 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3916 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3917 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3918 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3919 ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
3920 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
3921 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
3922 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3924 create_pf("msitest", FALSE);
3925 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
3926 create_pf_data("msitest\\tiberius", "abcdefgh", TRUE);
3927 create_pf("msitest\\gaius", TRUE);
3929 r = MsiInstallProductA(msifile, "GAIUS=1");
3930 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3931 todo_wine
3933 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
3934 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3936 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
3937 ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
3938 ok(delete_pf("msitest\\tiberius", TRUE), "File removed\n");
3939 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
3940 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3942 error:
3943 delete_pf("msitest", FALSE);
3944 DeleteFileA("msitest\\augustus");
3945 RemoveDirectoryA("msitest");
3946 DeleteFileA("maximus");
3947 DeleteFileA("tiberius");
3948 DeleteFileA("test1.cab");
3949 DeleteFileA("test4.cab");
3950 DeleteFileA(msifile);
3953 static void test_sourcefolder(void)
3955 UINT r;
3957 if (is_process_limited())
3959 skip("process is limited\n");
3960 return;
3963 CreateDirectoryA("msitest", NULL);
3964 create_file("augustus", 500);
3966 create_database(msifile, sf_tables, sizeof(sf_tables) / sizeof(msi_table));
3968 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3970 r = MsiInstallProductA(msifile, NULL);
3971 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3973 skip("Not enough rights to perform tests\n");
3974 goto error;
3976 ok(r == ERROR_INSTALL_FAILURE,
3977 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3978 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3979 todo_wine
3981 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3983 RemoveDirectoryA("msitest");
3985 r = MsiInstallProductA(msifile, NULL);
3986 ok(r == ERROR_INSTALL_FAILURE,
3987 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3988 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3989 todo_wine
3991 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3994 error:
3995 DeleteFileA(msifile);
3996 DeleteFileA("augustus");
3999 static void test_customaction51(void)
4001 UINT r;
4003 if (is_process_limited())
4005 skip("process is limited\n");
4006 return;
4009 CreateDirectoryA("msitest", NULL);
4010 create_file("msitest\\augustus", 500);
4012 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
4014 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4016 r = MsiInstallProductA(msifile, NULL);
4017 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4019 skip("Not enough rights to perform tests\n");
4020 goto error;
4022 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4023 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4024 ok(delete_pf("msitest", FALSE), "Directory created\n");
4026 error:
4027 DeleteFileA(msifile);
4028 DeleteFileA("msitest\\augustus");
4029 RemoveDirectoryA("msitest");
4032 static void test_installstate(void)
4034 UINT r;
4036 if (is_process_limited())
4038 skip("process is limited\n");
4039 return;
4042 CreateDirectoryA("msitest", NULL);
4043 create_file("msitest\\alpha", 500);
4044 create_file("msitest\\beta", 500);
4045 create_file("msitest\\gamma", 500);
4046 create_file("msitest\\theta", 500);
4047 create_file("msitest\\delta", 500);
4048 create_file("msitest\\epsilon", 500);
4049 create_file("msitest\\zeta", 500);
4050 create_file("msitest\\iota", 500);
4051 create_file("msitest\\eta", 500);
4052 create_file("msitest\\kappa", 500);
4053 create_file("msitest\\lambda", 500);
4054 create_file("msitest\\mu", 500);
4056 create_database(msifile, is_tables, sizeof(is_tables) / sizeof(msi_table));
4058 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4060 r = MsiInstallProductA(msifile, NULL);
4061 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4063 skip("Not enough rights to perform tests\n");
4064 goto error;
4066 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4067 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4068 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4069 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4070 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4071 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4072 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4073 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4074 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4075 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4076 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4077 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4078 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4079 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4081 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
4082 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4083 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4084 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4085 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4086 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4087 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4088 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
4089 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4090 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4091 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
4092 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4093 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4094 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4095 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4097 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
4098 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4099 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4100 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4101 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4102 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4103 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4104 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4105 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4106 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4107 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4108 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4109 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4110 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4111 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4113 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
4114 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4115 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
4116 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4117 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4118 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
4119 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4120 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4121 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4122 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4123 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4124 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4125 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4126 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4127 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4129 error:
4130 DeleteFileA(msifile);
4131 DeleteFileA("msitest\\alpha");
4132 DeleteFileA("msitest\\beta");
4133 DeleteFileA("msitest\\gamma");
4134 DeleteFileA("msitest\\theta");
4135 DeleteFileA("msitest\\delta");
4136 DeleteFileA("msitest\\epsilon");
4137 DeleteFileA("msitest\\zeta");
4138 DeleteFileA("msitest\\iota");
4139 DeleteFileA("msitest\\eta");
4140 DeleteFileA("msitest\\kappa");
4141 DeleteFileA("msitest\\lambda");
4142 DeleteFileA("msitest\\mu");
4143 RemoveDirectoryA("msitest");
4146 static const struct sourcepathmap
4148 BOOL sost; /* shortone\shorttwo */
4149 BOOL solt; /* shortone\longtwo */
4150 BOOL lost; /* longone\shorttwo */
4151 BOOL lolt; /* longone\longtwo */
4152 BOOL soste; /* shortone\shorttwo source exists */
4153 BOOL solte; /* shortone\longtwo source exists */
4154 BOOL loste; /* longone\shorttwo source exists */
4155 BOOL lolte; /* longone\longtwo source exists */
4156 UINT err;
4157 DWORD size;
4158 } spmap[256] =
4160 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4161 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4162 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4163 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4164 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4165 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4166 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4167 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4168 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4169 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4170 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4171 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4172 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4173 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4174 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4175 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4176 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4177 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4178 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4179 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4180 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4181 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4182 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4183 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4184 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4185 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4186 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4187 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4188 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4189 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4190 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4191 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4192 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4193 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4194 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4195 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4196 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4197 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4198 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4199 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4200 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4201 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4202 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4203 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4204 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4205 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4206 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4207 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4208 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4209 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4210 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4211 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4212 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4213 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4214 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4215 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4216 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4217 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4218 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4219 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4220 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4221 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4222 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4223 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4224 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4225 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4226 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4227 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4228 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4229 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4230 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4231 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4232 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4233 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4234 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4235 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4236 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4237 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4238 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4239 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4240 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4241 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4242 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4243 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4244 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4245 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4246 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4247 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4248 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4249 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4250 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4251 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4252 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4253 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4254 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4255 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4256 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4257 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4258 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4259 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4260 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4261 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4262 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4263 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4264 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4265 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4266 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4267 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4268 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4269 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4270 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4271 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4272 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4273 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4274 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4275 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4276 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4277 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4278 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4279 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4280 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4281 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4282 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4283 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4284 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4285 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4286 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4287 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4288 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4289 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4290 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4291 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4292 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4293 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4294 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4295 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4296 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4297 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4298 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4299 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4300 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4301 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4302 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4303 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4304 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4305 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4306 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4307 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4308 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4309 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4310 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4311 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4312 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4313 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4314 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4315 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4316 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4317 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4318 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4319 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4320 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4321 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4322 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4323 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4324 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4325 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4326 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4327 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4328 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4329 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4330 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4331 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4332 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4333 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4334 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4335 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4336 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4337 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4338 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4339 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4340 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4341 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4342 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4343 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4344 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4345 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4346 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4347 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4348 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4349 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4350 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4351 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4352 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4353 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4354 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4355 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4356 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4357 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4358 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4359 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4360 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4361 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4362 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4363 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4364 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4365 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4366 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4367 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4368 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4369 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4370 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4371 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4372 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4373 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4374 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4375 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4376 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4377 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4378 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4379 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4380 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4381 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4382 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4383 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4384 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4385 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4386 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4387 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4388 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4389 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4390 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4391 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4392 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4393 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4394 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4395 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4396 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4397 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4398 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4399 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4400 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4401 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4402 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4403 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4404 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4405 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4406 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4407 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4408 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4409 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4410 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4411 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4412 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4413 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4414 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4415 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4418 static DWORD get_pf_file_size(LPCSTR file)
4420 CHAR path[MAX_PATH];
4421 HANDLE hfile;
4422 DWORD size;
4424 lstrcpyA(path, PROG_FILES_DIR);
4425 lstrcatA(path, "\\");
4426 lstrcatA(path, file);
4428 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
4429 if (hfile == INVALID_HANDLE_VALUE)
4430 return INVALID_FILE_SIZE;
4432 size = GetFileSize(hfile, NULL);
4433 CloseHandle(hfile);
4434 return size;
4437 static void test_sourcepath(void)
4439 UINT r, i;
4441 if (!winetest_interactive)
4443 skip("Run in interactive mode to run source path tests.\n");
4444 return;
4447 create_database(msifile, sp_tables, sizeof(sp_tables) / sizeof(msi_table));
4449 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4451 for (i = 0; i < sizeof(spmap) / sizeof(spmap[0]); i++)
4453 if (spmap[i].sost)
4455 CreateDirectoryA("shortone", NULL);
4456 CreateDirectoryA("shortone\\shorttwo", NULL);
4459 if (spmap[i].solt)
4461 CreateDirectoryA("shortone", NULL);
4462 CreateDirectoryA("shortone\\longtwo", NULL);
4465 if (spmap[i].lost)
4467 CreateDirectoryA("longone", NULL);
4468 CreateDirectoryA("longone\\shorttwo", NULL);
4471 if (spmap[i].lolt)
4473 CreateDirectoryA("longone", NULL);
4474 CreateDirectoryA("longone\\longtwo", NULL);
4477 if (spmap[i].soste)
4478 create_file("shortone\\shorttwo\\augustus", 50);
4479 if (spmap[i].solte)
4480 create_file("shortone\\longtwo\\augustus", 100);
4481 if (spmap[i].loste)
4482 create_file("longone\\shorttwo\\augustus", 150);
4483 if (spmap[i].lolte)
4484 create_file("longone\\longtwo\\augustus", 200);
4486 r = MsiInstallProductA(msifile, NULL);
4487 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
4488 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
4489 "%d: Expected %d, got %d\n", i, spmap[i].size,
4490 get_pf_file_size("msitest\\augustus"));
4492 if (r == ERROR_SUCCESS)
4494 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
4495 ok(delete_pf("msitest", FALSE), "%d: Directory not created\n", i);
4497 else
4499 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
4500 todo_wine ok(!delete_pf("msitest", FALSE), "%d: Directory installed\n", i);
4503 DeleteFileA("shortone\\shorttwo\\augustus");
4504 DeleteFileA("shortone\\longtwo\\augustus");
4505 DeleteFileA("longone\\shorttwo\\augustus");
4506 DeleteFileA("longone\\longtwo\\augustus");
4507 RemoveDirectoryA("shortone\\shorttwo");
4508 RemoveDirectoryA("shortone\\longtwo");
4509 RemoveDirectoryA("longone\\shorttwo");
4510 RemoveDirectoryA("longone\\longtwo");
4511 RemoveDirectoryA("shortone");
4512 RemoveDirectoryA("longone");
4515 DeleteFileA(msifile);
4518 static void test_missingcomponent(void)
4520 UINT r;
4522 if (is_process_limited())
4524 skip("process is limited\n");
4525 return;
4528 CreateDirectoryA("msitest", NULL);
4529 create_file("msitest\\hydrogen", 500);
4530 create_file("msitest\\helium", 500);
4531 create_file("msitest\\lithium", 500);
4532 create_file("beryllium", 500);
4534 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
4536 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4538 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
4539 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4541 skip("Not enough rights to perform tests\n");
4542 goto error;
4544 else if (r == ERROR_INSTALL_FAILURE)
4546 win_skip("broken result\n");
4547 goto error;
4549 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4550 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4551 ok(pf_exists("msitest\\helium"), "File not installed\n");
4552 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4553 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
4554 ok(pf_exists("msitest"), "File not installed\n");
4556 r = MsiInstallProductA(msifile, "REMOVE=ALL INSTALLLEVEL=10 PROPVAR=42");
4557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4558 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
4559 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
4560 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
4561 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
4562 ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
4564 error:
4565 DeleteFileA(msifile);
4566 DeleteFileA("msitest\\hydrogen");
4567 DeleteFileA("msitest\\helium");
4568 DeleteFileA("msitest\\lithium");
4569 DeleteFileA("beryllium");
4570 RemoveDirectoryA("msitest");
4573 static void test_sourcedirprop(void)
4575 UINT r;
4576 CHAR props[MAX_PATH];
4578 if (is_process_limited())
4580 skip("process is limited\n");
4581 return;
4584 CreateDirectoryA("msitest", NULL);
4585 create_file("msitest\\augustus", 500);
4587 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
4589 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4591 r = MsiInstallProductA(msifile, NULL);
4592 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4594 skip("Not enough rights to perform tests\n");
4595 goto error;
4597 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4598 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4599 ok(delete_pf("msitest", FALSE), "Directory created\n");
4601 DeleteFileA("msitest\\augustus");
4602 RemoveDirectoryA("msitest");
4604 CreateDirectoryA("altsource", NULL);
4605 CreateDirectoryA("altsource\\msitest", NULL);
4606 create_file("altsource\\msitest\\augustus", 500);
4608 sprintf(props, "SRCDIR=%s\\altsource\\", CURR_DIR);
4610 r = MsiInstallProductA(msifile, props);
4611 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4612 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4613 ok(delete_pf("msitest", FALSE), "Directory created\n");
4615 DeleteFileA("altsource\\msitest\\augustus");
4616 RemoveDirectoryA("altsource\\msitest");
4617 RemoveDirectoryA("altsource");
4619 error:
4620 DeleteFileA("msitest\\augustus");
4621 RemoveDirectoryA("msitest");
4622 DeleteFileA(msifile);
4625 static void test_adminimage(void)
4627 UINT r;
4629 if (is_process_limited())
4631 skip("process is limited\n");
4632 return;
4635 CreateDirectoryA("msitest", NULL);
4636 CreateDirectoryA("msitest\\first", NULL);
4637 CreateDirectoryA("msitest\\second", NULL);
4638 CreateDirectoryA("msitest\\cabout", NULL);
4639 CreateDirectoryA("msitest\\cabout\\new", NULL);
4640 create_file("msitest\\one.txt", 100);
4641 create_file("msitest\\first\\two.txt", 100);
4642 create_file("msitest\\second\\three.txt", 100);
4643 create_file("msitest\\cabout\\four.txt", 100);
4644 create_file("msitest\\cabout\\new\\five.txt", 100);
4645 create_file("msitest\\filename", 100);
4646 create_file("msitest\\service.exe", 100);
4648 create_database_wordcount(msifile, ai_tables,
4649 sizeof(ai_tables) / sizeof(msi_table),
4650 100, msidbSumInfoSourceTypeAdminImage, ";1033",
4651 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
4653 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4655 r = MsiInstallProductA(msifile, NULL);
4656 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4658 skip("Not enough rights to perform tests\n");
4659 goto error;
4661 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4663 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4664 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4665 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4666 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4667 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4668 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4669 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4670 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4671 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
4672 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4673 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4674 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4676 error:
4677 DeleteFileA("msifile");
4678 DeleteFileA("msitest\\cabout\\new\\five.txt");
4679 DeleteFileA("msitest\\cabout\\four.txt");
4680 DeleteFileA("msitest\\second\\three.txt");
4681 DeleteFileA("msitest\\first\\two.txt");
4682 DeleteFileA("msitest\\one.txt");
4683 DeleteFileA("msitest\\service.exe");
4684 DeleteFileA("msitest\\filename");
4685 RemoveDirectoryA("msitest\\cabout\\new");
4686 RemoveDirectoryA("msitest\\cabout");
4687 RemoveDirectoryA("msitest\\second");
4688 RemoveDirectoryA("msitest\\first");
4689 RemoveDirectoryA("msitest");
4692 static void test_propcase(void)
4694 UINT r;
4696 if (is_process_limited())
4698 skip("process is limited\n");
4699 return;
4702 CreateDirectoryA("msitest", NULL);
4703 create_file("msitest\\augustus", 500);
4705 create_database(msifile, pc_tables, sizeof(pc_tables) / sizeof(msi_table));
4707 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4709 r = MsiInstallProductA(msifile, "MyProp=42");
4710 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4712 skip("Not enough rights to perform tests\n");
4713 goto error;
4715 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4716 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4717 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4719 r = MsiInstallProductA(msifile, "BLAHBLAH=\"Copyright \"\"My Company\"\" 2015\" MyProp=42");
4720 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4721 todo_wine
4722 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4723 todo_wine
4724 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4726 error:
4727 DeleteFileA(msifile);
4728 DeleteFileA("msitest\\augustus");
4729 RemoveDirectoryA("msitest");
4732 static void test_int_widths( void )
4734 static const WCHAR msitestW[] = {'m','s','i','t','e','s','t','.','m','s','i',0};
4735 static const WCHAR msitableW[] = {'m','s','i','t','a','b','l','e','.','i','d','t',0};
4736 static const WCHAR slashW[] = {'\\',0};
4737 static const char int0[] = "int0\ni0\nint0\tint0\n1";
4738 static const char int1[] = "int1\ni1\nint1\tint1\n1";
4739 static const char int2[] = "int2\ni2\nint2\tint2\n1";
4740 static const char int3[] = "int3\ni3\nint3\tint3\n1";
4741 static const char int4[] = "int4\ni4\nint4\tint4\n1";
4742 static const char int5[] = "int5\ni5\nint5\tint5\n1";
4743 static const char int8[] = "int8\ni8\nint8\tint8\n1";
4744 static const struct
4746 const char *data;
4747 unsigned int size;
4748 UINT ret;
4750 tests[] =
4752 { int0, sizeof(int0) - 1, ERROR_SUCCESS },
4753 { int1, sizeof(int1) - 1, ERROR_SUCCESS },
4754 { int2, sizeof(int2) - 1, ERROR_SUCCESS },
4755 { int3, sizeof(int3) - 1, ERROR_FUNCTION_FAILED },
4756 { int4, sizeof(int4) - 1, ERROR_SUCCESS },
4757 { int5, sizeof(int5) - 1, ERROR_FUNCTION_FAILED },
4758 { int8, sizeof(int8) - 1, ERROR_FUNCTION_FAILED }
4760 WCHAR tmpdir[MAX_PATH], msitable[MAX_PATH], msidb[MAX_PATH];
4761 MSIHANDLE db;
4762 UINT r, i;
4764 GetTempPathW(MAX_PATH, tmpdir);
4765 CreateDirectoryW(tmpdir, NULL);
4767 lstrcpyW(msitable, tmpdir);
4768 lstrcatW(msitable, slashW);
4769 lstrcatW(msitable, msitableW);
4771 lstrcpyW(msidb, tmpdir);
4772 lstrcatW(msidb, slashW);
4773 lstrcatW(msidb, msitestW);
4775 r = MsiOpenDatabaseW(msidb, MSIDBOPEN_CREATE, &db);
4776 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4778 for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
4780 DWORD count;
4781 HANDLE handle = CreateFileW(msitable, GENERIC_WRITE, 0, NULL,
4782 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
4783 WriteFile(handle, tests[i].data, tests[i].size, &count, NULL);
4784 CloseHandle(handle);
4786 r = MsiDatabaseImportW(db, tmpdir, msitableW);
4787 ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r);
4789 r = MsiDatabaseCommit(db);
4790 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4791 DeleteFileW(msitable);
4794 MsiCloseHandle(db);
4795 DeleteFileW(msidb);
4796 RemoveDirectoryW(tmpdir);
4799 static void test_shortcut(void)
4801 UINT r;
4802 HRESULT hr;
4804 if (is_process_limited())
4806 skip("process is limited\n");
4807 return;
4810 create_test_files();
4811 create_database(msifile, sc_tables, sizeof(sc_tables) / sizeof(msi_table));
4813 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4815 r = MsiInstallProductA(msifile, NULL);
4816 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4818 skip("Not enough rights to perform tests\n");
4819 goto error;
4821 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4823 hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
4824 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
4826 r = MsiInstallProductA(msifile, NULL);
4827 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4829 CoUninitialize();
4831 hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
4832 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
4834 r = MsiInstallProductA(msifile, NULL);
4835 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4837 CoUninitialize();
4839 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4840 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4841 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4842 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4843 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4844 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4845 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4846 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4847 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4848 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
4849 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4850 while (!delete_pf("msitest\\Shortcut.lnk", TRUE) && GetLastError() == ERROR_SHARING_VIOLATION) Sleep(1000);
4851 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4853 error:
4854 delete_test_files();
4855 DeleteFileA(msifile);
4858 static void test_preselected(void)
4860 UINT r;
4862 if (is_process_limited())
4864 skip("process is limited\n");
4865 return;
4868 create_test_files();
4869 create_database(msifile, ps_tables, sizeof(ps_tables) / sizeof(msi_table));
4871 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4873 r = MsiInstallProductA(msifile, "ADDLOCAL=One");
4874 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4876 skip("Not enough rights to perform tests\n");
4877 goto error;
4879 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4881 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
4882 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
4883 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
4884 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
4885 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
4886 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
4887 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
4888 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
4889 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
4890 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
4891 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
4892 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4894 r = MsiInstallProductA(msifile, NULL);
4895 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4897 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4898 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4899 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4900 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4901 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4902 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4903 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4904 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4905 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4906 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
4907 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4908 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4910 error:
4911 delete_test_files();
4912 DeleteFileA(msifile);
4915 static void test_installed_prop(void)
4917 static const char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}";
4918 UINT r;
4920 if (is_process_limited())
4922 skip("process is limited\n");
4923 return;
4926 create_test_files();
4927 create_database(msifile, ip_tables, sizeof(ip_tables) / sizeof(msi_table));
4929 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4931 r = MsiInstallProductA(msifile, "FULL=1");
4932 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4934 skip("Not enough rights to perform tests\n");
4935 goto error;
4937 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4939 r = MsiInstallProductA(msifile, "FULL=1");
4940 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4942 r = MsiConfigureProductExA(prodcode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, "FULL=1");
4943 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4945 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4946 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4947 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4948 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4949 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4950 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4951 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4952 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4953 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4954 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
4955 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4956 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4958 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4959 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4961 error:
4962 delete_test_files();
4963 DeleteFileA(msifile);
4966 static void test_allusers_prop(void)
4968 UINT r;
4970 if (is_process_limited())
4972 skip("process is limited\n");
4973 return;
4976 create_test_files();
4977 create_database(msifile, aup_tables, sizeof(aup_tables) / sizeof(msi_table));
4979 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4981 /* ALLUSERS property unset */
4982 r = MsiInstallProductA(msifile, "FULL=1");
4983 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4985 skip("Not enough rights to perform tests\n");
4986 goto error;
4988 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4990 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4991 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4992 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4993 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4994 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4995 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4996 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4997 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4998 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4999 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5000 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5001 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5003 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5004 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5006 delete_test_files();
5008 create_test_files();
5009 create_database(msifile, aup2_tables, sizeof(aup2_tables) / sizeof(msi_table));
5011 /* ALLUSERS property set to 1 */
5012 r = MsiInstallProductA(msifile, "FULL=1");
5013 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5015 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5016 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5017 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5018 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5019 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5020 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5021 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5022 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5023 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5024 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5025 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5026 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5028 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5029 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5031 delete_test_files();
5033 create_test_files();
5034 create_database(msifile, aup3_tables, sizeof(aup3_tables) / sizeof(msi_table));
5036 /* ALLUSERS property set to 2 */
5037 r = MsiInstallProductA(msifile, "FULL=1");
5038 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5040 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5041 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5042 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5043 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5044 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5045 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5046 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5047 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5048 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5049 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5050 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5051 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5053 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5054 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5056 delete_test_files();
5058 create_test_files();
5059 create_database(msifile, aup4_tables, sizeof(aup4_tables) / sizeof(msi_table));
5061 /* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */
5062 r = MsiInstallProductA(msifile, "FULL=1");
5063 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5065 error:
5066 delete_test_files();
5067 DeleteFileA(msifile);
5070 static const char session_manager[] = "System\\CurrentControlSet\\Control\\Session Manager";
5071 static const char rename_ops[] = "PendingFileRenameOperations";
5073 static void process_pending_renames(HKEY hkey)
5075 char *buf, *src, *dst, *buf2, *buf2ptr;
5076 DWORD size;
5077 LONG ret;
5078 BOOL found = FALSE;
5080 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size);
5081 ok(!ret, "RegQueryValueExA failed %d\n", ret);
5083 buf = HeapAlloc(GetProcessHeap(), 0, size + 1);
5084 buf2ptr = buf2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 1);
5086 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size);
5087 buf[size] = 0;
5088 ok(!ret, "RegQueryValueExA failed %d\n", ret);
5089 if (ret) return;
5091 for (src = buf; *src; src = dst + strlen(dst) + 1)
5093 DWORD flags = MOVEFILE_COPY_ALLOWED;
5094 BOOL fileret;
5096 dst = src + strlen(src) + 1;
5098 if (!strstr(src, "msitest"))
5100 lstrcpyA(buf2ptr, src);
5101 buf2ptr += strlen(src) + 1;
5102 lstrcpyA(buf2ptr, dst);
5103 buf2ptr += strlen(dst) + 1;
5104 continue;
5107 found = TRUE;
5109 if (*dst == '!')
5111 flags |= MOVEFILE_REPLACE_EXISTING;
5112 dst++;
5114 if (src[0] == '\\' && src[1] == '?' && src[2] == '?' && src[3] == '\\') src += 4;
5115 if (*dst)
5117 if (dst[0] == '\\' && dst[1] == '?' && dst[2] == '?' && dst[3] == '\\') dst += 4;
5118 fileret = MoveFileExA(src, dst, flags);
5119 ok(fileret, "Failed to move file %s -> %s (%u)\n", src, dst, GetLastError());
5121 else
5123 fileret = DeleteFileA(src);
5124 ok(fileret || broken(!fileret) /* win2k3 */, "Failed to delete file %s (%u)\n", src, GetLastError());
5128 ok(found, "Expected a 'msitest' entry\n");
5130 if (*buf2)
5131 RegSetValueExA(hkey, rename_ops, 0, REG_MULTI_SZ, (LPBYTE)buf2, buf2ptr + 1 - buf2);
5132 else
5133 RegDeleteValueA(hkey, rename_ops);
5135 HeapFree(GetProcessHeap(), 0, buf);
5136 HeapFree(GetProcessHeap(), 0, buf2);
5139 static BOOL file_matches_data(LPCSTR file, LPCSTR data)
5141 DWORD len, data_len = strlen(data);
5142 HANDLE handle;
5143 char buf[128];
5145 handle = CreateFileA(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
5146 ok(handle != INVALID_HANDLE_VALUE, "failed to open %s (%u)\n", file, GetLastError());
5148 if (ReadFile(handle, buf, sizeof(buf), &len, NULL) && len >= data_len)
5150 CloseHandle(handle);
5151 return !memcmp(buf, data, data_len);
5153 CloseHandle(handle);
5154 return FALSE;
5157 static void test_file_in_use(void)
5159 UINT r;
5160 HANDLE file;
5161 HKEY hkey;
5162 char path[MAX_PATH];
5164 if (is_process_limited())
5166 skip("process is limited\n");
5167 return;
5170 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
5172 CreateDirectoryA("msitest", NULL);
5173 create_file("msitest\\maximus", 500);
5174 create_database(msifile, fiu_tables, sizeof(fiu_tables) / sizeof(msi_table));
5176 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5178 lstrcpyA(path, PROG_FILES_DIR);
5179 lstrcatA(path, "\\msitest");
5180 CreateDirectoryA(path, NULL);
5182 lstrcatA(path, "\\maximus");
5183 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
5185 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
5186 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5188 skip("Not enough rights to perform tests\n");
5189 goto error;
5191 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
5192 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
5193 CloseHandle(file);
5194 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
5196 process_pending_renames(hkey);
5197 RegCloseKey(hkey);
5199 ok(file_matches_data(path, "msitest\\maximus"), "Expected file to match\n");
5200 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
5201 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
5203 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5204 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5206 error:
5207 RegCloseKey(hkey);
5209 delete_pf("msitest\\maximus", TRUE);
5210 delete_pf("msitest", FALSE);
5211 DeleteFileA("msitest\\maximus");
5212 delete_test_files();
5213 DeleteFileA(msifile);
5216 static void test_file_in_use_cab(void)
5218 UINT r;
5219 HANDLE file;
5220 HKEY hkey;
5221 char path[MAX_PATH];
5223 if (is_process_limited())
5225 skip("process is limited\n");
5226 return;
5229 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
5231 CreateDirectoryA("msitest", NULL);
5232 create_file("maximus", 500);
5233 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
5234 DeleteFileA("maximus");
5236 create_database(msifile, fiuc_tables, sizeof(fiuc_tables) / sizeof(msi_table));
5238 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5240 lstrcpyA(path, PROG_FILES_DIR);
5241 lstrcatA(path, "\\msitest");
5242 CreateDirectoryA(path, NULL);
5244 lstrcatA(path, "\\maximus");
5245 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
5247 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
5248 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5250 skip("Not enough rights to perform tests\n");
5251 goto error;
5253 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
5254 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
5255 CloseHandle(file);
5256 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
5258 process_pending_renames(hkey);
5259 RegCloseKey(hkey);
5261 ok(file_matches_data(path, "maximus"), "Expected file to match\n");
5262 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
5263 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
5265 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5266 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5268 error:
5269 RegCloseKey(hkey);
5271 delete_pf("msitest\\maximus", TRUE);
5272 delete_pf("msitest", FALSE);
5273 DeleteFileA("msitest\\maximus");
5274 delete_cab_files();
5275 delete_test_files();
5276 DeleteFileA(msifile);
5279 static void test_feature_override(void)
5281 UINT r;
5282 REGSAM access = KEY_ALL_ACCESS;
5284 if (is_process_limited())
5286 skip("process is limited\n");
5287 return;
5290 create_test_files();
5291 create_file("msitest\\override.txt", 1000);
5292 create_file("msitest\\preselected.txt", 1000);
5293 create_file("msitest\\notpreselected.txt", 1000);
5294 create_database(msifile, fo_tables, sizeof(fo_tables) / sizeof(msi_table));
5296 if (is_wow64)
5297 access |= KEY_WOW64_64KEY;
5299 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5301 r = MsiInstallProductA(msifile, "ADDLOCAL=override");
5302 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5304 skip("Not enough rights to perform tests\n");
5305 goto error;
5307 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5309 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5310 ok(!pf_exists("msitest\\preselected.txt"), "file installed\n");
5311 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5313 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5314 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5316 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5318 r = MsiInstallProductA(msifile, "preselect=1");
5319 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5321 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5322 ok(pf_exists("msitest\\preselected.txt"), "file not installed\n");
5323 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5325 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5326 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5328 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5329 todo_wine {
5330 ok(delete_pf("msitest\\preselected.txt", TRUE), "file removed\n");
5331 ok(delete_pf("msitest", FALSE), "directory removed\n");
5334 r = MsiInstallProductA(msifile, NULL);
5335 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5337 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5338 ok(pf_exists("msitest\\preselected.txt"), "file not installed\n");
5339 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5341 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5342 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5344 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5345 todo_wine {
5346 ok(delete_pf("msitest\\preselected.txt", TRUE), "file removed\n");
5347 ok(delete_pf("msitest", FALSE), "directory removed\n");
5350 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", access);
5352 error:
5353 DeleteFileA("msitest\\override.txt");
5354 DeleteFileA("msitest\\preselected.txt");
5355 DeleteFileA("msitest\\notpreselected.txt");
5356 delete_test_files();
5357 DeleteFileA(msifile);
5360 static void test_icon_table(void)
5362 MSIHANDLE hdb = 0, record;
5363 LPCSTR query;
5364 UINT res;
5365 CHAR path[MAX_PATH];
5366 static const char prodcode[] = "{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}";
5368 if (is_process_limited())
5370 skip("process is limited\n");
5371 return;
5374 create_database(msifile, icon_base_tables, sizeof(icon_base_tables) / sizeof(msi_table));
5376 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5378 res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb);
5379 ok(res == ERROR_SUCCESS, "failed to open db: %d\n", res);
5381 query = "CREATE TABLE `Icon` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)";
5382 res = run_query( hdb, 0, query );
5383 ok(res == ERROR_SUCCESS, "Can't create Icon table: %d\n", res);
5385 create_file("icon.ico", 100);
5386 record = MsiCreateRecord(1);
5387 res = MsiRecordSetStreamA(record, 1, "icon.ico");
5388 ok(res == ERROR_SUCCESS, "Failed to add stream data to record: %d\n", res);
5390 query = "INSERT INTO `Icon` (`Name`, `Data`) VALUES ('testicon', ?)";
5391 res = run_query(hdb, record, query);
5392 ok(res == ERROR_SUCCESS, "Insert into Icon table failed: %d\n", res);
5394 res = MsiCloseHandle(record);
5395 ok(res == ERROR_SUCCESS, "Failed to close record handle: %d\n", res);
5396 DeleteFileA("icon.ico");
5397 res = MsiDatabaseCommit(hdb);
5398 ok(res == ERROR_SUCCESS, "Failed to commit database: %d\n", res);
5399 res = MsiCloseHandle(hdb);
5400 ok(res == ERROR_SUCCESS, "Failed to close database: %d\n", res);
5402 /* per-user */
5403 res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
5404 if (res == ERROR_INSTALL_PACKAGE_REJECTED)
5406 skip("Not enough rights to perform tests\n");
5407 DeleteFileA(msifile);
5408 return;
5410 ok(res == ERROR_SUCCESS, "Failed to do per-user install: %d\n", res);
5412 lstrcpyA(path, APP_DATA_DIR);
5413 lstrcatA(path, "\\");
5414 lstrcatA(path, "Microsoft\\Installer\\");
5415 lstrcatA(path, prodcode);
5416 lstrcatA(path, "\\testicon");
5417 ok(file_exists(path), "Per-user icon file isn't where it's expected (%s)\n", path);
5419 res = MsiInstallProductA(msifile, "REMOVE=ALL");
5420 ok(res == ERROR_SUCCESS, "Failed to uninstall per-user\n");
5421 ok(!file_exists(path), "Per-user icon file not removed (%s)\n", path);
5423 /* system-wide */
5424 res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
5425 ok(res == ERROR_SUCCESS, "Failed to system-wide install: %d\n", res);
5427 lstrcpyA(path, WINDOWS_DIR);
5428 lstrcatA(path, "\\");
5429 lstrcatA(path, "Installer\\");
5430 lstrcatA(path, prodcode);
5431 lstrcatA(path, "\\testicon");
5432 ok(file_exists(path), "System-wide icon file isn't where it's expected (%s)\n", path);
5434 res = MsiInstallProductA(msifile, "REMOVE=ALL");
5435 ok(res == ERROR_SUCCESS, "Failed to uninstall system-wide\n");
5436 ok(!file_exists(path), "System-wide icon file not removed (%s)\n", path);
5438 delete_pfmsitest_files();
5439 DeleteFileA(msifile);
5442 static void test_package_validation(void)
5444 UINT r;
5446 if (is_process_limited())
5448 skip("process is limited\n");
5449 return;
5452 CreateDirectoryA("msitest", NULL);
5453 create_file("msitest\\maximus", 500);
5454 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;1033");
5456 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5458 r = MsiInstallProductA(msifile, NULL);
5459 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5461 skip("Not enough rights to perform tests\n");
5462 goto error;
5464 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5465 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5466 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5468 DeleteFileA(msifile);
5469 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,9999;9999");
5471 r = MsiInstallProductA(msifile, NULL);
5472 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5474 DeleteFileA(msifile);
5475 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,1033;9999");
5477 r = MsiInstallProductA(msifile, NULL);
5478 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5480 DeleteFileA(msifile);
5481 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,9999;1033");
5483 r = MsiInstallProductA(msifile, NULL);
5484 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5485 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5486 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5488 DeleteFileA(msifile);
5489 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel64,9999;1033");
5491 r = MsiInstallProductA(msifile, NULL);
5492 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5494 DeleteFileA(msifile);
5495 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel32,1033;1033");
5497 r = MsiInstallProductA(msifile, NULL);
5498 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5500 DeleteFileA(msifile);
5501 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel32,9999;1033");
5503 r = MsiInstallProductA(msifile, NULL);
5504 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5506 DeleteFileA(msifile);
5507 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;9999");
5509 r = MsiInstallProductA(msifile, NULL);
5510 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5511 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5512 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5514 if (GetSystemDefaultLangID() == MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ))
5516 DeleteFileA(msifile);
5517 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;9");
5518 r = MsiInstallProductA(msifile, NULL);
5519 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5520 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5521 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5523 DeleteFileA(msifile);
5524 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;1024");
5525 r = MsiInstallProductA(msifile, NULL);
5526 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5527 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5528 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5531 DeleteFileA(msifile);
5532 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel32;0");
5534 r = MsiInstallProductA(msifile, NULL);
5535 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5536 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5537 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5539 if (is_64bit && !is_wow64)
5541 DeleteFileA(msifile);
5542 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5544 r = MsiInstallProductA(msifile, NULL);
5545 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5546 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5547 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5549 DeleteFileA(msifile);
5550 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5552 r = MsiInstallProductA(msifile, NULL);
5553 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
5554 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5555 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5557 DeleteFileA(msifile);
5558 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5560 r = MsiInstallProductA(msifile, NULL);
5561 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5562 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5563 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5565 else if (is_wow64)
5567 DeleteFileA(msifile);
5568 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5570 r = MsiInstallProductA(msifile, NULL);
5571 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5572 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5573 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5575 DeleteFileA(msifile);
5576 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5578 r = MsiInstallProductA(msifile, NULL);
5579 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
5580 ok(!delete_pf_native("msitest\\maximus", TRUE), "file exists\n");
5581 ok(!delete_pf_native("msitest", FALSE), "directory exists\n");
5583 DeleteFileA(msifile);
5584 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5586 r = MsiInstallProductA(msifile, NULL);
5587 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5588 ok(delete_pf_native("msitest\\maximus", TRUE), "file exists\n");
5589 ok(delete_pf_native("msitest", FALSE), "directory exists\n");
5591 else
5593 DeleteFileA(msifile);
5594 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5596 r = MsiInstallProductA(msifile, NULL);
5597 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5598 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5599 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5601 DeleteFileA(msifile);
5602 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Alpha,Beta,Intel;0");
5604 r = MsiInstallProductA(msifile, NULL);
5605 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5606 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5607 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5609 DeleteFileA(msifile);
5610 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5612 r = MsiInstallProductA(msifile, NULL);
5613 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5614 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5615 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5617 DeleteFileA(msifile);
5618 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5620 r = MsiInstallProductA(msifile, NULL);
5621 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5622 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5623 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5626 error:
5627 /* Delete the files in the temp (current) folder */
5628 DeleteFileA(msifile);
5629 DeleteFileA("msitest\\maximus");
5630 RemoveDirectoryA("msitest");
5633 static void test_upgrade_code(void)
5635 UINT r;
5637 if (is_process_limited())
5639 skip("process is limited\n");
5640 return;
5643 CreateDirectoryA("msitest", NULL);
5644 create_file("msitest\\upgradecode.txt", 1000);
5645 create_database(msifile, uc_tables, sizeof(uc_tables) / sizeof(msi_table));
5647 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5649 r = MsiInstallProductA(msifile, NULL);
5650 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5652 ok(pf_exists("msitest\\upgradecode.txt"), "file not installed\n");
5654 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5655 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5657 ok(!delete_pf("msitest\\upgradecode.txt", TRUE), "file not removed\n");
5658 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5660 DeleteFileA("msitest\\upgradecode.txt");
5661 RemoveDirectoryA("msitest");
5662 DeleteFileA(msifile);
5665 static void test_mixed_package(void)
5667 UINT r;
5668 LONG res;
5669 HKEY hkey;
5670 char value[MAX_PATH];
5671 DWORD size;
5673 if (is_process_limited())
5675 skip("process is limited\n");
5676 return;
5678 if (!is_wow64 && !is_64bit)
5680 skip("this test must be run on 64-bit\n");
5681 return;
5683 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5684 create_database_template(msifile, mixed_tables, sizeof(mixed_tables)/sizeof(msi_table), 200, "x64;1033");
5686 r = MsiInstallProductA(msifile, NULL);
5687 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5689 skip("Not enough rights to perform tests\n");
5690 goto error;
5692 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5694 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5695 ok(!res, "can't open 32-bit component key, got %d\n", res);
5696 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5697 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5698 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5699 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5700 RegCloseKey(hkey);
5702 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5703 ok(!res, "can't open 64-bit component key, got %d\n", res);
5704 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5705 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5706 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5707 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5708 RegCloseKey(hkey);
5710 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5711 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5712 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5713 ok(res == ERROR_SUCCESS, "can't open 32-bit CLSID key, got %d\n", res);
5714 if (res == ERROR_SUCCESS) {
5715 size = sizeof(value);
5716 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5717 ok(!strcmp(value, "winetest32.dll"), "got %s\n", value);
5718 RegCloseKey(hkey);
5721 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5722 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5723 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5724 ok(res == ERROR_SUCCESS, "can't open 64-bit CLSID key, got %d\n", res);
5725 if (res == ERROR_SUCCESS) {
5726 size = sizeof(value);
5727 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5728 ok(!strcmp(value, "winetest64.dll"), "got %s\n", value);
5729 RegCloseKey(hkey);
5732 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5733 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5735 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5736 ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
5738 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5739 ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
5741 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5742 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5743 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5744 ok(res == ERROR_FILE_NOT_FOUND, "32-bit CLSID key not removed\n");
5746 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5747 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5748 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5749 ok(res == ERROR_FILE_NOT_FOUND, "64-bit CLSID key not removed\n");
5751 DeleteFileA( msifile );
5752 create_database_template(msifile, mixed_tables, sizeof(mixed_tables)/sizeof(msi_table), 200, "Intel;1033");
5754 r = MsiInstallProductA(msifile, NULL);
5755 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5757 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5758 ok(!res, "can't open 32-bit component key, got %d\n", res);
5759 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5760 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5761 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5762 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5763 RegCloseKey(hkey);
5765 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5766 ok(!res, "can't open 64-bit component key, got %d\n", res);
5767 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5768 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5769 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5770 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5771 RegCloseKey(hkey);
5773 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5774 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5775 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5776 ok(res == ERROR_SUCCESS, "can't open 32-bit CLSID key, got %d\n", res);
5777 if (res == ERROR_SUCCESS) {
5778 size = sizeof(value);
5779 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5780 ok(!strcmp(value, "winetest32.dll"), "got %s\n", value);
5781 RegCloseKey(hkey);
5784 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5785 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5786 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5787 ok(res == ERROR_SUCCESS, "can't open 64-bit CLSID key, got %d\n", res);
5788 if (res == ERROR_SUCCESS) {
5789 size = sizeof(value);
5790 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5791 ok(!strcmp(value, "winetest64.dll"), "got %s\n", value);
5792 RegCloseKey(hkey);
5795 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5796 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5798 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5799 ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
5801 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5802 ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
5804 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5805 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5806 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5807 ok(res == ERROR_FILE_NOT_FOUND, "32-bit CLSID key not removed\n");
5809 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5810 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5811 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5812 ok(res == ERROR_FILE_NOT_FOUND, "64-bit CLSID key not removed\n");
5814 error:
5815 DeleteFileA( msifile );
5818 static void test_volume_props(void)
5820 UINT r;
5822 if (is_process_limited())
5824 skip("process is limited\n");
5825 return;
5827 CreateDirectoryA("msitest", NULL);
5828 create_file("msitest\\volumeprop.txt", 1000);
5829 create_database(msifile, vp_tables, sizeof(vp_tables)/sizeof(msi_table));
5831 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5833 r = MsiInstallProductA(msifile, NULL);
5834 ok(r == ERROR_SUCCESS, "got %u\n", r);
5836 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5837 ok(r == ERROR_SUCCESS, "got %u\n", r);
5839 DeleteFileA("msitest\\volumeprop.txt");
5840 RemoveDirectoryA("msitest");
5841 DeleteFileA(msifile);
5844 static void test_shared_component(void)
5846 UINT r;
5848 if (is_process_limited())
5850 skip("process is limited\n");
5851 return;
5853 CreateDirectoryA("msitest", NULL);
5854 create_file("msitest\\sharedcomponent.txt", 1000);
5855 create_database_wordcount(msifile, shc_tables, sizeof(shc_tables)/sizeof(shc_tables[0]),
5856 100, 0, ";", "{A8826420-FD72-4E61-9E15-C1944CF4CBE1}");
5857 create_database_wordcount(msifile2, shc2_tables, sizeof(shc2_tables)/sizeof(shc2_tables[0]),
5858 100, 0, ";", "{A8B50B30-0E8A-4ACD-B3CF-1A5DC58B2739}");
5860 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5862 r = MsiInstallProductA(msifile, NULL);
5863 ok(r == ERROR_SUCCESS, "got %u\n", r);
5865 ok(pf_exists("msitest\\sharedcomponent.txt"), "file not installed\n");
5867 r = MsiInstallProductA(msifile2, NULL);
5868 ok(r == ERROR_SUCCESS, "got %u\n", r);
5870 ok(pf_exists("msitest\\sharedcomponent.txt"), "file not installed\n");
5872 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5873 ok(r == ERROR_SUCCESS, "got %u\n", r);
5875 ok(pf_exists("msitest\\sharedcomponent.txt"), "file removed\n");
5877 r = MsiInstallProductA(msifile2, "REMOVE=ALL");
5878 ok(r == ERROR_SUCCESS, "got %u\n", r);
5880 ok(!pf_exists("msitest\\sharedcomponent.txt"), "file not removed\n");
5882 DeleteFileA("msitest\\sharedcomponent.txt");
5883 RemoveDirectoryA("msitest");
5884 DeleteFileA(msifile);
5885 DeleteFileA(msifile2);
5888 START_TEST(install)
5890 DWORD len;
5891 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
5892 STATEMGRSTATUS status;
5893 BOOL ret = FALSE;
5895 init_functionpointers();
5897 if (pIsWow64Process)
5898 pIsWow64Process(GetCurrentProcess(), &is_wow64);
5900 GetCurrentDirectoryA(MAX_PATH, prev_path);
5901 GetTempPathA(MAX_PATH, temp_path);
5902 SetCurrentDirectoryA(temp_path);
5904 lstrcpyA(CURR_DIR, temp_path);
5905 len = lstrlenA(CURR_DIR);
5907 if(len && (CURR_DIR[len - 1] == '\\'))
5908 CURR_DIR[len - 1] = 0;
5910 ok(get_system_dirs(), "failed to retrieve system dirs\n");
5911 ok(get_user_dirs(), "failed to retrieve user dirs\n");
5913 /* Create a restore point ourselves so we circumvent the multitude of restore points
5914 * that would have been created by all the installation and removal tests.
5916 * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
5917 * creation of restore points.
5919 if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
5921 memset(&status, 0, sizeof(status));
5922 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
5925 /* Create only one log file and don't append. We have to pass something
5926 * for the log mode for this to work. The logfile needs to have an absolute
5927 * path otherwise we still end up with some extra logfiles as some tests
5928 * change the current directory.
5930 lstrcpyA(log_file, temp_path);
5931 lstrcatA(log_file, "\\msitest.log");
5932 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
5934 if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */
5935 test_MsiInstallProduct();
5936 test_MsiSetComponentState();
5937 test_packagecoltypes();
5938 test_continuouscabs();
5939 test_caborder();
5940 test_mixedmedia();
5941 test_samesequence();
5942 test_uiLevelFlags();
5943 test_readonlyfile();
5944 test_readonlyfile_cab();
5945 test_setdirproperty();
5946 test_cabisextracted();
5947 test_transformprop();
5948 test_currentworkingdir();
5949 test_admin();
5950 test_adminprops();
5951 test_missingcab();
5952 test_sourcefolder();
5953 test_customaction51();
5954 test_installstate();
5955 test_sourcepath();
5956 test_missingcomponent();
5957 test_sourcedirprop();
5958 test_adminimage();
5959 test_propcase();
5960 test_int_widths();
5961 test_shortcut();
5962 test_preselected();
5963 test_installed_prop();
5964 test_file_in_use();
5965 test_file_in_use_cab();
5966 test_allusers_prop();
5967 test_feature_override();
5968 test_icon_table();
5969 test_package_validation();
5970 test_upgrade_code();
5971 test_mixed_package();
5972 test_volume_props();
5973 test_shared_component();
5975 DeleteFileA(log_file);
5977 if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
5979 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
5980 if (ret)
5981 remove_restore_point(status.llSequenceNumber);
5983 FreeLibrary(hsrclient);
5985 SetCurrentDirectoryA(prev_path);