po: Update German translation.
[wine.git] / dlls / msi / tests / install.c
blob9d4fecc3eeb8a2ea24b878ddd99616368dc9aaaf
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 static const char ft_file_dat[] =
1226 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1227 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1228 "File\tFile\n"
1229 "featuretree\tcomp\tfeaturetree.txt\t1000\t\t\t8192\t1\n";
1231 static const char ft_comp_dat[] =
1232 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1233 "s72\tS38\ts72\ti2\tS255\tS72\n"
1234 "Component\tComponent\n"
1235 "comp\t{12345678-1234-1234-1234-222222222222}\tTARGETDIR\t0\t\t\n"
1236 "comp2\t{12345678-1234-1234-1234-333333333333}\tTARGETDIR\t0\t\tfeaturetree\n";
1238 static const char ft_feature_dat[] =
1239 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1240 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1241 "Feature\tFeature\n"
1242 "A\t\t\t\t2\t1\t\t0\n"
1243 "C\tB\t\t\t2\t1\t\t0\n"
1244 "B\tA\t\t\t4\t1\t\t0\n"
1245 "D\t\t\t\t2\t1\t\t0\n";
1247 static const char ft_feature_comp_dat[] =
1248 "Feature_\tComponent_\n"
1249 "s38\ts72\n"
1250 "FeatureComponents\tFeature_\tComponent_\n"
1251 "C\tcomp\n"
1252 "D\tcomp2\n";
1254 static const char ft_condition_dat[] =
1255 "Feature_\tLevel\tCondition\n"
1256 "s38\ti2\tS255\n"
1257 "Condition\tFeature_\tLevel\n"
1258 "A\t0\t\"0\"<>INSTALLTYPE\n";
1260 static const char ft_custom_action_dat[] =
1261 "Action\tType\tSource\tTarget\tISComments\n"
1262 "s72\ti2\tS64\tS0\tS255\n"
1263 "CustomAction\tAction\n"
1264 "Run A\t19\t\tA\t\n"
1265 "Run B\t19\t\tB\t\n"
1266 "Run C\t19\t\tC\t\n";
1268 static const char ft_install_exec_seq_dat[] =
1269 "Action\tCondition\tSequence\n"
1270 "s72\tS255\tI2\n"
1271 "InstallExecuteSequence\tAction\n"
1272 "CostInitialize\t\t100\n"
1273 "FileCost\t\t200\n"
1274 "CostFinalize\t\t300\n"
1275 "InstallValidate\t\t400\n"
1276 "InstallInitialize\t\t500\n"
1277 "Run C\t3 = &C AND NOT Installed\t600\n"
1278 "Run B\t3 = &B AND NOT Installed\t700\n"
1279 "Run A\t3 = &A AND NOT Installed\t800\n"
1280 "ProcessComponents\t\t900\n"
1281 "RemoveFiles\t\t1000\n"
1282 "InstallFiles\t\t1100\n"
1283 "RegisterProduct\t\t1200\n"
1284 "PublishFeatures\t\t1300\n"
1285 "PublishProduct\t\t1400\n"
1286 "InstallFinalize\t\t1500\n";
1288 typedef struct _msi_table
1290 const CHAR *filename;
1291 const CHAR *data;
1292 int size;
1293 } msi_table;
1295 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
1297 static const msi_table tables[] =
1299 ADD_TABLE(component),
1300 ADD_TABLE(directory),
1301 ADD_TABLE(feature),
1302 ADD_TABLE(feature_comp),
1303 ADD_TABLE(file),
1304 ADD_TABLE(install_exec_seq),
1305 ADD_TABLE(media),
1306 ADD_TABLE(property),
1307 ADD_TABLE(registry),
1308 ADD_TABLE(service_install),
1309 ADD_TABLE(service_control)
1312 static const msi_table sc_tables[] =
1314 ADD_TABLE(component),
1315 ADD_TABLE(directory),
1316 ADD_TABLE(feature),
1317 ADD_TABLE(feature_comp),
1318 ADD_TABLE(file),
1319 ADD_TABLE(install_exec_seq),
1320 ADD_TABLE(media),
1321 ADD_TABLE(property),
1322 ADD_TABLE(shortcut)
1325 static const msi_table ps_tables[] =
1327 ADD_TABLE(component),
1328 ADD_TABLE(directory),
1329 ADD_TABLE(feature),
1330 ADD_TABLE(feature_comp),
1331 ADD_TABLE(file),
1332 ADD_TABLE(install_exec_seq),
1333 ADD_TABLE(media),
1334 ADD_TABLE(property),
1335 ADD_TABLE(condition)
1338 static const msi_table up_tables[] =
1340 ADD_TABLE(component),
1341 ADD_TABLE(directory),
1342 ADD_TABLE(feature),
1343 ADD_TABLE(feature_comp),
1344 ADD_TABLE(file),
1345 ADD_TABLE(install_exec_seq),
1346 ADD_TABLE(media),
1347 ADD_TABLE(up_property),
1348 ADD_TABLE(registry),
1349 ADD_TABLE(service_install),
1350 ADD_TABLE(service_control)
1353 static const msi_table up2_tables[] =
1355 ADD_TABLE(component),
1356 ADD_TABLE(directory),
1357 ADD_TABLE(feature),
1358 ADD_TABLE(feature_comp),
1359 ADD_TABLE(file),
1360 ADD_TABLE(install_exec_seq),
1361 ADD_TABLE(media),
1362 ADD_TABLE(up2_property),
1363 ADD_TABLE(registry),
1364 ADD_TABLE(service_install),
1365 ADD_TABLE(service_control)
1368 static const msi_table up3_tables[] =
1370 ADD_TABLE(component),
1371 ADD_TABLE(directory),
1372 ADD_TABLE(feature),
1373 ADD_TABLE(feature_comp),
1374 ADD_TABLE(file),
1375 ADD_TABLE(install_exec_seq),
1376 ADD_TABLE(media),
1377 ADD_TABLE(up3_property),
1378 ADD_TABLE(registry),
1379 ADD_TABLE(service_install),
1380 ADD_TABLE(service_control)
1383 static const msi_table up4_tables[] =
1385 ADD_TABLE(component),
1386 ADD_TABLE(directory),
1387 ADD_TABLE(feature),
1388 ADD_TABLE(feature_comp),
1389 ADD_TABLE(file),
1390 ADD_TABLE(pp_install_exec_seq),
1391 ADD_TABLE(media),
1392 ADD_TABLE(property),
1393 ADD_TABLE(registry),
1394 ADD_TABLE(service_install),
1395 ADD_TABLE(service_control)
1398 static const msi_table up5_tables[] =
1400 ADD_TABLE(component),
1401 ADD_TABLE(directory),
1402 ADD_TABLE(feature),
1403 ADD_TABLE(feature_comp),
1404 ADD_TABLE(file),
1405 ADD_TABLE(pp_install_exec_seq),
1406 ADD_TABLE(media),
1407 ADD_TABLE(up_property),
1408 ADD_TABLE(registry),
1409 ADD_TABLE(service_install),
1410 ADD_TABLE(service_control)
1413 static const msi_table up6_tables[] =
1415 ADD_TABLE(component),
1416 ADD_TABLE(directory),
1417 ADD_TABLE(feature),
1418 ADD_TABLE(feature_comp),
1419 ADD_TABLE(file),
1420 ADD_TABLE(pp_install_exec_seq),
1421 ADD_TABLE(media),
1422 ADD_TABLE(up2_property),
1423 ADD_TABLE(registry),
1424 ADD_TABLE(service_install),
1425 ADD_TABLE(service_control)
1428 static const msi_table up7_tables[] =
1430 ADD_TABLE(component),
1431 ADD_TABLE(directory),
1432 ADD_TABLE(feature),
1433 ADD_TABLE(feature_comp),
1434 ADD_TABLE(file),
1435 ADD_TABLE(pp_install_exec_seq),
1436 ADD_TABLE(media),
1437 ADD_TABLE(up3_property),
1438 ADD_TABLE(registry),
1439 ADD_TABLE(service_install),
1440 ADD_TABLE(service_control)
1443 static const msi_table cc_tables[] =
1445 ADD_TABLE(cc_component),
1446 ADD_TABLE(directory),
1447 ADD_TABLE(cc_feature),
1448 ADD_TABLE(cc_feature_comp),
1449 ADD_TABLE(cc_file),
1450 ADD_TABLE(install_exec_seq),
1451 ADD_TABLE(cc_media),
1452 ADD_TABLE(property),
1455 static const msi_table cc2_tables[] =
1457 ADD_TABLE(cc2_component),
1458 ADD_TABLE(directory),
1459 ADD_TABLE(cc_feature),
1460 ADD_TABLE(cc_feature_comp),
1461 ADD_TABLE(cc2_file),
1462 ADD_TABLE(install_exec_seq),
1463 ADD_TABLE(cc_media),
1464 ADD_TABLE(property),
1467 static const msi_table cc3_tables[] =
1469 ADD_TABLE(cc_component),
1470 ADD_TABLE(directory),
1471 ADD_TABLE(cc_feature),
1472 ADD_TABLE(cc_feature_comp),
1473 ADD_TABLE(cc_file),
1474 ADD_TABLE(install_exec_seq),
1475 ADD_TABLE(cc3_media),
1476 ADD_TABLE(property),
1479 static const msi_table co_tables[] =
1481 ADD_TABLE(cc_component),
1482 ADD_TABLE(directory),
1483 ADD_TABLE(cc_feature),
1484 ADD_TABLE(cc_feature_comp),
1485 ADD_TABLE(co_file),
1486 ADD_TABLE(install_exec_seq),
1487 ADD_TABLE(co_media),
1488 ADD_TABLE(property),
1491 static const msi_table co2_tables[] =
1493 ADD_TABLE(cc_component),
1494 ADD_TABLE(directory),
1495 ADD_TABLE(cc_feature),
1496 ADD_TABLE(cc_feature_comp),
1497 ADD_TABLE(cc_file),
1498 ADD_TABLE(install_exec_seq),
1499 ADD_TABLE(co2_media),
1500 ADD_TABLE(property),
1503 static const msi_table mm_tables[] =
1505 ADD_TABLE(cc_component),
1506 ADD_TABLE(directory),
1507 ADD_TABLE(cc_feature),
1508 ADD_TABLE(cc_feature_comp),
1509 ADD_TABLE(mm_file),
1510 ADD_TABLE(install_exec_seq),
1511 ADD_TABLE(mm_media),
1512 ADD_TABLE(property),
1515 static const msi_table ss_tables[] =
1517 ADD_TABLE(cc_component),
1518 ADD_TABLE(directory),
1519 ADD_TABLE(cc_feature),
1520 ADD_TABLE(cc_feature_comp),
1521 ADD_TABLE(cc_file),
1522 ADD_TABLE(install_exec_seq),
1523 ADD_TABLE(ss_media),
1524 ADD_TABLE(property),
1527 static const msi_table ui_tables[] =
1529 ADD_TABLE(ui_component),
1530 ADD_TABLE(directory),
1531 ADD_TABLE(cc_feature),
1532 ADD_TABLE(cc_feature_comp),
1533 ADD_TABLE(cc_file),
1534 ADD_TABLE(install_exec_seq),
1535 ADD_TABLE(ui_install_ui_seq),
1536 ADD_TABLE(ui_custom_action),
1537 ADD_TABLE(cc_media),
1538 ADD_TABLE(property),
1541 static const msi_table rof_tables[] =
1543 ADD_TABLE(rof_component),
1544 ADD_TABLE(directory),
1545 ADD_TABLE(rof_feature),
1546 ADD_TABLE(rof_feature_comp),
1547 ADD_TABLE(rof_file),
1548 ADD_TABLE(install_exec_seq),
1549 ADD_TABLE(rof_media),
1550 ADD_TABLE(property),
1553 static const msi_table rofc_tables[] =
1555 ADD_TABLE(rof_component),
1556 ADD_TABLE(directory),
1557 ADD_TABLE(rof_feature),
1558 ADD_TABLE(rof_feature_comp),
1559 ADD_TABLE(rofc_file),
1560 ADD_TABLE(install_exec_seq),
1561 ADD_TABLE(rofc_media),
1562 ADD_TABLE(property),
1565 static const msi_table sdp_tables[] =
1567 ADD_TABLE(rof_component),
1568 ADD_TABLE(directory),
1569 ADD_TABLE(rof_feature),
1570 ADD_TABLE(rof_feature_comp),
1571 ADD_TABLE(rof_file),
1572 ADD_TABLE(sdp_install_exec_seq),
1573 ADD_TABLE(sdp_custom_action),
1574 ADD_TABLE(rof_media),
1575 ADD_TABLE(property),
1578 static const msi_table cie_tables[] =
1580 ADD_TABLE(cie_component),
1581 ADD_TABLE(directory),
1582 ADD_TABLE(cc_feature),
1583 ADD_TABLE(cie_feature_comp),
1584 ADD_TABLE(cie_file),
1585 ADD_TABLE(install_exec_seq),
1586 ADD_TABLE(cie_media),
1587 ADD_TABLE(property),
1590 static const msi_table tp_tables[] =
1592 ADD_TABLE(tp_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 cwd_tables[] =
1604 ADD_TABLE(cwd_component),
1605 ADD_TABLE(directory),
1606 ADD_TABLE(rof_feature),
1607 ADD_TABLE(ci2_feature_comp),
1608 ADD_TABLE(ci2_file),
1609 ADD_TABLE(install_exec_seq),
1610 ADD_TABLE(rof_media),
1611 ADD_TABLE(property),
1614 static const msi_table adm_tables[] =
1616 ADD_TABLE(adm_component),
1617 ADD_TABLE(directory),
1618 ADD_TABLE(rof_feature),
1619 ADD_TABLE(ci2_feature_comp),
1620 ADD_TABLE(ci2_file),
1621 ADD_TABLE(install_exec_seq),
1622 ADD_TABLE(rof_media),
1623 ADD_TABLE(property),
1624 ADD_TABLE(adm_custom_action),
1625 ADD_TABLE(adm_admin_exec_seq),
1628 static const msi_table amp_tables[] =
1630 ADD_TABLE(amp_component),
1631 ADD_TABLE(directory),
1632 ADD_TABLE(rof_feature),
1633 ADD_TABLE(ci2_feature_comp),
1634 ADD_TABLE(ci2_file),
1635 ADD_TABLE(install_exec_seq),
1636 ADD_TABLE(rof_media),
1637 ADD_TABLE(property),
1640 static const msi_table mc_tables[] =
1642 ADD_TABLE(mc_component),
1643 ADD_TABLE(directory),
1644 ADD_TABLE(cc_feature),
1645 ADD_TABLE(cie_feature_comp),
1646 ADD_TABLE(mc_file),
1647 ADD_TABLE(install_exec_seq),
1648 ADD_TABLE(mc_media),
1649 ADD_TABLE(property),
1650 ADD_TABLE(mc_file_hash),
1653 static const msi_table sf_tables[] =
1655 ADD_TABLE(wrv_component),
1656 ADD_TABLE(directory),
1657 ADD_TABLE(rof_feature),
1658 ADD_TABLE(ci2_feature_comp),
1659 ADD_TABLE(ci2_file),
1660 ADD_TABLE(install_exec_seq),
1661 ADD_TABLE(rof_media),
1662 ADD_TABLE(property),
1665 static const msi_table ca51_tables[] =
1667 ADD_TABLE(ca51_component),
1668 ADD_TABLE(directory),
1669 ADD_TABLE(rof_feature),
1670 ADD_TABLE(ci2_feature_comp),
1671 ADD_TABLE(ci2_file),
1672 ADD_TABLE(ca51_install_exec_seq),
1673 ADD_TABLE(rof_media),
1674 ADD_TABLE(property),
1675 ADD_TABLE(ca51_custom_action),
1678 static const msi_table is_tables[] =
1680 ADD_TABLE(is_component),
1681 ADD_TABLE(directory),
1682 ADD_TABLE(is_feature),
1683 ADD_TABLE(is_feature_comp),
1684 ADD_TABLE(is_file),
1685 ADD_TABLE(install_exec_seq),
1686 ADD_TABLE(is_media),
1687 ADD_TABLE(property),
1690 static const msi_table sp_tables[] =
1692 ADD_TABLE(sp_component),
1693 ADD_TABLE(sp_directory),
1694 ADD_TABLE(rof_feature),
1695 ADD_TABLE(ci2_feature_comp),
1696 ADD_TABLE(ci2_file),
1697 ADD_TABLE(install_exec_seq),
1698 ADD_TABLE(rof_media),
1699 ADD_TABLE(property),
1702 static const msi_table mcp_tables[] =
1704 ADD_TABLE(mcp_component),
1705 ADD_TABLE(directory),
1706 ADD_TABLE(mcp_feature),
1707 ADD_TABLE(mcp_feature_comp),
1708 ADD_TABLE(mcp_file),
1709 ADD_TABLE(rem_install_exec_seq),
1710 ADD_TABLE(rof_media),
1711 ADD_TABLE(property),
1714 static const msi_table ai_tables[] =
1716 ADD_TABLE(component),
1717 ADD_TABLE(directory),
1718 ADD_TABLE(feature),
1719 ADD_TABLE(feature_comp),
1720 ADD_TABLE(ai_file),
1721 ADD_TABLE(install_exec_seq),
1722 ADD_TABLE(media),
1723 ADD_TABLE(property)
1726 static const msi_table pc_tables[] =
1728 ADD_TABLE(ca51_component),
1729 ADD_TABLE(directory),
1730 ADD_TABLE(rof_feature),
1731 ADD_TABLE(ci2_feature_comp),
1732 ADD_TABLE(ci2_file),
1733 ADD_TABLE(install_exec_seq),
1734 ADD_TABLE(rof_media),
1735 ADD_TABLE(property)
1738 static const msi_table ip_tables[] =
1740 ADD_TABLE(component),
1741 ADD_TABLE(directory),
1742 ADD_TABLE(feature),
1743 ADD_TABLE(feature_comp),
1744 ADD_TABLE(file),
1745 ADD_TABLE(ip_install_exec_seq),
1746 ADD_TABLE(ip_custom_action),
1747 ADD_TABLE(media),
1748 ADD_TABLE(property)
1751 static const msi_table aup_tables[] =
1753 ADD_TABLE(component),
1754 ADD_TABLE(directory),
1755 ADD_TABLE(feature),
1756 ADD_TABLE(feature_comp),
1757 ADD_TABLE(file),
1758 ADD_TABLE(aup_install_exec_seq),
1759 ADD_TABLE(aup_custom_action),
1760 ADD_TABLE(media),
1761 ADD_TABLE(property)
1764 static const msi_table aup2_tables[] =
1766 ADD_TABLE(component),
1767 ADD_TABLE(directory),
1768 ADD_TABLE(feature),
1769 ADD_TABLE(feature_comp),
1770 ADD_TABLE(file),
1771 ADD_TABLE(aup2_install_exec_seq),
1772 ADD_TABLE(aup_custom_action),
1773 ADD_TABLE(media),
1774 ADD_TABLE(aup_property)
1777 static const msi_table aup3_tables[] =
1779 ADD_TABLE(component),
1780 ADD_TABLE(directory),
1781 ADD_TABLE(feature),
1782 ADD_TABLE(feature_comp),
1783 ADD_TABLE(file),
1784 ADD_TABLE(aup2_install_exec_seq),
1785 ADD_TABLE(aup_custom_action),
1786 ADD_TABLE(media),
1787 ADD_TABLE(aup2_property)
1790 static const msi_table aup4_tables[] =
1792 ADD_TABLE(component),
1793 ADD_TABLE(directory),
1794 ADD_TABLE(feature),
1795 ADD_TABLE(feature_comp),
1796 ADD_TABLE(file),
1797 ADD_TABLE(aup3_install_exec_seq),
1798 ADD_TABLE(aup_custom_action),
1799 ADD_TABLE(media),
1800 ADD_TABLE(aup2_property)
1803 static const msi_table fiu_tables[] =
1805 ADD_TABLE(rof_component),
1806 ADD_TABLE(directory),
1807 ADD_TABLE(rof_feature),
1808 ADD_TABLE(rof_feature_comp),
1809 ADD_TABLE(rof_file),
1810 ADD_TABLE(pp_install_exec_seq),
1811 ADD_TABLE(rof_media),
1812 ADD_TABLE(property),
1815 static const msi_table fiuc_tables[] =
1817 ADD_TABLE(rof_component),
1818 ADD_TABLE(directory),
1819 ADD_TABLE(rof_feature),
1820 ADD_TABLE(rof_feature_comp),
1821 ADD_TABLE(rofc_file),
1822 ADD_TABLE(pp_install_exec_seq),
1823 ADD_TABLE(rofc_media),
1824 ADD_TABLE(property),
1827 static const msi_table fo_tables[] =
1829 ADD_TABLE(directory),
1830 ADD_TABLE(fo_file),
1831 ADD_TABLE(fo_component),
1832 ADD_TABLE(fo_feature),
1833 ADD_TABLE(fo_condition),
1834 ADD_TABLE(fo_feature_comp),
1835 ADD_TABLE(fo_custom_action),
1836 ADD_TABLE(fo_install_exec_seq),
1837 ADD_TABLE(media),
1838 ADD_TABLE(property)
1841 static const msi_table icon_base_tables[] =
1843 ADD_TABLE(ci_component),
1844 ADD_TABLE(directory),
1845 ADD_TABLE(rof_feature),
1846 ADD_TABLE(rof_feature_comp),
1847 ADD_TABLE(rof_file),
1848 ADD_TABLE(pp_install_exec_seq),
1849 ADD_TABLE(rof_media),
1850 ADD_TABLE(icon_property),
1853 static const msi_table pv_tables[] =
1855 ADD_TABLE(rof_component),
1856 ADD_TABLE(directory),
1857 ADD_TABLE(rof_feature),
1858 ADD_TABLE(rof_feature_comp),
1859 ADD_TABLE(rof_file),
1860 ADD_TABLE(pv_install_exec_seq),
1861 ADD_TABLE(rof_media),
1862 ADD_TABLE(property)
1865 static const msi_table uc_tables[] =
1867 ADD_TABLE(directory),
1868 ADD_TABLE(uc_component),
1869 ADD_TABLE(uc_feature),
1870 ADD_TABLE(uc_feature_comp),
1871 ADD_TABLE(uc_file),
1872 ADD_TABLE(uc_install_exec_seq),
1873 ADD_TABLE(media),
1874 ADD_TABLE(uc_property)
1877 static const msi_table mixed_tables[] =
1879 ADD_TABLE(directory),
1880 ADD_TABLE(mixed_component),
1881 ADD_TABLE(mixed_feature),
1882 ADD_TABLE(mixed_feature_comp),
1883 ADD_TABLE(mixed_install_exec_seq),
1884 ADD_TABLE(mixed_registry),
1885 ADD_TABLE(media),
1886 ADD_TABLE(property)
1889 static const msi_table vp_tables[] =
1891 ADD_TABLE(directory),
1892 ADD_TABLE(vp_file),
1893 ADD_TABLE(vp_component),
1894 ADD_TABLE(vp_feature),
1895 ADD_TABLE(vp_feature_comp),
1896 ADD_TABLE(vp_custom_action),
1897 ADD_TABLE(vp_install_exec_seq),
1898 ADD_TABLE(media),
1899 ADD_TABLE(property)
1902 static const msi_table shc_tables[] =
1904 ADD_TABLE(media),
1905 ADD_TABLE(directory),
1906 ADD_TABLE(shc_file),
1907 ADD_TABLE(shc_component),
1908 ADD_TABLE(shc_feature),
1909 ADD_TABLE(shc_feature_comp),
1910 ADD_TABLE(shc_custom_action),
1911 ADD_TABLE(shc_install_exec_seq),
1912 ADD_TABLE(shc_property)
1915 static const msi_table shc2_tables[] =
1917 ADD_TABLE(media),
1918 ADD_TABLE(directory),
1919 ADD_TABLE(shc_file),
1920 ADD_TABLE(shc_component),
1921 ADD_TABLE(shc_feature),
1922 ADD_TABLE(shc_feature_comp),
1923 ADD_TABLE(shc_custom_action),
1924 ADD_TABLE(shc_install_exec_seq),
1925 ADD_TABLE(shc2_property)
1928 static const msi_table ft_tables[] =
1930 ADD_TABLE(media),
1931 ADD_TABLE(directory),
1932 ADD_TABLE(ft_file),
1933 ADD_TABLE(ft_comp),
1934 ADD_TABLE(ft_feature),
1935 ADD_TABLE(ft_feature_comp),
1936 ADD_TABLE(ft_condition),
1937 ADD_TABLE(ft_custom_action),
1938 ADD_TABLE(ft_install_exec_seq),
1939 ADD_TABLE(property)
1942 /* cabinet definitions */
1944 /* make the max size large so there is only one cab file */
1945 #define MEDIA_SIZE 0x7FFFFFFF
1946 #define FOLDER_THRESHOLD 900000
1948 /* the FCI callbacks */
1950 static void * CDECL mem_alloc(ULONG cb)
1952 return HeapAlloc(GetProcessHeap(), 0, cb);
1955 static void CDECL mem_free(void *memory)
1957 HeapFree(GetProcessHeap(), 0, memory);
1960 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
1962 sprintf(pccab->szCab, pv, pccab->iCab);
1963 return TRUE;
1966 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
1968 return 0;
1971 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
1972 BOOL fContinuation, void *pv)
1974 return 0;
1977 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
1979 HANDLE handle;
1980 DWORD dwAccess = 0;
1981 DWORD dwShareMode = 0;
1982 DWORD dwCreateDisposition = OPEN_EXISTING;
1984 dwAccess = GENERIC_READ | GENERIC_WRITE;
1985 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
1986 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
1988 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
1989 dwCreateDisposition = OPEN_EXISTING;
1990 else
1991 dwCreateDisposition = CREATE_NEW;
1993 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
1994 dwCreateDisposition, 0, NULL);
1996 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
1998 return (INT_PTR)handle;
2001 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2003 HANDLE handle = (HANDLE)hf;
2004 DWORD dwRead;
2005 BOOL res;
2007 res = ReadFile(handle, memory, cb, &dwRead, NULL);
2008 ok(res, "Failed to ReadFile\n");
2010 return dwRead;
2013 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2015 HANDLE handle = (HANDLE)hf;
2016 DWORD dwWritten;
2017 BOOL res;
2019 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2020 ok(res, "Failed to WriteFile\n");
2022 return dwWritten;
2025 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
2027 HANDLE handle = (HANDLE)hf;
2028 ok(CloseHandle(handle), "Failed to CloseHandle\n");
2030 return 0;
2033 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
2035 HANDLE handle = (HANDLE)hf;
2036 DWORD ret;
2038 ret = SetFilePointer(handle, dist, NULL, seektype);
2039 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2041 return ret;
2044 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
2046 BOOL ret = DeleteFileA(pszFile);
2047 ok(ret, "Failed to DeleteFile %s\n", pszFile);
2049 return 0;
2052 static void init_functionpointers(void)
2054 HMODULE hmsi = GetModuleHandleA("msi.dll");
2055 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2056 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2058 #define GET_PROC(mod, func) \
2059 p ## func = (void*)GetProcAddress(mod, #func); \
2060 if(!p ## func) \
2061 trace("GetProcAddress(%s) failed\n", #func);
2063 GET_PROC(hmsi, MsiQueryComponentStateA);
2064 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
2065 GET_PROC(hmsi, MsiGetComponentPathExA);
2067 GET_PROC(hadvapi32, CheckTokenMembership);
2068 GET_PROC(hadvapi32, ConvertSidToStringSidA);
2069 GET_PROC(hadvapi32, OpenProcessToken);
2070 GET_PROC(hadvapi32, RegDeleteKeyExA)
2071 GET_PROC(hkernel32, IsWow64Process)
2073 hsrclient = LoadLibraryA("srclient.dll");
2074 GET_PROC(hsrclient, SRRemoveRestorePoint);
2075 GET_PROC(hsrclient, SRSetRestorePointA);
2077 #undef GET_PROC
2080 static BOOL is_process_limited(void)
2082 SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
2083 PSID Group = NULL;
2084 BOOL IsInGroup;
2085 HANDLE token;
2087 if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
2089 if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
2090 DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
2091 !pCheckTokenMembership(NULL, Group, &IsInGroup))
2093 trace("Could not check if the current user is an administrator\n");
2094 FreeSid(Group);
2095 return FALSE;
2097 FreeSid(Group);
2099 if (!IsInGroup)
2101 /* Only administrators have enough privileges for these tests */
2102 return TRUE;
2105 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2107 BOOL ret;
2108 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
2109 DWORD size;
2111 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2112 CloseHandle(token);
2113 return (ret && type == TokenElevationTypeLimited);
2115 return FALSE;
2118 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
2120 CHAR buffer[0x20];
2121 UINT r;
2122 DWORD sz;
2124 sz = sizeof buffer;
2125 r = MsiRecordGetStringA(rec, field, buffer, &sz);
2126 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
2129 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2131 LPSTR tempname;
2133 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2134 GetTempFileNameA(".", "xx", 0, tempname);
2136 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2138 lstrcpyA(pszTempName, tempname);
2139 HeapFree(GetProcessHeap(), 0, tempname);
2140 return TRUE;
2143 HeapFree(GetProcessHeap(), 0, tempname);
2145 return FALSE;
2148 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2149 USHORT *pattribs, int *err, void *pv)
2151 BY_HANDLE_FILE_INFORMATION finfo;
2152 FILETIME filetime;
2153 HANDLE handle;
2154 DWORD attrs;
2155 BOOL res;
2157 handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2158 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2160 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2162 res = GetFileInformationByHandle(handle, &finfo);
2163 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2165 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2166 FileTimeToDosDateTime(&filetime, pdate, ptime);
2168 attrs = GetFileAttributesA(pszName);
2169 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2171 return (INT_PTR)handle;
2174 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2176 char path[MAX_PATH];
2177 char filename[MAX_PATH];
2179 lstrcpyA(path, CURR_DIR);
2180 lstrcatA(path, "\\");
2181 lstrcatA(path, file);
2183 lstrcpyA(filename, file);
2185 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2186 progress, get_open_info, compress);
2189 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2191 ZeroMemory(pCabParams, sizeof(CCAB));
2193 pCabParams->cb = max_size;
2194 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2195 pCabParams->setID = 0xbeef;
2196 pCabParams->iCab = 1;
2197 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2198 lstrcatA(pCabParams->szCabPath, "\\");
2199 lstrcpyA(pCabParams->szCab, name);
2202 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2204 CCAB cabParams;
2205 LPCSTR ptr;
2206 HFCI hfci;
2207 ERF erf;
2208 BOOL res;
2210 set_cab_parameters(&cabParams, name, max_size);
2212 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2213 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2214 get_temp_file, &cabParams, NULL);
2216 ok(hfci != NULL, "Failed to create an FCI context\n");
2218 ptr = files;
2219 while (*ptr)
2221 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2222 ok(res, "Failed to add file: %s\n", ptr);
2223 ptr += lstrlenA(ptr) + 1;
2226 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2227 ok(res, "Failed to flush the cabinet\n");
2229 res = FCIDestroy(hfci);
2230 ok(res, "Failed to destroy the cabinet\n");
2233 static BOOL get_user_dirs(void)
2235 HKEY hkey;
2236 DWORD type, size;
2238 if (RegOpenKeyA(HKEY_CURRENT_USER,
2239 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2240 return FALSE;
2242 size = MAX_PATH;
2243 if(RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size)){
2244 RegCloseKey(hkey);
2245 return FALSE;
2248 RegCloseKey(hkey);
2249 return TRUE;
2252 static BOOL get_system_dirs(void)
2254 HKEY hkey;
2255 DWORD type, size;
2257 if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2258 return FALSE;
2260 size = MAX_PATH;
2261 if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2262 RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size)) {
2263 RegCloseKey(hkey);
2264 return FALSE;
2267 size = MAX_PATH;
2268 if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2269 RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size)) {
2270 RegCloseKey(hkey);
2271 return FALSE;
2274 size = MAX_PATH;
2275 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR_NATIVE, &size)) {
2276 RegCloseKey(hkey);
2277 return FALSE;
2280 RegCloseKey(hkey);
2282 if(!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH))
2283 return FALSE;
2285 return TRUE;
2288 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2290 HANDLE file;
2291 DWORD written;
2293 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2294 if (file == INVALID_HANDLE_VALUE)
2295 return;
2297 WriteFile(file, data, strlen(data), &written, NULL);
2299 if (size)
2301 SetFilePointer(file, size, NULL, FILE_BEGIN);
2302 SetEndOfFile(file);
2305 CloseHandle(file);
2308 #define create_file(name, size) create_file_data(name, name, size)
2310 static void create_test_files(void)
2312 CreateDirectoryA("msitest", NULL);
2313 create_file("msitest\\one.txt", 100);
2314 CreateDirectoryA("msitest\\first", NULL);
2315 create_file("msitest\\first\\two.txt", 100);
2316 CreateDirectoryA("msitest\\second", NULL);
2317 create_file("msitest\\second\\three.txt", 100);
2319 create_file("four.txt", 100);
2320 create_file("five.txt", 100);
2321 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2323 create_file("msitest\\filename", 100);
2324 create_file("msitest\\service.exe", 100);
2326 DeleteFileA("four.txt");
2327 DeleteFileA("five.txt");
2330 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2332 CHAR path[MAX_PATH];
2334 lstrcpyA(path, PROG_FILES_DIR);
2335 lstrcatA(path, "\\");
2336 lstrcatA(path, rel_path);
2338 if (is_file)
2339 return DeleteFileA(path);
2340 else
2341 return RemoveDirectoryA(path);
2344 static BOOL delete_pf_native(const CHAR *rel_path, BOOL is_file)
2346 CHAR path[MAX_PATH];
2348 lstrcpyA(path, PROG_FILES_DIR_NATIVE);
2349 lstrcatA(path, "\\");
2350 lstrcatA(path, rel_path);
2352 if (is_file)
2353 return DeleteFileA(path);
2354 else
2355 return RemoveDirectoryA(path);
2358 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
2360 CHAR path[MAX_PATH];
2362 lstrcpyA(path, COMMON_FILES_DIR);
2363 lstrcatA(path, "\\");
2364 lstrcatA(path, rel_path);
2366 if (is_file)
2367 return DeleteFileA(path);
2368 else
2369 return RemoveDirectoryA(path);
2372 static BOOL compare_pf_data(const char *filename, const char *data, DWORD size)
2374 DWORD read;
2375 HANDLE handle;
2376 BOOL ret = FALSE;
2377 char *buffer, path[MAX_PATH];
2379 lstrcpyA(path, PROG_FILES_DIR);
2380 lstrcatA(path, "\\");
2381 lstrcatA(path, filename);
2383 handle = CreateFileA(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2384 buffer = HeapAlloc(GetProcessHeap(), 0, size);
2385 if (buffer)
2387 ReadFile(handle, buffer, size, &read, NULL);
2388 if (read == size && !memcmp(data, buffer, size)) ret = TRUE;
2389 HeapFree(GetProcessHeap(), 0, buffer);
2391 CloseHandle(handle);
2392 return ret;
2395 static void delete_test_files(void)
2397 DeleteFileA("msitest.msi");
2398 DeleteFileA("msitest.cab");
2399 DeleteFileA("msitest\\second\\three.txt");
2400 DeleteFileA("msitest\\first\\two.txt");
2401 DeleteFileA("msitest\\one.txt");
2402 DeleteFileA("msitest\\service.exe");
2403 DeleteFileA("msitest\\filename");
2404 RemoveDirectoryA("msitest\\second");
2405 RemoveDirectoryA("msitest\\first");
2406 RemoveDirectoryA("msitest");
2409 static void write_file(const CHAR *filename, const char *data, int data_size)
2411 DWORD size;
2413 HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
2414 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2415 WriteFile(hf, data, data_size, &size, NULL);
2416 CloseHandle(hf);
2419 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount,
2420 const char *template, const char *packagecode)
2422 MSIHANDLE summary;
2423 UINT r;
2425 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2426 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2428 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2429 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2431 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL, packagecode);
2432 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2434 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL);
2435 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2437 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2438 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2440 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2441 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2443 /* write the summary changes back to the stream */
2444 r = MsiSummaryInfoPersist(summary);
2445 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2447 MsiCloseHandle(summary);
2450 #define create_database(name, tables, num_tables) \
2451 create_database_wordcount(name, tables, num_tables, 100, 0, ";1033", \
2452 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2454 #define create_database_template(name, tables, num_tables, version, template) \
2455 create_database_wordcount(name, tables, num_tables, version, 0, template, \
2456 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2458 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2459 int num_tables, INT version, INT wordcount,
2460 const char *template, const char *packagecode)
2462 MSIHANDLE db;
2463 UINT r;
2464 WCHAR *nameW;
2465 int j, len;
2467 len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2468 if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
2469 MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2471 r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
2472 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2474 /* import the tables into the database */
2475 for (j = 0; j < num_tables; j++)
2477 const msi_table *table = &tables[j];
2479 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2481 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2482 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2484 DeleteFileA(table->filename);
2487 write_msi_summary_info(db, version, wordcount, template, packagecode);
2489 r = MsiDatabaseCommit(db);
2490 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2492 MsiCloseHandle(db);
2493 HeapFree( GetProcessHeap(), 0, nameW );
2496 static void check_service_is_installed(void)
2498 SC_HANDLE scm, service;
2499 BOOL res;
2501 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
2502 ok(scm != NULL, "Failed to open the SC Manager\n");
2504 service = OpenServiceA(scm, "TestService", SC_MANAGER_ALL_ACCESS);
2505 ok(service != NULL, "Failed to open TestService\n");
2507 res = DeleteService(service);
2508 ok(res, "Failed to delete TestService\n");
2510 CloseServiceHandle(service);
2511 CloseServiceHandle(scm);
2514 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2516 RESTOREPOINTINFOA spec;
2518 spec.dwEventType = event_type;
2519 spec.dwRestorePtType = APPLICATION_INSTALL;
2520 spec.llSequenceNumber = status->llSequenceNumber;
2521 lstrcpyA(spec.szDescription, "msitest restore point");
2523 return pSRSetRestorePointA(&spec, status);
2526 static void remove_restore_point(DWORD seq_number)
2528 DWORD res;
2530 res = pSRRemoveRestorePoint(seq_number);
2531 if (res != ERROR_SUCCESS)
2532 trace("Failed to remove the restore point : %08x\n", res);
2535 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
2537 if (pRegDeleteKeyExA)
2538 return pRegDeleteKeyExA( key, subkey, access, 0 );
2539 return RegDeleteKeyA( key, subkey );
2542 static void test_MsiInstallProduct(void)
2544 UINT r;
2545 CHAR path[MAX_PATH];
2546 LONG res;
2547 HKEY hkey;
2548 DWORD num, size, type;
2549 REGSAM access = KEY_ALL_ACCESS;
2551 if (is_process_limited())
2553 skip("process is limited\n");
2554 return;
2557 if (is_wow64)
2558 access |= KEY_WOW64_64KEY;
2560 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2562 /* szPackagePath is NULL */
2563 r = MsiInstallProductA(NULL, "INSTALL=ALL");
2564 ok(r == ERROR_INVALID_PARAMETER,
2565 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2567 /* both szPackagePath and szCommandLine are NULL */
2568 r = MsiInstallProductA(NULL, NULL);
2569 ok(r == ERROR_INVALID_PARAMETER,
2570 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2572 /* szPackagePath is empty */
2573 r = MsiInstallProductA("", "INSTALL=ALL");
2574 ok(r == ERROR_PATH_NOT_FOUND,
2575 "Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
2577 create_test_files();
2578 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2580 /* install, don't publish */
2581 r = MsiInstallProductA(msifile, NULL);
2582 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2584 skip("Not enough rights to perform tests\n");
2585 goto error;
2587 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2589 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2590 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2591 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2592 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2593 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2594 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2595 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2596 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2597 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2598 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2599 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2600 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2602 res = RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", 0, access, &hkey);
2603 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2605 size = MAX_PATH;
2606 type = REG_SZ;
2607 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
2608 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2609 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
2611 size = MAX_PATH;
2612 type = REG_SZ;
2613 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
2614 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2616 size = sizeof(num);
2617 type = REG_DWORD;
2618 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
2619 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2620 ok(num == 314, "Expected 314, got %d\n", num);
2622 size = MAX_PATH;
2623 type = REG_SZ;
2624 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
2625 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2626 ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
2628 check_service_is_installed();
2630 delete_key(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", access);
2632 /* not published, reinstall */
2633 r = MsiInstallProductA(msifile, NULL);
2634 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2636 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2637 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2638 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2639 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2640 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2641 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2642 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2643 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2644 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2645 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2646 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2647 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2649 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2650 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2651 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2653 create_database(msifile, up_tables, sizeof(up_tables) / sizeof(msi_table));
2655 /* not published, RemovePreviousVersions set */
2656 r = MsiInstallProductA(msifile, NULL);
2657 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2659 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2660 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2661 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2662 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2663 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2664 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2665 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2666 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2667 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2668 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2669 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2670 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2672 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2673 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2674 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2676 create_database(msifile, up2_tables, sizeof(up2_tables) / sizeof(msi_table));
2678 /* not published, version number bumped */
2679 r = MsiInstallProductA(msifile, NULL);
2680 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2682 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2683 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2684 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2685 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2686 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2687 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2688 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2689 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2690 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2691 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2692 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2693 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2695 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2696 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2697 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2699 create_database(msifile, up3_tables, sizeof(up3_tables) / sizeof(msi_table));
2701 /* not published, RemovePreviousVersions set and version number bumped */
2702 r = MsiInstallProductA(msifile, NULL);
2703 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2705 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2706 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2707 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2708 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2709 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2710 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2711 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2712 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2713 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2714 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2715 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2716 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2718 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2719 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2720 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2722 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2724 /* install, publish product */
2725 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2726 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2728 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2729 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2730 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2731 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2732 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2733 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2734 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2735 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2736 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2737 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2738 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2739 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2741 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2742 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2744 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2746 /* published, reinstall */
2747 r = MsiInstallProductA(msifile, NULL);
2748 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2750 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2751 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2752 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2753 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2754 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2755 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2756 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2757 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2758 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2759 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2760 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2761 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2763 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2764 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2766 create_database(msifile, up5_tables, sizeof(up5_tables) / sizeof(msi_table));
2768 /* published product, RemovePreviousVersions set */
2769 r = MsiInstallProductA(msifile, NULL);
2770 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2772 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2773 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2774 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2775 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2776 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2777 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2778 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2779 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2780 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2781 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2782 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2783 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2785 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2786 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2788 create_database(msifile, up6_tables, sizeof(up6_tables) / sizeof(msi_table));
2790 /* published product, version number bumped */
2791 r = MsiInstallProductA(msifile, NULL);
2792 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2794 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2795 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2796 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2797 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2798 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2799 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2800 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2801 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2802 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2803 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2804 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2805 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2807 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2808 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2810 create_database(msifile, up7_tables, sizeof(up7_tables) / sizeof(msi_table));
2812 /* published product, RemovePreviousVersions set and version number bumped */
2813 r = MsiInstallProductA(msifile, NULL);
2814 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2816 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2817 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2818 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2819 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2820 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2821 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2822 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2823 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2824 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2825 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2826 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2827 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2829 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2830 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2832 r = MsiInstallProductA(msifile, "REMOVE=ALL");
2833 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2835 error:
2836 delete_test_files();
2837 DeleteFileA(msifile);
2840 static void test_MsiSetComponentState(void)
2842 INSTALLSTATE installed, action;
2843 MSIHANDLE package;
2844 char path[MAX_PATH];
2845 UINT r;
2847 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2849 CoInitialize(NULL);
2851 lstrcpyA(path, CURR_DIR);
2852 lstrcatA(path, "\\");
2853 lstrcatA(path, msifile);
2855 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2857 r = MsiOpenPackageA(path, &package);
2858 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2860 skip("Not enough rights to perform tests\n");
2861 goto error;
2863 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2865 r = MsiDoActionA(package, "CostInitialize");
2866 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2868 r = MsiDoActionA(package, "FileCost");
2869 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2871 r = MsiDoActionA(package, "CostFinalize");
2872 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2874 r = MsiGetComponentStateA(package, "dangler", &installed, &action);
2875 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2876 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
2877 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2879 r = MsiSetComponentStateA(package, "dangler", INSTALLSTATE_SOURCE);
2880 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2882 MsiCloseHandle(package);
2884 error:
2885 CoUninitialize();
2886 DeleteFileA(msifile);
2889 static void test_packagecoltypes(void)
2891 MSIHANDLE hdb, view, rec;
2892 char path[MAX_PATH];
2893 WCHAR pathW[MAX_PATH];
2894 LPCSTR query;
2895 UINT r, count;
2897 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2899 CoInitialize(NULL);
2901 lstrcpyA(path, CURR_DIR);
2902 lstrcatA(path, "\\");
2903 lstrcatA(path, msifile);
2904 MultiByteToWideChar( CP_ACP, 0, path, -1, pathW, MAX_PATH );
2906 r = MsiOpenDatabaseW(pathW, MSIDBOPEN_READONLY, &hdb);
2907 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2909 query = "SELECT * FROM `Media`";
2910 r = MsiDatabaseOpenViewA( hdb, query, &view );
2911 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2913 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
2914 count = MsiRecordGetFieldCount( rec );
2915 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2916 ok(count == 6, "Expected 6, got %d\n", count);
2917 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
2918 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
2919 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
2920 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
2921 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
2922 ok(check_record(rec, 6, "Source"), "wrong column label\n");
2923 MsiCloseHandle(rec);
2925 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
2926 count = MsiRecordGetFieldCount( rec );
2927 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2928 ok(count == 6, "Expected 6, got %d\n", count);
2929 ok(check_record(rec, 1, "i2"), "wrong column label\n");
2930 ok(check_record(rec, 2, "i4"), "wrong column label\n");
2931 ok(check_record(rec, 3, "L64"), "wrong column label\n");
2932 ok(check_record(rec, 4, "S255"), "wrong column label\n");
2933 ok(check_record(rec, 5, "S32"), "wrong column label\n");
2934 ok(check_record(rec, 6, "S72"), "wrong column label\n");
2936 MsiCloseHandle(rec);
2937 MsiCloseHandle(view);
2938 MsiCloseHandle(hdb);
2939 CoUninitialize();
2941 DeleteFileA(msifile);
2944 static void create_cc_test_files(void)
2946 CCAB cabParams;
2947 HFCI hfci;
2948 ERF erf;
2949 static CHAR cab_context[] = "test%d.cab";
2950 BOOL res;
2952 create_file("maximus", 500);
2953 create_file("augustus", 50000);
2954 create_file("tiberius", 500);
2955 create_file("caesar", 500);
2957 set_cab_parameters(&cabParams, "test1.cab", 40000);
2959 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2960 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2961 get_temp_file, &cabParams, cab_context);
2962 ok(hfci != NULL, "Failed to create an FCI context\n");
2964 res = add_file(hfci, "maximus", tcompTYPE_NONE);
2965 ok(res, "Failed to add file maximus\n");
2967 res = add_file(hfci, "augustus", tcompTYPE_NONE);
2968 ok(res, "Failed to add file augustus\n");
2970 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
2971 ok(res, "Failed to add file tiberius\n");
2973 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2974 ok(res, "Failed to flush the cabinet\n");
2976 res = FCIDestroy(hfci);
2977 ok(res, "Failed to destroy the cabinet\n");
2979 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2981 DeleteFileA("maximus");
2982 DeleteFileA("augustus");
2983 DeleteFileA("tiberius");
2984 DeleteFileA("caesar");
2987 static void delete_cab_files(void)
2989 SHFILEOPSTRUCTA shfl;
2990 CHAR path[MAX_PATH+10];
2992 lstrcpyA(path, CURR_DIR);
2993 lstrcatA(path, "\\*.cab");
2994 path[strlen(path) + 1] = '\0';
2996 shfl.hwnd = NULL;
2997 shfl.wFunc = FO_DELETE;
2998 shfl.pFrom = path;
2999 shfl.pTo = NULL;
3000 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
3002 SHFileOperationA(&shfl);
3005 static void test_continuouscabs(void)
3007 UINT r;
3009 if (is_process_limited())
3011 skip("process is limited\n");
3012 return;
3015 create_cc_test_files();
3016 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
3018 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3020 r = MsiInstallProductA(msifile, NULL);
3021 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3023 skip("Not enough rights to perform tests\n");
3024 goto error;
3026 else
3028 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3029 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3030 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3031 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3032 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3035 delete_cab_files();
3036 DeleteFileA(msifile);
3038 create_cc_test_files();
3039 create_database(msifile, cc2_tables, sizeof(cc2_tables) / sizeof(msi_table));
3041 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3043 r = MsiInstallProductA(msifile, NULL);
3044 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3046 skip("Not enough rights to perform tests\n");
3048 else
3050 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3051 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3052 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3053 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
3054 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3055 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3058 delete_cab_files();
3059 DeleteFileA(msifile);
3061 /* Tests to show that only msi cab filename is taken in case of mismatch with the one given by previous cab */
3063 /* Filename from cab is right and the one from msi is wrong */
3064 create_cc_test_files();
3065 create_database(msifile, cc3_tables, sizeof(cc3_tables) / sizeof(msi_table));
3067 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3069 r = MsiInstallProductA(msifile, NULL);
3070 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3072 skip("Not enough rights to perform tests\n");
3074 else
3076 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3077 todo_wine ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3078 ok(!delete_pf("msitest\\caesar", TRUE), "File installed\n");
3079 todo_wine ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
3080 todo_wine ok(!delete_pf("msitest", FALSE), "Directory created\n");
3083 delete_cab_files();
3084 DeleteFileA(msifile);
3086 /* Filename from msi is right and the one from cab is wrong */
3087 create_cc_test_files();
3088 ok(MoveFileA("test2.cab", "test2_.cab"), "Cannot rename test2.cab to test2_.cab\n");
3089 create_database(msifile, cc3_tables, sizeof(cc3_tables) / sizeof(msi_table));
3091 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3093 r = MsiInstallProductA(msifile, NULL);
3094 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3096 skip("Not enough rights to perform tests\n");
3098 else
3100 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3101 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3102 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3103 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3104 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3107 error:
3108 delete_cab_files();
3109 DeleteFileA(msifile);
3112 static void test_caborder(void)
3114 UINT r;
3116 create_file("imperator", 100);
3117 create_file("maximus", 500);
3118 create_file("augustus", 50000);
3119 create_file("caesar", 500);
3121 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
3123 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3125 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3126 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3127 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3129 r = MsiInstallProductA(msifile, NULL);
3130 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3132 skip("Not enough rights to perform tests\n");
3133 goto error;
3135 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3136 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3137 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3138 todo_wine
3140 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3141 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3144 delete_cab_files();
3146 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
3147 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
3148 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3150 r = MsiInstallProductA(msifile, NULL);
3151 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3152 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3153 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3154 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3155 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3157 delete_cab_files();
3158 DeleteFileA(msifile);
3160 create_cc_test_files();
3161 create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
3163 r = MsiInstallProductA(msifile, NULL);
3164 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3165 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3166 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3167 todo_wine
3169 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3170 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3173 delete_cab_files();
3174 DeleteFileA(msifile);
3176 create_cc_test_files();
3177 create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
3179 r = MsiInstallProductA(msifile, NULL);
3180 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3181 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3182 todo_wine
3184 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3185 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3186 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3189 error:
3190 delete_cab_files();
3191 DeleteFileA("imperator");
3192 DeleteFileA("maximus");
3193 DeleteFileA("augustus");
3194 DeleteFileA("caesar");
3195 DeleteFileA(msifile);
3198 static void test_mixedmedia(void)
3200 UINT r;
3202 if (is_process_limited())
3204 skip("process is limited\n");
3205 return;
3208 CreateDirectoryA("msitest", NULL);
3209 create_file("msitest\\maximus", 500);
3210 create_file("msitest\\augustus", 500);
3211 create_file("caesar", 500);
3213 create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
3215 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3217 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
3219 r = MsiInstallProductA(msifile, NULL);
3220 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3222 skip("Not enough rights to perform tests\n");
3223 goto error;
3225 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3226 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3227 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3228 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3229 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3231 error:
3232 /* Delete the files in the temp (current) folder */
3233 DeleteFileA("msitest\\maximus");
3234 DeleteFileA("msitest\\augustus");
3235 RemoveDirectoryA("msitest");
3236 DeleteFileA("caesar");
3237 DeleteFileA("test1.cab");
3238 DeleteFileA(msifile);
3241 static void test_samesequence(void)
3243 UINT r;
3245 create_cc_test_files();
3246 create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
3248 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3250 r = MsiInstallProductA(msifile, NULL);
3251 if (r == ERROR_INSTALL_FAILURE)
3253 win_skip("unprivileged user?\n");
3254 goto error;
3256 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3257 if (r == ERROR_SUCCESS)
3259 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3260 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3261 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3262 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3265 error:
3266 delete_cab_files();
3267 DeleteFileA(msifile);
3270 static void test_uiLevelFlags(void)
3272 UINT r;
3274 create_cc_test_files();
3275 create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
3277 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
3279 r = MsiInstallProductA(msifile, NULL);
3280 if (r == ERROR_INSTALL_FAILURE)
3282 win_skip("unprivileged user?\n");
3283 goto error;
3286 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3287 if (r == ERROR_SUCCESS)
3289 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
3290 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3291 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3292 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3295 error:
3296 delete_cab_files();
3297 DeleteFileA(msifile);
3300 static BOOL file_matches(LPSTR path)
3302 CHAR buf[MAX_PATH];
3303 HANDLE file;
3304 DWORD size;
3306 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3307 NULL, OPEN_EXISTING, 0, NULL);
3308 ZeroMemory(buf, MAX_PATH);
3309 ReadFile(file, buf, 15, &size, NULL);
3310 CloseHandle(file);
3312 return !lstrcmpA(buf, "msitest\\maximus");
3315 static void test_readonlyfile(void)
3317 UINT r;
3318 DWORD size;
3319 HANDLE file;
3320 CHAR path[MAX_PATH];
3322 if (is_process_limited())
3324 skip("process is limited\n");
3325 return;
3328 CreateDirectoryA("msitest", NULL);
3329 create_file("msitest\\maximus", 500);
3330 create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
3332 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3334 lstrcpyA(path, PROG_FILES_DIR);
3335 lstrcatA(path, "\\msitest");
3336 CreateDirectoryA(path, NULL);
3338 lstrcatA(path, "\\maximus");
3339 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3340 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3342 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3343 CloseHandle(file);
3345 r = MsiInstallProductA(msifile, NULL);
3346 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3348 skip("Not enough rights to perform tests\n");
3349 goto error;
3351 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3352 ok(file_matches(path), "Expected file to be overwritten\n");
3353 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3354 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3356 error:
3357 /* Delete the files in the temp (current) folder */
3358 DeleteFileA("msitest\\maximus");
3359 RemoveDirectoryA("msitest");
3360 DeleteFileA(msifile);
3363 static void test_readonlyfile_cab(void)
3365 UINT r;
3366 DWORD size;
3367 HANDLE file;
3368 CHAR path[MAX_PATH];
3369 CHAR buf[16];
3371 if (is_process_limited())
3373 skip("process is limited\n");
3374 return;
3377 CreateDirectoryA("msitest", NULL);
3378 create_file("maximus", 500);
3379 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3380 DeleteFileA("maximus");
3382 create_database(msifile, rofc_tables, sizeof(rofc_tables) / sizeof(msi_table));
3384 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3386 lstrcpyA(path, PROG_FILES_DIR);
3387 lstrcatA(path, "\\msitest");
3388 CreateDirectoryA(path, NULL);
3390 lstrcatA(path, "\\maximus");
3391 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3392 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3394 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3395 CloseHandle(file);
3397 r = MsiInstallProductA(msifile, NULL);
3398 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3400 skip("Not enough rights to perform tests\n");
3401 goto error;
3403 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3405 memset( buf, 0, sizeof(buf) );
3406 if ((file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3407 NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
3409 ReadFile(file, buf, sizeof(buf) - 1, &size, NULL);
3410 CloseHandle(file);
3412 ok(!memcmp( buf, "maximus", sizeof("maximus")-1 ), "Expected file to be overwritten, got '%s'\n", buf);
3413 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3414 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3416 error:
3417 /* Delete the files in the temp (current) folder */
3418 delete_cab_files();
3419 DeleteFileA("msitest\\maximus");
3420 RemoveDirectoryA("msitest");
3421 DeleteFileA(msifile);
3424 static void test_setdirproperty(void)
3426 UINT r;
3428 if (is_process_limited())
3430 skip("process is limited\n");
3431 return;
3434 CreateDirectoryA("msitest", NULL);
3435 create_file("msitest\\maximus", 500);
3436 create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
3438 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3440 r = MsiInstallProductA(msifile, NULL);
3441 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3443 skip("Not enough rights to perform tests\n");
3444 goto error;
3446 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3447 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
3448 ok(delete_cf("msitest", FALSE), "Directory not created\n");
3450 error:
3451 /* Delete the files in the temp (current) folder */
3452 DeleteFileA(msifile);
3453 DeleteFileA("msitest\\maximus");
3454 RemoveDirectoryA("msitest");
3457 static void test_cabisextracted(void)
3459 UINT r;
3461 if (is_process_limited())
3463 skip("process is limited\n");
3464 return;
3467 CreateDirectoryA("msitest", NULL);
3468 create_file("msitest\\gaius", 500);
3469 create_file("maximus", 500);
3470 create_file("augustus", 500);
3471 create_file("caesar", 500);
3473 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3474 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3475 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3477 create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
3479 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3481 r = MsiInstallProductA(msifile, NULL);
3482 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3484 skip("Not enough rights to perform tests\n");
3485 goto error;
3487 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3488 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3489 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3490 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3491 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
3492 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3494 error:
3495 /* Delete the files in the temp (current) folder */
3496 delete_cab_files();
3497 DeleteFileA(msifile);
3498 DeleteFileA("maximus");
3499 DeleteFileA("augustus");
3500 DeleteFileA("caesar");
3501 DeleteFileA("msitest\\gaius");
3502 RemoveDirectoryA("msitest");
3505 static BOOL file_exists(LPCSTR file)
3507 return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES;
3510 static BOOL pf_exists(LPCSTR file)
3512 CHAR path[MAX_PATH];
3514 lstrcpyA(path, PROG_FILES_DIR);
3515 lstrcatA(path, "\\");
3516 lstrcatA(path, file);
3518 return file_exists(path);
3521 static void delete_pfmsitest_files(void)
3523 SHFILEOPSTRUCTA shfl;
3524 CHAR path[MAX_PATH+11];
3526 lstrcpyA(path, PROG_FILES_DIR);
3527 lstrcatA(path, "\\msitest\\*");
3528 path[strlen(path) + 1] = '\0';
3530 shfl.hwnd = NULL;
3531 shfl.wFunc = FO_DELETE;
3532 shfl.pFrom = path;
3533 shfl.pTo = NULL;
3534 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT | FOF_NOERRORUI;
3536 SHFileOperationA(&shfl);
3538 lstrcpyA(path, PROG_FILES_DIR);
3539 lstrcatA(path, "\\msitest");
3540 RemoveDirectoryA(path);
3543 static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
3545 MSIHANDLE hview = 0;
3546 UINT r;
3548 r = MsiDatabaseOpenViewA(hdb, query, &hview);
3549 if(r != ERROR_SUCCESS)
3550 return r;
3552 r = MsiViewExecute(hview, hrec);
3553 if(r == ERROR_SUCCESS)
3554 r = MsiViewClose(hview);
3555 MsiCloseHandle(hview);
3556 return r;
3559 static void set_transform_summary_info(void)
3561 UINT r;
3562 MSIHANDLE suminfo = 0;
3564 /* build summary info */
3565 r = MsiGetSummaryInformationA(0, mstfile, 3, &suminfo);
3566 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
3568 r = MsiSummaryInfoSetPropertyA(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
3569 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3571 r = MsiSummaryInfoSetPropertyA(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
3572 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3573 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3574 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
3575 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
3577 r = MsiSummaryInfoSetPropertyA(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
3578 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3580 r = MsiSummaryInfoPersist(suminfo);
3581 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
3583 r = MsiCloseHandle(suminfo);
3584 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
3587 static void generate_transform(void)
3589 MSIHANDLE hdb1, hdb2;
3590 LPCSTR query;
3591 UINT r;
3593 /* start with two identical databases */
3594 CopyFileA(msifile, msifile2, FALSE);
3596 r = MsiOpenDatabaseW(msifile2W, MSIDBOPEN_TRANSACT, &hdb1);
3597 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3599 r = MsiDatabaseCommit(hdb1);
3600 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
3602 r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_READONLY, &hdb2);
3603 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3605 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
3606 r = run_query(hdb1, 0, query);
3607 ok(r == ERROR_SUCCESS, "failed to add property\n");
3609 /* database needs to be committed */
3610 MsiDatabaseCommit(hdb1);
3612 r = MsiDatabaseGenerateTransformA(hdb1, hdb2, mstfile, 0, 0);
3613 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3615 r = MsiCreateTransformSummaryInfoA(hdb2, hdb2, mstfile, 0, 0);
3616 todo_wine ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3618 MsiCloseHandle(hdb1);
3619 MsiCloseHandle(hdb2);
3622 /* data for generating a transform */
3624 /* tables transform names - encoded as they would be in an msi database file */
3625 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
3626 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
3627 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
3629 /* data in each table */
3630 static const char data1[] = /* _StringData */
3631 "propval"; /* all the strings squashed together */
3633 static const WCHAR data2[] = { /* _StringPool */
3634 /* len, refs */
3635 0, 0, /* string 0 '' */
3636 4, 1, /* string 1 'prop' */
3637 3, 1, /* string 2 'val' */
3640 static const WCHAR data3[] = { /* Property */
3641 0x0201, 0x0001, 0x0002,
3644 static const struct {
3645 LPCWSTR name;
3646 const void *data;
3647 DWORD size;
3648 } table_transform_data[] =
3650 { name1, data1, sizeof data1 - 1 },
3651 { name2, data2, sizeof data2 },
3652 { name3, data3, sizeof data3 },
3655 #define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
3657 static void generate_transform_manual(void)
3659 IStorage *stg = NULL;
3660 IStream *stm;
3661 WCHAR name[0x20];
3662 HRESULT r;
3663 DWORD i, count;
3664 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
3666 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
3668 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
3670 r = StgCreateDocfile(name, mode, 0, &stg);
3671 ok(r == S_OK, "failed to create storage\n");
3672 if (!stg)
3673 return;
3675 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
3676 ok(r == S_OK, "failed to set storage type\n");
3678 for (i=0; i<NUM_TRANSFORM_TABLES; i++)
3680 r = IStorage_CreateStream(stg, table_transform_data[i].name,
3681 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3682 if (FAILED(r))
3684 ok(0, "failed to create stream %08x\n", r);
3685 continue;
3688 r = IStream_Write(stm, table_transform_data[i].data,
3689 table_transform_data[i].size, &count);
3690 if (FAILED(r) || count != table_transform_data[i].size)
3691 ok(0, "failed to write stream\n");
3692 IStream_Release(stm);
3695 IStorage_Release(stg);
3697 set_transform_summary_info();
3700 static void test_transformprop(void)
3702 UINT r;
3704 if (is_process_limited())
3706 skip("process is limited\n");
3707 return;
3710 CreateDirectoryA("msitest", NULL);
3711 create_file("msitest\\augustus", 500);
3713 create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
3715 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3717 r = MsiInstallProductA(msifile, NULL);
3718 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3720 skip("Not enough rights to perform tests\n");
3721 goto error;
3723 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3724 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3725 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3727 if (0)
3728 generate_transform();
3729 else
3730 generate_transform_manual();
3732 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
3733 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3734 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3735 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3737 error:
3738 /* Delete the files in the temp (current) folder */
3739 DeleteFileA(msifile);
3740 DeleteFileA(msifile2);
3741 DeleteFileA(mstfile);
3742 DeleteFileA("msitest\\augustus");
3743 RemoveDirectoryA("msitest");
3746 static void test_currentworkingdir(void)
3748 UINT r;
3749 CHAR drive[MAX_PATH], path[MAX_PATH];
3750 LPSTR ptr;
3752 if (is_process_limited())
3754 skip("process is limited\n");
3755 return;
3758 CreateDirectoryA("msitest", NULL);
3759 create_file("msitest\\augustus", 500);
3761 create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
3763 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3765 CreateDirectoryA("diffdir", NULL);
3766 SetCurrentDirectoryA("diffdir");
3768 sprintf(path, "..\\%s", msifile);
3769 r = MsiInstallProductA(path, NULL);
3770 todo_wine
3772 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
3773 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3774 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3777 sprintf(path, "%s\\%s", CURR_DIR, msifile);
3778 r = MsiInstallProductA(path, NULL);
3779 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3781 skip("Not enough rights to perform tests\n");
3782 goto error;
3784 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3785 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3786 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3788 lstrcpyA(drive, CURR_DIR);
3789 drive[2] = '\\';
3790 drive[3] = '\0';
3791 SetCurrentDirectoryA(drive);
3793 lstrcpyA(path, CURR_DIR);
3794 if (path[lstrlenA(path) - 1] != '\\') lstrcatA(path, "\\");
3795 lstrcatA(path, msifile);
3796 ptr = strchr(path, ':');
3797 ptr +=2;
3799 r = MsiInstallProductA(ptr, NULL);
3800 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3801 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3802 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3804 error:
3805 SetCurrentDirectoryA(CURR_DIR);
3806 DeleteFileA(msifile);
3807 DeleteFileA("msitest\\augustus");
3808 RemoveDirectoryA("msitest");
3809 RemoveDirectoryA("diffdir");
3812 static void set_admin_summary_info(const WCHAR *name)
3814 MSIHANDLE db, summary;
3815 UINT r;
3817 r = MsiOpenDatabaseW(name, MSIDBOPEN_DIRECT, &db);
3818 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3820 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
3821 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3823 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
3824 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3826 /* write the summary changes back to the stream */
3827 r = MsiSummaryInfoPersist(summary);
3828 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3830 MsiCloseHandle(summary);
3832 r = MsiDatabaseCommit(db);
3833 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3835 MsiCloseHandle(db);
3838 static void test_admin(void)
3840 UINT r;
3842 CreateDirectoryA("msitest", NULL);
3843 create_file("msitest\\augustus", 500);
3845 create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
3846 set_admin_summary_info(msifileW);
3848 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3850 r = MsiInstallProductA(msifile, NULL);
3851 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3853 skip("Not enough rights to perform tests\n");
3854 goto error;
3856 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3857 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3858 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3859 ok(!DeleteFileA("c:\\msitest\\augustus"), "File installed\n");
3860 ok(!RemoveDirectoryA("c:\\msitest"), "File installed\n");
3862 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
3863 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3864 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3865 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3866 todo_wine
3868 ok(DeleteFileA("c:\\msitest\\augustus"), "File not installed\n");
3869 ok(RemoveDirectoryA("c:\\msitest"), "File not installed\n");
3872 error:
3873 DeleteFileA(msifile);
3874 DeleteFileA("msitest\\augustus");
3875 RemoveDirectoryA("msitest");
3878 static void set_admin_property_stream(LPCSTR file)
3880 IStorage *stg;
3881 IStream *stm;
3882 WCHAR fileW[MAX_PATH];
3883 HRESULT hr;
3884 DWORD count;
3885 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
3887 /* AdminProperties */
3888 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
3889 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',' ',
3890 'M','y','P','r','o','p','=','4','2',0};
3892 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
3894 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
3895 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3896 if (!stg)
3897 return;
3899 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3900 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3902 hr = IStream_Write(stm, data, sizeof(data), &count);
3903 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3905 IStream_Release(stm);
3906 IStorage_Release(stg);
3909 static void test_adminprops(void)
3911 UINT r;
3913 if (is_process_limited())
3915 skip("process is limited\n");
3916 return;
3919 CreateDirectoryA("msitest", NULL);
3920 create_file("msitest\\augustus", 500);
3922 create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
3923 set_admin_summary_info(msifileW);
3924 set_admin_property_stream(msifile);
3926 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3928 r = MsiInstallProductA(msifile, NULL);
3929 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3931 skip("Not enough rights to perform tests\n");
3932 goto error;
3934 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3935 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
3936 ok(delete_pf("msitest", FALSE), "Directory created\n");
3938 error:
3939 DeleteFileA(msifile);
3940 DeleteFileA("msitest\\augustus");
3941 RemoveDirectoryA("msitest");
3944 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
3946 CHAR path[MAX_PATH];
3948 lstrcpyA(path, PROG_FILES_DIR);
3949 lstrcatA(path, "\\");
3950 lstrcatA(path, file);
3952 if (is_file)
3953 create_file_data(path, data, 500);
3954 else
3955 CreateDirectoryA(path, NULL);
3958 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
3960 static void test_missingcab(void)
3962 UINT r;
3964 if (is_process_limited())
3966 skip("process is limited\n");
3967 return;
3970 CreateDirectoryA("msitest", NULL);
3971 create_file("msitest\\augustus", 500);
3972 create_file("maximus", 500);
3973 create_file("tiberius", 500);
3975 create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
3977 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3979 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3980 create_cab_file("test4.cab", MEDIA_SIZE, "tiberius\0");
3982 create_pf("msitest", FALSE);
3983 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
3984 create_pf_data("msitest\\tiberius", "abcdefgh", TRUE);
3986 r = MsiInstallProductA(msifile, NULL);
3987 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3989 skip("Not enough rights to perform tests\n");
3990 goto error;
3992 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3993 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3994 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3995 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3996 ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
3997 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
3998 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
3999 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4001 create_pf("msitest", FALSE);
4002 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
4003 create_pf_data("msitest\\tiberius", "abcdefgh", TRUE);
4004 create_pf("msitest\\gaius", TRUE);
4006 r = MsiInstallProductA(msifile, "GAIUS=1");
4007 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4008 todo_wine
4010 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
4011 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4013 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
4014 ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
4015 ok(delete_pf("msitest\\tiberius", TRUE), "File removed\n");
4016 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
4017 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4019 error:
4020 delete_pf("msitest", FALSE);
4021 DeleteFileA("msitest\\augustus");
4022 RemoveDirectoryA("msitest");
4023 DeleteFileA("maximus");
4024 DeleteFileA("tiberius");
4025 DeleteFileA("test1.cab");
4026 DeleteFileA("test4.cab");
4027 DeleteFileA(msifile);
4030 static void test_sourcefolder(void)
4032 UINT r;
4034 if (is_process_limited())
4036 skip("process is limited\n");
4037 return;
4040 CreateDirectoryA("msitest", NULL);
4041 create_file("augustus", 500);
4043 create_database(msifile, sf_tables, sizeof(sf_tables) / sizeof(msi_table));
4045 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4047 r = MsiInstallProductA(msifile, NULL);
4048 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4050 skip("Not enough rights to perform tests\n");
4051 goto error;
4053 ok(r == ERROR_INSTALL_FAILURE,
4054 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4055 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4056 todo_wine
4058 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4060 RemoveDirectoryA("msitest");
4062 r = MsiInstallProductA(msifile, NULL);
4063 ok(r == ERROR_INSTALL_FAILURE,
4064 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4065 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4066 todo_wine
4068 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4071 error:
4072 DeleteFileA(msifile);
4073 DeleteFileA("augustus");
4076 static void test_customaction51(void)
4078 UINT r;
4080 if (is_process_limited())
4082 skip("process is limited\n");
4083 return;
4086 CreateDirectoryA("msitest", NULL);
4087 create_file("msitest\\augustus", 500);
4089 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
4091 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4093 r = MsiInstallProductA(msifile, NULL);
4094 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4096 skip("Not enough rights to perform tests\n");
4097 goto error;
4099 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4100 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4101 ok(delete_pf("msitest", FALSE), "Directory created\n");
4103 error:
4104 DeleteFileA(msifile);
4105 DeleteFileA("msitest\\augustus");
4106 RemoveDirectoryA("msitest");
4109 static void test_installstate(void)
4111 UINT r;
4113 if (is_process_limited())
4115 skip("process is limited\n");
4116 return;
4119 CreateDirectoryA("msitest", NULL);
4120 create_file("msitest\\alpha", 500);
4121 create_file("msitest\\beta", 500);
4122 create_file("msitest\\gamma", 500);
4123 create_file("msitest\\theta", 500);
4124 create_file("msitest\\delta", 500);
4125 create_file("msitest\\epsilon", 500);
4126 create_file("msitest\\zeta", 500);
4127 create_file("msitest\\iota", 500);
4128 create_file("msitest\\eta", 500);
4129 create_file("msitest\\kappa", 500);
4130 create_file("msitest\\lambda", 500);
4131 create_file("msitest\\mu", 500);
4133 create_database(msifile, is_tables, sizeof(is_tables) / sizeof(msi_table));
4135 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4137 r = MsiInstallProductA(msifile, NULL);
4138 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4140 skip("Not enough rights to perform tests\n");
4141 goto error;
4143 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4144 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4145 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4146 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4147 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4148 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4149 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4150 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4151 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4152 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4153 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4154 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4155 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4156 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4158 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
4159 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4160 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4161 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4162 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4163 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4164 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4165 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
4166 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4167 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4168 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
4169 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4170 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4171 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4172 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4174 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
4175 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4176 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4177 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4178 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4179 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4180 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4181 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4182 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4183 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4184 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4185 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4186 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4187 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4188 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4190 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
4191 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4192 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
4193 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4194 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4195 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
4196 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4197 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4198 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4199 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4200 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4201 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4202 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4203 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4204 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4206 error:
4207 DeleteFileA(msifile);
4208 DeleteFileA("msitest\\alpha");
4209 DeleteFileA("msitest\\beta");
4210 DeleteFileA("msitest\\gamma");
4211 DeleteFileA("msitest\\theta");
4212 DeleteFileA("msitest\\delta");
4213 DeleteFileA("msitest\\epsilon");
4214 DeleteFileA("msitest\\zeta");
4215 DeleteFileA("msitest\\iota");
4216 DeleteFileA("msitest\\eta");
4217 DeleteFileA("msitest\\kappa");
4218 DeleteFileA("msitest\\lambda");
4219 DeleteFileA("msitest\\mu");
4220 RemoveDirectoryA("msitest");
4223 static const struct sourcepathmap
4225 BOOL sost; /* shortone\shorttwo */
4226 BOOL solt; /* shortone\longtwo */
4227 BOOL lost; /* longone\shorttwo */
4228 BOOL lolt; /* longone\longtwo */
4229 BOOL soste; /* shortone\shorttwo source exists */
4230 BOOL solte; /* shortone\longtwo source exists */
4231 BOOL loste; /* longone\shorttwo source exists */
4232 BOOL lolte; /* longone\longtwo source exists */
4233 UINT err;
4234 DWORD size;
4235 } spmap[256] =
4237 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4238 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4239 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4240 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4241 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4242 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4243 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4244 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4245 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4246 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4247 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4248 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4249 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4250 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4251 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4252 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4253 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4254 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4255 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4256 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4257 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4258 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4259 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4260 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4261 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4262 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4263 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4264 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4265 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4266 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4267 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4268 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4269 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4270 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4271 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4272 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4273 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4274 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4275 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4276 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4277 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4278 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4279 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4280 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4281 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4282 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4283 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4284 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4285 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4286 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4287 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4288 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4289 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4290 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4291 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4292 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4293 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4294 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4295 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4296 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4297 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4298 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4299 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4300 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4301 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4302 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4303 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4304 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4305 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4306 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4307 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4308 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4309 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4310 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4311 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4312 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4313 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4314 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4315 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4316 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4317 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4318 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4319 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4320 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4321 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4322 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4323 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4324 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4325 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4326 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4327 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4328 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4329 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4330 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4331 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4332 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4333 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4334 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4335 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4336 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4337 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4338 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4339 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4340 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4341 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4342 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4343 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4344 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4345 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4346 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4347 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4348 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4349 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4350 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4351 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4352 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4353 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4354 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4355 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4356 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4357 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4358 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4359 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4360 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4361 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4362 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4363 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4364 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4365 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4366 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4367 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4368 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4369 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4370 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4371 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4372 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4373 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4374 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4375 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4376 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4377 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4378 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4379 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4380 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4381 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4382 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4383 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4384 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4385 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4386 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4387 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4388 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4389 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4390 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4391 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4392 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4393 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4394 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4395 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4396 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4397 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4398 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4399 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4400 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4401 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4402 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4403 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4404 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4405 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4406 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4407 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4408 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4409 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4410 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4411 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4412 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4413 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4414 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4415 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4416 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4417 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4418 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4419 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4420 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4421 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4422 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4423 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4424 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4425 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4426 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4427 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4428 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4429 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4430 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4431 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4432 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4433 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4434 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4435 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4436 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4437 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4438 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4439 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4440 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4441 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4442 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4443 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4444 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4445 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4446 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4447 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4448 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4449 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4450 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4451 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4452 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4453 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4454 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4455 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4456 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4457 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4458 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4459 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4460 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4461 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4462 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4463 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4464 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4465 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4466 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4467 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4468 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4469 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4470 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4471 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4472 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4473 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4474 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4475 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4476 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4477 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4478 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4479 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4480 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4481 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4482 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4483 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4484 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4485 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4486 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4487 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4488 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4489 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4490 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4491 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4492 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4495 static DWORD get_pf_file_size(LPCSTR file)
4497 CHAR path[MAX_PATH];
4498 HANDLE hfile;
4499 DWORD size;
4501 lstrcpyA(path, PROG_FILES_DIR);
4502 lstrcatA(path, "\\");
4503 lstrcatA(path, file);
4505 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
4506 if (hfile == INVALID_HANDLE_VALUE)
4507 return INVALID_FILE_SIZE;
4509 size = GetFileSize(hfile, NULL);
4510 CloseHandle(hfile);
4511 return size;
4514 static void test_sourcepath(void)
4516 UINT r, i;
4518 if (!winetest_interactive)
4520 skip("Run in interactive mode to run source path tests.\n");
4521 return;
4524 create_database(msifile, sp_tables, sizeof(sp_tables) / sizeof(msi_table));
4526 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4528 for (i = 0; i < sizeof(spmap) / sizeof(spmap[0]); i++)
4530 if (spmap[i].sost)
4532 CreateDirectoryA("shortone", NULL);
4533 CreateDirectoryA("shortone\\shorttwo", NULL);
4536 if (spmap[i].solt)
4538 CreateDirectoryA("shortone", NULL);
4539 CreateDirectoryA("shortone\\longtwo", NULL);
4542 if (spmap[i].lost)
4544 CreateDirectoryA("longone", NULL);
4545 CreateDirectoryA("longone\\shorttwo", NULL);
4548 if (spmap[i].lolt)
4550 CreateDirectoryA("longone", NULL);
4551 CreateDirectoryA("longone\\longtwo", NULL);
4554 if (spmap[i].soste)
4555 create_file("shortone\\shorttwo\\augustus", 50);
4556 if (spmap[i].solte)
4557 create_file("shortone\\longtwo\\augustus", 100);
4558 if (spmap[i].loste)
4559 create_file("longone\\shorttwo\\augustus", 150);
4560 if (spmap[i].lolte)
4561 create_file("longone\\longtwo\\augustus", 200);
4563 r = MsiInstallProductA(msifile, NULL);
4564 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
4565 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
4566 "%d: Expected %d, got %d\n", i, spmap[i].size,
4567 get_pf_file_size("msitest\\augustus"));
4569 if (r == ERROR_SUCCESS)
4571 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
4572 ok(delete_pf("msitest", FALSE), "%d: Directory not created\n", i);
4574 else
4576 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
4577 todo_wine ok(!delete_pf("msitest", FALSE), "%d: Directory installed\n", i);
4580 DeleteFileA("shortone\\shorttwo\\augustus");
4581 DeleteFileA("shortone\\longtwo\\augustus");
4582 DeleteFileA("longone\\shorttwo\\augustus");
4583 DeleteFileA("longone\\longtwo\\augustus");
4584 RemoveDirectoryA("shortone\\shorttwo");
4585 RemoveDirectoryA("shortone\\longtwo");
4586 RemoveDirectoryA("longone\\shorttwo");
4587 RemoveDirectoryA("longone\\longtwo");
4588 RemoveDirectoryA("shortone");
4589 RemoveDirectoryA("longone");
4592 DeleteFileA(msifile);
4595 static void test_missingcomponent(void)
4597 UINT r;
4599 if (is_process_limited())
4601 skip("process is limited\n");
4602 return;
4605 CreateDirectoryA("msitest", NULL);
4606 create_file("msitest\\hydrogen", 500);
4607 create_file("msitest\\helium", 500);
4608 create_file("msitest\\lithium", 500);
4609 create_file("beryllium", 500);
4611 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
4613 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4615 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
4616 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4618 skip("Not enough rights to perform tests\n");
4619 goto error;
4621 else if (r == ERROR_INSTALL_FAILURE)
4623 win_skip("broken result\n");
4624 goto error;
4626 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4627 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4628 ok(pf_exists("msitest\\helium"), "File not installed\n");
4629 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4630 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
4631 ok(pf_exists("msitest"), "File not installed\n");
4633 r = MsiInstallProductA(msifile, "REMOVE=ALL INSTALLLEVEL=10 PROPVAR=42");
4634 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4635 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
4636 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
4637 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
4638 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
4639 ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
4641 error:
4642 DeleteFileA(msifile);
4643 DeleteFileA("msitest\\hydrogen");
4644 DeleteFileA("msitest\\helium");
4645 DeleteFileA("msitest\\lithium");
4646 DeleteFileA("beryllium");
4647 RemoveDirectoryA("msitest");
4650 static void test_sourcedirprop(void)
4652 UINT r;
4653 CHAR props[MAX_PATH];
4655 if (is_process_limited())
4657 skip("process is limited\n");
4658 return;
4661 CreateDirectoryA("msitest", NULL);
4662 create_file("msitest\\augustus", 500);
4664 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
4666 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4668 r = MsiInstallProductA(msifile, NULL);
4669 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4671 skip("Not enough rights to perform tests\n");
4672 goto error;
4674 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4675 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4676 ok(delete_pf("msitest", FALSE), "Directory created\n");
4678 DeleteFileA("msitest\\augustus");
4679 RemoveDirectoryA("msitest");
4681 CreateDirectoryA("altsource", NULL);
4682 CreateDirectoryA("altsource\\msitest", NULL);
4683 create_file("altsource\\msitest\\augustus", 500);
4685 sprintf(props, "SRCDIR=%s\\altsource\\", CURR_DIR);
4687 r = MsiInstallProductA(msifile, props);
4688 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4689 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4690 ok(delete_pf("msitest", FALSE), "Directory created\n");
4692 DeleteFileA("altsource\\msitest\\augustus");
4693 RemoveDirectoryA("altsource\\msitest");
4694 RemoveDirectoryA("altsource");
4696 error:
4697 DeleteFileA("msitest\\augustus");
4698 RemoveDirectoryA("msitest");
4699 DeleteFileA(msifile);
4702 static void test_adminimage(void)
4704 UINT r;
4706 if (is_process_limited())
4708 skip("process is limited\n");
4709 return;
4712 CreateDirectoryA("msitest", NULL);
4713 CreateDirectoryA("msitest\\first", NULL);
4714 CreateDirectoryA("msitest\\second", NULL);
4715 CreateDirectoryA("msitest\\cabout", NULL);
4716 CreateDirectoryA("msitest\\cabout\\new", NULL);
4717 create_file("msitest\\one.txt", 100);
4718 create_file("msitest\\first\\two.txt", 100);
4719 create_file("msitest\\second\\three.txt", 100);
4720 create_file("msitest\\cabout\\four.txt", 100);
4721 create_file("msitest\\cabout\\new\\five.txt", 100);
4722 create_file("msitest\\filename", 100);
4723 create_file("msitest\\service.exe", 100);
4725 create_database_wordcount(msifile, ai_tables,
4726 sizeof(ai_tables) / sizeof(msi_table),
4727 100, msidbSumInfoSourceTypeAdminImage, ";1033",
4728 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
4730 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4732 r = MsiInstallProductA(msifile, NULL);
4733 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4735 skip("Not enough rights to perform tests\n");
4736 goto error;
4738 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4740 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4741 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4742 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4743 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4744 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4745 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4746 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4747 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4748 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
4749 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4750 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4751 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4753 error:
4754 DeleteFileA("msifile");
4755 DeleteFileA("msitest\\cabout\\new\\five.txt");
4756 DeleteFileA("msitest\\cabout\\four.txt");
4757 DeleteFileA("msitest\\second\\three.txt");
4758 DeleteFileA("msitest\\first\\two.txt");
4759 DeleteFileA("msitest\\one.txt");
4760 DeleteFileA("msitest\\service.exe");
4761 DeleteFileA("msitest\\filename");
4762 RemoveDirectoryA("msitest\\cabout\\new");
4763 RemoveDirectoryA("msitest\\cabout");
4764 RemoveDirectoryA("msitest\\second");
4765 RemoveDirectoryA("msitest\\first");
4766 RemoveDirectoryA("msitest");
4769 static void test_propcase(void)
4771 UINT r;
4773 if (is_process_limited())
4775 skip("process is limited\n");
4776 return;
4779 CreateDirectoryA("msitest", NULL);
4780 create_file("msitest\\augustus", 500);
4782 create_database(msifile, pc_tables, sizeof(pc_tables) / sizeof(msi_table));
4784 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4786 r = MsiInstallProductA(msifile, "MyProp=42");
4787 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4789 skip("Not enough rights to perform tests\n");
4790 goto error;
4792 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4793 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4794 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4796 r = MsiInstallProductA(msifile, "Prop1=\"Copyright \"\"My Company\"\" 2015\" MyProp=42");
4797 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4798 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4799 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4801 r = MsiInstallProductA(msifile, "Prop1=\"\"\"install.exe\"\" /Install\" MyProp=\"42\"");
4802 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4803 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4804 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4806 error:
4807 DeleteFileA(msifile);
4808 DeleteFileA("msitest\\augustus");
4809 RemoveDirectoryA("msitest");
4812 static void test_int_widths( void )
4814 static const WCHAR msitestW[] = {'m','s','i','t','e','s','t','.','m','s','i',0};
4815 static const WCHAR msitableW[] = {'m','s','i','t','a','b','l','e','.','i','d','t',0};
4816 static const WCHAR slashW[] = {'\\',0};
4817 static const char int0[] = "int0\ni0\nint0\tint0\n1";
4818 static const char int1[] = "int1\ni1\nint1\tint1\n1";
4819 static const char int2[] = "int2\ni2\nint2\tint2\n1";
4820 static const char int3[] = "int3\ni3\nint3\tint3\n1";
4821 static const char int4[] = "int4\ni4\nint4\tint4\n1";
4822 static const char int5[] = "int5\ni5\nint5\tint5\n1";
4823 static const char int8[] = "int8\ni8\nint8\tint8\n1";
4824 static const struct
4826 const char *data;
4827 unsigned int size;
4828 UINT ret;
4830 tests[] =
4832 { int0, sizeof(int0) - 1, ERROR_SUCCESS },
4833 { int1, sizeof(int1) - 1, ERROR_SUCCESS },
4834 { int2, sizeof(int2) - 1, ERROR_SUCCESS },
4835 { int3, sizeof(int3) - 1, ERROR_FUNCTION_FAILED },
4836 { int4, sizeof(int4) - 1, ERROR_SUCCESS },
4837 { int5, sizeof(int5) - 1, ERROR_FUNCTION_FAILED },
4838 { int8, sizeof(int8) - 1, ERROR_FUNCTION_FAILED }
4840 WCHAR tmpdir[MAX_PATH], msitable[MAX_PATH], msidb[MAX_PATH];
4841 MSIHANDLE db;
4842 UINT r, i;
4844 GetTempPathW(MAX_PATH, tmpdir);
4845 CreateDirectoryW(tmpdir, NULL);
4847 lstrcpyW(msitable, tmpdir);
4848 lstrcatW(msitable, slashW);
4849 lstrcatW(msitable, msitableW);
4851 lstrcpyW(msidb, tmpdir);
4852 lstrcatW(msidb, slashW);
4853 lstrcatW(msidb, msitestW);
4855 r = MsiOpenDatabaseW(msidb, MSIDBOPEN_CREATE, &db);
4856 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4858 for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
4860 DWORD count;
4861 HANDLE handle = CreateFileW(msitable, GENERIC_WRITE, 0, NULL,
4862 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
4863 WriteFile(handle, tests[i].data, tests[i].size, &count, NULL);
4864 CloseHandle(handle);
4866 r = MsiDatabaseImportW(db, tmpdir, msitableW);
4867 ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r);
4869 r = MsiDatabaseCommit(db);
4870 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4871 DeleteFileW(msitable);
4874 MsiCloseHandle(db);
4875 DeleteFileW(msidb);
4876 RemoveDirectoryW(tmpdir);
4879 static void test_shortcut(void)
4881 UINT r;
4882 HRESULT hr;
4884 if (is_process_limited())
4886 skip("process is limited\n");
4887 return;
4890 create_test_files();
4891 create_database(msifile, sc_tables, sizeof(sc_tables) / sizeof(msi_table));
4893 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4895 r = MsiInstallProductA(msifile, NULL);
4896 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4898 skip("Not enough rights to perform tests\n");
4899 goto error;
4901 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4903 hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
4904 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
4906 r = MsiInstallProductA(msifile, NULL);
4907 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4909 CoUninitialize();
4911 hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
4912 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
4914 r = MsiInstallProductA(msifile, NULL);
4915 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4917 CoUninitialize();
4919 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4920 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4921 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4922 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4923 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4924 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4925 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4926 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4927 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4928 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
4929 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4930 while (!delete_pf("msitest\\Shortcut.lnk", TRUE) && GetLastError() == ERROR_SHARING_VIOLATION) Sleep(1000);
4931 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4933 error:
4934 delete_test_files();
4935 DeleteFileA(msifile);
4938 static void test_preselected(void)
4940 UINT r;
4942 if (is_process_limited())
4944 skip("process is limited\n");
4945 return;
4948 create_test_files();
4949 create_database(msifile, ps_tables, sizeof(ps_tables) / sizeof(msi_table));
4951 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4953 r = MsiInstallProductA(msifile, "ADDLOCAL=One");
4954 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4956 skip("Not enough rights to perform tests\n");
4957 goto error;
4959 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4961 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
4962 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
4963 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
4964 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
4965 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
4966 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
4967 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
4968 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
4969 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
4970 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
4971 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
4972 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4974 r = MsiInstallProductA(msifile, NULL);
4975 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4977 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4978 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4979 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4980 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4981 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4982 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4983 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4984 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4985 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4986 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
4987 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4988 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4990 error:
4991 delete_test_files();
4992 DeleteFileA(msifile);
4995 static void test_installed_prop(void)
4997 static const char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}";
4998 UINT r;
5000 if (is_process_limited())
5002 skip("process is limited\n");
5003 return;
5006 create_test_files();
5007 create_database(msifile, ip_tables, sizeof(ip_tables) / sizeof(msi_table));
5009 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5011 r = MsiInstallProductA(msifile, "FULL=1");
5012 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5014 skip("Not enough rights to perform tests\n");
5015 goto error;
5017 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5019 r = MsiInstallProductA(msifile, "FULL=1");
5020 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5022 r = MsiConfigureProductExA(prodcode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, "FULL=1");
5023 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5025 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5026 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5027 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5028 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5029 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5030 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5031 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5032 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5033 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5034 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5035 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5036 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5038 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5039 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5041 error:
5042 delete_test_files();
5043 DeleteFileA(msifile);
5046 static void test_allusers_prop(void)
5048 UINT r;
5050 if (is_process_limited())
5052 skip("process is limited\n");
5053 return;
5056 create_test_files();
5057 create_database(msifile, aup_tables, sizeof(aup_tables) / sizeof(msi_table));
5059 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5061 /* ALLUSERS property unset */
5062 r = MsiInstallProductA(msifile, "FULL=1");
5063 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5065 skip("Not enough rights to perform tests\n");
5066 goto error;
5068 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5070 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5071 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5072 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5073 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5074 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5075 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5076 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5077 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5078 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5079 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5080 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5081 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5083 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5084 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5086 delete_test_files();
5088 create_test_files();
5089 create_database(msifile, aup2_tables, sizeof(aup2_tables) / sizeof(msi_table));
5091 /* ALLUSERS property set to 1 */
5092 r = MsiInstallProductA(msifile, "FULL=1");
5093 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5095 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5096 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5097 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5098 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5099 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5100 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5101 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5102 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5103 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5104 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5105 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5106 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5108 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5109 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5111 delete_test_files();
5113 create_test_files();
5114 create_database(msifile, aup3_tables, sizeof(aup3_tables) / sizeof(msi_table));
5116 /* ALLUSERS property set to 2 */
5117 r = MsiInstallProductA(msifile, "FULL=1");
5118 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5120 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5121 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5122 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5123 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5124 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5125 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5126 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5127 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5128 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5129 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5130 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5131 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5133 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5134 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5136 delete_test_files();
5138 create_test_files();
5139 create_database(msifile, aup4_tables, sizeof(aup4_tables) / sizeof(msi_table));
5141 /* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */
5142 r = MsiInstallProductA(msifile, "FULL=1");
5143 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5145 error:
5146 delete_test_files();
5147 DeleteFileA(msifile);
5150 static const char session_manager[] = "System\\CurrentControlSet\\Control\\Session Manager";
5151 static const char rename_ops[] = "PendingFileRenameOperations";
5153 static void process_pending_renames(HKEY hkey)
5155 char *buf, *src, *dst, *buf2, *buf2ptr;
5156 DWORD size;
5157 LONG ret;
5158 BOOL found = FALSE;
5160 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size);
5161 ok(!ret, "RegQueryValueExA failed %d\n", ret);
5163 buf = HeapAlloc(GetProcessHeap(), 0, size + 1);
5164 buf2ptr = buf2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 1);
5166 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size);
5167 buf[size] = 0;
5168 ok(!ret, "RegQueryValueExA failed %d\n", ret);
5169 if (ret) return;
5171 for (src = buf; *src; src = dst + strlen(dst) + 1)
5173 DWORD flags = MOVEFILE_COPY_ALLOWED;
5174 BOOL fileret;
5176 dst = src + strlen(src) + 1;
5178 if (!strstr(src, "msitest"))
5180 lstrcpyA(buf2ptr, src);
5181 buf2ptr += strlen(src) + 1;
5182 lstrcpyA(buf2ptr, dst);
5183 buf2ptr += strlen(dst) + 1;
5184 continue;
5187 found = TRUE;
5189 if (*dst == '!')
5191 flags |= MOVEFILE_REPLACE_EXISTING;
5192 dst++;
5194 if (src[0] == '\\' && src[1] == '?' && src[2] == '?' && src[3] == '\\') src += 4;
5195 if (*dst)
5197 if (dst[0] == '\\' && dst[1] == '?' && dst[2] == '?' && dst[3] == '\\') dst += 4;
5198 fileret = MoveFileExA(src, dst, flags);
5199 ok(fileret, "Failed to move file %s -> %s (%u)\n", src, dst, GetLastError());
5201 else
5203 fileret = DeleteFileA(src);
5204 ok(fileret || broken(!fileret) /* win2k3 */, "Failed to delete file %s (%u)\n", src, GetLastError());
5208 ok(found, "Expected a 'msitest' entry\n");
5210 if (*buf2)
5211 RegSetValueExA(hkey, rename_ops, 0, REG_MULTI_SZ, (LPBYTE)buf2, buf2ptr + 1 - buf2);
5212 else
5213 RegDeleteValueA(hkey, rename_ops);
5215 HeapFree(GetProcessHeap(), 0, buf);
5216 HeapFree(GetProcessHeap(), 0, buf2);
5219 static BOOL file_matches_data(LPCSTR file, LPCSTR data)
5221 DWORD len, data_len = strlen(data);
5222 HANDLE handle;
5223 char buf[128];
5225 handle = CreateFileA(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
5226 ok(handle != INVALID_HANDLE_VALUE, "failed to open %s (%u)\n", file, GetLastError());
5228 if (ReadFile(handle, buf, sizeof(buf), &len, NULL) && len >= data_len)
5230 CloseHandle(handle);
5231 return !memcmp(buf, data, data_len);
5233 CloseHandle(handle);
5234 return FALSE;
5237 static void test_file_in_use(void)
5239 UINT r;
5240 HANDLE file;
5241 HKEY hkey;
5242 char path[MAX_PATH];
5244 if (is_process_limited())
5246 skip("process is limited\n");
5247 return;
5250 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
5252 CreateDirectoryA("msitest", NULL);
5253 create_file("msitest\\maximus", 500);
5254 create_database(msifile, fiu_tables, sizeof(fiu_tables) / sizeof(msi_table));
5256 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5258 lstrcpyA(path, PROG_FILES_DIR);
5259 lstrcatA(path, "\\msitest");
5260 CreateDirectoryA(path, NULL);
5262 lstrcatA(path, "\\maximus");
5263 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
5265 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
5266 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5268 skip("Not enough rights to perform tests\n");
5269 goto error;
5271 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
5272 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
5273 CloseHandle(file);
5274 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
5276 process_pending_renames(hkey);
5277 RegCloseKey(hkey);
5279 ok(file_matches_data(path, "msitest\\maximus"), "Expected file to match\n");
5280 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
5281 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
5283 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5284 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5286 error:
5287 RegCloseKey(hkey);
5289 delete_pf("msitest\\maximus", TRUE);
5290 delete_pf("msitest", FALSE);
5291 DeleteFileA("msitest\\maximus");
5292 delete_test_files();
5293 DeleteFileA(msifile);
5296 static void test_file_in_use_cab(void)
5298 UINT r;
5299 HANDLE file;
5300 HKEY hkey;
5301 char path[MAX_PATH];
5303 if (is_process_limited())
5305 skip("process is limited\n");
5306 return;
5309 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
5311 CreateDirectoryA("msitest", NULL);
5312 create_file("maximus", 500);
5313 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
5314 DeleteFileA("maximus");
5316 create_database(msifile, fiuc_tables, sizeof(fiuc_tables) / sizeof(msi_table));
5318 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5320 lstrcpyA(path, PROG_FILES_DIR);
5321 lstrcatA(path, "\\msitest");
5322 CreateDirectoryA(path, NULL);
5324 lstrcatA(path, "\\maximus");
5325 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
5327 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
5328 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5330 skip("Not enough rights to perform tests\n");
5331 goto error;
5333 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
5334 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
5335 CloseHandle(file);
5336 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
5338 process_pending_renames(hkey);
5339 RegCloseKey(hkey);
5341 ok(file_matches_data(path, "maximus"), "Expected file to match\n");
5342 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
5343 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
5345 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5346 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5348 error:
5349 RegCloseKey(hkey);
5351 delete_pf("msitest\\maximus", TRUE);
5352 delete_pf("msitest", FALSE);
5353 DeleteFileA("msitest\\maximus");
5354 delete_cab_files();
5355 delete_test_files();
5356 DeleteFileA(msifile);
5359 static void test_feature_override(void)
5361 UINT r;
5362 REGSAM access = KEY_ALL_ACCESS;
5364 if (is_process_limited())
5366 skip("process is limited\n");
5367 return;
5370 create_test_files();
5371 create_file("msitest\\override.txt", 1000);
5372 create_file("msitest\\preselected.txt", 1000);
5373 create_file("msitest\\notpreselected.txt", 1000);
5374 create_database(msifile, fo_tables, sizeof(fo_tables) / sizeof(msi_table));
5376 if (is_wow64)
5377 access |= KEY_WOW64_64KEY;
5379 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5381 r = MsiInstallProductA(msifile, "ADDLOCAL=override");
5382 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5384 skip("Not enough rights to perform tests\n");
5385 goto error;
5387 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5389 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5390 ok(!pf_exists("msitest\\preselected.txt"), "file installed\n");
5391 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5393 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5394 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5396 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5398 r = MsiInstallProductA(msifile, "preselect=1");
5399 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5401 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5402 ok(pf_exists("msitest\\preselected.txt"), "file not installed\n");
5403 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5405 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5406 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5408 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5409 todo_wine {
5410 ok(delete_pf("msitest\\preselected.txt", TRUE), "file removed\n");
5411 ok(delete_pf("msitest", FALSE), "directory removed\n");
5414 r = MsiInstallProductA(msifile, NULL);
5415 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5417 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5418 ok(pf_exists("msitest\\preselected.txt"), "file not installed\n");
5419 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5421 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5422 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5424 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5425 todo_wine {
5426 ok(delete_pf("msitest\\preselected.txt", TRUE), "file removed\n");
5427 ok(delete_pf("msitest", FALSE), "directory removed\n");
5430 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", access);
5432 error:
5433 DeleteFileA("msitest\\override.txt");
5434 DeleteFileA("msitest\\preselected.txt");
5435 DeleteFileA("msitest\\notpreselected.txt");
5436 delete_test_files();
5437 DeleteFileA(msifile);
5440 static void test_icon_table(void)
5442 MSIHANDLE hdb = 0, record;
5443 LPCSTR query;
5444 UINT res;
5445 CHAR path[MAX_PATH];
5446 static const char prodcode[] = "{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}";
5448 if (is_process_limited())
5450 skip("process is limited\n");
5451 return;
5454 create_database(msifile, icon_base_tables, sizeof(icon_base_tables) / sizeof(msi_table));
5456 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5458 res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb);
5459 ok(res == ERROR_SUCCESS, "failed to open db: %d\n", res);
5461 query = "CREATE TABLE `Icon` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)";
5462 res = run_query( hdb, 0, query );
5463 ok(res == ERROR_SUCCESS, "Can't create Icon table: %d\n", res);
5465 create_file("icon.ico", 100);
5466 record = MsiCreateRecord(1);
5467 res = MsiRecordSetStreamA(record, 1, "icon.ico");
5468 ok(res == ERROR_SUCCESS, "Failed to add stream data to record: %d\n", res);
5470 query = "INSERT INTO `Icon` (`Name`, `Data`) VALUES ('testicon', ?)";
5471 res = run_query(hdb, record, query);
5472 ok(res == ERROR_SUCCESS, "Insert into Icon table failed: %d\n", res);
5474 res = MsiCloseHandle(record);
5475 ok(res == ERROR_SUCCESS, "Failed to close record handle: %d\n", res);
5476 DeleteFileA("icon.ico");
5477 res = MsiDatabaseCommit(hdb);
5478 ok(res == ERROR_SUCCESS, "Failed to commit database: %d\n", res);
5479 res = MsiCloseHandle(hdb);
5480 ok(res == ERROR_SUCCESS, "Failed to close database: %d\n", res);
5482 /* per-user */
5483 res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
5484 if (res == ERROR_INSTALL_PACKAGE_REJECTED)
5486 skip("Not enough rights to perform tests\n");
5487 DeleteFileA(msifile);
5488 return;
5490 ok(res == ERROR_SUCCESS, "Failed to do per-user install: %d\n", res);
5492 lstrcpyA(path, APP_DATA_DIR);
5493 lstrcatA(path, "\\");
5494 lstrcatA(path, "Microsoft\\Installer\\");
5495 lstrcatA(path, prodcode);
5496 lstrcatA(path, "\\testicon");
5497 ok(file_exists(path), "Per-user icon file isn't where it's expected (%s)\n", path);
5499 res = MsiInstallProductA(msifile, "REMOVE=ALL");
5500 ok(res == ERROR_SUCCESS, "Failed to uninstall per-user\n");
5501 ok(!file_exists(path), "Per-user icon file not removed (%s)\n", path);
5503 /* system-wide */
5504 res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
5505 ok(res == ERROR_SUCCESS, "Failed to system-wide install: %d\n", res);
5507 lstrcpyA(path, WINDOWS_DIR);
5508 lstrcatA(path, "\\");
5509 lstrcatA(path, "Installer\\");
5510 lstrcatA(path, prodcode);
5511 lstrcatA(path, "\\testicon");
5512 ok(file_exists(path), "System-wide icon file isn't where it's expected (%s)\n", path);
5514 res = MsiInstallProductA(msifile, "REMOVE=ALL");
5515 ok(res == ERROR_SUCCESS, "Failed to uninstall system-wide\n");
5516 ok(!file_exists(path), "System-wide icon file not removed (%s)\n", path);
5518 delete_pfmsitest_files();
5519 DeleteFileA(msifile);
5522 static void test_package_validation(void)
5524 UINT r;
5526 if (is_process_limited())
5528 skip("process is limited\n");
5529 return;
5532 CreateDirectoryA("msitest", NULL);
5533 create_file("msitest\\maximus", 500);
5534 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;1033");
5536 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5538 r = MsiInstallProductA(msifile, NULL);
5539 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5541 skip("Not enough rights to perform tests\n");
5542 goto error;
5544 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5545 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5546 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5548 DeleteFileA(msifile);
5549 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,9999;9999");
5551 r = MsiInstallProductA(msifile, NULL);
5552 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5554 DeleteFileA(msifile);
5555 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,1033;9999");
5557 r = MsiInstallProductA(msifile, NULL);
5558 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5560 DeleteFileA(msifile);
5561 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,9999;1033");
5563 r = MsiInstallProductA(msifile, NULL);
5564 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5565 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5566 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5568 DeleteFileA(msifile);
5569 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel64,9999;1033");
5571 r = MsiInstallProductA(msifile, NULL);
5572 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5574 DeleteFileA(msifile);
5575 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel32,1033;1033");
5577 r = MsiInstallProductA(msifile, NULL);
5578 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5580 DeleteFileA(msifile);
5581 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel32,9999;1033");
5583 r = MsiInstallProductA(msifile, NULL);
5584 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5586 DeleteFileA(msifile);
5587 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;9999");
5589 r = MsiInstallProductA(msifile, NULL);
5590 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5591 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5592 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5594 if (GetSystemDefaultLangID() == MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ))
5596 DeleteFileA(msifile);
5597 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;9");
5598 r = MsiInstallProductA(msifile, NULL);
5599 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5600 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5601 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5603 DeleteFileA(msifile);
5604 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;1024");
5605 r = MsiInstallProductA(msifile, NULL);
5606 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5607 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5608 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5611 DeleteFileA(msifile);
5612 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel32;0");
5614 r = MsiInstallProductA(msifile, NULL);
5615 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5616 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5617 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5619 if (is_64bit && !is_wow64)
5621 DeleteFileA(msifile);
5622 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5624 r = MsiInstallProductA(msifile, NULL);
5625 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5626 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5627 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5629 DeleteFileA(msifile);
5630 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5632 r = MsiInstallProductA(msifile, NULL);
5633 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
5634 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5635 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5637 DeleteFileA(msifile);
5638 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5640 r = MsiInstallProductA(msifile, NULL);
5641 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5642 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5643 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5645 else if (is_wow64)
5647 DeleteFileA(msifile);
5648 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5650 r = MsiInstallProductA(msifile, NULL);
5651 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5652 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5653 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5655 DeleteFileA(msifile);
5656 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5658 r = MsiInstallProductA(msifile, NULL);
5659 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
5660 ok(!delete_pf_native("msitest\\maximus", TRUE), "file exists\n");
5661 ok(!delete_pf_native("msitest", FALSE), "directory exists\n");
5663 DeleteFileA(msifile);
5664 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5666 r = MsiInstallProductA(msifile, NULL);
5667 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5668 ok(delete_pf_native("msitest\\maximus", TRUE), "file exists\n");
5669 ok(delete_pf_native("msitest", FALSE), "directory exists\n");
5671 else
5673 DeleteFileA(msifile);
5674 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5676 r = MsiInstallProductA(msifile, NULL);
5677 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5678 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5679 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5681 DeleteFileA(msifile);
5682 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Alpha,Beta,Intel;0");
5684 r = MsiInstallProductA(msifile, NULL);
5685 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5686 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5687 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5689 DeleteFileA(msifile);
5690 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5692 r = MsiInstallProductA(msifile, NULL);
5693 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5694 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5695 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5697 DeleteFileA(msifile);
5698 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5700 r = MsiInstallProductA(msifile, NULL);
5701 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5702 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5703 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5706 error:
5707 /* Delete the files in the temp (current) folder */
5708 DeleteFileA(msifile);
5709 DeleteFileA("msitest\\maximus");
5710 RemoveDirectoryA("msitest");
5713 static void test_upgrade_code(void)
5715 UINT r;
5717 if (is_process_limited())
5719 skip("process is limited\n");
5720 return;
5723 CreateDirectoryA("msitest", NULL);
5724 create_file("msitest\\upgradecode.txt", 1000);
5725 create_database(msifile, uc_tables, sizeof(uc_tables) / sizeof(msi_table));
5727 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5729 r = MsiInstallProductA(msifile, NULL);
5730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5732 ok(pf_exists("msitest\\upgradecode.txt"), "file not installed\n");
5734 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5735 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5737 ok(!delete_pf("msitest\\upgradecode.txt", TRUE), "file not removed\n");
5738 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5740 DeleteFileA("msitest\\upgradecode.txt");
5741 RemoveDirectoryA("msitest");
5742 DeleteFileA(msifile);
5745 static void test_mixed_package(void)
5747 UINT r;
5748 LONG res;
5749 HKEY hkey;
5750 char value[MAX_PATH];
5751 DWORD size;
5753 if (is_process_limited())
5755 skip("process is limited\n");
5756 return;
5758 if (!is_wow64 && !is_64bit)
5760 skip("this test must be run on 64-bit\n");
5761 return;
5763 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5764 create_database_template(msifile, mixed_tables, sizeof(mixed_tables)/sizeof(msi_table), 200, "x64;1033");
5766 r = MsiInstallProductA(msifile, NULL);
5767 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5769 skip("Not enough rights to perform tests\n");
5770 goto error;
5772 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5774 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5775 ok(!res, "can't open 32-bit component key, got %d\n", res);
5776 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5777 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5778 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5779 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5780 RegCloseKey(hkey);
5782 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5783 ok(!res, "can't open 64-bit component key, got %d\n", res);
5784 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5785 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5786 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5787 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5788 RegCloseKey(hkey);
5790 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5791 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5792 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5793 ok(res == ERROR_SUCCESS, "can't open 32-bit CLSID key, got %d\n", res);
5794 if (res == ERROR_SUCCESS) {
5795 size = sizeof(value);
5796 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5797 ok(!strcmp(value, "winetest32.dll"), "got %s\n", value);
5798 RegCloseKey(hkey);
5801 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5802 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5803 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5804 ok(res == ERROR_SUCCESS, "can't open 64-bit CLSID key, got %d\n", res);
5805 if (res == ERROR_SUCCESS) {
5806 size = sizeof(value);
5807 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5808 ok(!strcmp(value, "winetest64.dll"), "got %s\n", value);
5809 RegCloseKey(hkey);
5812 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5813 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5815 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5816 ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
5818 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5819 ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
5821 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5822 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5823 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5824 ok(res == ERROR_FILE_NOT_FOUND, "32-bit CLSID key not removed\n");
5826 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5827 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5828 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5829 ok(res == ERROR_FILE_NOT_FOUND, "64-bit CLSID key not removed\n");
5831 DeleteFileA( msifile );
5832 create_database_template(msifile, mixed_tables, sizeof(mixed_tables)/sizeof(msi_table), 200, "Intel;1033");
5834 r = MsiInstallProductA(msifile, NULL);
5835 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5837 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5838 ok(!res, "can't open 32-bit component key, got %d\n", res);
5839 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5840 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5841 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5842 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5843 RegCloseKey(hkey);
5845 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5846 ok(!res, "can't open 64-bit component key, got %d\n", res);
5847 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5848 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5849 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5850 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5851 RegCloseKey(hkey);
5853 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5854 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5855 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5856 ok(res == ERROR_SUCCESS, "can't open 32-bit CLSID key, got %d\n", res);
5857 if (res == ERROR_SUCCESS) {
5858 size = sizeof(value);
5859 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5860 ok(!strcmp(value, "winetest32.dll"), "got %s\n", value);
5861 RegCloseKey(hkey);
5864 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5865 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5866 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5867 ok(res == ERROR_SUCCESS, "can't open 64-bit CLSID key, got %d\n", res);
5868 if (res == ERROR_SUCCESS) {
5869 size = sizeof(value);
5870 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5871 ok(!strcmp(value, "winetest64.dll"), "got %s\n", value);
5872 RegCloseKey(hkey);
5875 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5876 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5878 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5879 ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
5881 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5882 ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
5884 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5885 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5886 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5887 ok(res == ERROR_FILE_NOT_FOUND, "32-bit CLSID key not removed\n");
5889 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5890 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5891 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5892 ok(res == ERROR_FILE_NOT_FOUND, "64-bit CLSID key not removed\n");
5894 error:
5895 DeleteFileA( msifile );
5898 static void test_volume_props(void)
5900 UINT r;
5902 if (is_process_limited())
5904 skip("process is limited\n");
5905 return;
5907 CreateDirectoryA("msitest", NULL);
5908 create_file("msitest\\volumeprop.txt", 1000);
5909 create_database(msifile, vp_tables, sizeof(vp_tables)/sizeof(msi_table));
5911 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5913 r = MsiInstallProductA(msifile, NULL);
5914 ok(r == ERROR_SUCCESS, "got %u\n", r);
5916 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5917 ok(r == ERROR_SUCCESS, "got %u\n", r);
5919 DeleteFileA("msitest\\volumeprop.txt");
5920 RemoveDirectoryA("msitest");
5921 DeleteFileA(msifile);
5924 static void test_shared_component(void)
5926 UINT r;
5928 if (is_process_limited())
5930 skip("process is limited\n");
5931 return;
5933 CreateDirectoryA("msitest", NULL);
5934 create_file("msitest\\sharedcomponent.txt", 1000);
5935 create_database_wordcount(msifile, shc_tables, sizeof(shc_tables)/sizeof(shc_tables[0]),
5936 100, 0, ";", "{A8826420-FD72-4E61-9E15-C1944CF4CBE1}");
5937 create_database_wordcount(msifile2, shc2_tables, sizeof(shc2_tables)/sizeof(shc2_tables[0]),
5938 100, 0, ";", "{A8B50B30-0E8A-4ACD-B3CF-1A5DC58B2739}");
5940 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5942 r = MsiInstallProductA(msifile, NULL);
5943 ok(r == ERROR_SUCCESS, "got %u\n", r);
5945 ok(pf_exists("msitest\\sharedcomponent.txt"), "file not installed\n");
5947 r = MsiInstallProductA(msifile2, NULL);
5948 ok(r == ERROR_SUCCESS, "got %u\n", r);
5950 ok(pf_exists("msitest\\sharedcomponent.txt"), "file not installed\n");
5952 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5953 ok(r == ERROR_SUCCESS, "got %u\n", r);
5955 ok(pf_exists("msitest\\sharedcomponent.txt"), "file removed\n");
5957 r = MsiInstallProductA(msifile2, "REMOVE=ALL");
5958 ok(r == ERROR_SUCCESS, "got %u\n", r);
5960 ok(!pf_exists("msitest\\sharedcomponent.txt"), "file not removed\n");
5962 DeleteFileA("msitest\\sharedcomponent.txt");
5963 RemoveDirectoryA("msitest");
5964 DeleteFileA(msifile);
5965 DeleteFileA(msifile2);
5968 static void test_remove_upgrade_code(void)
5970 UINT r;
5971 LONG res;
5972 HKEY hkey;
5973 REGSAM access = KEY_ALL_ACCESS;
5974 DWORD type, size;
5975 char buf[1];
5977 if (is_process_limited())
5979 skip( "process is limited\n" );
5980 return;
5982 if (is_wow64) access |= KEY_WOW64_64KEY;
5984 create_test_files();
5985 create_database( msifile, icon_base_tables, sizeof(icon_base_tables)/sizeof(icon_base_tables[0]) );
5987 MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
5989 r = MsiInstallProductA( msifile, "FULL=1" );
5990 ok(r == ERROR_SUCCESS, "got %u\n", r);
5992 res = RegOpenKeyExA( HKEY_LOCAL_MACHINE,
5993 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2",
5994 0, access, &hkey );
5995 ok( res == ERROR_SUCCESS, "got %d\n", res );
5997 type = 0xdeadbeef;
5998 buf[0] = 0x55;
5999 size = sizeof(buf);
6000 res = RegQueryValueExA( hkey, "94A88FD7F6998CE40A22FB59F6B9C2BB", NULL, &type, (BYTE *)buf, &size );
6001 ok( res == ERROR_SUCCESS, "got %d\n", res );
6002 ok( type == REG_SZ, "got %u\n", type );
6003 ok( size == 1, "got %u\n", size );
6004 ok( !buf[0], "wrong data\n" );
6005 RegCloseKey( hkey );
6007 r = MsiInstallProductA( msifile, "REMOVE=ALL" );
6008 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6010 res = RegOpenKeyExA( HKEY_LOCAL_MACHINE,
6011 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2",
6012 0, access, &hkey );
6013 ok( res == ERROR_FILE_NOT_FOUND, "got %d\n", res );
6015 RemoveDirectoryA( "msitest" );
6016 DeleteFileA( msifile );
6019 static void test_feature_tree(void)
6021 UINT r;
6023 if (is_process_limited())
6025 skip( "process is limited\n" );
6026 return;
6029 create_file( "msitest\\featuretree.txt", 1000 );
6030 create_database( msifile, ft_tables, sizeof(ft_tables)/sizeof(ft_tables[0]) );
6032 MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
6034 r = MsiInstallProductA( msifile, "INSTALLTYPE=\"0\"" );
6035 ok( r == ERROR_INSTALL_FAILURE, "got %u\n", r );
6037 r = MsiInstallProductA( msifile, "INSTALLTYPE=\"1\"" );
6038 ok( r == ERROR_SUCCESS, "got %u\n", r );
6040 r = MsiInstallProductA( msifile, "REMOVE=ALL" );
6041 ok( r == ERROR_SUCCESS, "got %u\n", r );
6043 DeleteFileA( "msitest\\featuretree.txt" );
6044 RemoveDirectoryA( "msitest" );
6045 DeleteFileA( msifile );
6048 START_TEST(install)
6050 DWORD len;
6051 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6052 STATEMGRSTATUS status;
6053 BOOL ret = FALSE;
6055 init_functionpointers();
6057 if (pIsWow64Process)
6058 pIsWow64Process(GetCurrentProcess(), &is_wow64);
6060 GetCurrentDirectoryA(MAX_PATH, prev_path);
6061 GetTempPathA(MAX_PATH, temp_path);
6062 SetCurrentDirectoryA(temp_path);
6064 lstrcpyA(CURR_DIR, temp_path);
6065 len = lstrlenA(CURR_DIR);
6067 if(len && (CURR_DIR[len - 1] == '\\'))
6068 CURR_DIR[len - 1] = 0;
6070 ok(get_system_dirs(), "failed to retrieve system dirs\n");
6071 ok(get_user_dirs(), "failed to retrieve user dirs\n");
6073 /* Create a restore point ourselves so we circumvent the multitude of restore points
6074 * that would have been created by all the installation and removal tests.
6076 * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
6077 * creation of restore points.
6079 if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
6081 memset(&status, 0, sizeof(status));
6082 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
6085 /* Create only one log file and don't append. We have to pass something
6086 * for the log mode for this to work. The logfile needs to have an absolute
6087 * path otherwise we still end up with some extra logfiles as some tests
6088 * change the current directory.
6090 lstrcpyA(log_file, temp_path);
6091 lstrcatA(log_file, "\\msitest.log");
6092 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
6094 if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */
6095 test_MsiInstallProduct();
6096 test_MsiSetComponentState();
6097 test_packagecoltypes();
6098 test_continuouscabs();
6099 test_caborder();
6100 test_mixedmedia();
6101 test_samesequence();
6102 test_uiLevelFlags();
6103 test_readonlyfile();
6104 test_readonlyfile_cab();
6105 test_setdirproperty();
6106 test_cabisextracted();
6107 test_transformprop();
6108 test_currentworkingdir();
6109 test_admin();
6110 test_adminprops();
6111 test_missingcab();
6112 test_sourcefolder();
6113 test_customaction51();
6114 test_installstate();
6115 test_sourcepath();
6116 test_missingcomponent();
6117 test_sourcedirprop();
6118 test_adminimage();
6119 test_propcase();
6120 test_int_widths();
6121 test_shortcut();
6122 test_preselected();
6123 test_installed_prop();
6124 test_file_in_use();
6125 test_file_in_use_cab();
6126 test_allusers_prop();
6127 test_feature_override();
6128 test_icon_table();
6129 test_package_validation();
6130 test_upgrade_code();
6131 test_mixed_package();
6132 test_volume_props();
6133 test_shared_component();
6134 test_remove_upgrade_code();
6135 test_feature_tree();
6137 DeleteFileA(log_file);
6139 if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
6141 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
6142 if (ret)
6143 remove_restore_point(status.llSequenceNumber);
6145 FreeLibrary(hsrclient);
6147 SetCurrentDirectoryA(prev_path);