msi/tests: Prepare install.c for the switch to -D__WINESRC__.
[wine.git] / dlls / msi / tests / install.c
blob6604e025109d9424cb06ec62d2c0f664c9889055
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 *pConvertSidToStringSidA)(PSID, LPSTR*);
47 static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
48 static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
49 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
51 static HMODULE hsrclient = 0;
52 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
53 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
55 static BOOL is_wow64;
56 static const BOOL is_64bit = sizeof(void *) > sizeof(int);
58 static const char *msifile = "msitest.msi";
59 static const char *msifile2 = "winetest2.msi";
60 static const char *mstfile = "winetest.mst";
62 static const WCHAR msifileW[] = {'m','s','i','t','e','s','t','.','m','s','i',0};
63 static const WCHAR msifile2W[] = {'w','i','n','e','t','e','s','t','2','.','m','s','i',0};
65 static CHAR CURR_DIR[MAX_PATH];
66 static CHAR PROG_FILES_DIR[MAX_PATH];
67 static CHAR PROG_FILES_DIR_NATIVE[MAX_PATH];
68 static CHAR COMMON_FILES_DIR[MAX_PATH];
69 static CHAR APP_DATA_DIR[MAX_PATH];
70 static CHAR WINDOWS_DIR[MAX_PATH];
72 /* msi database data */
74 static const CHAR component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
75 "s72\tS38\ts72\ti2\tS255\tS72\n"
76 "Component\tComponent\n"
77 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
78 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
79 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n"
80 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
81 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
82 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
83 "component\t\tMSITESTDIR\t0\t1\tfile\n"
84 "service_comp\t\tMSITESTDIR\t0\t1\tservice_file";
86 static const CHAR directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
87 "s72\tS72\tl255\n"
88 "Directory\tDirectory\n"
89 "CABOUTDIR\tMSITESTDIR\tcabout\n"
90 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
91 "FIRSTDIR\tMSITESTDIR\tfirst\n"
92 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
93 "NEWDIR\tCABOUTDIR\tnew\n"
94 "ProgramFilesFolder\tTARGETDIR\t.\n"
95 "TARGETDIR\t\tSourceDir";
97 static const CHAR feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
98 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
99 "Feature\tFeature\n"
100 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
101 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
102 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
103 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
104 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
105 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
106 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
108 static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
109 "s38\ts72\n"
110 "FeatureComponents\tFeature_\tComponent_\n"
111 "Five\tFive\n"
112 "Four\tFour\n"
113 "One\tOne\n"
114 "Three\tThree\n"
115 "Two\tTwo\n"
116 "feature\tcomponent\n"
117 "service_feature\tservice_comp\n";
119 static const CHAR file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
120 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
121 "File\tFile\n"
122 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
123 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
124 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
125 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
126 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
127 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
128 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
130 static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
131 "s72\tS255\tI2\n"
132 "InstallExecuteSequence\tAction\n"
133 "AllocateRegistrySpace\tNOT Installed\t1550\n"
134 "CostFinalize\t\t1000\n"
135 "CostInitialize\t\t800\n"
136 "FileCost\t\t900\n"
137 "ResolveSource\t\t950\n"
138 "MoveFiles\t\t1700\n"
139 "InstallFiles\t\t4000\n"
140 "DuplicateFiles\t\t4500\n"
141 "WriteEnvironmentStrings\t\t4550\n"
142 "CreateShortcuts\t\t4600\n"
143 "InstallServices\t\t5000\n"
144 "InstallFinalize\t\t6600\n"
145 "InstallInitialize\t\t1500\n"
146 "InstallValidate\t\t1400\n"
147 "LaunchConditions\t\t100\n"
148 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
150 static const CHAR media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
151 "i2\ti4\tL64\tS255\tS32\tS72\n"
152 "Media\tDiskId\n"
153 "1\t3\t\t\tDISK1\t\n"
154 "2\t5\t\tmsitest.cab\tDISK2\t\n";
156 static const CHAR property_dat[] = "Property\tValue\n"
157 "s72\tl0\n"
158 "Property\tProperty\n"
159 "DefaultUIFont\tDlgFont8\n"
160 "HASUIRUN\t0\n"
161 "INSTALLLEVEL\t3\n"
162 "InstallMode\tTypical\n"
163 "Manufacturer\tWine\n"
164 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
165 "PRIMARYFOLDER\tTARGETDIR\n"
166 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
167 "ProductID\tnone\n"
168 "ProductLanguage\t1033\n"
169 "ProductName\tMSITEST\n"
170 "ProductVersion\t1.1.1\n"
171 "PROMPTROLLBACKCOST\tP\n"
172 "Setup\tSetup\n"
173 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
174 "AdminProperties\tPOSTADMIN\n"
175 "ROOTDRIVE\tC:\\\n"
176 "SERVNAME\tTestService\n"
177 "SERVDISP\tTestServiceDisp\n"
178 "MSIFASTINSTALL\t1\n";
180 static const CHAR aup_property_dat[] = "Property\tValue\n"
181 "s72\tl0\n"
182 "Property\tProperty\n"
183 "DefaultUIFont\tDlgFont8\n"
184 "HASUIRUN\t0\n"
185 "ALLUSERS\t1\n"
186 "INSTALLLEVEL\t3\n"
187 "InstallMode\tTypical\n"
188 "Manufacturer\tWine\n"
189 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
190 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
191 "ProductID\tnone\n"
192 "ProductLanguage\t1033\n"
193 "ProductName\tMSITEST\n"
194 "ProductVersion\t1.1.1\n"
195 "PROMPTROLLBACKCOST\tP\n"
196 "Setup\tSetup\n"
197 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
198 "AdminProperties\tPOSTADMIN\n"
199 "ROOTDRIVE\tC:\\\n"
200 "SERVNAME\tTestService\n"
201 "SERVDISP\tTestServiceDisp\n"
202 "MSIFASTINSTALL\t1\n";
204 static const CHAR aup2_property_dat[] = "Property\tValue\n"
205 "s72\tl0\n"
206 "Property\tProperty\n"
207 "DefaultUIFont\tDlgFont8\n"
208 "HASUIRUN\t0\n"
209 "ALLUSERS\t2\n"
210 "INSTALLLEVEL\t3\n"
211 "InstallMode\tTypical\n"
212 "Manufacturer\tWine\n"
213 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
214 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
215 "ProductID\tnone\n"
216 "ProductLanguage\t1033\n"
217 "ProductName\tMSITEST\n"
218 "ProductVersion\t1.1.1\n"
219 "PROMPTROLLBACKCOST\tP\n"
220 "Setup\tSetup\n"
221 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
222 "AdminProperties\tPOSTADMIN\n"
223 "ROOTDRIVE\tC:\\\n"
224 "SERVNAME\tTestService\n"
225 "SERVDISP\tTestServiceDisp\n"
226 "MSIFASTINSTALL\t1\n";
228 static const CHAR icon_property_dat[] = "Property\tValue\n"
229 "s72\tl0\n"
230 "Property\tProperty\n"
231 "DefaultUIFont\tDlgFont8\n"
232 "HASUIRUN\t0\n"
233 "INSTALLLEVEL\t3\n"
234 "InstallMode\tTypical\n"
235 "Manufacturer\tWine\n"
236 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
237 "ProductCode\t{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}\n"
238 "ProductID\tnone\n"
239 "ProductLanguage\t1033\n"
240 "ProductName\tMSITEST\n"
241 "ProductVersion\t1.1.1\n"
242 "PROMPTROLLBACKCOST\tP\n"
243 "Setup\tSetup\n"
244 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
245 "AdminProperties\tPOSTADMIN\n"
246 "ROOTDRIVE\tC:\\\n"
247 "SERVNAME\tTestService\n"
248 "SERVDISP\tTestServiceDisp\n"
249 "MSIFASTINSTALL\t1\n";
251 static const CHAR shortcut_dat[] = "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
252 "s72\ts72\tl128\ts72\ts72\tS255\tL255\tI2\tS72\tI2\tI2\tS72\n"
253 "Shortcut\tShortcut\n"
254 "Shortcut\tMSITESTDIR\tShortcut\tcomponent\tShortcut\t\tShortcut\t\t\t\t\t\n";
256 static const CHAR condition_dat[] = "Feature_\tLevel\tCondition\n"
257 "s38\ti2\tS255\n"
258 "Condition\tFeature_\tLevel\n"
259 "One\t4\t1\n";
261 static const CHAR up_property_dat[] = "Property\tValue\n"
262 "s72\tl0\n"
263 "Property\tProperty\n"
264 "DefaultUIFont\tDlgFont8\n"
265 "HASUIRUN\t0\n"
266 "INSTALLLEVEL\t3\n"
267 "InstallMode\tTypical\n"
268 "Manufacturer\tWine\n"
269 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
270 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
271 "ProductID\tnone\n"
272 "ProductLanguage\t1033\n"
273 "ProductName\tMSITEST\n"
274 "ProductVersion\t1.1.1\n"
275 "PROMPTROLLBACKCOST\tP\n"
276 "Setup\tSetup\n"
277 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
278 "AdminProperties\tPOSTADMIN\n"
279 "ROOTDRIVE\tC:\\\n"
280 "SERVNAME\tTestService\n"
281 "SERVDISP\tTestServiceDisp\n"
282 "RemovePreviousVersions\t1\n"
283 "MSIFASTINSTALL\t1\n";
285 static const CHAR up2_property_dat[] = "Property\tValue\n"
286 "s72\tl0\n"
287 "Property\tProperty\n"
288 "DefaultUIFont\tDlgFont8\n"
289 "HASUIRUN\t0\n"
290 "INSTALLLEVEL\t3\n"
291 "InstallMode\tTypical\n"
292 "Manufacturer\tWine\n"
293 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
294 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
295 "ProductID\tnone\n"
296 "ProductLanguage\t1033\n"
297 "ProductName\tMSITEST\n"
298 "ProductVersion\t1.1.2\n"
299 "PROMPTROLLBACKCOST\tP\n"
300 "Setup\tSetup\n"
301 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
302 "AdminProperties\tPOSTADMIN\n"
303 "ROOTDRIVE\tC:\\\n"
304 "SERVNAME\tTestService\n"
305 "SERVDISP\tTestServiceDisp\n"
306 "MSIFASTINSTALL\t1\n";
308 static const CHAR up3_property_dat[] = "Property\tValue\n"
309 "s72\tl0\n"
310 "Property\tProperty\n"
311 "DefaultUIFont\tDlgFont8\n"
312 "HASUIRUN\t0\n"
313 "INSTALLLEVEL\t3\n"
314 "InstallMode\tTypical\n"
315 "Manufacturer\tWine\n"
316 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
317 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
318 "ProductID\tnone\n"
319 "ProductLanguage\t1033\n"
320 "ProductName\tMSITEST\n"
321 "ProductVersion\t1.1.2\n"
322 "PROMPTROLLBACKCOST\tP\n"
323 "Setup\tSetup\n"
324 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
325 "AdminProperties\tPOSTADMIN\n"
326 "ROOTDRIVE\tC:\\\n"
327 "SERVNAME\tTestService\n"
328 "SERVDISP\tTestServiceDisp\n"
329 "RemovePreviousVersions\t1\n"
330 "MSIFASTINSTALL\t1\n";
332 static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
333 "s72\ti2\tl255\tL255\tL0\ts72\n"
334 "Registry\tRegistry\n"
335 "Apples\t1\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
336 "Oranges\t1\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
337 "regdata\t1\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
338 "OrderTest\t1\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
340 static const CHAR service_install_dat[] = "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
341 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
342 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
343 "ServiceInstall\tServiceInstall\n"
344 "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\t";
346 static const CHAR service_control_dat[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
347 "s72\tl255\ti2\tL255\tI2\ts72\n"
348 "ServiceControl\tServiceControl\n"
349 "ServiceControl\tTestService\t8\t\t0\tservice_comp";
351 /* tables for test_continuouscabs */
352 static const CHAR cc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
353 "s72\tS38\ts72\ti2\tS255\tS72\n"
354 "Component\tComponent\n"
355 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
356 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
357 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
359 static const CHAR cc2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
360 "s72\tS38\ts72\ti2\tS255\tS72\n"
361 "Component\tComponent\n"
362 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
363 "augustus\t\tMSITESTDIR\t0\t0\taugustus\n"
364 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
366 static const CHAR cc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
367 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
368 "Feature\tFeature\n"
369 "feature\t\t\t\t2\t1\tTARGETDIR\t0";
371 static const CHAR cc_feature_comp_dat[] = "Feature_\tComponent_\n"
372 "s38\ts72\n"
373 "FeatureComponents\tFeature_\tComponent_\n"
374 "feature\tmaximus\n"
375 "feature\taugustus\n"
376 "feature\tcaesar";
378 static const CHAR cc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
379 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
380 "File\tFile\n"
381 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
382 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
383 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
385 static const CHAR cc2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
386 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
387 "File\tFile\n"
388 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
389 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
390 "tiberius\tmaximus\ttiberius\t500\t\t\t16384\t3\n"
391 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
393 static const CHAR cc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
394 "i2\ti4\tL64\tS255\tS32\tS72\n"
395 "Media\tDiskId\n"
396 "1\t10\t\ttest1.cab\tDISK1\t\n"
397 "2\t2\t\ttest2.cab\tDISK2\t\n"
398 "3\t12\t\ttest3.cab\tDISK3\t\n";
400 static const CHAR cc3_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
401 "i2\ti4\tL64\tS255\tS32\tS72\n"
402 "Media\tDiskId\n"
403 "1\t10\t\ttest1.cab\tDISK1\t\n"
404 "2\t2\t\ttest2_.cab\tDISK2\t\n"
405 "3\t12\t\ttest3.cab\tDISK3\t\n";
407 static const CHAR co_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
408 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
409 "File\tFile\n"
410 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
411 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
412 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
414 static const CHAR co_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
415 "i2\ti4\tL64\tS255\tS32\tS72\n"
416 "Media\tDiskId\n"
417 "1\t10\t\ttest1.cab\tDISK1\t\n"
418 "2\t2\t\ttest2.cab\tDISK2\t\n"
419 "3\t3\t\ttest3.cab\tDISK3\t\n";
421 static const CHAR co2_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
422 "i2\ti4\tL64\tS255\tS32\tS72\n"
423 "Media\tDiskId\n"
424 "1\t10\t\ttest1.cab\tDISK1\t\n"
425 "2\t12\t\ttest3.cab\tDISK3\t\n"
426 "3\t2\t\ttest2.cab\tDISK2\t\n";
428 static const CHAR mm_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
429 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
430 "File\tFile\n"
431 "maximus\tmaximus\tmaximus\t500\t\t\t512\t1\n"
432 "augustus\taugustus\taugustus\t500\t\t\t512\t2\n"
433 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
435 static const CHAR mm_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
436 "i2\ti4\tL64\tS255\tS32\tS72\n"
437 "Media\tDiskId\n"
438 "1\t3\t\ttest1.cab\tDISK1\t\n";
440 static const CHAR ss_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
441 "i2\ti4\tL64\tS255\tS32\tS72\n"
442 "Media\tDiskId\n"
443 "1\t2\t\ttest1.cab\tDISK1\t\n"
444 "2\t2\t\ttest2.cab\tDISK2\t\n"
445 "3\t12\t\ttest3.cab\tDISK3\t\n";
447 /* tables for test_uiLevelFlags */
448 static const CHAR ui_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
449 "s72\tS38\ts72\ti2\tS255\tS72\n"
450 "Component\tComponent\n"
451 "maximus\t\tMSITESTDIR\t0\tHASUIRUN=1\tmaximus\n"
452 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
453 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
455 static const CHAR ui_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
456 "s72\tS255\tI2\n"
457 "InstallUISequence\tAction\n"
458 "SetUIProperty\t\t5\n"
459 "ExecuteAction\t\t1100\n";
461 static const CHAR ui_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
462 "s72\ti2\tS64\tS0\tS255\n"
463 "CustomAction\tAction\n"
464 "SetUIProperty\t51\tHASUIRUN\t1\t\n";
466 static const CHAR rof_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
467 "s72\tS38\ts72\ti2\tS255\tS72\n"
468 "Component\tComponent\n"
469 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
471 static const CHAR rof_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
472 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
473 "Feature\tFeature\n"
474 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
475 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
477 static const CHAR rof_feature_comp_dat[] = "Feature_\tComponent_\n"
478 "s38\ts72\n"
479 "FeatureComponents\tFeature_\tComponent_\n"
480 "feature\tmaximus\n"
481 "montecristo\tmaximus";
483 static const CHAR rof_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
484 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
485 "File\tFile\n"
486 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
488 static const CHAR rof_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
489 "i2\ti4\tL64\tS255\tS32\tS72\n"
490 "Media\tDiskId\n"
491 "1\t1\t\t\tDISK1\t\n";
493 static const CHAR rofc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
494 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
495 "File\tFile\n"
496 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1";
498 static const CHAR rofc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
499 "i2\ti4\tL64\tS255\tS32\tS72\n"
500 "Media\tDiskId\n"
501 "1\t1\t\ttest1.cab\tDISK1\t\n";
503 static const CHAR sdp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
504 "s72\tS255\tI2\n"
505 "InstallExecuteSequence\tAction\n"
506 "AllocateRegistrySpace\tNOT Installed\t1550\n"
507 "CostFinalize\t\t1000\n"
508 "CostInitialize\t\t800\n"
509 "FileCost\t\t900\n"
510 "InstallFiles\t\t4000\n"
511 "InstallFinalize\t\t6600\n"
512 "InstallInitialize\t\t1500\n"
513 "InstallValidate\t\t1400\n"
514 "LaunchConditions\t\t100\n"
515 "SetDirProperty\t\t950";
517 static const CHAR sdp_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
518 "s72\ti2\tS64\tS0\tS255\n"
519 "CustomAction\tAction\n"
520 "SetDirProperty\t51\tMSITESTDIR\t[CommonFilesFolder]msitest\\\t\n";
522 static const CHAR pv_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
523 "s72\tS255\tI2\n"
524 "InstallExecuteSequence\tAction\n"
525 "LaunchConditions\t\t100\n"
526 "CostInitialize\t\t800\n"
527 "FileCost\t\t900\n"
528 "CostFinalize\t\t1000\n"
529 "InstallValidate\t\t1400\n"
530 "InstallInitialize\t\t1500\n"
531 "InstallFiles\t\t4000\n"
532 "InstallFinalize\t\t6600\n";
534 static const CHAR cie_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
535 "s72\tS38\ts72\ti2\tS255\tS72\n"
536 "Component\tComponent\n"
537 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
538 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
539 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
540 "gaius\t\tMSITESTDIR\t0\t1\tgaius\n";
542 static const CHAR cie_feature_comp_dat[] = "Feature_\tComponent_\n"
543 "s38\ts72\n"
544 "FeatureComponents\tFeature_\tComponent_\n"
545 "feature\tmaximus\n"
546 "feature\taugustus\n"
547 "feature\tcaesar\n"
548 "feature\tgaius";
550 static const CHAR cie_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
551 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
552 "File\tFile\n"
553 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
554 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
555 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12\n"
556 "gaius\tgaius\tgaius\t500\t\t\t8192\t11";
558 static const CHAR cie_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
559 "i2\ti4\tL64\tS255\tS32\tS72\n"
560 "Media\tDiskId\n"
561 "1\t1\t\ttest1.cab\tDISK1\t\n"
562 "2\t2\t\ttest2.cab\tDISK2\t\n"
563 "3\t12\t\ttest3.cab\tDISK3\t\n";
565 static const CHAR ci_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
566 "s72\tS255\tI2\n"
567 "InstallExecuteSequence\tAction\n"
568 "CostFinalize\t\t1000\n"
569 "CostInitialize\t\t800\n"
570 "FileCost\t\t900\n"
571 "InstallFiles\t\t4000\n"
572 "InstallServices\t\t5000\n"
573 "InstallFinalize\t\t6600\n"
574 "InstallInitialize\t\t1500\n"
575 "RunInstall\t\t1600\n"
576 "InstallValidate\t\t1400\n"
577 "LaunchConditions\t\t100";
579 static const CHAR ci_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
580 "s72\ti2\tS64\tS0\tS255\n"
581 "CustomAction\tAction\n"
582 "RunInstall\t87\tmsitest\\concurrent.msi\tMYPROP=[UILevel]\t\n";
584 static const CHAR ci_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
585 "s72\tS38\ts72\ti2\tS255\tS72\n"
586 "Component\tComponent\n"
587 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n";
589 static const CHAR ci2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
590 "s72\tS38\ts72\ti2\tS255\tS72\n"
591 "Component\tComponent\n"
592 "augustus\t\tMSITESTDIR\t0\tUILevel=3 AND MYPROP=5\taugustus\n";
594 static const CHAR ci2_feature_comp_dat[] = "Feature_\tComponent_\n"
595 "s38\ts72\n"
596 "FeatureComponents\tFeature_\tComponent_\n"
597 "feature\taugustus";
599 static const CHAR ci2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
600 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
601 "File\tFile\n"
602 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
604 static const CHAR pp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
605 "s72\tS255\tI2\n"
606 "InstallExecuteSequence\tAction\n"
607 "ValidateProductID\t\t700\n"
608 "CostInitialize\t\t800\n"
609 "FileCost\t\t900\n"
610 "CostFinalize\t\t1000\n"
611 "InstallValidate\t\t1400\n"
612 "InstallInitialize\t\t1500\n"
613 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
614 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
615 "RemoveFiles\t\t3500\n"
616 "InstallFiles\t\t4000\n"
617 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
618 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
619 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
620 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
621 "InstallFinalize\t\t6600";
623 static const CHAR tp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
624 "s72\tS38\ts72\ti2\tS255\tS72\n"
625 "Component\tComponent\n"
626 "augustus\t\tMSITESTDIR\t0\tprop=\"val\"\taugustus\n";
628 static const CHAR cwd_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
629 "s72\tS38\ts72\ti2\tS255\tS72\n"
630 "Component\tComponent\n"
631 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
633 static const CHAR adm_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\tPOSTADMIN=1\taugustus";
638 static const CHAR adm_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
639 "s72\ti2\tS64\tS0\tS255\n"
640 "CustomAction\tAction\n"
641 "SetPOSTADMIN\t51\tPOSTADMIN\t1\t\n";
643 static const CHAR adm_admin_exec_seq_dat[] = "Action\tCondition\tSequence\n"
644 "s72\tS255\tI2\n"
645 "AdminExecuteSequence\tAction\n"
646 "CostFinalize\t\t1000\n"
647 "CostInitialize\t\t800\n"
648 "FileCost\t\t900\n"
649 "SetPOSTADMIN\t\t950\n"
650 "InstallFiles\t\t4000\n"
651 "InstallFinalize\t\t6600\n"
652 "InstallInitialize\t\t1500\n"
653 "InstallValidate\t\t1400\n"
654 "LaunchConditions\t\t100";
656 static const CHAR amp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
657 "s72\tS38\ts72\ti2\tS255\tS72\n"
658 "Component\tComponent\n"
659 "augustus\t\tMSITESTDIR\t0\tMYPROP=2718 and MyProp=42\taugustus\n";
661 static const CHAR rem_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
662 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
663 "File\tFile\n"
664 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
665 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
666 "lithium\tlithium\tlithium\t0\t\t\t8192\t1";
668 static const CHAR rem_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
669 "s72\tS255\tI2\n"
670 "InstallExecuteSequence\tAction\n"
671 "ValidateProductID\t\t700\n"
672 "CostInitialize\t\t800\n"
673 "FileCost\t\t900\n"
674 "CostFinalize\t\t1000\n"
675 "InstallValidate\t\t1400\n"
676 "InstallInitialize\t\t1500\n"
677 "ProcessComponents\t\t1600\n"
678 "UnpublishFeatures\t\t1800\n"
679 "RemoveFiles\t\t3500\n"
680 "InstallFiles\t\t4000\n"
681 "RegisterProduct\t\t6100\n"
682 "PublishFeatures\t\t6300\n"
683 "PublishProduct\t\t6400\n"
684 "InstallFinalize\t\t6600";
686 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
687 "s72\tS38\ts72\ti2\tS255\tS72\n"
688 "Component\tComponent\n"
689 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
690 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
691 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
692 "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n"
693 "tiberius\t\tMSITESTDIR\t0\t\ttiberius\n";
695 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
696 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
697 "File\tFile\n"
698 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
699 "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
700 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
701 "gaius\tgaius\tgaius\t500\t\t\t16384\t4\n"
702 "tiberius\ttiberius\ttiberius\t500\t\t\t0\t5\n";
704 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
705 "i2\ti4\tL64\tS255\tS32\tS72\n"
706 "Media\tDiskId\n"
707 "1\t1\t\ttest1.cab\tDISK1\t\n"
708 "2\t2\t\ttest2.cab\tDISK2\t\n"
709 "3\t3\t\ttest3.cab\tDISK3\t\n"
710 "4\t4\t\ttest3.cab\tDISK3\t\n"
711 "5\t5\t\ttest4.cab\tDISK4\t\n";
713 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
714 "s72\ti2\ti4\ti4\ti4\ti4\n"
715 "MsiFileHash\tFile_\n"
716 "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
718 static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
719 "s72\tS38\ts72\ti2\tS255\tS72\n"
720 "Component\tComponent\n"
721 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
723 static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
724 "s72\tS38\ts72\ti2\tS255\tS72\n"
725 "Component\tComponent\n"
726 "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
728 static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
729 "s72\tS255\tI2\n"
730 "InstallExecuteSequence\tAction\n"
731 "ValidateProductID\t\t700\n"
732 "GoodSetProperty\t\t725\n"
733 "BadSetProperty\t\t750\n"
734 "CostInitialize\t\t800\n"
735 "ResolveSource\t\t810\n"
736 "FileCost\t\t900\n"
737 "SetSourceDir\tSRCDIR\t910\n"
738 "CostFinalize\t\t1000\n"
739 "InstallValidate\t\t1400\n"
740 "InstallInitialize\t\t1500\n"
741 "InstallFiles\t\t4000\n"
742 "InstallFinalize\t\t6600";
744 static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
745 "s72\ti2\tS64\tS0\n"
746 "CustomAction\tAction\n"
747 "GoodSetProperty\t51\tMYPROP\t42\n"
748 "BadSetProperty\t51\t\tMYPROP\n"
749 "SetSourceDir\t51\tSourceDir\t[SRCDIR]\n";
751 static const CHAR is_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
752 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
753 "Feature\tFeature\n"
754 "one\t\t\t\t2\t1\t\t0\n" /* favorLocal */
755 "two\t\t\t\t2\t1\t\t1\n" /* favorSource */
756 "three\t\t\t\t2\t1\t\t4\n" /* favorAdvertise */
757 "four\t\t\t\t2\t0\t\t0"; /* disabled */
759 static const CHAR is_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
760 "s72\tS38\ts72\ti2\tS255\tS72\n"
761 "Component\tComponent\n"
762 "alpha\t\tMSITESTDIR\t0\t\talpha_file\n" /* favorLocal:Local */
763 "beta\t\tMSITESTDIR\t1\t\tbeta_file\n" /* favorLocal:Source */
764 "gamma\t\tMSITESTDIR\t2\t\tgamma_file\n" /* favorLocal:Optional */
765 "theta\t\tMSITESTDIR\t0\t\ttheta_file\n" /* favorSource:Local */
766 "delta\t\tMSITESTDIR\t1\t\tdelta_file\n" /* favorSource:Source */
767 "epsilon\t\tMSITESTDIR\t2\t\tepsilon_file\n" /* favorSource:Optional */
768 "zeta\t\tMSITESTDIR\t0\t\tzeta_file\n" /* favorAdvertise:Local */
769 "iota\t\tMSITESTDIR\t1\t\tiota_file\n" /* favorAdvertise:Source */
770 "eta\t\tMSITESTDIR\t2\t\teta_file\n" /* favorAdvertise:Optional */
771 "kappa\t\tMSITESTDIR\t0\t\tkappa_file\n" /* disabled:Local */
772 "lambda\t\tMSITESTDIR\t1\t\tlambda_file\n" /* disabled:Source */
773 "mu\t\tMSITESTDIR\t2\t\tmu_file\n"; /* disabled:Optional */
775 static const CHAR is_feature_comp_dat[] = "Feature_\tComponent_\n"
776 "s38\ts72\n"
777 "FeatureComponents\tFeature_\tComponent_\n"
778 "one\talpha\n"
779 "one\tbeta\n"
780 "one\tgamma\n"
781 "two\ttheta\n"
782 "two\tdelta\n"
783 "two\tepsilon\n"
784 "three\tzeta\n"
785 "three\tiota\n"
786 "three\teta\n"
787 "four\tkappa\n"
788 "four\tlambda\n"
789 "four\tmu";
791 static const CHAR is_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
792 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
793 "File\tFile\n"
794 "alpha_file\talpha\talpha\t500\t\t\t8192\t1\n"
795 "beta_file\tbeta\tbeta\t500\t\t\t8291\t2\n"
796 "gamma_file\tgamma\tgamma\t500\t\t\t8192\t3\n"
797 "theta_file\ttheta\ttheta\t500\t\t\t8192\t4\n"
798 "delta_file\tdelta\tdelta\t500\t\t\t8192\t5\n"
799 "epsilon_file\tepsilon\tepsilon\t500\t\t\t8192\t6\n"
800 "zeta_file\tzeta\tzeta\t500\t\t\t8192\t7\n"
801 "iota_file\tiota\tiota\t500\t\t\t8192\t8\n"
802 "eta_file\teta\teta\t500\t\t\t8192\t9\n"
803 "kappa_file\tkappa\tkappa\t500\t\t\t8192\t10\n"
804 "lambda_file\tlambda\tlambda\t500\t\t\t8192\t11\n"
805 "mu_file\tmu\tmu\t500\t\t\t8192\t12";
807 static const CHAR is_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
808 "i2\ti4\tL64\tS255\tS32\tS72\n"
809 "Media\tDiskId\n"
810 "1\t12\t\t\tDISK1\t\n";
812 static const CHAR sp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
813 "s72\tS38\ts72\ti2\tS255\tS72\n"
814 "Component\tComponent\n"
815 "augustus\t\tTWODIR\t0\t\taugustus\n";
817 static const CHAR sp_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
818 "s72\tS72\tl255\n"
819 "Directory\tDirectory\n"
820 "TARGETDIR\t\tSourceDir\n"
821 "ProgramFilesFolder\tTARGETDIR\t.\n"
822 "MSITESTDIR\tProgramFilesFolder\tmsitest:.\n"
823 "ONEDIR\tMSITESTDIR\t.:shortone|longone\n"
824 "TWODIR\tONEDIR\t.:shorttwo|longtwo";
826 static const CHAR mcp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
827 "s72\tS38\ts72\ti2\tS255\tS72\n"
828 "Component\tComponent\n"
829 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t2\t\thydrogen\n"
830 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t2\t\thelium\n"
831 "lithium\t{4AF28FFC-71C7-4307-BDE4-B77C5338F56F}\tMSITESTDIR\t2\tPROPVAR=42\tlithium\n";
833 static const CHAR mcp_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
834 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
835 "Feature\tFeature\n"
836 "hydroxyl\t\thydroxyl\thydroxyl\t2\t1\tTARGETDIR\t0\n"
837 "heliox\t\theliox\theliox\t2\t5\tTARGETDIR\t0\n"
838 "lithia\t\tlithia\tlithia\t2\t10\tTARGETDIR\t0";
840 static const CHAR mcp_feature_comp_dat[] = "Feature_\tComponent_\n"
841 "s38\ts72\n"
842 "FeatureComponents\tFeature_\tComponent_\n"
843 "hydroxyl\thydrogen\n"
844 "heliox\thelium\n"
845 "lithia\tlithium";
847 static const CHAR mcp_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
848 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
849 "File\tFile\n"
850 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
851 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
852 "lithium\tlithium\tlithium\t0\t\t\t8192\t1\n"
853 "beryllium\tmissingcomp\tberyllium\t0\t\t\t8192\t1";
855 static const CHAR ai_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
856 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
857 "File\tFile\n"
858 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
859 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
860 "one.txt\tOne\tone.txt\t1000\t\t\t16384\t1\n"
861 "three.txt\tThree\tthree.txt\t1000\t\t\t16384\t3\n"
862 "two.txt\tTwo\ttwo.txt\t1000\t\t\t16384\t2\n"
863 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
864 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
866 static const CHAR ip_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
867 "s72\tS255\tI2\n"
868 "InstallExecuteSequence\tAction\n"
869 "CostFinalize\t\t1000\n"
870 "ValidateProductID\t\t700\n"
871 "CostInitialize\t\t800\n"
872 "FileCost\t\t900\n"
873 "RemoveFiles\t\t3500\n"
874 "InstallFiles\t\t4000\n"
875 "RegisterUser\t\t6000\n"
876 "RegisterProduct\t\t6100\n"
877 "PublishFeatures\t\t6300\n"
878 "PublishProduct\t\t6400\n"
879 "InstallFinalize\t\t6600\n"
880 "InstallInitialize\t\t1500\n"
881 "ProcessComponents\t\t1600\n"
882 "UnpublishFeatures\t\t1800\n"
883 "InstallValidate\t\t1400\n"
884 "LaunchConditions\t\t100\n"
885 "TestInstalledProp\tInstalled AND NOT REMOVE\t950\n";
887 static const CHAR ip_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
888 "s72\ti2\tS64\tS0\tS255\n"
889 "CustomAction\tAction\n"
890 "TestInstalledProp\t19\t\tTest failed\t\n";
892 static const CHAR aup_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
893 "s72\tS255\tI2\n"
894 "InstallExecuteSequence\tAction\n"
895 "CostFinalize\t\t1000\n"
896 "ValidateProductID\t\t700\n"
897 "CostInitialize\t\t800\n"
898 "FileCost\t\t900\n"
899 "RemoveFiles\t\t3500\n"
900 "InstallFiles\t\t4000\n"
901 "RegisterUser\t\t6000\n"
902 "RegisterProduct\t\t6100\n"
903 "PublishFeatures\t\t6300\n"
904 "PublishProduct\t\t6400\n"
905 "InstallFinalize\t\t6600\n"
906 "InstallInitialize\t\t1500\n"
907 "ProcessComponents\t\t1600\n"
908 "UnpublishFeatures\t\t1800\n"
909 "InstallValidate\t\t1400\n"
910 "LaunchConditions\t\t100\n"
911 "TestAllUsersProp\tALLUSERS AND NOT REMOVE\t50\n";
913 static const CHAR aup2_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
914 "s72\tS255\tI2\n"
915 "InstallExecuteSequence\tAction\n"
916 "CostFinalize\t\t1000\n"
917 "ValidateProductID\t\t700\n"
918 "CostInitialize\t\t800\n"
919 "FileCost\t\t900\n"
920 "RemoveFiles\t\t3500\n"
921 "InstallFiles\t\t4000\n"
922 "RegisterUser\t\t6000\n"
923 "RegisterProduct\t\t6100\n"
924 "PublishFeatures\t\t6300\n"
925 "PublishProduct\t\t6400\n"
926 "InstallFinalize\t\t6600\n"
927 "InstallInitialize\t\t1500\n"
928 "ProcessComponents\t\t1600\n"
929 "UnpublishFeatures\t\t1800\n"
930 "InstallValidate\t\t1400\n"
931 "LaunchConditions\t\t100\n"
932 "TestAllUsersProp\tALLUSERS=2 AND NOT REMOVE\t50\n";
934 static const CHAR aup3_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
935 "s72\tS255\tI2\n"
936 "InstallExecuteSequence\tAction\n"
937 "CostFinalize\t\t1000\n"
938 "ValidateProductID\t\t700\n"
939 "CostInitialize\t\t800\n"
940 "FileCost\t\t900\n"
941 "RemoveFiles\t\t3500\n"
942 "InstallFiles\t\t4000\n"
943 "RegisterUser\t\t6000\n"
944 "RegisterProduct\t\t6100\n"
945 "PublishFeatures\t\t6300\n"
946 "PublishProduct\t\t6400\n"
947 "InstallFinalize\t\t6600\n"
948 "InstallInitialize\t\t1500\n"
949 "ProcessComponents\t\t1600\n"
950 "UnpublishFeatures\t\t1800\n"
951 "InstallValidate\t\t1400\n"
952 "LaunchConditions\t\t100\n"
953 "TestAllUsersProp\tALLUSERS=1 AND NOT REMOVE\t50\n";
955 static const CHAR aup_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
956 "s72\ti2\tS64\tS0\tS255\n"
957 "CustomAction\tAction\n"
958 "TestAllUsersProp\t19\t\tTest failed\t\n";
960 static const CHAR fo_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
961 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
962 "File\tFile\n"
963 "override.txt\toverride\toverride.txt\t1000\t\t\t8192\t1\n"
964 "preselected.txt\tpreselected\tpreselected.txt\t1000\t\t\t8192\t2\n"
965 "notpreselected.txt\tnotpreselected\tnotpreselected.txt\t1000\t\t\t8192\t3\n";
967 static const CHAR fo_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
968 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
969 "Feature\tFeature\n"
970 "override\t\t\toverride feature\t1\t1\tMSITESTDIR\t0\n"
971 "preselected\t\t\tpreselected feature\t1\t1\tMSITESTDIR\t0\n"
972 "notpreselected\t\t\tnotpreselected feature\t1\t1\tMSITESTDIR\t0\n";
974 static const CHAR fo_condition_dat[] = "Feature_\tLevel\tCondition\n"
975 "s38\ti2\tS255\n"
976 "Condition\tFeature_\tLevel\n"
977 "preselected\t0\tPreselected\n"
978 "notpreselected\t0\tNOT Preselected\n";
980 static const CHAR fo_feature_comp_dat[] = "Feature_\tComponent_\n"
981 "s38\ts72\n"
982 "FeatureComponents\tFeature_\tComponent_\n"
983 "override\toverride\n"
984 "preselected\tpreselected\n"
985 "notpreselected\tnotpreselected\n";
987 static const CHAR fo_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
988 "s72\tS38\ts72\ti2\tS255\tS72\n"
989 "Component\tComponent\n"
990 "override\t{0A00FB1D-97B0-4B42-ADF0-BB8913416623}\tMSITESTDIR\t0\t\toverride.txt\n"
991 "preselected\t{44E1DB75-605A-43DD-8CF5-CAB17F1BBD60}\tMSITESTDIR\t0\t\tpreselected.txt\n"
992 "notpreselected\t{E1647733-5E75-400A-A92E-5E60B4D4EF9F}\tMSITESTDIR\t0\t\tnotpreselected.txt\n";
994 static const CHAR fo_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
995 "s72\ti2\tS64\tS0\tS255\n"
996 "CustomAction\tAction\n"
997 "SetPreselected\t51\tPreselected\t1\t\n";
999 static const CHAR fo_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1000 "s72\tS255\tI2\n"
1001 "InstallExecuteSequence\tAction\n"
1002 "LaunchConditions\t\t100\n"
1003 "SetPreselected\tpreselect=1\t200\n"
1004 "CostInitialize\t\t800\n"
1005 "FileCost\t\t900\n"
1006 "CostFinalize\t\t1000\n"
1007 "InstallValidate\t\t1400\n"
1008 "InstallInitialize\t\t1500\n"
1009 "ProcessComponents\t\t1600\n"
1010 "RemoveFiles\t\t1700\n"
1011 "InstallFiles\t\t2000\n"
1012 "RegisterProduct\t\t5000\n"
1013 "PublishFeatures\t\t5100\n"
1014 "PublishProduct\t\t5200\n"
1015 "InstallFinalize\t\t6000\n";
1017 static const CHAR uc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1018 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1019 "File\tFile\n"
1020 "upgradecode.txt\tupgradecode\tupgradecode.txt\t1000\t\t\t8192\t1\n";
1022 static const CHAR uc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1023 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1024 "Feature\tFeature\n"
1025 "upgradecode\t\t\tupgradecode feature\t1\t2\tMSITESTDIR\t0\n";
1027 static const CHAR uc_feature_comp_dat[] = "Feature_\tComponent_\n"
1028 "s38\ts72\n"
1029 "FeatureComponents\tFeature_\tComponent_\n"
1030 "upgradecode\tupgradecode\n";
1032 static const CHAR uc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1033 "s72\tS38\ts72\ti2\tS255\tS72\n"
1034 "Component\tComponent\n"
1035 "upgradecode\t{6952B732-2FCB-4E47-976F-989FCBD7EDFB}\tMSITESTDIR\t0\t\tupgradecode.txt\n";
1037 static const CHAR uc_property_dat[] = "Property\tValue\n"
1038 "s72\tl0\n"
1039 "Property\tProperty\n"
1040 "INSTALLLEVEL\t3\n"
1041 "ProductCode\t{E5FB1241-F547-4BA7-A60E-8E75797268D4}\n"
1042 "ProductName\tMSITEST\n"
1043 "ProductVersion\t1.1.1\n"
1044 "UpgradeCode\t#UPGEADECODE#\n"
1045 "MSIFASTINSTALL\t1\n";
1047 static const CHAR uc_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1048 "s72\tS255\tI2\n"
1049 "InstallExecuteSequence\tAction\n"
1050 "LaunchConditions\t\t100\n"
1051 "CostInitialize\t\t200\n"
1052 "FileCost\t\t300\n"
1053 "CostFinalize\t\t400\n"
1054 "InstallInitialize\t\t500\n"
1055 "ProcessComponents\t\t600\n"
1056 "InstallValidate\t\t700\n"
1057 "RemoveFiles\t\t800\n"
1058 "InstallFiles\t\t900\n"
1059 "RegisterProduct\t\t1000\n"
1060 "PublishFeatures\t\t1100\n"
1061 "PublishProduct\t\t1200\n"
1062 "InstallFinalize\t\t1300\n";
1064 static const char mixed_feature_dat[] =
1065 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1066 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1067 "Feature\tFeature\n"
1068 "feature1\t\t\t\t1\t2\tMSITESTDIR\t0\n"
1069 "feature2\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1071 static const char mixed_feature_comp_dat[] =
1072 "Feature_\tComponent_\n"
1073 "s38\ts72\n"
1074 "FeatureComponents\tFeature_\tComponent_\n"
1075 "feature1\tcomp1\n"
1076 "feature2\tcomp2\n";
1078 static const char mixed_component_dat[] =
1079 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1080 "s72\tS38\ts72\ti2\tS255\tS72\n"
1081 "Component\tComponent\n"
1082 "comp1\t{DE9F0EF4-0ED3-495A-8105-060C0EA457B8}\tTARGETDIR\t4\t\tregdata1\n"
1083 "comp2\t{4912DBE7-FC3A-4F91-BB5C-88F5C15C19A5}\tTARGETDIR\t260\t\tregdata2\n";
1085 static const char mixed_registry_dat[] =
1086 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
1087 "s72\ti2\tl255\tL255\tL0\ts72\n"
1088 "Registry\tRegistry\n"
1089 "regdata1\t2\tSOFTWARE\\Wine\\msitest\ttest1\t\tcomp1\n"
1090 "regdata2\t2\tSOFTWARE\\Wine\\msitest\ttest2\t\tcomp2\n";
1092 static const char mixed_install_exec_seq_dat[] =
1093 "Action\tCondition\tSequence\n"
1094 "s72\tS255\tI2\n"
1095 "InstallExecuteSequence\tAction\n"
1096 "LaunchConditions\t\t100\n"
1097 "CostInitialize\t\t200\n"
1098 "FileCost\t\t300\n"
1099 "CostFinalize\t\t400\n"
1100 "InstallValidate\t\t500\n"
1101 "InstallInitialize\t\t600\n"
1102 "ProcessComponents\t\t700\n"
1103 "UnpublishFeatures\t\t800\n"
1104 "RemoveRegistryValues\t\t900\n"
1105 "WriteRegistryValues\t\t1000\n"
1106 "RegisterProduct\t\t1100\n"
1107 "PublishFeatures\t\t1200\n"
1108 "PublishProduct\t\t1300\n"
1109 "InstallFinalize\t\t1400\n";
1111 static const char vp_file_dat[] =
1112 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1113 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1114 "File\tFile\n"
1115 "volumeprop\tcomp\tvolumeprop.txt\t1000\t\t\t8192\t1\n";
1117 static const char vp_feature_dat[] =
1118 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1119 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1120 "Feature\tFeature\n"
1121 "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1123 static const char vp_feature_comp_dat[] =
1124 "Feature_\tComponent_\n"
1125 "s38\ts72\n"
1126 "FeatureComponents\tFeature_\tComponent_\n"
1127 "feature\tcomp\n";
1129 static const char vp_component_dat[] =
1130 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1131 "s72\tS38\ts72\ti2\tS255\tS72\n"
1132 "Component\tComponent\n"
1133 "comp\t{24364AE7-5B7F-496C-AF5A-54893639C567}\tMSITESTDIR\t0\t\tvolumeprop\n";
1135 static const char vp_custom_action_dat[] =
1136 "Action\tType\tSource\tTarget\tISComments\n"
1137 "s72\ti2\tS64\tS0\tS255\n"
1138 "CustomAction\tAction\n"
1139 "TestPrimaryVolumePath0\t19\t\tPrimaryVolumePath set before CostFinalize\t\n"
1140 "TestPrimaryVolumeSpaceAvailable0\t19\t\tPrimaryVolumeSpaceAvailable set before CostFinalize\t\n"
1141 "TestPrimaryVolumePath1\t19\t\tPrimaryVolumePath set before InstallValidate\t\n"
1142 "TestPrimaryVolumeSpaceAvailable1\t19\t\tPrimaryVolumeSpaceAvailable not set before InstallValidate\t\n"
1143 "TestPrimaryVolumePath2\t19\t\tPrimaryVolumePath not set after InstallValidate\t\n"
1144 "TestPrimaryVolumeSpaceAvailable2\t19\t\tPrimaryVolumeSpaceAvailable not set after InstallValidate\t\n";
1146 static const char vp_install_exec_seq_dat[] =
1147 "Action\tCondition\tSequence\n"
1148 "s72\tS255\tI2\n"
1149 "InstallExecuteSequence\tAction\n"
1150 "LaunchConditions\t\t100\n"
1151 "CostInitialize\t\t200\n"
1152 "FileCost\t\t300\n"
1153 "TestPrimaryVolumePath0\tPrimaryVolumePath AND NOT REMOVE\t400\n"
1154 "TestPrimaryVolumeSpaceAvailable0\tPrimaryVolumeSpaceAvailable AND NOT REMOVE\t500\n"
1155 "CostFinalize\t\t600\n"
1156 "TestPrimaryVolumePath1\tPrimaryVolumePath AND NOT REMOVE\t600\n"
1157 "TestPrimaryVolumeSpaceAvailable1\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t800\n"
1158 "InstallValidate\t\t900\n"
1159 "TestPrimaryVolumePath2\tNOT PrimaryVolumePath AND NOT REMOVE\t1000\n"
1160 "TestPrimaryVolumeSpaceAvailable2\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t1100\n"
1161 "InstallInitialize\t\t1200\n"
1162 "ProcessComponents\t\t1300\n"
1163 "RemoveFiles\t\t1400\n"
1164 "InstallFiles\t\t1500\n"
1165 "RegisterProduct\t\t1600\n"
1166 "PublishFeatures\t\t1700\n"
1167 "PublishProduct\t\t1800\n"
1168 "InstallFinalize\t\t1900\n";
1170 typedef struct _msi_table
1172 const CHAR *filename;
1173 const CHAR *data;
1174 int size;
1175 } msi_table;
1177 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
1179 static const msi_table tables[] =
1181 ADD_TABLE(component),
1182 ADD_TABLE(directory),
1183 ADD_TABLE(feature),
1184 ADD_TABLE(feature_comp),
1185 ADD_TABLE(file),
1186 ADD_TABLE(install_exec_seq),
1187 ADD_TABLE(media),
1188 ADD_TABLE(property),
1189 ADD_TABLE(registry),
1190 ADD_TABLE(service_install),
1191 ADD_TABLE(service_control)
1194 static const msi_table sc_tables[] =
1196 ADD_TABLE(component),
1197 ADD_TABLE(directory),
1198 ADD_TABLE(feature),
1199 ADD_TABLE(feature_comp),
1200 ADD_TABLE(file),
1201 ADD_TABLE(install_exec_seq),
1202 ADD_TABLE(media),
1203 ADD_TABLE(property),
1204 ADD_TABLE(shortcut)
1207 static const msi_table ps_tables[] =
1209 ADD_TABLE(component),
1210 ADD_TABLE(directory),
1211 ADD_TABLE(feature),
1212 ADD_TABLE(feature_comp),
1213 ADD_TABLE(file),
1214 ADD_TABLE(install_exec_seq),
1215 ADD_TABLE(media),
1216 ADD_TABLE(property),
1217 ADD_TABLE(condition)
1220 static const msi_table up_tables[] =
1222 ADD_TABLE(component),
1223 ADD_TABLE(directory),
1224 ADD_TABLE(feature),
1225 ADD_TABLE(feature_comp),
1226 ADD_TABLE(file),
1227 ADD_TABLE(install_exec_seq),
1228 ADD_TABLE(media),
1229 ADD_TABLE(up_property),
1230 ADD_TABLE(registry),
1231 ADD_TABLE(service_install),
1232 ADD_TABLE(service_control)
1235 static const msi_table up2_tables[] =
1237 ADD_TABLE(component),
1238 ADD_TABLE(directory),
1239 ADD_TABLE(feature),
1240 ADD_TABLE(feature_comp),
1241 ADD_TABLE(file),
1242 ADD_TABLE(install_exec_seq),
1243 ADD_TABLE(media),
1244 ADD_TABLE(up2_property),
1245 ADD_TABLE(registry),
1246 ADD_TABLE(service_install),
1247 ADD_TABLE(service_control)
1250 static const msi_table up3_tables[] =
1252 ADD_TABLE(component),
1253 ADD_TABLE(directory),
1254 ADD_TABLE(feature),
1255 ADD_TABLE(feature_comp),
1256 ADD_TABLE(file),
1257 ADD_TABLE(install_exec_seq),
1258 ADD_TABLE(media),
1259 ADD_TABLE(up3_property),
1260 ADD_TABLE(registry),
1261 ADD_TABLE(service_install),
1262 ADD_TABLE(service_control)
1265 static const msi_table up4_tables[] =
1267 ADD_TABLE(component),
1268 ADD_TABLE(directory),
1269 ADD_TABLE(feature),
1270 ADD_TABLE(feature_comp),
1271 ADD_TABLE(file),
1272 ADD_TABLE(pp_install_exec_seq),
1273 ADD_TABLE(media),
1274 ADD_TABLE(property),
1275 ADD_TABLE(registry),
1276 ADD_TABLE(service_install),
1277 ADD_TABLE(service_control)
1280 static const msi_table up5_tables[] =
1282 ADD_TABLE(component),
1283 ADD_TABLE(directory),
1284 ADD_TABLE(feature),
1285 ADD_TABLE(feature_comp),
1286 ADD_TABLE(file),
1287 ADD_TABLE(pp_install_exec_seq),
1288 ADD_TABLE(media),
1289 ADD_TABLE(up_property),
1290 ADD_TABLE(registry),
1291 ADD_TABLE(service_install),
1292 ADD_TABLE(service_control)
1295 static const msi_table up6_tables[] =
1297 ADD_TABLE(component),
1298 ADD_TABLE(directory),
1299 ADD_TABLE(feature),
1300 ADD_TABLE(feature_comp),
1301 ADD_TABLE(file),
1302 ADD_TABLE(pp_install_exec_seq),
1303 ADD_TABLE(media),
1304 ADD_TABLE(up2_property),
1305 ADD_TABLE(registry),
1306 ADD_TABLE(service_install),
1307 ADD_TABLE(service_control)
1310 static const msi_table up7_tables[] =
1312 ADD_TABLE(component),
1313 ADD_TABLE(directory),
1314 ADD_TABLE(feature),
1315 ADD_TABLE(feature_comp),
1316 ADD_TABLE(file),
1317 ADD_TABLE(pp_install_exec_seq),
1318 ADD_TABLE(media),
1319 ADD_TABLE(up3_property),
1320 ADD_TABLE(registry),
1321 ADD_TABLE(service_install),
1322 ADD_TABLE(service_control)
1325 static const msi_table cc_tables[] =
1327 ADD_TABLE(cc_component),
1328 ADD_TABLE(directory),
1329 ADD_TABLE(cc_feature),
1330 ADD_TABLE(cc_feature_comp),
1331 ADD_TABLE(cc_file),
1332 ADD_TABLE(install_exec_seq),
1333 ADD_TABLE(cc_media),
1334 ADD_TABLE(property),
1337 static const msi_table cc2_tables[] =
1339 ADD_TABLE(cc2_component),
1340 ADD_TABLE(directory),
1341 ADD_TABLE(cc_feature),
1342 ADD_TABLE(cc_feature_comp),
1343 ADD_TABLE(cc2_file),
1344 ADD_TABLE(install_exec_seq),
1345 ADD_TABLE(cc_media),
1346 ADD_TABLE(property),
1349 static const msi_table cc3_tables[] =
1351 ADD_TABLE(cc_component),
1352 ADD_TABLE(directory),
1353 ADD_TABLE(cc_feature),
1354 ADD_TABLE(cc_feature_comp),
1355 ADD_TABLE(cc_file),
1356 ADD_TABLE(install_exec_seq),
1357 ADD_TABLE(cc3_media),
1358 ADD_TABLE(property),
1361 static const msi_table co_tables[] =
1363 ADD_TABLE(cc_component),
1364 ADD_TABLE(directory),
1365 ADD_TABLE(cc_feature),
1366 ADD_TABLE(cc_feature_comp),
1367 ADD_TABLE(co_file),
1368 ADD_TABLE(install_exec_seq),
1369 ADD_TABLE(co_media),
1370 ADD_TABLE(property),
1373 static const msi_table co2_tables[] =
1375 ADD_TABLE(cc_component),
1376 ADD_TABLE(directory),
1377 ADD_TABLE(cc_feature),
1378 ADD_TABLE(cc_feature_comp),
1379 ADD_TABLE(cc_file),
1380 ADD_TABLE(install_exec_seq),
1381 ADD_TABLE(co2_media),
1382 ADD_TABLE(property),
1385 static const msi_table mm_tables[] =
1387 ADD_TABLE(cc_component),
1388 ADD_TABLE(directory),
1389 ADD_TABLE(cc_feature),
1390 ADD_TABLE(cc_feature_comp),
1391 ADD_TABLE(mm_file),
1392 ADD_TABLE(install_exec_seq),
1393 ADD_TABLE(mm_media),
1394 ADD_TABLE(property),
1397 static const msi_table ss_tables[] =
1399 ADD_TABLE(cc_component),
1400 ADD_TABLE(directory),
1401 ADD_TABLE(cc_feature),
1402 ADD_TABLE(cc_feature_comp),
1403 ADD_TABLE(cc_file),
1404 ADD_TABLE(install_exec_seq),
1405 ADD_TABLE(ss_media),
1406 ADD_TABLE(property),
1409 static const msi_table ui_tables[] =
1411 ADD_TABLE(ui_component),
1412 ADD_TABLE(directory),
1413 ADD_TABLE(cc_feature),
1414 ADD_TABLE(cc_feature_comp),
1415 ADD_TABLE(cc_file),
1416 ADD_TABLE(install_exec_seq),
1417 ADD_TABLE(ui_install_ui_seq),
1418 ADD_TABLE(ui_custom_action),
1419 ADD_TABLE(cc_media),
1420 ADD_TABLE(property),
1423 static const msi_table rof_tables[] =
1425 ADD_TABLE(rof_component),
1426 ADD_TABLE(directory),
1427 ADD_TABLE(rof_feature),
1428 ADD_TABLE(rof_feature_comp),
1429 ADD_TABLE(rof_file),
1430 ADD_TABLE(install_exec_seq),
1431 ADD_TABLE(rof_media),
1432 ADD_TABLE(property),
1435 static const msi_table rofc_tables[] =
1437 ADD_TABLE(rof_component),
1438 ADD_TABLE(directory),
1439 ADD_TABLE(rof_feature),
1440 ADD_TABLE(rof_feature_comp),
1441 ADD_TABLE(rofc_file),
1442 ADD_TABLE(install_exec_seq),
1443 ADD_TABLE(rofc_media),
1444 ADD_TABLE(property),
1447 static const msi_table sdp_tables[] =
1449 ADD_TABLE(rof_component),
1450 ADD_TABLE(directory),
1451 ADD_TABLE(rof_feature),
1452 ADD_TABLE(rof_feature_comp),
1453 ADD_TABLE(rof_file),
1454 ADD_TABLE(sdp_install_exec_seq),
1455 ADD_TABLE(sdp_custom_action),
1456 ADD_TABLE(rof_media),
1457 ADD_TABLE(property),
1460 static const msi_table cie_tables[] =
1462 ADD_TABLE(cie_component),
1463 ADD_TABLE(directory),
1464 ADD_TABLE(cc_feature),
1465 ADD_TABLE(cie_feature_comp),
1466 ADD_TABLE(cie_file),
1467 ADD_TABLE(install_exec_seq),
1468 ADD_TABLE(cie_media),
1469 ADD_TABLE(property),
1472 static const msi_table ci_tables[] =
1474 ADD_TABLE(ci_component),
1475 ADD_TABLE(directory),
1476 ADD_TABLE(rof_feature),
1477 ADD_TABLE(rof_feature_comp),
1478 ADD_TABLE(rof_file),
1479 ADD_TABLE(ci_install_exec_seq),
1480 ADD_TABLE(rof_media),
1481 ADD_TABLE(property),
1482 ADD_TABLE(ci_custom_action),
1485 static const msi_table ci2_tables[] =
1487 ADD_TABLE(ci2_component),
1488 ADD_TABLE(directory),
1489 ADD_TABLE(rof_feature),
1490 ADD_TABLE(ci2_feature_comp),
1491 ADD_TABLE(ci2_file),
1492 ADD_TABLE(install_exec_seq),
1493 ADD_TABLE(rof_media),
1494 ADD_TABLE(property),
1497 static const msi_table tp_tables[] =
1499 ADD_TABLE(tp_component),
1500 ADD_TABLE(directory),
1501 ADD_TABLE(rof_feature),
1502 ADD_TABLE(ci2_feature_comp),
1503 ADD_TABLE(ci2_file),
1504 ADD_TABLE(install_exec_seq),
1505 ADD_TABLE(rof_media),
1506 ADD_TABLE(property),
1509 static const msi_table cwd_tables[] =
1511 ADD_TABLE(cwd_component),
1512 ADD_TABLE(directory),
1513 ADD_TABLE(rof_feature),
1514 ADD_TABLE(ci2_feature_comp),
1515 ADD_TABLE(ci2_file),
1516 ADD_TABLE(install_exec_seq),
1517 ADD_TABLE(rof_media),
1518 ADD_TABLE(property),
1521 static const msi_table adm_tables[] =
1523 ADD_TABLE(adm_component),
1524 ADD_TABLE(directory),
1525 ADD_TABLE(rof_feature),
1526 ADD_TABLE(ci2_feature_comp),
1527 ADD_TABLE(ci2_file),
1528 ADD_TABLE(install_exec_seq),
1529 ADD_TABLE(rof_media),
1530 ADD_TABLE(property),
1531 ADD_TABLE(adm_custom_action),
1532 ADD_TABLE(adm_admin_exec_seq),
1535 static const msi_table amp_tables[] =
1537 ADD_TABLE(amp_component),
1538 ADD_TABLE(directory),
1539 ADD_TABLE(rof_feature),
1540 ADD_TABLE(ci2_feature_comp),
1541 ADD_TABLE(ci2_file),
1542 ADD_TABLE(install_exec_seq),
1543 ADD_TABLE(rof_media),
1544 ADD_TABLE(property),
1547 static const msi_table mc_tables[] =
1549 ADD_TABLE(mc_component),
1550 ADD_TABLE(directory),
1551 ADD_TABLE(cc_feature),
1552 ADD_TABLE(cie_feature_comp),
1553 ADD_TABLE(mc_file),
1554 ADD_TABLE(install_exec_seq),
1555 ADD_TABLE(mc_media),
1556 ADD_TABLE(property),
1557 ADD_TABLE(mc_file_hash),
1560 static const msi_table sf_tables[] =
1562 ADD_TABLE(wrv_component),
1563 ADD_TABLE(directory),
1564 ADD_TABLE(rof_feature),
1565 ADD_TABLE(ci2_feature_comp),
1566 ADD_TABLE(ci2_file),
1567 ADD_TABLE(install_exec_seq),
1568 ADD_TABLE(rof_media),
1569 ADD_TABLE(property),
1572 static const msi_table ca51_tables[] =
1574 ADD_TABLE(ca51_component),
1575 ADD_TABLE(directory),
1576 ADD_TABLE(rof_feature),
1577 ADD_TABLE(ci2_feature_comp),
1578 ADD_TABLE(ci2_file),
1579 ADD_TABLE(ca51_install_exec_seq),
1580 ADD_TABLE(rof_media),
1581 ADD_TABLE(property),
1582 ADD_TABLE(ca51_custom_action),
1585 static const msi_table is_tables[] =
1587 ADD_TABLE(is_component),
1588 ADD_TABLE(directory),
1589 ADD_TABLE(is_feature),
1590 ADD_TABLE(is_feature_comp),
1591 ADD_TABLE(is_file),
1592 ADD_TABLE(install_exec_seq),
1593 ADD_TABLE(is_media),
1594 ADD_TABLE(property),
1597 static const msi_table sp_tables[] =
1599 ADD_TABLE(sp_component),
1600 ADD_TABLE(sp_directory),
1601 ADD_TABLE(rof_feature),
1602 ADD_TABLE(ci2_feature_comp),
1603 ADD_TABLE(ci2_file),
1604 ADD_TABLE(install_exec_seq),
1605 ADD_TABLE(rof_media),
1606 ADD_TABLE(property),
1609 static const msi_table mcp_tables[] =
1611 ADD_TABLE(mcp_component),
1612 ADD_TABLE(directory),
1613 ADD_TABLE(mcp_feature),
1614 ADD_TABLE(mcp_feature_comp),
1615 ADD_TABLE(mcp_file),
1616 ADD_TABLE(rem_install_exec_seq),
1617 ADD_TABLE(rof_media),
1618 ADD_TABLE(property),
1621 static const msi_table ai_tables[] =
1623 ADD_TABLE(component),
1624 ADD_TABLE(directory),
1625 ADD_TABLE(feature),
1626 ADD_TABLE(feature_comp),
1627 ADD_TABLE(ai_file),
1628 ADD_TABLE(install_exec_seq),
1629 ADD_TABLE(media),
1630 ADD_TABLE(property)
1633 static const msi_table pc_tables[] =
1635 ADD_TABLE(ca51_component),
1636 ADD_TABLE(directory),
1637 ADD_TABLE(rof_feature),
1638 ADD_TABLE(ci2_feature_comp),
1639 ADD_TABLE(ci2_file),
1640 ADD_TABLE(install_exec_seq),
1641 ADD_TABLE(rof_media),
1642 ADD_TABLE(property)
1645 static const msi_table ip_tables[] =
1647 ADD_TABLE(component),
1648 ADD_TABLE(directory),
1649 ADD_TABLE(feature),
1650 ADD_TABLE(feature_comp),
1651 ADD_TABLE(file),
1652 ADD_TABLE(ip_install_exec_seq),
1653 ADD_TABLE(ip_custom_action),
1654 ADD_TABLE(media),
1655 ADD_TABLE(property)
1658 static const msi_table aup_tables[] =
1660 ADD_TABLE(component),
1661 ADD_TABLE(directory),
1662 ADD_TABLE(feature),
1663 ADD_TABLE(feature_comp),
1664 ADD_TABLE(file),
1665 ADD_TABLE(aup_install_exec_seq),
1666 ADD_TABLE(aup_custom_action),
1667 ADD_TABLE(media),
1668 ADD_TABLE(property)
1671 static const msi_table aup2_tables[] =
1673 ADD_TABLE(component),
1674 ADD_TABLE(directory),
1675 ADD_TABLE(feature),
1676 ADD_TABLE(feature_comp),
1677 ADD_TABLE(file),
1678 ADD_TABLE(aup2_install_exec_seq),
1679 ADD_TABLE(aup_custom_action),
1680 ADD_TABLE(media),
1681 ADD_TABLE(aup_property)
1684 static const msi_table aup3_tables[] =
1686 ADD_TABLE(component),
1687 ADD_TABLE(directory),
1688 ADD_TABLE(feature),
1689 ADD_TABLE(feature_comp),
1690 ADD_TABLE(file),
1691 ADD_TABLE(aup2_install_exec_seq),
1692 ADD_TABLE(aup_custom_action),
1693 ADD_TABLE(media),
1694 ADD_TABLE(aup2_property)
1697 static const msi_table aup4_tables[] =
1699 ADD_TABLE(component),
1700 ADD_TABLE(directory),
1701 ADD_TABLE(feature),
1702 ADD_TABLE(feature_comp),
1703 ADD_TABLE(file),
1704 ADD_TABLE(aup3_install_exec_seq),
1705 ADD_TABLE(aup_custom_action),
1706 ADD_TABLE(media),
1707 ADD_TABLE(aup2_property)
1710 static const msi_table fiu_tables[] =
1712 ADD_TABLE(rof_component),
1713 ADD_TABLE(directory),
1714 ADD_TABLE(rof_feature),
1715 ADD_TABLE(rof_feature_comp),
1716 ADD_TABLE(rof_file),
1717 ADD_TABLE(pp_install_exec_seq),
1718 ADD_TABLE(rof_media),
1719 ADD_TABLE(property),
1722 static const msi_table fiuc_tables[] =
1724 ADD_TABLE(rof_component),
1725 ADD_TABLE(directory),
1726 ADD_TABLE(rof_feature),
1727 ADD_TABLE(rof_feature_comp),
1728 ADD_TABLE(rofc_file),
1729 ADD_TABLE(pp_install_exec_seq),
1730 ADD_TABLE(rofc_media),
1731 ADD_TABLE(property),
1734 static const msi_table fo_tables[] =
1736 ADD_TABLE(directory),
1737 ADD_TABLE(fo_file),
1738 ADD_TABLE(fo_component),
1739 ADD_TABLE(fo_feature),
1740 ADD_TABLE(fo_condition),
1741 ADD_TABLE(fo_feature_comp),
1742 ADD_TABLE(fo_custom_action),
1743 ADD_TABLE(fo_install_exec_seq),
1744 ADD_TABLE(media),
1745 ADD_TABLE(property)
1748 static const msi_table icon_base_tables[] =
1750 ADD_TABLE(ci_component),
1751 ADD_TABLE(directory),
1752 ADD_TABLE(rof_feature),
1753 ADD_TABLE(rof_feature_comp),
1754 ADD_TABLE(rof_file),
1755 ADD_TABLE(pp_install_exec_seq),
1756 ADD_TABLE(rof_media),
1757 ADD_TABLE(icon_property),
1760 static const msi_table pv_tables[] =
1762 ADD_TABLE(rof_component),
1763 ADD_TABLE(directory),
1764 ADD_TABLE(rof_feature),
1765 ADD_TABLE(rof_feature_comp),
1766 ADD_TABLE(rof_file),
1767 ADD_TABLE(pv_install_exec_seq),
1768 ADD_TABLE(rof_media),
1769 ADD_TABLE(property)
1772 static const msi_table uc_tables[] =
1774 ADD_TABLE(directory),
1775 ADD_TABLE(uc_component),
1776 ADD_TABLE(uc_feature),
1777 ADD_TABLE(uc_feature_comp),
1778 ADD_TABLE(uc_file),
1779 ADD_TABLE(uc_install_exec_seq),
1780 ADD_TABLE(media),
1781 ADD_TABLE(uc_property)
1784 static const msi_table mixed_tables[] =
1786 ADD_TABLE(directory),
1787 ADD_TABLE(mixed_component),
1788 ADD_TABLE(mixed_feature),
1789 ADD_TABLE(mixed_feature_comp),
1790 ADD_TABLE(mixed_install_exec_seq),
1791 ADD_TABLE(mixed_registry),
1792 ADD_TABLE(media),
1793 ADD_TABLE(property)
1796 static const msi_table vp_tables[] =
1798 ADD_TABLE(directory),
1799 ADD_TABLE(vp_file),
1800 ADD_TABLE(vp_component),
1801 ADD_TABLE(vp_feature),
1802 ADD_TABLE(vp_feature_comp),
1803 ADD_TABLE(vp_custom_action),
1804 ADD_TABLE(vp_install_exec_seq),
1805 ADD_TABLE(media),
1806 ADD_TABLE(property)
1809 /* cabinet definitions */
1811 /* make the max size large so there is only one cab file */
1812 #define MEDIA_SIZE 0x7FFFFFFF
1813 #define FOLDER_THRESHOLD 900000
1815 /* the FCI callbacks */
1817 static void * CDECL mem_alloc(ULONG cb)
1819 return HeapAlloc(GetProcessHeap(), 0, cb);
1822 static void CDECL mem_free(void *memory)
1824 HeapFree(GetProcessHeap(), 0, memory);
1827 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
1829 sprintf(pccab->szCab, pv, pccab->iCab);
1830 return TRUE;
1833 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
1835 return 0;
1838 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
1839 BOOL fContinuation, void *pv)
1841 return 0;
1844 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
1846 HANDLE handle;
1847 DWORD dwAccess = 0;
1848 DWORD dwShareMode = 0;
1849 DWORD dwCreateDisposition = OPEN_EXISTING;
1851 dwAccess = GENERIC_READ | GENERIC_WRITE;
1852 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
1853 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
1855 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
1856 dwCreateDisposition = OPEN_EXISTING;
1857 else
1858 dwCreateDisposition = CREATE_NEW;
1860 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
1861 dwCreateDisposition, 0, NULL);
1863 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
1865 return (INT_PTR)handle;
1868 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1870 HANDLE handle = (HANDLE)hf;
1871 DWORD dwRead;
1872 BOOL res;
1874 res = ReadFile(handle, memory, cb, &dwRead, NULL);
1875 ok(res, "Failed to ReadFile\n");
1877 return dwRead;
1880 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1882 HANDLE handle = (HANDLE)hf;
1883 DWORD dwWritten;
1884 BOOL res;
1886 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
1887 ok(res, "Failed to WriteFile\n");
1889 return dwWritten;
1892 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
1894 HANDLE handle = (HANDLE)hf;
1895 ok(CloseHandle(handle), "Failed to CloseHandle\n");
1897 return 0;
1900 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
1902 HANDLE handle = (HANDLE)hf;
1903 DWORD ret;
1905 ret = SetFilePointer(handle, dist, NULL, seektype);
1906 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
1908 return ret;
1911 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
1913 BOOL ret = DeleteFileA(pszFile);
1914 ok(ret, "Failed to DeleteFile %s\n", pszFile);
1916 return 0;
1919 static void init_functionpointers(void)
1921 HMODULE hmsi = GetModuleHandleA("msi.dll");
1922 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
1923 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
1925 #define GET_PROC(mod, func) \
1926 p ## func = (void*)GetProcAddress(mod, #func); \
1927 if(!p ## func) \
1928 trace("GetProcAddress(%s) failed\n", #func);
1930 GET_PROC(hmsi, MsiQueryComponentStateA);
1931 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
1932 GET_PROC(hmsi, MsiGetComponentPathExA);
1934 GET_PROC(hadvapi32, ConvertSidToStringSidA);
1935 GET_PROC(hadvapi32, OpenProcessToken);
1936 GET_PROC(hadvapi32, RegDeleteKeyExA)
1937 GET_PROC(hkernel32, IsWow64Process)
1939 hsrclient = LoadLibraryA("srclient.dll");
1940 GET_PROC(hsrclient, SRRemoveRestorePoint);
1941 GET_PROC(hsrclient, SRSetRestorePointA);
1943 #undef GET_PROC
1946 static BOOL is_process_limited(void)
1948 HANDLE token;
1950 if (!pOpenProcessToken) return FALSE;
1952 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
1954 BOOL ret;
1955 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
1956 DWORD size;
1958 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
1959 CloseHandle(token);
1960 return (ret && type == TokenElevationTypeLimited);
1962 return FALSE;
1965 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
1967 CHAR buffer[0x20];
1968 UINT r;
1969 DWORD sz;
1971 sz = sizeof buffer;
1972 r = MsiRecordGetStringA(rec, field, buffer, &sz);
1973 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
1976 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
1978 LPSTR tempname;
1980 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
1981 GetTempFileNameA(".", "xx", 0, tempname);
1983 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
1985 lstrcpyA(pszTempName, tempname);
1986 HeapFree(GetProcessHeap(), 0, tempname);
1987 return TRUE;
1990 HeapFree(GetProcessHeap(), 0, tempname);
1992 return FALSE;
1995 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
1996 USHORT *pattribs, int *err, void *pv)
1998 BY_HANDLE_FILE_INFORMATION finfo;
1999 FILETIME filetime;
2000 HANDLE handle;
2001 DWORD attrs;
2002 BOOL res;
2004 handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2005 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2007 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2009 res = GetFileInformationByHandle(handle, &finfo);
2010 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2012 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2013 FileTimeToDosDateTime(&filetime, pdate, ptime);
2015 attrs = GetFileAttributesA(pszName);
2016 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2018 return (INT_PTR)handle;
2021 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2023 char path[MAX_PATH];
2024 char filename[MAX_PATH];
2026 lstrcpyA(path, CURR_DIR);
2027 lstrcatA(path, "\\");
2028 lstrcatA(path, file);
2030 lstrcpyA(filename, file);
2032 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2033 progress, get_open_info, compress);
2036 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2038 ZeroMemory(pCabParams, sizeof(CCAB));
2040 pCabParams->cb = max_size;
2041 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2042 pCabParams->setID = 0xbeef;
2043 pCabParams->iCab = 1;
2044 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2045 lstrcatA(pCabParams->szCabPath, "\\");
2046 lstrcpyA(pCabParams->szCab, name);
2049 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2051 CCAB cabParams;
2052 LPCSTR ptr;
2053 HFCI hfci;
2054 ERF erf;
2055 BOOL res;
2057 set_cab_parameters(&cabParams, name, max_size);
2059 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2060 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2061 get_temp_file, &cabParams, NULL);
2063 ok(hfci != NULL, "Failed to create an FCI context\n");
2065 ptr = files;
2066 while (*ptr)
2068 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2069 ok(res, "Failed to add file: %s\n", ptr);
2070 ptr += lstrlenA(ptr) + 1;
2073 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2074 ok(res, "Failed to flush the cabinet\n");
2076 res = FCIDestroy(hfci);
2077 ok(res, "Failed to destroy the cabinet\n");
2080 static BOOL get_user_dirs(void)
2082 HKEY hkey;
2083 DWORD type, size;
2085 if (RegOpenKeyA(HKEY_CURRENT_USER,
2086 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2087 return FALSE;
2089 size = MAX_PATH;
2090 if(RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size)){
2091 RegCloseKey(hkey);
2092 return FALSE;
2095 RegCloseKey(hkey);
2096 return TRUE;
2099 static BOOL get_system_dirs(void)
2101 HKEY hkey;
2102 DWORD type, size;
2104 if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2105 return FALSE;
2107 size = MAX_PATH;
2108 if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2109 RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size)) {
2110 RegCloseKey(hkey);
2111 return FALSE;
2114 size = MAX_PATH;
2115 if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2116 RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size)) {
2117 RegCloseKey(hkey);
2118 return FALSE;
2121 size = MAX_PATH;
2122 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR_NATIVE, &size)) {
2123 RegCloseKey(hkey);
2124 return FALSE;
2127 RegCloseKey(hkey);
2129 if(!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH))
2130 return FALSE;
2132 return TRUE;
2135 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2137 HANDLE file;
2138 DWORD written;
2140 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2141 if (file == INVALID_HANDLE_VALUE)
2142 return;
2144 WriteFile(file, data, strlen(data), &written, NULL);
2146 if (size)
2148 SetFilePointer(file, size, NULL, FILE_BEGIN);
2149 SetEndOfFile(file);
2152 CloseHandle(file);
2155 #define create_file(name, size) create_file_data(name, name, size)
2157 static void create_test_files(void)
2159 CreateDirectoryA("msitest", NULL);
2160 create_file("msitest\\one.txt", 100);
2161 CreateDirectoryA("msitest\\first", NULL);
2162 create_file("msitest\\first\\two.txt", 100);
2163 CreateDirectoryA("msitest\\second", NULL);
2164 create_file("msitest\\second\\three.txt", 100);
2166 create_file("four.txt", 100);
2167 create_file("five.txt", 100);
2168 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2170 create_file("msitest\\filename", 100);
2171 create_file("msitest\\service.exe", 100);
2173 DeleteFileA("four.txt");
2174 DeleteFileA("five.txt");
2177 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2179 CHAR path[MAX_PATH];
2181 lstrcpyA(path, PROG_FILES_DIR);
2182 lstrcatA(path, "\\");
2183 lstrcatA(path, rel_path);
2185 if (is_file)
2186 return DeleteFileA(path);
2187 else
2188 return RemoveDirectoryA(path);
2191 static BOOL delete_pf_native(const CHAR *rel_path, BOOL is_file)
2193 CHAR path[MAX_PATH];
2195 lstrcpyA(path, PROG_FILES_DIR_NATIVE);
2196 lstrcatA(path, "\\");
2197 lstrcatA(path, rel_path);
2199 if (is_file)
2200 return DeleteFileA(path);
2201 else
2202 return RemoveDirectoryA(path);
2205 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
2207 CHAR path[MAX_PATH];
2209 lstrcpyA(path, COMMON_FILES_DIR);
2210 lstrcatA(path, "\\");
2211 lstrcatA(path, rel_path);
2213 if (is_file)
2214 return DeleteFileA(path);
2215 else
2216 return RemoveDirectoryA(path);
2219 static BOOL compare_pf_data(const char *filename, const char *data, DWORD size)
2221 DWORD read;
2222 HANDLE handle;
2223 BOOL ret = FALSE;
2224 char *buffer, path[MAX_PATH];
2226 lstrcpyA(path, PROG_FILES_DIR);
2227 lstrcatA(path, "\\");
2228 lstrcatA(path, filename);
2230 handle = CreateFileA(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2231 buffer = HeapAlloc(GetProcessHeap(), 0, size);
2232 if (buffer)
2234 ReadFile(handle, buffer, size, &read, NULL);
2235 if (read == size && !memcmp(data, buffer, size)) ret = TRUE;
2236 HeapFree(GetProcessHeap(), 0, buffer);
2238 CloseHandle(handle);
2239 return ret;
2242 static void delete_test_files(void)
2244 DeleteFileA("msitest.msi");
2245 DeleteFileA("msitest.cab");
2246 DeleteFileA("msitest\\second\\three.txt");
2247 DeleteFileA("msitest\\first\\two.txt");
2248 DeleteFileA("msitest\\one.txt");
2249 DeleteFileA("msitest\\service.exe");
2250 DeleteFileA("msitest\\filename");
2251 RemoveDirectoryA("msitest\\second");
2252 RemoveDirectoryA("msitest\\first");
2253 RemoveDirectoryA("msitest");
2256 static void write_file(const CHAR *filename, const char *data, int data_size)
2258 DWORD size;
2260 HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
2261 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2262 WriteFile(hf, data, data_size, &size, NULL);
2263 CloseHandle(hf);
2266 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, const char *template)
2268 MSIHANDLE summary;
2269 UINT r;
2271 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2272 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2274 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2275 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2277 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
2278 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2279 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2281 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL);
2282 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2284 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2285 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2287 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2288 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2290 /* write the summary changes back to the stream */
2291 r = MsiSummaryInfoPersist(summary);
2292 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2294 MsiCloseHandle(summary);
2297 #define create_database(name, tables, num_tables) \
2298 create_database_wordcount(name, tables, num_tables, 100, 0, ";1033");
2300 #define create_database_template(name, tables, num_tables, version, template) \
2301 create_database_wordcount(name, tables, num_tables, version, 0, template);
2303 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2304 int num_tables, INT version, INT wordcount,
2305 const char *template)
2307 MSIHANDLE db;
2308 UINT r;
2309 int j;
2311 r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db);
2312 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2314 /* import the tables into the database */
2315 for (j = 0; j < num_tables; j++)
2317 const msi_table *table = &tables[j];
2319 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2321 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2322 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2324 DeleteFileA(table->filename);
2327 write_msi_summary_info(db, version, wordcount, template);
2329 r = MsiDatabaseCommit(db);
2330 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2332 MsiCloseHandle(db);
2335 static void check_service_is_installed(void)
2337 SC_HANDLE scm, service;
2338 BOOL res;
2340 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
2341 ok(scm != NULL, "Failed to open the SC Manager\n");
2343 service = OpenServiceA(scm, "TestService", SC_MANAGER_ALL_ACCESS);
2344 ok(service != NULL, "Failed to open TestService\n");
2346 res = DeleteService(service);
2347 ok(res, "Failed to delete TestService\n");
2349 CloseServiceHandle(service);
2350 CloseServiceHandle(scm);
2353 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2355 RESTOREPOINTINFOA spec;
2357 spec.dwEventType = event_type;
2358 spec.dwRestorePtType = APPLICATION_INSTALL;
2359 spec.llSequenceNumber = status->llSequenceNumber;
2360 lstrcpyA(spec.szDescription, "msitest restore point");
2362 return pSRSetRestorePointA(&spec, status);
2365 static void remove_restore_point(DWORD seq_number)
2367 DWORD res;
2369 res = pSRRemoveRestorePoint(seq_number);
2370 if (res != ERROR_SUCCESS)
2371 trace("Failed to remove the restore point : %08x\n", res);
2374 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
2376 if (pRegDeleteKeyExA)
2377 return pRegDeleteKeyExA( key, subkey, access, 0 );
2378 return RegDeleteKeyA( key, subkey );
2381 static void test_MsiInstallProduct(void)
2383 UINT r;
2384 CHAR path[MAX_PATH];
2385 LONG res;
2386 HKEY hkey;
2387 DWORD num, size, type;
2388 REGSAM access = KEY_ALL_ACCESS;
2390 if (is_process_limited())
2392 skip("process is limited\n");
2393 return;
2396 if (is_wow64)
2397 access |= KEY_WOW64_64KEY;
2399 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2401 /* szPackagePath is NULL */
2402 r = MsiInstallProductA(NULL, "INSTALL=ALL");
2403 ok(r == ERROR_INVALID_PARAMETER,
2404 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2406 /* both szPackagePath and szCommandLine are NULL */
2407 r = MsiInstallProductA(NULL, NULL);
2408 ok(r == ERROR_INVALID_PARAMETER,
2409 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2411 /* szPackagePath is empty */
2412 r = MsiInstallProductA("", "INSTALL=ALL");
2413 ok(r == ERROR_PATH_NOT_FOUND,
2414 "Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
2416 create_test_files();
2417 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2419 /* install, don't publish */
2420 r = MsiInstallProductA(msifile, NULL);
2421 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2423 skip("Not enough rights to perform tests\n");
2424 goto error;
2426 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2428 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2429 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2430 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2431 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2432 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2433 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2434 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2435 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2436 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2437 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2438 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2439 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2441 res = RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", 0, access, &hkey);
2442 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2444 size = MAX_PATH;
2445 type = REG_SZ;
2446 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
2447 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2448 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
2450 size = MAX_PATH;
2451 type = REG_SZ;
2452 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
2453 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2455 size = sizeof(num);
2456 type = REG_DWORD;
2457 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
2458 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2459 ok(num == 314, "Expected 314, got %d\n", num);
2461 size = MAX_PATH;
2462 type = REG_SZ;
2463 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
2464 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2465 ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
2467 check_service_is_installed();
2469 delete_key(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", access);
2471 /* not published, reinstall */
2472 r = MsiInstallProductA(msifile, NULL);
2473 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2475 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2476 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2477 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2478 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2479 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2480 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2481 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2482 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2483 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2484 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2485 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2486 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2488 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2489 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2490 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2492 create_database(msifile, up_tables, sizeof(up_tables) / sizeof(msi_table));
2494 /* not published, RemovePreviousVersions set */
2495 r = MsiInstallProductA(msifile, NULL);
2496 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2498 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2499 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2500 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2501 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2502 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2503 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2504 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2505 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2506 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2507 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2508 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2509 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2511 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2512 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2513 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2515 create_database(msifile, up2_tables, sizeof(up2_tables) / sizeof(msi_table));
2517 /* not published, version number bumped */
2518 r = MsiInstallProductA(msifile, NULL);
2519 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2521 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2522 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2523 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2524 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2525 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2526 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2527 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2528 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2529 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2530 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2531 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2532 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2534 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2535 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2536 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2538 create_database(msifile, up3_tables, sizeof(up3_tables) / sizeof(msi_table));
2540 /* not published, RemovePreviousVersions set and version number bumped */
2541 r = MsiInstallProductA(msifile, NULL);
2542 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2544 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2545 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2546 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2547 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2548 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2549 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2550 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2551 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2552 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2553 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2554 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2555 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2557 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2558 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2559 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2561 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2563 /* install, publish product */
2564 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2565 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2567 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2568 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2569 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2570 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2571 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2572 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2573 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2574 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2575 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2576 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2577 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2578 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2580 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2581 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2583 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2585 /* published, reinstall */
2586 r = MsiInstallProductA(msifile, NULL);
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 = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2603 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2605 create_database(msifile, up5_tables, sizeof(up5_tables) / sizeof(msi_table));
2607 /* published product, RemovePreviousVersions set */
2608 r = MsiInstallProductA(msifile, NULL);
2609 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2611 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2612 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2613 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2614 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2615 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2616 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2617 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2618 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2619 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2620 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2621 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2622 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2624 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2625 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2627 create_database(msifile, up6_tables, sizeof(up6_tables) / sizeof(msi_table));
2629 /* published product, version number bumped */
2630 r = MsiInstallProductA(msifile, NULL);
2631 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2633 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2634 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2635 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2636 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2637 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2638 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2639 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2640 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2641 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2642 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2643 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2644 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2646 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2647 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2649 create_database(msifile, up7_tables, sizeof(up7_tables) / sizeof(msi_table));
2651 /* published product, RemovePreviousVersions set and version number bumped */
2652 r = MsiInstallProductA(msifile, NULL);
2653 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2655 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2656 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2657 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2658 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2659 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2660 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2661 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2662 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2663 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2664 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2665 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2666 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2668 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2669 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2671 r = MsiInstallProductA(msifile, "REMOVE=ALL");
2672 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2674 error:
2675 delete_test_files();
2676 DeleteFileA(msifile);
2679 static void test_MsiSetComponentState(void)
2681 INSTALLSTATE installed, action;
2682 MSIHANDLE package;
2683 char path[MAX_PATH];
2684 UINT r;
2686 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2688 CoInitialize(NULL);
2690 lstrcpyA(path, CURR_DIR);
2691 lstrcatA(path, "\\");
2692 lstrcatA(path, msifile);
2694 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2696 r = MsiOpenPackageA(path, &package);
2697 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2699 skip("Not enough rights to perform tests\n");
2700 goto error;
2702 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2704 r = MsiDoActionA(package, "CostInitialize");
2705 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2707 r = MsiDoActionA(package, "FileCost");
2708 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2710 r = MsiDoActionA(package, "CostFinalize");
2711 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2713 r = MsiGetComponentStateA(package, "dangler", &installed, &action);
2714 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2715 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
2716 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2718 r = MsiSetComponentStateA(package, "dangler", INSTALLSTATE_SOURCE);
2719 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2721 MsiCloseHandle(package);
2723 error:
2724 CoUninitialize();
2725 DeleteFileA(msifile);
2728 static void test_packagecoltypes(void)
2730 MSIHANDLE hdb, view, rec;
2731 char path[MAX_PATH];
2732 LPCSTR query;
2733 UINT r, count;
2735 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2737 CoInitialize(NULL);
2739 lstrcpyA(path, CURR_DIR);
2740 lstrcatA(path, "\\");
2741 lstrcatA(path, msifile);
2743 r = MsiOpenDatabaseA(path, MSIDBOPEN_READONLY, &hdb);
2744 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2746 query = "SELECT * FROM `Media`";
2747 r = MsiDatabaseOpenViewA( hdb, query, &view );
2748 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2750 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
2751 count = MsiRecordGetFieldCount( rec );
2752 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2753 ok(count == 6, "Expected 6, got %d\n", count);
2754 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
2755 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
2756 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
2757 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
2758 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
2759 ok(check_record(rec, 6, "Source"), "wrong column label\n");
2760 MsiCloseHandle(rec);
2762 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
2763 count = MsiRecordGetFieldCount( rec );
2764 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2765 ok(count == 6, "Expected 6, got %d\n", count);
2766 ok(check_record(rec, 1, "i2"), "wrong column label\n");
2767 ok(check_record(rec, 2, "i4"), "wrong column label\n");
2768 ok(check_record(rec, 3, "L64"), "wrong column label\n");
2769 ok(check_record(rec, 4, "S255"), "wrong column label\n");
2770 ok(check_record(rec, 5, "S32"), "wrong column label\n");
2771 ok(check_record(rec, 6, "S72"), "wrong column label\n");
2773 MsiCloseHandle(rec);
2774 MsiCloseHandle(view);
2775 MsiCloseHandle(hdb);
2776 CoUninitialize();
2778 DeleteFileA(msifile);
2781 static void create_cc_test_files(void)
2783 CCAB cabParams;
2784 HFCI hfci;
2785 ERF erf;
2786 static CHAR cab_context[] = "test%d.cab";
2787 BOOL res;
2789 create_file("maximus", 500);
2790 create_file("augustus", 50000);
2791 create_file("tiberius", 500);
2792 create_file("caesar", 500);
2794 set_cab_parameters(&cabParams, "test1.cab", 40000);
2796 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2797 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2798 get_temp_file, &cabParams, cab_context);
2799 ok(hfci != NULL, "Failed to create an FCI context\n");
2801 res = add_file(hfci, "maximus", tcompTYPE_NONE);
2802 ok(res, "Failed to add file maximus\n");
2804 res = add_file(hfci, "augustus", tcompTYPE_NONE);
2805 ok(res, "Failed to add file augustus\n");
2807 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
2808 ok(res, "Failed to add file tiberius\n");
2810 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2811 ok(res, "Failed to flush the cabinet\n");
2813 res = FCIDestroy(hfci);
2814 ok(res, "Failed to destroy the cabinet\n");
2816 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2818 DeleteFileA("maximus");
2819 DeleteFileA("augustus");
2820 DeleteFileA("tiberius");
2821 DeleteFileA("caesar");
2824 static void delete_cab_files(void)
2826 SHFILEOPSTRUCTA shfl;
2827 CHAR path[MAX_PATH+10];
2829 lstrcpyA(path, CURR_DIR);
2830 lstrcatA(path, "\\*.cab");
2831 path[strlen(path) + 1] = '\0';
2833 shfl.hwnd = NULL;
2834 shfl.wFunc = FO_DELETE;
2835 shfl.pFrom = path;
2836 shfl.pTo = NULL;
2837 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
2839 SHFileOperationA(&shfl);
2842 static void test_continuouscabs(void)
2844 UINT r;
2846 if (is_process_limited())
2848 skip("process is limited\n");
2849 return;
2852 create_cc_test_files();
2853 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
2855 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2857 r = MsiInstallProductA(msifile, NULL);
2858 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2860 skip("Not enough rights to perform tests\n");
2862 else
2864 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2865 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2866 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2867 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2868 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2871 delete_cab_files();
2872 DeleteFileA(msifile);
2874 create_cc_test_files();
2875 create_database(msifile, cc2_tables, sizeof(cc2_tables) / sizeof(msi_table));
2877 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2879 r = MsiInstallProductA(msifile, NULL);
2880 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2882 skip("Not enough rights to perform tests\n");
2884 else
2886 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2887 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2888 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
2889 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
2890 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2891 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2894 delete_cab_files();
2895 DeleteFileA(msifile);
2897 /* Tests to show that only msi cab filename is taken in case of mismatch with the one given by previous cab */
2899 /* Filename from cab is right and the one from msi is wrong */
2900 create_cc_test_files();
2901 create_database(msifile, cc3_tables, sizeof(cc3_tables) / sizeof(msi_table));
2903 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2905 r = MsiInstallProductA(msifile, NULL);
2906 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2908 skip("Not enough rights to perform tests\n");
2910 else
2912 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAIRE, got %u\n", r);
2913 todo_wine ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
2914 ok(!delete_pf("msitest\\caesar", TRUE), "File installed\n");
2915 todo_wine ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
2916 todo_wine ok(!delete_pf("msitest", FALSE), "Directory created\n");
2919 delete_cab_files();
2920 DeleteFileA(msifile);
2922 /* Filename from msi is right and the one from cab is wrong */
2923 create_cc_test_files();
2924 ok(MoveFileA("test2.cab", "test2_.cab"), "Cannot rename test2.cab to test2_.cab\n");
2925 create_database(msifile, cc3_tables, sizeof(cc3_tables) / sizeof(msi_table));
2927 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2929 r = MsiInstallProductA(msifile, NULL);
2930 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2932 skip("Not enough rights to perform tests\n");
2934 else
2936 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2937 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2938 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2939 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2940 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2943 delete_cab_files();
2944 DeleteFileA(msifile);
2947 static void test_caborder(void)
2949 UINT r;
2951 create_file("imperator", 100);
2952 create_file("maximus", 500);
2953 create_file("augustus", 50000);
2954 create_file("caesar", 500);
2956 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
2958 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2960 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
2961 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
2962 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2964 r = MsiInstallProductA(msifile, NULL);
2965 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2967 skip("Not enough rights to perform tests\n");
2968 goto error;
2970 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
2971 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
2972 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
2973 todo_wine
2975 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
2976 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
2979 delete_cab_files();
2981 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
2982 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
2983 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2985 r = MsiInstallProductA(msifile, NULL);
2986 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
2987 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
2988 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
2989 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
2990 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
2992 delete_cab_files();
2993 DeleteFileA(msifile);
2995 create_cc_test_files();
2996 create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
2998 r = MsiInstallProductA(msifile, NULL);
2999 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3000 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3001 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3002 todo_wine
3004 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3005 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3008 delete_cab_files();
3009 DeleteFileA(msifile);
3011 create_cc_test_files();
3012 create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
3014 r = MsiInstallProductA(msifile, NULL);
3015 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3016 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3017 todo_wine
3019 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3020 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3021 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3024 error:
3025 delete_cab_files();
3026 DeleteFileA("imperator");
3027 DeleteFileA("maximus");
3028 DeleteFileA("augustus");
3029 DeleteFileA("caesar");
3030 DeleteFileA(msifile);
3033 static void test_mixedmedia(void)
3035 UINT r;
3037 if (is_process_limited())
3039 skip("process is limited\n");
3040 return;
3043 CreateDirectoryA("msitest", NULL);
3044 create_file("msitest\\maximus", 500);
3045 create_file("msitest\\augustus", 500);
3046 create_file("caesar", 500);
3048 create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
3050 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3052 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
3054 r = MsiInstallProductA(msifile, NULL);
3055 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3057 skip("Not enough rights to perform tests\n");
3058 goto error;
3060 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3061 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3062 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3063 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3064 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3066 error:
3067 /* Delete the files in the temp (current) folder */
3068 DeleteFileA("msitest\\maximus");
3069 DeleteFileA("msitest\\augustus");
3070 RemoveDirectoryA("msitest");
3071 DeleteFileA("caesar");
3072 DeleteFileA("test1.cab");
3073 DeleteFileA(msifile);
3076 static void test_samesequence(void)
3078 UINT r;
3080 create_cc_test_files();
3081 create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
3083 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3085 r = MsiInstallProductA(msifile, NULL);
3086 ok(r == ERROR_SUCCESS || broken(r == ERROR_INSTALL_FAILURE), "Expected ERROR_SUCCESS, got %u\n", r);
3087 if (r == ERROR_SUCCESS)
3089 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3090 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3091 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3092 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3094 delete_cab_files();
3095 DeleteFileA(msifile);
3098 static void test_uiLevelFlags(void)
3100 UINT r;
3102 create_cc_test_files();
3103 create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
3105 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
3107 r = MsiInstallProductA(msifile, NULL);
3108 ok(r == ERROR_SUCCESS || broken(r == ERROR_INSTALL_FAILURE), "Expected ERROR_SUCCESS, got %u\n", r);
3109 if (r == ERROR_SUCCESS)
3111 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
3112 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3113 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3114 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3116 delete_cab_files();
3117 DeleteFileA(msifile);
3120 static BOOL file_matches(LPSTR path)
3122 CHAR buf[MAX_PATH];
3123 HANDLE file;
3124 DWORD size;
3126 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3127 NULL, OPEN_EXISTING, 0, NULL);
3128 ZeroMemory(buf, MAX_PATH);
3129 ReadFile(file, buf, 15, &size, NULL);
3130 CloseHandle(file);
3132 return !lstrcmpA(buf, "msitest\\maximus");
3135 static void test_readonlyfile(void)
3137 UINT r;
3138 DWORD size;
3139 HANDLE file;
3140 CHAR path[MAX_PATH];
3142 if (is_process_limited())
3144 skip("process is limited\n");
3145 return;
3148 CreateDirectoryA("msitest", NULL);
3149 create_file("msitest\\maximus", 500);
3150 create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
3152 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3154 lstrcpyA(path, PROG_FILES_DIR);
3155 lstrcatA(path, "\\msitest");
3156 CreateDirectoryA(path, NULL);
3158 lstrcatA(path, "\\maximus");
3159 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3160 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3162 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3163 CloseHandle(file);
3165 r = MsiInstallProductA(msifile, NULL);
3166 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3168 skip("Not enough rights to perform tests\n");
3169 goto error;
3171 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3172 ok(file_matches(path), "Expected file to be overwritten\n");
3173 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3174 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3176 error:
3177 /* Delete the files in the temp (current) folder */
3178 DeleteFileA("msitest\\maximus");
3179 RemoveDirectoryA("msitest");
3180 DeleteFileA(msifile);
3183 static void test_readonlyfile_cab(void)
3185 UINT r;
3186 DWORD size;
3187 HANDLE file;
3188 CHAR path[MAX_PATH];
3189 CHAR buf[16];
3191 if (is_process_limited())
3193 skip("process is limited\n");
3194 return;
3197 CreateDirectoryA("msitest", NULL);
3198 create_file("maximus", 500);
3199 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3200 DeleteFileA("maximus");
3202 create_database(msifile, rofc_tables, sizeof(rofc_tables) / sizeof(msi_table));
3204 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3206 lstrcpyA(path, PROG_FILES_DIR);
3207 lstrcatA(path, "\\msitest");
3208 CreateDirectoryA(path, NULL);
3210 lstrcatA(path, "\\maximus");
3211 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3212 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3214 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3215 CloseHandle(file);
3217 r = MsiInstallProductA(msifile, NULL);
3218 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3220 skip("Not enough rights to perform tests\n");
3221 goto error;
3223 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3225 memset( buf, 0, sizeof(buf) );
3226 if ((file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3227 NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
3229 ReadFile(file, buf, sizeof(buf) - 1, &size, NULL);
3230 CloseHandle(file);
3232 ok(!memcmp( buf, "maximus", sizeof("maximus")-1 ), "Expected file to be overwritten, got '%s'\n", buf);
3233 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3234 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3236 error:
3237 /* Delete the files in the temp (current) folder */
3238 delete_cab_files();
3239 DeleteFileA("msitest\\maximus");
3240 RemoveDirectoryA("msitest");
3241 DeleteFileA(msifile);
3244 static void test_setdirproperty(void)
3246 UINT r;
3248 if (is_process_limited())
3250 skip("process is limited\n");
3251 return;
3254 CreateDirectoryA("msitest", NULL);
3255 create_file("msitest\\maximus", 500);
3256 create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
3258 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3260 r = MsiInstallProductA(msifile, NULL);
3261 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3263 skip("Not enough rights to perform tests\n");
3264 goto error;
3266 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3267 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
3268 ok(delete_cf("msitest", FALSE), "Directory not created\n");
3270 error:
3271 /* Delete the files in the temp (current) folder */
3272 DeleteFileA(msifile);
3273 DeleteFileA("msitest\\maximus");
3274 RemoveDirectoryA("msitest");
3277 static void test_cabisextracted(void)
3279 UINT r;
3281 if (is_process_limited())
3283 skip("process is limited\n");
3284 return;
3287 CreateDirectoryA("msitest", NULL);
3288 create_file("msitest\\gaius", 500);
3289 create_file("maximus", 500);
3290 create_file("augustus", 500);
3291 create_file("caesar", 500);
3293 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3294 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3295 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3297 create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
3299 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3301 r = MsiInstallProductA(msifile, NULL);
3302 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3304 skip("Not enough rights to perform tests\n");
3305 goto error;
3307 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3308 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3309 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3310 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3311 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
3312 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3314 error:
3315 /* Delete the files in the temp (current) folder */
3316 delete_cab_files();
3317 DeleteFileA(msifile);
3318 DeleteFileA("maximus");
3319 DeleteFileA("augustus");
3320 DeleteFileA("caesar");
3321 DeleteFileA("msitest\\gaius");
3322 RemoveDirectoryA("msitest");
3325 static BOOL file_exists(LPCSTR file)
3327 return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES;
3330 static BOOL pf_exists(LPCSTR file)
3332 CHAR path[MAX_PATH];
3334 lstrcpyA(path, PROG_FILES_DIR);
3335 lstrcatA(path, "\\");
3336 lstrcatA(path, file);
3338 return file_exists(path);
3341 static void delete_pfmsitest_files(void)
3343 SHFILEOPSTRUCTA shfl;
3344 CHAR path[MAX_PATH+11];
3346 lstrcpyA(path, PROG_FILES_DIR);
3347 lstrcatA(path, "\\msitest\\*");
3348 path[strlen(path) + 1] = '\0';
3350 shfl.hwnd = NULL;
3351 shfl.wFunc = FO_DELETE;
3352 shfl.pFrom = path;
3353 shfl.pTo = NULL;
3354 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT | FOF_NOERRORUI;
3356 SHFileOperationA(&shfl);
3358 lstrcpyA(path, PROG_FILES_DIR);
3359 lstrcatA(path, "\\msitest");
3360 RemoveDirectoryA(path);
3363 static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
3365 MSIHANDLE hview = 0;
3366 UINT r;
3368 r = MsiDatabaseOpenViewA(hdb, query, &hview);
3369 if(r != ERROR_SUCCESS)
3370 return r;
3372 r = MsiViewExecute(hview, hrec);
3373 if(r == ERROR_SUCCESS)
3374 r = MsiViewClose(hview);
3375 MsiCloseHandle(hview);
3376 return r;
3379 static void set_transform_summary_info(void)
3381 UINT r;
3382 MSIHANDLE suminfo = 0;
3384 /* build summary info */
3385 r = MsiGetSummaryInformationA(0, mstfile, 3, &suminfo);
3386 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
3388 r = MsiSummaryInfoSetPropertyA(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
3389 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3391 r = MsiSummaryInfoSetPropertyA(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
3392 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3393 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3394 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
3395 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
3397 r = MsiSummaryInfoSetPropertyA(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
3398 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3400 r = MsiSummaryInfoPersist(suminfo);
3401 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
3403 r = MsiCloseHandle(suminfo);
3404 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
3407 static void generate_transform(void)
3409 MSIHANDLE hdb1, hdb2;
3410 LPCSTR query;
3411 UINT r;
3413 /* start with two identical databases */
3414 CopyFileA(msifile, msifile2, FALSE);
3416 r = MsiOpenDatabaseA(msifile2, MSIDBOPEN_TRANSACT, &hdb1);
3417 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3419 r = MsiDatabaseCommit(hdb1);
3420 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
3422 r = MsiOpenDatabaseA(msifile, MSIDBOPEN_READONLY, &hdb2);
3423 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3425 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
3426 r = run_query(hdb1, 0, query);
3427 ok(r == ERROR_SUCCESS, "failed to add property\n");
3429 /* database needs to be committed */
3430 MsiDatabaseCommit(hdb1);
3432 r = MsiDatabaseGenerateTransformA(hdb1, hdb2, mstfile, 0, 0);
3433 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3435 r = MsiCreateTransformSummaryInfoA(hdb2, hdb2, mstfile, 0, 0);
3436 todo_wine ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3438 MsiCloseHandle(hdb1);
3439 MsiCloseHandle(hdb2);
3442 /* data for generating a transform */
3444 /* tables transform names - encoded as they would be in an msi database file */
3445 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
3446 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
3447 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
3449 /* data in each table */
3450 static const char data1[] = /* _StringData */
3451 "propval"; /* all the strings squashed together */
3453 static const WCHAR data2[] = { /* _StringPool */
3454 /* len, refs */
3455 0, 0, /* string 0 '' */
3456 4, 1, /* string 1 'prop' */
3457 3, 1, /* string 2 'val' */
3460 static const WCHAR data3[] = { /* Property */
3461 0x0201, 0x0001, 0x0002,
3464 static const struct {
3465 LPCWSTR name;
3466 const void *data;
3467 DWORD size;
3468 } table_transform_data[] =
3470 { name1, data1, sizeof data1 - 1 },
3471 { name2, data2, sizeof data2 },
3472 { name3, data3, sizeof data3 },
3475 #define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
3477 static void generate_transform_manual(void)
3479 IStorage *stg = NULL;
3480 IStream *stm;
3481 WCHAR name[0x20];
3482 HRESULT r;
3483 DWORD i, count;
3484 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
3486 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
3488 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
3490 r = StgCreateDocfile(name, mode, 0, &stg);
3491 ok(r == S_OK, "failed to create storage\n");
3492 if (!stg)
3493 return;
3495 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
3496 ok(r == S_OK, "failed to set storage type\n");
3498 for (i=0; i<NUM_TRANSFORM_TABLES; i++)
3500 r = IStorage_CreateStream(stg, table_transform_data[i].name,
3501 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3502 if (FAILED(r))
3504 ok(0, "failed to create stream %08x\n", r);
3505 continue;
3508 r = IStream_Write(stm, table_transform_data[i].data,
3509 table_transform_data[i].size, &count);
3510 if (FAILED(r) || count != table_transform_data[i].size)
3511 ok(0, "failed to write stream\n");
3512 IStream_Release(stm);
3515 IStorage_Release(stg);
3517 set_transform_summary_info();
3520 static void test_transformprop(void)
3522 UINT r;
3524 if (is_process_limited())
3526 skip("process is limited\n");
3527 return;
3530 CreateDirectoryA("msitest", NULL);
3531 create_file("msitest\\augustus", 500);
3533 create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
3535 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3537 r = MsiInstallProductA(msifile, NULL);
3538 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3540 skip("Not enough rights to perform tests\n");
3541 goto error;
3543 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3544 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3545 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3547 if (0)
3548 generate_transform();
3549 else
3550 generate_transform_manual();
3552 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
3553 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3554 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3555 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3557 error:
3558 /* Delete the files in the temp (current) folder */
3559 DeleteFileA(msifile);
3560 DeleteFileA(msifile2);
3561 DeleteFileA(mstfile);
3562 DeleteFileA("msitest\\augustus");
3563 RemoveDirectoryA("msitest");
3566 static void test_currentworkingdir(void)
3568 UINT r;
3569 CHAR drive[MAX_PATH], path[MAX_PATH];
3570 LPSTR ptr;
3572 if (is_process_limited())
3574 skip("process is limited\n");
3575 return;
3578 CreateDirectoryA("msitest", NULL);
3579 create_file("msitest\\augustus", 500);
3581 create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
3583 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3585 CreateDirectoryA("diffdir", NULL);
3586 SetCurrentDirectoryA("diffdir");
3588 sprintf(path, "..\\%s", msifile);
3589 r = MsiInstallProductA(path, NULL);
3590 todo_wine
3592 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
3593 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3594 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3597 sprintf(path, "%s\\%s", CURR_DIR, msifile);
3598 r = MsiInstallProductA(path, NULL);
3599 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3601 skip("Not enough rights to perform tests\n");
3602 goto error;
3604 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3605 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3606 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3608 lstrcpyA(drive, CURR_DIR);
3609 drive[2] = '\\';
3610 drive[3] = '\0';
3611 SetCurrentDirectoryA(drive);
3613 lstrcpyA(path, CURR_DIR);
3614 if (path[lstrlenA(path) - 1] != '\\') lstrcatA(path, "\\");
3615 lstrcatA(path, msifile);
3616 ptr = strchr(path, ':');
3617 ptr +=2;
3619 r = MsiInstallProductA(ptr, NULL);
3620 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3621 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3622 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3624 error:
3625 SetCurrentDirectoryA(CURR_DIR);
3626 DeleteFileA(msifile);
3627 DeleteFileA("msitest\\augustus");
3628 RemoveDirectoryA("msitest");
3629 RemoveDirectoryA("diffdir");
3632 static void set_admin_summary_info(const CHAR *name)
3634 MSIHANDLE db, summary;
3635 UINT r;
3637 r = MsiOpenDatabaseA(name, MSIDBOPEN_DIRECT, &db);
3638 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3640 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
3641 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3643 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
3644 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3646 /* write the summary changes back to the stream */
3647 r = MsiSummaryInfoPersist(summary);
3648 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3650 MsiCloseHandle(summary);
3652 r = MsiDatabaseCommit(db);
3653 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3655 MsiCloseHandle(db);
3658 static void test_admin(void)
3660 UINT r;
3662 CreateDirectoryA("msitest", NULL);
3663 create_file("msitest\\augustus", 500);
3665 create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
3666 set_admin_summary_info(msifile);
3668 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3670 r = MsiInstallProductA(msifile, NULL);
3671 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3673 skip("Not enough rights to perform tests\n");
3674 goto error;
3676 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3677 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3678 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3679 ok(!DeleteFileA("c:\\msitest\\augustus"), "File installed\n");
3680 ok(!RemoveDirectoryA("c:\\msitest"), "File installed\n");
3682 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
3683 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3684 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3685 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3686 todo_wine
3688 ok(DeleteFileA("c:\\msitest\\augustus"), "File not installed\n");
3689 ok(RemoveDirectoryA("c:\\msitest"), "File not installed\n");
3692 error:
3693 DeleteFileA(msifile);
3694 DeleteFileA("msitest\\augustus");
3695 RemoveDirectoryA("msitest");
3698 static void set_admin_property_stream(LPCSTR file)
3700 IStorage *stg;
3701 IStream *stm;
3702 WCHAR fileW[MAX_PATH];
3703 HRESULT hr;
3704 DWORD count;
3705 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
3707 /* AdminProperties */
3708 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
3709 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',' ',
3710 'M','y','P','r','o','p','=','4','2',0};
3712 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
3714 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
3715 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3716 if (!stg)
3717 return;
3719 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3720 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3722 hr = IStream_Write(stm, data, sizeof(data), &count);
3723 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3725 IStream_Release(stm);
3726 IStorage_Release(stg);
3729 static void test_adminprops(void)
3731 UINT r;
3733 if (is_process_limited())
3735 skip("process is limited\n");
3736 return;
3739 CreateDirectoryA("msitest", NULL);
3740 create_file("msitest\\augustus", 500);
3742 create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
3743 set_admin_summary_info(msifile);
3744 set_admin_property_stream(msifile);
3746 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3748 r = MsiInstallProductA(msifile, NULL);
3749 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3751 skip("Not enough rights to perform tests\n");
3752 goto error;
3754 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3755 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
3756 ok(delete_pf("msitest", FALSE), "Directory created\n");
3758 error:
3759 DeleteFileA(msifile);
3760 DeleteFileA("msitest\\augustus");
3761 RemoveDirectoryA("msitest");
3764 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
3766 CHAR path[MAX_PATH];
3768 lstrcpyA(path, PROG_FILES_DIR);
3769 lstrcatA(path, "\\");
3770 lstrcatA(path, file);
3772 if (is_file)
3773 create_file_data(path, data, 500);
3774 else
3775 CreateDirectoryA(path, NULL);
3778 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
3780 static void test_missingcab(void)
3782 UINT r;
3784 if (is_process_limited())
3786 skip("process is limited\n");
3787 return;
3790 CreateDirectoryA("msitest", NULL);
3791 create_file("msitest\\augustus", 500);
3792 create_file("maximus", 500);
3793 create_file("tiberius", 500);
3795 create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
3797 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3799 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3800 create_cab_file("test4.cab", MEDIA_SIZE, "tiberius\0");
3802 create_pf("msitest", FALSE);
3803 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
3804 create_pf_data("msitest\\tiberius", "abcdefgh", TRUE);
3806 r = MsiInstallProductA(msifile, NULL);
3807 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3809 skip("Not enough rights to perform tests\n");
3810 goto error;
3812 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3813 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3814 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3815 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3816 ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
3817 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
3818 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
3819 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3821 create_pf("msitest", FALSE);
3822 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
3823 create_pf_data("msitest\\tiberius", "abcdefgh", TRUE);
3824 create_pf("msitest\\gaius", TRUE);
3826 r = MsiInstallProductA(msifile, "GAIUS=1");
3827 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3828 todo_wine
3830 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
3831 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3833 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
3834 ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
3835 ok(delete_pf("msitest\\tiberius", TRUE), "File removed\n");
3836 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
3837 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3839 error:
3840 delete_pf("msitest", FALSE);
3841 DeleteFileA("msitest\\augustus");
3842 RemoveDirectoryA("msitest");
3843 DeleteFileA("maximus");
3844 DeleteFileA("tiberius");
3845 DeleteFileA("test1.cab");
3846 DeleteFileA("test4.cab");
3847 DeleteFileA(msifile);
3850 static void test_sourcefolder(void)
3852 UINT r;
3854 if (is_process_limited())
3856 skip("process is limited\n");
3857 return;
3860 CreateDirectoryA("msitest", NULL);
3861 create_file("augustus", 500);
3863 create_database(msifile, sf_tables, sizeof(sf_tables) / sizeof(msi_table));
3865 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3867 r = MsiInstallProductA(msifile, NULL);
3868 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3870 skip("Not enough rights to perform tests\n");
3871 goto error;
3873 ok(r == ERROR_INSTALL_FAILURE,
3874 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3875 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3876 todo_wine
3878 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3880 RemoveDirectoryA("msitest");
3882 r = MsiInstallProductA(msifile, NULL);
3883 ok(r == ERROR_INSTALL_FAILURE,
3884 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3885 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3886 todo_wine
3888 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3891 error:
3892 DeleteFileA(msifile);
3893 DeleteFileA("augustus");
3896 static void test_customaction51(void)
3898 UINT r;
3900 if (is_process_limited())
3902 skip("process is limited\n");
3903 return;
3906 CreateDirectoryA("msitest", NULL);
3907 create_file("msitest\\augustus", 500);
3909 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
3911 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3913 r = MsiInstallProductA(msifile, NULL);
3914 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3916 skip("Not enough rights to perform tests\n");
3917 goto error;
3919 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3920 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
3921 ok(delete_pf("msitest", FALSE), "Directory created\n");
3923 error:
3924 DeleteFileA(msifile);
3925 DeleteFileA("msitest\\augustus");
3926 RemoveDirectoryA("msitest");
3929 static void test_installstate(void)
3931 UINT r;
3933 if (is_process_limited())
3935 skip("process is limited\n");
3936 return;
3939 CreateDirectoryA("msitest", NULL);
3940 create_file("msitest\\alpha", 500);
3941 create_file("msitest\\beta", 500);
3942 create_file("msitest\\gamma", 500);
3943 create_file("msitest\\theta", 500);
3944 create_file("msitest\\delta", 500);
3945 create_file("msitest\\epsilon", 500);
3946 create_file("msitest\\zeta", 500);
3947 create_file("msitest\\iota", 500);
3948 create_file("msitest\\eta", 500);
3949 create_file("msitest\\kappa", 500);
3950 create_file("msitest\\lambda", 500);
3951 create_file("msitest\\mu", 500);
3953 create_database(msifile, is_tables, sizeof(is_tables) / sizeof(msi_table));
3955 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3957 r = MsiInstallProductA(msifile, NULL);
3958 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3960 skip("Not enough rights to perform tests\n");
3961 goto error;
3963 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3964 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
3965 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
3966 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
3967 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
3968 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
3969 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
3970 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
3971 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
3972 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
3973 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
3974 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
3975 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
3976 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3978 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
3979 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3980 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
3981 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
3982 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
3983 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
3984 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
3985 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
3986 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
3987 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
3988 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
3989 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
3990 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
3991 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
3992 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3994 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
3995 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3996 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
3997 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
3998 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
3999 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4000 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4001 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4002 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4003 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4004 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4005 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4006 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4007 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4008 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4010 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
4011 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4012 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
4013 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4014 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4015 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
4016 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4017 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4018 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4019 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4020 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4021 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4022 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4023 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4024 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4026 error:
4027 DeleteFileA(msifile);
4028 DeleteFileA("msitest\\alpha");
4029 DeleteFileA("msitest\\beta");
4030 DeleteFileA("msitest\\gamma");
4031 DeleteFileA("msitest\\theta");
4032 DeleteFileA("msitest\\delta");
4033 DeleteFileA("msitest\\epsilon");
4034 DeleteFileA("msitest\\zeta");
4035 DeleteFileA("msitest\\iota");
4036 DeleteFileA("msitest\\eta");
4037 DeleteFileA("msitest\\kappa");
4038 DeleteFileA("msitest\\lambda");
4039 DeleteFileA("msitest\\mu");
4040 RemoveDirectoryA("msitest");
4043 static const struct sourcepathmap
4045 BOOL sost; /* shortone\shorttwo */
4046 BOOL solt; /* shortone\longtwo */
4047 BOOL lost; /* longone\shorttwo */
4048 BOOL lolt; /* longone\longtwo */
4049 BOOL soste; /* shortone\shorttwo source exists */
4050 BOOL solte; /* shortone\longtwo source exists */
4051 BOOL loste; /* longone\shorttwo source exists */
4052 BOOL lolte; /* longone\longtwo source exists */
4053 UINT err;
4054 DWORD size;
4055 } spmap[256] =
4057 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4058 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4059 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4060 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4061 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4062 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4063 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4064 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4065 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4066 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4067 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4068 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4069 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4070 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4071 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4072 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4073 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4074 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4075 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4076 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4077 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4078 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4079 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4080 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4081 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4082 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4083 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4084 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4085 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4086 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4087 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4088 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4089 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4090 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4091 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4092 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4093 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4094 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4095 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4096 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4097 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4098 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4099 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4100 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4101 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4102 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4103 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4104 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4105 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4106 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4107 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4108 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4109 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4110 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4111 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4112 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4113 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4114 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4115 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4116 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4117 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4118 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4119 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4120 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4121 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4122 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4123 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4124 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4125 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4126 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4127 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4128 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4129 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4130 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4131 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4132 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4133 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4134 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4135 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4136 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4137 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4138 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4139 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4140 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4141 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4142 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4143 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4144 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4145 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4146 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4147 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4148 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4149 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4150 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4151 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4152 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4153 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4154 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4155 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4156 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4157 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4158 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4159 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4160 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4161 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4162 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4163 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4164 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4165 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4166 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4167 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4168 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4169 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4170 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4171 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4172 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4173 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4174 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4175 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4176 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4177 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4178 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4179 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4180 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4181 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4182 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4183 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4184 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4185 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4186 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4187 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4188 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4189 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4190 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4191 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4192 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4193 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4194 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4195 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4196 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4197 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4198 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4199 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4200 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4201 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4202 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4203 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4204 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4205 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4206 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4207 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4208 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4209 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4210 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4211 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4212 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4213 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4214 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4215 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4216 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4217 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4218 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4219 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4220 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4221 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4222 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4223 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4224 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4225 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4226 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4227 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4228 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4229 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4230 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4231 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4232 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4233 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4234 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4235 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4236 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4237 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4238 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4239 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4240 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4241 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4242 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4243 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4244 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4245 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4246 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4247 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4248 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4249 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4250 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4251 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4252 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4253 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4254 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4255 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4256 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4257 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4258 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4259 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4260 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4261 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4262 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4263 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4264 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4265 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4266 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4267 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4268 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4269 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4270 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4271 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4272 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4273 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4274 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4275 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4276 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4277 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4278 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4279 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4280 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4281 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4282 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4283 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4284 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4285 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4286 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4287 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4288 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4289 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4290 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4291 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4292 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4293 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4294 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4295 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4296 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4297 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4298 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4299 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4300 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4301 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4302 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4303 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4304 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4305 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4306 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4307 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4308 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4309 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4310 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4311 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4312 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4315 static DWORD get_pf_file_size(LPCSTR file)
4317 CHAR path[MAX_PATH];
4318 HANDLE hfile;
4319 DWORD size;
4321 lstrcpyA(path, PROG_FILES_DIR);
4322 lstrcatA(path, "\\");
4323 lstrcatA(path, file);
4325 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
4326 if (hfile == INVALID_HANDLE_VALUE)
4327 return INVALID_FILE_SIZE;
4329 size = GetFileSize(hfile, NULL);
4330 CloseHandle(hfile);
4331 return size;
4334 static void test_sourcepath(void)
4336 UINT r, i;
4338 if (!winetest_interactive)
4340 skip("Run in interactive mode to run source path tests.\n");
4341 return;
4344 create_database(msifile, sp_tables, sizeof(sp_tables) / sizeof(msi_table));
4346 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4348 for (i = 0; i < sizeof(spmap) / sizeof(spmap[0]); i++)
4350 if (spmap[i].sost)
4352 CreateDirectoryA("shortone", NULL);
4353 CreateDirectoryA("shortone\\shorttwo", NULL);
4356 if (spmap[i].solt)
4358 CreateDirectoryA("shortone", NULL);
4359 CreateDirectoryA("shortone\\longtwo", NULL);
4362 if (spmap[i].lost)
4364 CreateDirectoryA("longone", NULL);
4365 CreateDirectoryA("longone\\shorttwo", NULL);
4368 if (spmap[i].lolt)
4370 CreateDirectoryA("longone", NULL);
4371 CreateDirectoryA("longone\\longtwo", NULL);
4374 if (spmap[i].soste)
4375 create_file("shortone\\shorttwo\\augustus", 50);
4376 if (spmap[i].solte)
4377 create_file("shortone\\longtwo\\augustus", 100);
4378 if (spmap[i].loste)
4379 create_file("longone\\shorttwo\\augustus", 150);
4380 if (spmap[i].lolte)
4381 create_file("longone\\longtwo\\augustus", 200);
4383 r = MsiInstallProductA(msifile, NULL);
4384 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
4385 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
4386 "%d: Expected %d, got %d\n", i, spmap[i].size,
4387 get_pf_file_size("msitest\\augustus"));
4389 if (r == ERROR_SUCCESS)
4391 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
4392 ok(delete_pf("msitest", FALSE), "%d: Directory not created\n", i);
4394 else
4396 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
4397 todo_wine ok(!delete_pf("msitest", FALSE), "%d: Directory installed\n", i);
4400 DeleteFileA("shortone\\shorttwo\\augustus");
4401 DeleteFileA("shortone\\longtwo\\augustus");
4402 DeleteFileA("longone\\shorttwo\\augustus");
4403 DeleteFileA("longone\\longtwo\\augustus");
4404 RemoveDirectoryA("shortone\\shorttwo");
4405 RemoveDirectoryA("shortone\\longtwo");
4406 RemoveDirectoryA("longone\\shorttwo");
4407 RemoveDirectoryA("longone\\longtwo");
4408 RemoveDirectoryA("shortone");
4409 RemoveDirectoryA("longone");
4412 DeleteFileA(msifile);
4415 static void test_missingcomponent(void)
4417 UINT r;
4419 if (is_process_limited())
4421 skip("process is limited\n");
4422 return;
4425 CreateDirectoryA("msitest", NULL);
4426 create_file("msitest\\hydrogen", 500);
4427 create_file("msitest\\helium", 500);
4428 create_file("msitest\\lithium", 500);
4429 create_file("beryllium", 500);
4431 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
4433 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4435 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
4436 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4438 skip("Not enough rights to perform tests\n");
4439 goto error;
4441 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4442 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4443 ok(pf_exists("msitest\\helium"), "File not installed\n");
4444 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4445 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
4446 ok(pf_exists("msitest"), "File not installed\n");
4448 r = MsiInstallProductA(msifile, "REMOVE=ALL INSTALLLEVEL=10 PROPVAR=42");
4449 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4450 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
4451 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
4452 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
4453 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
4454 ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
4456 error:
4457 DeleteFileA(msifile);
4458 DeleteFileA("msitest\\hydrogen");
4459 DeleteFileA("msitest\\helium");
4460 DeleteFileA("msitest\\lithium");
4461 DeleteFileA("beryllium");
4462 RemoveDirectoryA("msitest");
4465 static void test_sourcedirprop(void)
4467 UINT r;
4468 CHAR props[MAX_PATH];
4470 if (is_process_limited())
4472 skip("process is limited\n");
4473 return;
4476 CreateDirectoryA("msitest", NULL);
4477 create_file("msitest\\augustus", 500);
4479 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
4481 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4483 r = MsiInstallProductA(msifile, NULL);
4484 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4486 skip("Not enough rights to perform tests\n");
4487 goto error;
4489 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4490 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4491 ok(delete_pf("msitest", FALSE), "Directory created\n");
4493 DeleteFileA("msitest\\augustus");
4494 RemoveDirectoryA("msitest");
4496 CreateDirectoryA("altsource", NULL);
4497 CreateDirectoryA("altsource\\msitest", NULL);
4498 create_file("altsource\\msitest\\augustus", 500);
4500 sprintf(props, "SRCDIR=%s\\altsource\\", CURR_DIR);
4502 r = MsiInstallProductA(msifile, props);
4503 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4504 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4505 ok(delete_pf("msitest", FALSE), "Directory created\n");
4507 DeleteFileA("altsource\\msitest\\augustus");
4508 RemoveDirectoryA("altsource\\msitest");
4509 RemoveDirectoryA("altsource");
4511 error:
4512 DeleteFileA("msitest\\augustus");
4513 RemoveDirectoryA("msitest");
4514 DeleteFileA(msifile);
4517 static void test_adminimage(void)
4519 UINT r;
4521 if (is_process_limited())
4523 skip("process is limited\n");
4524 return;
4527 CreateDirectoryA("msitest", NULL);
4528 CreateDirectoryA("msitest\\first", NULL);
4529 CreateDirectoryA("msitest\\second", NULL);
4530 CreateDirectoryA("msitest\\cabout", NULL);
4531 CreateDirectoryA("msitest\\cabout\\new", NULL);
4532 create_file("msitest\\one.txt", 100);
4533 create_file("msitest\\first\\two.txt", 100);
4534 create_file("msitest\\second\\three.txt", 100);
4535 create_file("msitest\\cabout\\four.txt", 100);
4536 create_file("msitest\\cabout\\new\\five.txt", 100);
4537 create_file("msitest\\filename", 100);
4538 create_file("msitest\\service.exe", 100);
4540 create_database_wordcount(msifile, ai_tables,
4541 sizeof(ai_tables) / sizeof(msi_table),
4542 100, msidbSumInfoSourceTypeAdminImage, ";1033");
4544 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4546 r = MsiInstallProductA(msifile, NULL);
4547 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4549 skip("Not enough rights to perform tests\n");
4550 goto error;
4552 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4554 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4555 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4556 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4557 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4558 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4559 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4560 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4561 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4562 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
4563 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4564 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4565 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4567 error:
4568 DeleteFileA("msifile");
4569 DeleteFileA("msitest\\cabout\\new\\five.txt");
4570 DeleteFileA("msitest\\cabout\\four.txt");
4571 DeleteFileA("msitest\\second\\three.txt");
4572 DeleteFileA("msitest\\first\\two.txt");
4573 DeleteFileA("msitest\\one.txt");
4574 DeleteFileA("msitest\\service.exe");
4575 DeleteFileA("msitest\\filename");
4576 RemoveDirectoryA("msitest\\cabout\\new");
4577 RemoveDirectoryA("msitest\\cabout");
4578 RemoveDirectoryA("msitest\\second");
4579 RemoveDirectoryA("msitest\\first");
4580 RemoveDirectoryA("msitest");
4583 static void test_propcase(void)
4585 UINT r;
4587 if (is_process_limited())
4589 skip("process is limited\n");
4590 return;
4593 CreateDirectoryA("msitest", NULL);
4594 create_file("msitest\\augustus", 500);
4596 create_database(msifile, pc_tables, sizeof(pc_tables) / sizeof(msi_table));
4598 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4600 r = MsiInstallProductA(msifile, "MyProp=42");
4601 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4603 skip("Not enough rights to perform tests\n");
4604 goto error;
4606 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4607 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4608 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4610 error:
4611 DeleteFileA(msifile);
4612 DeleteFileA("msitest\\augustus");
4613 RemoveDirectoryA("msitest");
4616 static void test_int_widths( void )
4618 static const char int0[] = "int0\ni0\nint0\tint0\n1";
4619 static const char int1[] = "int1\ni1\nint1\tint1\n1";
4620 static const char int2[] = "int2\ni2\nint2\tint2\n1";
4621 static const char int3[] = "int3\ni3\nint3\tint3\n1";
4622 static const char int4[] = "int4\ni4\nint4\tint4\n1";
4623 static const char int5[] = "int5\ni5\nint5\tint5\n1";
4624 static const char int8[] = "int8\ni8\nint8\tint8\n1";
4625 static const struct
4627 const char *data;
4628 unsigned int size;
4629 UINT ret;
4631 tests[] =
4633 { int0, sizeof(int0) - 1, ERROR_SUCCESS },
4634 { int1, sizeof(int1) - 1, ERROR_SUCCESS },
4635 { int2, sizeof(int2) - 1, ERROR_SUCCESS },
4636 { int3, sizeof(int3) - 1, ERROR_FUNCTION_FAILED },
4637 { int4, sizeof(int4) - 1, ERROR_SUCCESS },
4638 { int5, sizeof(int5) - 1, ERROR_FUNCTION_FAILED },
4639 { int8, sizeof(int8) - 1, ERROR_FUNCTION_FAILED }
4641 char tmpdir[MAX_PATH], msitable[MAX_PATH], msidb[MAX_PATH];
4642 MSIHANDLE db;
4643 UINT r, i;
4645 GetTempPathA(MAX_PATH, tmpdir);
4646 CreateDirectoryA(tmpdir, NULL);
4648 lstrcpyA(msitable, tmpdir);
4649 lstrcatA(msitable, "\\msitable.idt");
4651 lstrcpyA(msidb, tmpdir);
4652 lstrcatA(msidb, "\\msitest.msi");
4654 r = MsiOpenDatabaseA(msidb, MSIDBOPEN_CREATE, &db);
4655 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4657 for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
4659 DWORD count;
4660 HANDLE handle = CreateFileA(msitable, GENERIC_WRITE, 0, NULL,
4661 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
4662 WriteFile(handle, tests[i].data, tests[i].size, &count, NULL);
4663 CloseHandle(handle);
4665 r = MsiDatabaseImportA(db, tmpdir, "msitable.idt");
4666 ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r);
4668 r = MsiDatabaseCommit(db);
4669 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4670 DeleteFileA(msitable);
4673 MsiCloseHandle(db);
4674 DeleteFileA(msidb);
4675 RemoveDirectoryA(tmpdir);
4678 static void test_shortcut(void)
4680 UINT r;
4681 HRESULT hr;
4683 if (is_process_limited())
4685 skip("process is limited\n");
4686 return;
4689 create_test_files();
4690 create_database(msifile, sc_tables, sizeof(sc_tables) / sizeof(msi_table));
4692 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4694 r = MsiInstallProductA(msifile, NULL);
4695 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4697 skip("Not enough rights to perform tests\n");
4698 goto error;
4700 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4702 hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
4703 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
4705 r = MsiInstallProductA(msifile, NULL);
4706 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4708 CoUninitialize();
4710 hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
4711 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
4713 r = MsiInstallProductA(msifile, NULL);
4714 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4716 CoUninitialize();
4718 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4719 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4720 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4721 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4722 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4723 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4724 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4725 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4726 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4727 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
4728 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4729 while (!delete_pf("msitest\\Shortcut.lnk", TRUE) && GetLastError() == ERROR_SHARING_VIOLATION) Sleep(1000);
4730 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4732 error:
4733 delete_test_files();
4734 DeleteFileA(msifile);
4737 static void test_preselected(void)
4739 UINT r;
4741 if (is_process_limited())
4743 skip("process is limited\n");
4744 return;
4747 create_test_files();
4748 create_database(msifile, ps_tables, sizeof(ps_tables) / sizeof(msi_table));
4750 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4752 r = MsiInstallProductA(msifile, "ADDLOCAL=One");
4753 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4755 skip("Not enough rights to perform tests\n");
4756 goto error;
4758 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4760 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
4761 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
4762 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
4763 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
4764 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
4765 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
4766 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
4767 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
4768 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
4769 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
4770 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
4771 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4773 r = MsiInstallProductA(msifile, NULL);
4774 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4776 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4777 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4778 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4779 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4780 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4781 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4782 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4783 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4784 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4785 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
4786 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4787 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4789 error:
4790 delete_test_files();
4791 DeleteFileA(msifile);
4794 static void test_installed_prop(void)
4796 static char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}";
4797 UINT r;
4799 if (is_process_limited())
4801 skip("process is limited\n");
4802 return;
4805 create_test_files();
4806 create_database(msifile, ip_tables, sizeof(ip_tables) / sizeof(msi_table));
4808 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4810 r = MsiInstallProductA(msifile, "FULL=1");
4811 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4813 skip("Not enough rights to perform tests\n");
4814 goto error;
4816 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4818 r = MsiInstallProductA(msifile, "FULL=1");
4819 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4821 r = MsiConfigureProductExA(prodcode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, "FULL=1");
4822 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4824 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4825 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4826 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4827 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4828 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4829 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4830 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4831 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4832 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4833 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
4834 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4835 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4837 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4838 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4840 error:
4841 delete_test_files();
4842 DeleteFileA(msifile);
4845 static void test_allusers_prop(void)
4847 UINT r;
4849 if (is_process_limited())
4851 skip("process is limited\n");
4852 return;
4855 create_test_files();
4856 create_database(msifile, aup_tables, sizeof(aup_tables) / sizeof(msi_table));
4858 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4860 /* ALLUSERS property unset */
4861 r = MsiInstallProductA(msifile, "FULL=1");
4862 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4864 skip("Not enough rights to perform tests\n");
4865 goto error;
4867 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4869 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4870 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4871 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4872 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4873 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4874 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4875 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4876 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4877 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4878 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
4879 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4880 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4882 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4883 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4885 delete_test_files();
4887 create_test_files();
4888 create_database(msifile, aup2_tables, sizeof(aup2_tables) / sizeof(msi_table));
4890 /* ALLUSERS property set to 1 */
4891 r = MsiInstallProductA(msifile, "FULL=1");
4892 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4894 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4895 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4896 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4897 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4898 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4899 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4900 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4901 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4902 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4903 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
4904 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4905 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4907 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4908 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4910 delete_test_files();
4912 create_test_files();
4913 create_database(msifile, aup3_tables, sizeof(aup3_tables) / sizeof(msi_table));
4915 /* ALLUSERS property set to 2 */
4916 r = MsiInstallProductA(msifile, "FULL=1");
4917 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
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 installed\n");
4929 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4930 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4932 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4933 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4935 delete_test_files();
4937 create_test_files();
4938 create_database(msifile, aup4_tables, sizeof(aup4_tables) / sizeof(msi_table));
4940 /* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */
4941 r = MsiInstallProductA(msifile, "FULL=1");
4942 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4944 error:
4945 delete_test_files();
4946 DeleteFileA(msifile);
4949 static char session_manager[] = "System\\CurrentControlSet\\Control\\Session Manager";
4950 static char rename_ops[] = "PendingFileRenameOperations";
4952 static void process_pending_renames(HKEY hkey)
4954 char *buf, *src, *dst, *buf2, *buf2ptr;
4955 DWORD size;
4956 LONG ret;
4957 BOOL found = FALSE;
4959 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size);
4960 ok(!ret, "RegQueryValueExA failed %d\n", ret);
4962 buf = HeapAlloc(GetProcessHeap(), 0, size + 1);
4963 buf2ptr = buf2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 1);
4965 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size);
4966 buf[size] = 0;
4967 ok(!ret, "RegQueryValueExA failed %d\n", ret);
4968 if (ret) return;
4970 for (src = buf; *src; src = dst + strlen(dst) + 1)
4972 DWORD flags = MOVEFILE_COPY_ALLOWED;
4973 BOOL fileret;
4975 dst = src + strlen(src) + 1;
4977 if (!strstr(src, "msitest"))
4979 lstrcpyA(buf2ptr, src);
4980 buf2ptr += strlen(src) + 1;
4981 lstrcpyA(buf2ptr, dst);
4982 buf2ptr += strlen(dst) + 1;
4983 continue;
4986 found = TRUE;
4988 if (*dst == '!')
4990 flags |= MOVEFILE_REPLACE_EXISTING;
4991 dst++;
4993 if (src[0] == '\\' && src[1] == '?' && src[2] == '?' && src[3] == '\\') src += 4;
4994 if (*dst)
4996 if (dst[0] == '\\' && dst[1] == '?' && dst[2] == '?' && dst[3] == '\\') dst += 4;
4997 fileret = MoveFileExA(src, dst, flags);
4998 ok(fileret, "Failed to move file %s -> %s (%u)\n", src, dst, GetLastError());
5000 else
5002 fileret = DeleteFileA(src);
5003 ok(fileret, "Failed to delete file %s (%u)\n", src, GetLastError());
5007 ok(found, "Expected a 'msitest' entry\n");
5009 if (*buf2)
5010 RegSetValueExA(hkey, rename_ops, 0, REG_MULTI_SZ, (LPBYTE)buf2, buf2ptr + 1 - buf2);
5011 else
5012 RegDeleteValueA(hkey, rename_ops);
5014 HeapFree(GetProcessHeap(), 0, buf);
5015 HeapFree(GetProcessHeap(), 0, buf2);
5018 static BOOL file_matches_data(LPCSTR file, LPCSTR data)
5020 DWORD len, data_len = strlen(data);
5021 HANDLE handle;
5022 char buf[128];
5024 handle = CreateFileA(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
5025 ok(handle != INVALID_HANDLE_VALUE, "failed to open %s (%u)\n", file, GetLastError());
5027 if (ReadFile(handle, buf, sizeof(buf), &len, NULL) && len >= data_len)
5029 CloseHandle(handle);
5030 return !memcmp(buf, data, data_len);
5032 CloseHandle(handle);
5033 return FALSE;
5036 static void test_file_in_use(void)
5038 UINT r;
5039 HANDLE file;
5040 HKEY hkey;
5041 char path[MAX_PATH];
5043 if (is_process_limited())
5045 skip("process is limited\n");
5046 return;
5049 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
5051 CreateDirectoryA("msitest", NULL);
5052 create_file("msitest\\maximus", 500);
5053 create_database(msifile, fiu_tables, sizeof(fiu_tables) / sizeof(msi_table));
5055 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5057 lstrcpyA(path, PROG_FILES_DIR);
5058 lstrcatA(path, "\\msitest");
5059 CreateDirectoryA(path, NULL);
5061 lstrcatA(path, "\\maximus");
5062 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
5064 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
5065 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5067 skip("Not enough rights to perform tests\n");
5068 goto error;
5070 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
5071 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
5072 CloseHandle(file);
5073 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
5075 process_pending_renames(hkey);
5076 RegCloseKey(hkey);
5078 ok(file_matches_data(path, "msitest\\maximus"), "Expected file to match\n");
5079 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
5080 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
5082 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5083 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5085 error:
5086 RegCloseKey(hkey);
5088 delete_pf("msitest\\maximus", TRUE);
5089 delete_pf("msitest", FALSE);
5090 DeleteFileA("msitest\\maximus");
5091 delete_test_files();
5092 DeleteFileA(msifile);
5095 static void test_file_in_use_cab(void)
5097 UINT r;
5098 HANDLE file;
5099 HKEY hkey;
5100 char path[MAX_PATH];
5102 if (is_process_limited())
5104 skip("process is limited\n");
5105 return;
5108 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
5110 CreateDirectoryA("msitest", NULL);
5111 create_file("maximus", 500);
5112 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
5113 DeleteFileA("maximus");
5115 create_database(msifile, fiuc_tables, sizeof(fiuc_tables) / sizeof(msi_table));
5117 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5119 lstrcpyA(path, PROG_FILES_DIR);
5120 lstrcatA(path, "\\msitest");
5121 CreateDirectoryA(path, NULL);
5123 lstrcatA(path, "\\maximus");
5124 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
5126 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
5127 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5129 skip("Not enough rights to perform tests\n");
5130 goto error;
5132 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
5133 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
5134 CloseHandle(file);
5135 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
5137 process_pending_renames(hkey);
5138 RegCloseKey(hkey);
5140 ok(file_matches_data(path, "maximus"), "Expected file to match\n");
5141 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
5142 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
5144 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5145 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5147 error:
5148 RegCloseKey(hkey);
5150 delete_pf("msitest\\maximus", TRUE);
5151 delete_pf("msitest", FALSE);
5152 DeleteFileA("msitest\\maximus");
5153 delete_cab_files();
5154 delete_test_files();
5155 DeleteFileA(msifile);
5158 static void test_feature_override(void)
5160 UINT r;
5161 REGSAM access = KEY_ALL_ACCESS;
5163 if (is_process_limited())
5165 skip("process is limited\n");
5166 return;
5169 create_test_files();
5170 create_file("msitest\\override.txt", 1000);
5171 create_file("msitest\\preselected.txt", 1000);
5172 create_file("msitest\\notpreselected.txt", 1000);
5173 create_database(msifile, fo_tables, sizeof(fo_tables) / sizeof(msi_table));
5175 if (is_wow64)
5176 access |= KEY_WOW64_64KEY;
5178 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5180 r = MsiInstallProductA(msifile, "ADDLOCAL=override");
5181 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5183 skip("Not enough rights to perform tests\n");
5184 goto error;
5186 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5188 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5189 ok(!pf_exists("msitest\\preselected.txt"), "file installed\n");
5190 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5192 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5193 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5195 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5197 r = MsiInstallProductA(msifile, "preselect=1");
5198 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5200 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5201 ok(pf_exists("msitest\\preselected.txt"), "file not installed\n");
5202 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5204 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5205 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5207 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5208 todo_wine {
5209 ok(delete_pf("msitest\\preselected.txt", TRUE), "file removed\n");
5210 ok(delete_pf("msitest", FALSE), "directory removed\n");
5213 r = MsiInstallProductA(msifile, NULL);
5214 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5216 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5217 ok(pf_exists("msitest\\preselected.txt"), "file not installed\n");
5218 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5220 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5221 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5223 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5224 todo_wine {
5225 ok(delete_pf("msitest\\preselected.txt", TRUE), "file removed\n");
5226 ok(delete_pf("msitest", FALSE), "directory removed\n");
5229 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", access);
5231 error:
5232 DeleteFileA("msitest\\override.txt");
5233 DeleteFileA("msitest\\preselected.txt");
5234 DeleteFileA("msitest\\notpreselected.txt");
5235 delete_test_files();
5236 DeleteFileA(msifile);
5239 static void test_icon_table(void)
5241 MSIHANDLE hdb = 0, record;
5242 LPCSTR query;
5243 UINT res;
5244 CHAR path[MAX_PATH];
5245 static const char prodcode[] = "{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}";
5247 if (is_process_limited())
5249 skip("process is limited\n");
5250 return;
5253 create_database(msifile, icon_base_tables, sizeof(icon_base_tables) / sizeof(msi_table));
5255 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5257 res = MsiOpenDatabaseA(msifile, MSIDBOPEN_TRANSACT, &hdb);
5258 ok(res == ERROR_SUCCESS, "failed to open db: %d\n", res);
5260 query = "CREATE TABLE `Icon` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)";
5261 res = run_query( hdb, 0, query );
5262 ok(res == ERROR_SUCCESS, "Can't create Icon table: %d\n", res);
5264 create_file("icon.ico", 100);
5265 record = MsiCreateRecord(1);
5266 res = MsiRecordSetStreamA(record, 1, "icon.ico");
5267 ok(res == ERROR_SUCCESS, "Failed to add stream data to record: %d\n", res);
5269 query = "INSERT INTO `Icon` (`Name`, `Data`) VALUES ('testicon', ?)";
5270 res = run_query(hdb, record, query);
5271 ok(res == ERROR_SUCCESS, "Insert into Icon table failed: %d\n", res);
5273 res = MsiCloseHandle(record);
5274 ok(res == ERROR_SUCCESS, "Failed to close record handle: %d\n", res);
5275 DeleteFileA("icon.ico");
5276 res = MsiDatabaseCommit(hdb);
5277 ok(res == ERROR_SUCCESS, "Failed to commit database: %d\n", res);
5278 res = MsiCloseHandle(hdb);
5279 ok(res == ERROR_SUCCESS, "Failed to close database: %d\n", res);
5281 /* per-user */
5282 res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
5283 if (res == ERROR_INSTALL_PACKAGE_REJECTED)
5285 skip("Not enough rights to perform tests\n");
5286 DeleteFileA(msifile);
5287 return;
5289 ok(res == ERROR_SUCCESS, "Failed to do per-user install: %d\n", res);
5291 lstrcpyA(path, APP_DATA_DIR);
5292 lstrcatA(path, "\\");
5293 lstrcatA(path, "Microsoft\\Installer\\");
5294 lstrcatA(path, prodcode);
5295 lstrcatA(path, "\\testicon");
5296 ok(file_exists(path), "Per-user icon file isn't where it's expected (%s)\n", path);
5298 res = MsiInstallProductA(msifile, "REMOVE=ALL");
5299 ok(res == ERROR_SUCCESS, "Failed to uninstall per-user\n");
5300 ok(!file_exists(path), "Per-user icon file not removed (%s)\n", path);
5302 /* system-wide */
5303 res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
5304 ok(res == ERROR_SUCCESS, "Failed to system-wide install: %d\n", res);
5306 lstrcpyA(path, WINDOWS_DIR);
5307 lstrcatA(path, "\\");
5308 lstrcatA(path, "Installer\\");
5309 lstrcatA(path, prodcode);
5310 lstrcatA(path, "\\testicon");
5311 ok(file_exists(path), "System-wide icon file isn't where it's expected (%s)\n", path);
5313 res = MsiInstallProductA(msifile, "REMOVE=ALL");
5314 ok(res == ERROR_SUCCESS, "Failed to uninstall system-wide\n");
5315 ok(!file_exists(path), "System-wide icon file not removed (%s)\n", path);
5317 delete_pfmsitest_files();
5318 DeleteFileA(msifile);
5321 static void test_package_validation(void)
5323 UINT r;
5325 if (is_process_limited())
5327 skip("process is limited\n");
5328 return;
5331 CreateDirectoryA("msitest", NULL);
5332 create_file("msitest\\maximus", 500);
5333 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;1033");
5335 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5337 r = MsiInstallProductA(msifile, NULL);
5338 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5340 skip("Not enough rights to perform tests\n");
5341 goto error;
5343 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5344 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5345 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5347 DeleteFileA(msifile);
5348 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,9999;9999");
5350 r = MsiInstallProductA(msifile, NULL);
5351 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5353 DeleteFileA(msifile);
5354 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,1033;9999");
5356 r = MsiInstallProductA(msifile, NULL);
5357 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5359 DeleteFileA(msifile);
5360 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,9999;1033");
5362 r = MsiInstallProductA(msifile, NULL);
5363 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5364 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5365 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5367 DeleteFileA(msifile);
5368 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel64,9999;1033");
5370 r = MsiInstallProductA(msifile, NULL);
5371 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5373 DeleteFileA(msifile);
5374 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel32,1033;1033");
5376 r = MsiInstallProductA(msifile, NULL);
5377 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5379 DeleteFileA(msifile);
5380 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel32,9999;1033");
5382 r = MsiInstallProductA(msifile, NULL);
5383 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5385 DeleteFileA(msifile);
5386 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;9999");
5388 r = MsiInstallProductA(msifile, NULL);
5389 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5390 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5391 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5393 if (GetSystemDefaultLangID() == MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ))
5395 DeleteFileA(msifile);
5396 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;9");
5397 r = MsiInstallProductA(msifile, NULL);
5398 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5399 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5400 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5402 DeleteFileA(msifile);
5403 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;1024");
5404 r = MsiInstallProductA(msifile, NULL);
5405 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5406 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5407 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5410 DeleteFileA(msifile);
5411 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel32;0");
5413 r = MsiInstallProductA(msifile, NULL);
5414 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5415 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5416 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5418 if (is_64bit && !is_wow64)
5420 DeleteFileA(msifile);
5421 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5423 r = MsiInstallProductA(msifile, NULL);
5424 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5425 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5426 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5428 DeleteFileA(msifile);
5429 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5431 r = MsiInstallProductA(msifile, NULL);
5432 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
5433 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5434 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5436 DeleteFileA(msifile);
5437 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5439 r = MsiInstallProductA(msifile, NULL);
5440 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5441 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5442 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5444 else if (is_wow64)
5446 DeleteFileA(msifile);
5447 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5449 r = MsiInstallProductA(msifile, NULL);
5450 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5451 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5452 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5454 DeleteFileA(msifile);
5455 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5457 r = MsiInstallProductA(msifile, NULL);
5458 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
5459 ok(!delete_pf_native("msitest\\maximus", TRUE), "file exists\n");
5460 ok(!delete_pf_native("msitest", FALSE), "directory exists\n");
5462 DeleteFileA(msifile);
5463 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5465 r = MsiInstallProductA(msifile, NULL);
5466 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5467 ok(delete_pf_native("msitest\\maximus", TRUE), "file exists\n");
5468 ok(delete_pf_native("msitest", FALSE), "directory exists\n");
5470 else
5472 DeleteFileA(msifile);
5473 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5475 r = MsiInstallProductA(msifile, NULL);
5476 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5477 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5478 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5480 DeleteFileA(msifile);
5481 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Alpha,Beta,Intel;0");
5483 r = MsiInstallProductA(msifile, NULL);
5484 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5485 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5486 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5488 DeleteFileA(msifile);
5489 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5491 r = MsiInstallProductA(msifile, NULL);
5492 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5493 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5494 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5496 DeleteFileA(msifile);
5497 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5499 r = MsiInstallProductA(msifile, NULL);
5500 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5501 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5502 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5505 error:
5506 /* Delete the files in the temp (current) folder */
5507 DeleteFileA(msifile);
5508 DeleteFileA("msitest\\maximus");
5509 RemoveDirectoryA("msitest");
5512 static void test_upgrade_code(void)
5514 UINT r;
5516 if (is_process_limited())
5518 skip("process is limited\n");
5519 return;
5522 CreateDirectoryA("msitest", NULL);
5523 create_file("msitest\\upgradecode.txt", 1000);
5524 create_database(msifile, uc_tables, sizeof(uc_tables) / sizeof(msi_table));
5526 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5528 r = MsiInstallProductA(msifile, NULL);
5529 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5531 ok(pf_exists("msitest\\upgradecode.txt"), "file not installed\n");
5533 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5534 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5536 ok(!delete_pf("msitest\\upgradecode.txt", TRUE), "file not removed\n");
5537 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5539 DeleteFileA("msitest\\upgradecode.txt");
5540 RemoveDirectoryA("msitest");
5541 DeleteFileA(msifile);
5544 static void test_mixed_package(void)
5546 UINT r;
5547 LONG res;
5548 HKEY hkey;
5550 if (is_process_limited())
5552 skip("process is limited\n");
5553 return;
5555 if (!is_wow64 && !is_64bit)
5557 skip("this test must be run on 64-bit\n");
5558 return;
5560 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5561 create_database_template(msifile, mixed_tables, sizeof(mixed_tables)/sizeof(msi_table), 200, "x64;1033");
5563 r = MsiInstallProductA(msifile, NULL);
5564 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5566 skip("Not enough rights to perform tests\n");
5567 goto error;
5569 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5571 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5572 ok(!res, "can't open 32-bit component key\n");
5573 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5574 ok(!res, "value test1 not found\n");
5575 RegCloseKey(hkey);
5577 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5578 ok(!res, "can't open 64-bit component key\n");
5579 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5580 ok(!res, "value test2 not found\n");
5581 RegCloseKey(hkey);
5583 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5584 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5586 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5587 ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
5589 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5590 ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
5592 DeleteFileA( msifile );
5593 create_database_template(msifile, mixed_tables, sizeof(mixed_tables)/sizeof(msi_table), 200, "Intel;1033");
5595 r = MsiInstallProductA(msifile, NULL);
5596 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5598 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5599 ok(!res, "can't open 32-bit component key\n");
5600 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5601 ok(!res, "value test1 not found\n");
5602 RegCloseKey(hkey);
5604 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5605 ok(!res, "can't open 64-bit component key\n");
5606 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5607 ok(!res, "value test2 not found\n");
5608 RegCloseKey(hkey);
5610 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5611 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5613 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5614 ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
5616 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5617 ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
5619 error:
5620 DeleteFileA( msifile );
5623 static void test_volume_props(void)
5625 UINT r;
5627 if (is_process_limited())
5629 skip("process is limited\n");
5630 return;
5632 CreateDirectoryA("msitest", NULL);
5633 create_file("msitest\\volumeprop.txt", 1000);
5634 create_database(msifile, vp_tables, sizeof(vp_tables)/sizeof(msi_table));
5636 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5638 r = MsiInstallProductA(msifile, NULL);
5639 ok(r == ERROR_SUCCESS, "got %u\n", r);
5641 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5642 ok(r == ERROR_SUCCESS, "got %u\n", r);
5644 DeleteFileA("msitest\\volumeprop.txt");
5645 RemoveDirectoryA("msitest");
5646 DeleteFileA(msifile);
5649 START_TEST(install)
5651 DWORD len;
5652 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
5653 STATEMGRSTATUS status;
5654 BOOL ret = FALSE;
5656 init_functionpointers();
5658 if (pIsWow64Process)
5659 pIsWow64Process(GetCurrentProcess(), &is_wow64);
5661 GetCurrentDirectoryA(MAX_PATH, prev_path);
5662 GetTempPathA(MAX_PATH, temp_path);
5663 SetCurrentDirectoryA(temp_path);
5665 lstrcpyA(CURR_DIR, temp_path);
5666 len = lstrlenA(CURR_DIR);
5668 if(len && (CURR_DIR[len - 1] == '\\'))
5669 CURR_DIR[len - 1] = 0;
5671 ok(get_system_dirs(), "failed to retrieve system dirs\n");
5672 ok(get_user_dirs(), "failed to retrieve user dirs\n");
5674 /* Create a restore point ourselves so we circumvent the multitude of restore points
5675 * that would have been created by all the installation and removal tests.
5677 * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
5678 * creation of restore points.
5680 if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
5682 memset(&status, 0, sizeof(status));
5683 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
5686 /* Create only one log file and don't append. We have to pass something
5687 * for the log mode for this to work. The logfile needs to have an absolute
5688 * path otherwise we still end up with some extra logfiles as some tests
5689 * change the current directory.
5691 lstrcpyA(log_file, temp_path);
5692 lstrcatA(log_file, "\\msitest.log");
5693 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
5695 test_MsiInstallProduct();
5696 test_MsiSetComponentState();
5697 test_packagecoltypes();
5698 test_continuouscabs();
5699 test_caborder();
5700 test_mixedmedia();
5701 test_samesequence();
5702 test_uiLevelFlags();
5703 test_readonlyfile();
5704 test_readonlyfile_cab();
5705 test_setdirproperty();
5706 test_cabisextracted();
5707 test_transformprop();
5708 test_currentworkingdir();
5709 test_admin();
5710 test_adminprops();
5711 test_missingcab();
5712 test_sourcefolder();
5713 test_customaction51();
5714 test_installstate();
5715 test_sourcepath();
5716 test_missingcomponent();
5717 test_sourcedirprop();
5718 test_adminimage();
5719 test_propcase();
5720 test_int_widths();
5721 test_shortcut();
5722 test_preselected();
5723 test_installed_prop();
5724 test_file_in_use();
5725 test_file_in_use_cab();
5726 test_allusers_prop();
5727 test_feature_override();
5728 test_icon_table();
5729 test_package_validation();
5730 test_upgrade_code();
5731 test_mixed_package();
5732 test_volume_props();
5734 DeleteFileA(log_file);
5736 if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
5738 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
5739 if (ret)
5740 remove_restore_point(status.llSequenceNumber);
5742 FreeLibrary(hsrclient);
5744 SetCurrentDirectoryA(prev_path);