msi: Make MsiDoAction() RPC-compatible.
[wine.git] / dlls / msi / tests / install.c
blobb63e5da96864b5c54199a99cd4d2cebffc49b892
1 /*
2 * Copyright (C) 2006 James Hawkins
4 * A test program for installing MSI products.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define _WIN32_MSI 300
22 #define COBJMACROS
24 #include <stdio.h>
26 #include <windows.h>
27 #include <msiquery.h>
28 #include <msidefs.h>
29 #include <msi.h>
30 #include <fci.h>
31 #include <objidl.h>
32 #include <srrestoreptapi.h>
33 #include <shlobj.h>
34 #include <winsvc.h>
35 #include <shellapi.h>
37 #include "wine/test.h"
39 static UINT (WINAPI *pMsiQueryComponentStateA)
40 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*);
41 static UINT (WINAPI *pMsiSourceListEnumSourcesA)
42 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
43 static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
44 (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
46 static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL);
47 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
48 static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE );
49 static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
50 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
52 static HMODULE hsrclient = 0;
53 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
54 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
56 static BOOL is_wow64;
57 static const BOOL is_64bit = sizeof(void *) > sizeof(int);
59 static const char *msifile = "msitest.msi";
60 static const char *msifile2 = "winetest2.msi";
61 static const char *mstfile = "winetest.mst";
63 static const WCHAR msifileW[] = {'m','s','i','t','e','s','t','.','m','s','i',0};
64 static const WCHAR msifile2W[] = {'w','i','n','e','t','e','s','t','2','.','m','s','i',0};
66 static CHAR CURR_DIR[MAX_PATH];
67 static CHAR PROG_FILES_DIR[MAX_PATH];
68 static CHAR PROG_FILES_DIR_NATIVE[MAX_PATH];
69 static CHAR COMMON_FILES_DIR[MAX_PATH];
70 static CHAR APP_DATA_DIR[MAX_PATH];
71 static CHAR WINDOWS_DIR[MAX_PATH];
73 static const char *customdll;
75 /* msi database data */
77 static const CHAR component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
78 "s72\tS38\ts72\ti2\tS255\tS72\n"
79 "Component\tComponent\n"
80 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
81 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
82 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n"
83 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
84 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
85 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
86 "component\t\tMSITESTDIR\t0\t1\tfile\n"
87 "service_comp\t\tMSITESTDIR\t0\t1\tservice_file";
89 static const CHAR directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
90 "s72\tS72\tl255\n"
91 "Directory\tDirectory\n"
92 "CABOUTDIR\tMSITESTDIR\tcabout\n"
93 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
94 "FIRSTDIR\tMSITESTDIR\tfirst\n"
95 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
96 "NEWDIR\tCABOUTDIR\tnew\n"
97 "ProgramFilesFolder\tTARGETDIR\t.\n"
98 "TARGETDIR\t\tSourceDir";
100 static const CHAR feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
101 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
102 "Feature\tFeature\n"
103 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
104 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
105 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
106 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
107 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
108 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
109 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
111 static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
112 "s38\ts72\n"
113 "FeatureComponents\tFeature_\tComponent_\n"
114 "Five\tFive\n"
115 "Four\tFour\n"
116 "One\tOne\n"
117 "Three\tThree\n"
118 "Two\tTwo\n"
119 "feature\tcomponent\n"
120 "service_feature\tservice_comp\n";
122 static const CHAR file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
123 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
124 "File\tFile\n"
125 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
126 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
127 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
128 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
129 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
130 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
131 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
133 static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
134 "s72\tS255\tI2\n"
135 "InstallExecuteSequence\tAction\n"
136 "AllocateRegistrySpace\tNOT Installed\t1550\n"
137 "CostFinalize\t\t1000\n"
138 "CostInitialize\t\t800\n"
139 "FileCost\t\t900\n"
140 "ResolveSource\t\t950\n"
141 "MoveFiles\t\t1700\n"
142 "InstallFiles\t\t4000\n"
143 "DuplicateFiles\t\t4500\n"
144 "WriteEnvironmentStrings\t\t4550\n"
145 "CreateShortcuts\t\t4600\n"
146 "InstallServices\t\t5000\n"
147 "InstallFinalize\t\t6600\n"
148 "InstallInitialize\t\t1500\n"
149 "InstallValidate\t\t1400\n"
150 "LaunchConditions\t\t100\n"
151 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
153 static const CHAR media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
154 "i2\ti4\tL64\tS255\tS32\tS72\n"
155 "Media\tDiskId\n"
156 "1\t3\t\t\tDISK1\t\n"
157 "2\t5\t\tmsitest.cab\tDISK2\t\n";
159 static const CHAR property_dat[] = "Property\tValue\n"
160 "s72\tl0\n"
161 "Property\tProperty\n"
162 "DefaultUIFont\tDlgFont8\n"
163 "HASUIRUN\t0\n"
164 "INSTALLLEVEL\t3\n"
165 "InstallMode\tTypical\n"
166 "Manufacturer\tWine\n"
167 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
168 "PRIMARYFOLDER\tTARGETDIR\n"
169 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
170 "ProductID\tnone\n"
171 "ProductLanguage\t1033\n"
172 "ProductName\tMSITEST\n"
173 "ProductVersion\t1.1.1\n"
174 "PROMPTROLLBACKCOST\tP\n"
175 "Setup\tSetup\n"
176 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
177 "AdminProperties\tPOSTADMIN\n"
178 "ROOTDRIVE\tC:\\\n"
179 "SERVNAME\tTestService\n"
180 "SERVDISP\tTestServiceDisp\n"
181 "MSIFASTINSTALL\t1\n";
183 static const CHAR aup_property_dat[] = "Property\tValue\n"
184 "s72\tl0\n"
185 "Property\tProperty\n"
186 "DefaultUIFont\tDlgFont8\n"
187 "HASUIRUN\t0\n"
188 "ALLUSERS\t1\n"
189 "INSTALLLEVEL\t3\n"
190 "InstallMode\tTypical\n"
191 "Manufacturer\tWine\n"
192 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
193 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
194 "ProductID\tnone\n"
195 "ProductLanguage\t1033\n"
196 "ProductName\tMSITEST\n"
197 "ProductVersion\t1.1.1\n"
198 "PROMPTROLLBACKCOST\tP\n"
199 "Setup\tSetup\n"
200 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
201 "AdminProperties\tPOSTADMIN\n"
202 "ROOTDRIVE\tC:\\\n"
203 "SERVNAME\tTestService\n"
204 "SERVDISP\tTestServiceDisp\n"
205 "MSIFASTINSTALL\t1\n";
207 static const CHAR aup2_property_dat[] = "Property\tValue\n"
208 "s72\tl0\n"
209 "Property\tProperty\n"
210 "DefaultUIFont\tDlgFont8\n"
211 "HASUIRUN\t0\n"
212 "ALLUSERS\t2\n"
213 "INSTALLLEVEL\t3\n"
214 "InstallMode\tTypical\n"
215 "Manufacturer\tWine\n"
216 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
217 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
218 "ProductID\tnone\n"
219 "ProductLanguage\t1033\n"
220 "ProductName\tMSITEST\n"
221 "ProductVersion\t1.1.1\n"
222 "PROMPTROLLBACKCOST\tP\n"
223 "Setup\tSetup\n"
224 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
225 "AdminProperties\tPOSTADMIN\n"
226 "ROOTDRIVE\tC:\\\n"
227 "SERVNAME\tTestService\n"
228 "SERVDISP\tTestServiceDisp\n"
229 "MSIFASTINSTALL\t1\n";
231 static const CHAR icon_property_dat[] = "Property\tValue\n"
232 "s72\tl0\n"
233 "Property\tProperty\n"
234 "DefaultUIFont\tDlgFont8\n"
235 "HASUIRUN\t0\n"
236 "INSTALLLEVEL\t3\n"
237 "InstallMode\tTypical\n"
238 "Manufacturer\tWine\n"
239 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
240 "ProductCode\t{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}\n"
241 "ProductID\tnone\n"
242 "ProductLanguage\t1033\n"
243 "ProductName\tMSITEST\n"
244 "ProductVersion\t1.1.1\n"
245 "PROMPTROLLBACKCOST\tP\n"
246 "Setup\tSetup\n"
247 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
248 "AdminProperties\tPOSTADMIN\n"
249 "ROOTDRIVE\tC:\\\n"
250 "SERVNAME\tTestService\n"
251 "SERVDISP\tTestServiceDisp\n"
252 "MSIFASTINSTALL\t1\n";
254 static const CHAR shortcut_dat[] = "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
255 "s72\ts72\tl128\ts72\ts72\tS255\tL255\tI2\tS72\tI2\tI2\tS72\n"
256 "Shortcut\tShortcut\n"
257 "Shortcut\tMSITESTDIR\tShortcut\tcomponent\tShortcut\t\tShortcut\t\t\t\t\t\n";
259 static const CHAR condition_dat[] = "Feature_\tLevel\tCondition\n"
260 "s38\ti2\tS255\n"
261 "Condition\tFeature_\tLevel\n"
262 "One\t4\t1\n";
264 static const CHAR up_property_dat[] = "Property\tValue\n"
265 "s72\tl0\n"
266 "Property\tProperty\n"
267 "DefaultUIFont\tDlgFont8\n"
268 "HASUIRUN\t0\n"
269 "INSTALLLEVEL\t3\n"
270 "InstallMode\tTypical\n"
271 "Manufacturer\tWine\n"
272 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
273 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
274 "ProductID\tnone\n"
275 "ProductLanguage\t1033\n"
276 "ProductName\tMSITEST\n"
277 "ProductVersion\t1.1.1\n"
278 "PROMPTROLLBACKCOST\tP\n"
279 "Setup\tSetup\n"
280 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
281 "AdminProperties\tPOSTADMIN\n"
282 "ROOTDRIVE\tC:\\\n"
283 "SERVNAME\tTestService\n"
284 "SERVDISP\tTestServiceDisp\n"
285 "RemovePreviousVersions\t1\n"
286 "MSIFASTINSTALL\t1\n";
288 static const CHAR up2_property_dat[] = "Property\tValue\n"
289 "s72\tl0\n"
290 "Property\tProperty\n"
291 "DefaultUIFont\tDlgFont8\n"
292 "HASUIRUN\t0\n"
293 "INSTALLLEVEL\t3\n"
294 "InstallMode\tTypical\n"
295 "Manufacturer\tWine\n"
296 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
297 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
298 "ProductID\tnone\n"
299 "ProductLanguage\t1033\n"
300 "ProductName\tMSITEST\n"
301 "ProductVersion\t1.1.2\n"
302 "PROMPTROLLBACKCOST\tP\n"
303 "Setup\tSetup\n"
304 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
305 "AdminProperties\tPOSTADMIN\n"
306 "ROOTDRIVE\tC:\\\n"
307 "SERVNAME\tTestService\n"
308 "SERVDISP\tTestServiceDisp\n"
309 "MSIFASTINSTALL\t1\n";
311 static const CHAR up3_property_dat[] = "Property\tValue\n"
312 "s72\tl0\n"
313 "Property\tProperty\n"
314 "DefaultUIFont\tDlgFont8\n"
315 "HASUIRUN\t0\n"
316 "INSTALLLEVEL\t3\n"
317 "InstallMode\tTypical\n"
318 "Manufacturer\tWine\n"
319 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
320 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
321 "ProductID\tnone\n"
322 "ProductLanguage\t1033\n"
323 "ProductName\tMSITEST\n"
324 "ProductVersion\t1.1.2\n"
325 "PROMPTROLLBACKCOST\tP\n"
326 "Setup\tSetup\n"
327 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
328 "AdminProperties\tPOSTADMIN\n"
329 "ROOTDRIVE\tC:\\\n"
330 "SERVNAME\tTestService\n"
331 "SERVDISP\tTestServiceDisp\n"
332 "RemovePreviousVersions\t1\n"
333 "MSIFASTINSTALL\t1\n";
335 static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
336 "s72\ti2\tl255\tL255\tL0\ts72\n"
337 "Registry\tRegistry\n"
338 "Apples\t1\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
339 "Oranges\t1\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
340 "regdata\t1\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
341 "OrderTest\t1\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
343 static const CHAR service_install_dat[] = "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
344 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
345 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
346 "ServiceInstall\tServiceInstall\n"
347 "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\t";
349 static const CHAR service_control_dat[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
350 "s72\tl255\ti2\tL255\tI2\ts72\n"
351 "ServiceControl\tServiceControl\n"
352 "ServiceControl\tTestService\t8\t\t0\tservice_comp";
354 /* tables for test_continuouscabs */
355 static const CHAR cc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
356 "s72\tS38\ts72\ti2\tS255\tS72\n"
357 "Component\tComponent\n"
358 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
359 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
360 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
362 static const CHAR cc2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
363 "s72\tS38\ts72\ti2\tS255\tS72\n"
364 "Component\tComponent\n"
365 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
366 "augustus\t\tMSITESTDIR\t0\t0\taugustus\n"
367 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
369 static const CHAR cc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
370 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
371 "Feature\tFeature\n"
372 "feature\t\t\t\t2\t1\tTARGETDIR\t0";
374 static const CHAR cc_feature_comp_dat[] = "Feature_\tComponent_\n"
375 "s38\ts72\n"
376 "FeatureComponents\tFeature_\tComponent_\n"
377 "feature\tmaximus\n"
378 "feature\taugustus\n"
379 "feature\tcaesar";
381 static const CHAR cc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
382 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
383 "File\tFile\n"
384 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
385 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
386 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
388 static const CHAR cc2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
389 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
390 "File\tFile\n"
391 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
392 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
393 "tiberius\tmaximus\ttiberius\t500\t\t\t16384\t3\n"
394 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
396 static const CHAR cc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
397 "i2\ti4\tL64\tS255\tS32\tS72\n"
398 "Media\tDiskId\n"
399 "1\t10\t\ttest1.cab\tDISK1\t\n"
400 "2\t2\t\ttest2.cab\tDISK2\t\n"
401 "3\t12\t\ttest3.cab\tDISK3\t\n";
403 static const CHAR cc3_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
404 "i2\ti4\tL64\tS255\tS32\tS72\n"
405 "Media\tDiskId\n"
406 "1\t10\t\ttest1.cab\tDISK1\t\n"
407 "2\t2\t\ttest2_.cab\tDISK2\t\n"
408 "3\t12\t\ttest3.cab\tDISK3\t\n";
410 static const CHAR co_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
411 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
412 "File\tFile\n"
413 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
414 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
415 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
417 static const CHAR co_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
418 "i2\ti4\tL64\tS255\tS32\tS72\n"
419 "Media\tDiskId\n"
420 "1\t10\t\ttest1.cab\tDISK1\t\n"
421 "2\t2\t\ttest2.cab\tDISK2\t\n"
422 "3\t3\t\ttest3.cab\tDISK3\t\n";
424 static const CHAR co2_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
425 "i2\ti4\tL64\tS255\tS32\tS72\n"
426 "Media\tDiskId\n"
427 "1\t10\t\ttest1.cab\tDISK1\t\n"
428 "2\t12\t\ttest3.cab\tDISK3\t\n"
429 "3\t2\t\ttest2.cab\tDISK2\t\n";
431 static const CHAR mm_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
432 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
433 "File\tFile\n"
434 "maximus\tmaximus\tmaximus\t500\t\t\t512\t1\n"
435 "augustus\taugustus\taugustus\t500\t\t\t512\t2\n"
436 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
438 static const CHAR mm_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
439 "i2\ti4\tL64\tS255\tS32\tS72\n"
440 "Media\tDiskId\n"
441 "1\t3\t\ttest1.cab\tDISK1\t\n";
443 static const CHAR ss_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
444 "i2\ti4\tL64\tS255\tS32\tS72\n"
445 "Media\tDiskId\n"
446 "1\t2\t\ttest1.cab\tDISK1\t\n"
447 "2\t2\t\ttest2.cab\tDISK2\t\n"
448 "3\t12\t\ttest3.cab\tDISK3\t\n";
450 /* tables for test_uiLevelFlags */
451 static const CHAR ui_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
452 "s72\tS38\ts72\ti2\tS255\tS72\n"
453 "Component\tComponent\n"
454 "maximus\t\tMSITESTDIR\t0\tHASUIRUN=1\tmaximus\n"
455 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
456 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
458 static const CHAR ui_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
459 "s72\tS255\tI2\n"
460 "InstallUISequence\tAction\n"
461 "SetUIProperty\t\t5\n"
462 "ExecuteAction\t\t1100\n";
464 static const CHAR ui_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
465 "s72\ti2\tS64\tS0\tS255\n"
466 "CustomAction\tAction\n"
467 "SetUIProperty\t51\tHASUIRUN\t1\t\n";
469 static const CHAR rof_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
470 "s72\tS38\ts72\ti2\tS255\tS72\n"
471 "Component\tComponent\n"
472 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
474 static const CHAR rof_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
475 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
476 "Feature\tFeature\n"
477 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
478 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
480 static const CHAR rof_feature_comp_dat[] = "Feature_\tComponent_\n"
481 "s38\ts72\n"
482 "FeatureComponents\tFeature_\tComponent_\n"
483 "feature\tmaximus\n"
484 "montecristo\tmaximus";
486 static const CHAR rof_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
487 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
488 "File\tFile\n"
489 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
491 static const CHAR rof_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
492 "i2\ti4\tL64\tS255\tS32\tS72\n"
493 "Media\tDiskId\n"
494 "1\t1\t\t\tDISK1\t\n";
496 static const CHAR rofc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
497 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
498 "File\tFile\n"
499 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1";
501 static const CHAR rofc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
502 "i2\ti4\tL64\tS255\tS32\tS72\n"
503 "Media\tDiskId\n"
504 "1\t1\t\ttest1.cab\tDISK1\t\n";
506 static const CHAR sdp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
507 "s72\tS255\tI2\n"
508 "InstallExecuteSequence\tAction\n"
509 "AllocateRegistrySpace\tNOT Installed\t1550\n"
510 "CostFinalize\t\t1000\n"
511 "CostInitialize\t\t800\n"
512 "FileCost\t\t900\n"
513 "InstallFiles\t\t4000\n"
514 "InstallFinalize\t\t6600\n"
515 "InstallInitialize\t\t1500\n"
516 "InstallValidate\t\t1400\n"
517 "LaunchConditions\t\t100\n"
518 "SetDirProperty\t\t950";
520 static const CHAR sdp_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
521 "s72\ti2\tS64\tS0\tS255\n"
522 "CustomAction\tAction\n"
523 "SetDirProperty\t51\tMSITESTDIR\t[CommonFilesFolder]msitest\\\t\n";
525 static const CHAR pv_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
526 "s72\tS255\tI2\n"
527 "InstallExecuteSequence\tAction\n"
528 "LaunchConditions\t\t100\n"
529 "CostInitialize\t\t800\n"
530 "FileCost\t\t900\n"
531 "CostFinalize\t\t1000\n"
532 "InstallValidate\t\t1400\n"
533 "InstallInitialize\t\t1500\n"
534 "InstallFiles\t\t4000\n"
535 "InstallFinalize\t\t6600\n";
537 static const CHAR cie_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
538 "s72\tS38\ts72\ti2\tS255\tS72\n"
539 "Component\tComponent\n"
540 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
541 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
542 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
543 "gaius\t\tMSITESTDIR\t0\t1\tgaius\n";
545 static const CHAR cie_feature_comp_dat[] = "Feature_\tComponent_\n"
546 "s38\ts72\n"
547 "FeatureComponents\tFeature_\tComponent_\n"
548 "feature\tmaximus\n"
549 "feature\taugustus\n"
550 "feature\tcaesar\n"
551 "feature\tgaius";
553 static const CHAR cie_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
554 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
555 "File\tFile\n"
556 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
557 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
558 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12\n"
559 "gaius\tgaius\tgaius\t500\t\t\t8192\t11";
561 static const CHAR cie_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
562 "i2\ti4\tL64\tS255\tS32\tS72\n"
563 "Media\tDiskId\n"
564 "1\t1\t\ttest1.cab\tDISK1\t\n"
565 "2\t2\t\ttest2.cab\tDISK2\t\n"
566 "3\t12\t\ttest3.cab\tDISK3\t\n";
568 static const CHAR ci_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
569 "s72\tS38\ts72\ti2\tS255\tS72\n"
570 "Component\tComponent\n"
571 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n";
573 static const CHAR ci2_feature_comp_dat[] = "Feature_\tComponent_\n"
574 "s38\ts72\n"
575 "FeatureComponents\tFeature_\tComponent_\n"
576 "feature\taugustus";
578 static const CHAR ci2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
579 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
580 "File\tFile\n"
581 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
583 static const CHAR pp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
584 "s72\tS255\tI2\n"
585 "InstallExecuteSequence\tAction\n"
586 "ValidateProductID\t\t700\n"
587 "CostInitialize\t\t800\n"
588 "FileCost\t\t900\n"
589 "CostFinalize\t\t1000\n"
590 "InstallValidate\t\t1400\n"
591 "InstallInitialize\t\t1500\n"
592 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
593 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
594 "RemoveFiles\t\t3500\n"
595 "InstallFiles\t\t4000\n"
596 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
597 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
598 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
599 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
600 "InstallFinalize\t\t6600";
602 static const CHAR tp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
603 "s72\tS38\ts72\ti2\tS255\tS72\n"
604 "Component\tComponent\n"
605 "augustus\t\tMSITESTDIR\t0\tprop=\"val\"\taugustus\n";
607 static const CHAR cwd_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
608 "s72\tS38\ts72\ti2\tS255\tS72\n"
609 "Component\tComponent\n"
610 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
612 static const CHAR adm_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
613 "s72\tS38\ts72\ti2\tS255\tS72\n"
614 "Component\tComponent\n"
615 "augustus\t\tMSITESTDIR\t0\tPOSTADMIN=1\taugustus";
617 static const CHAR adm_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
618 "s72\ti2\tS64\tS0\tS255\n"
619 "CustomAction\tAction\n"
620 "SetPOSTADMIN\t51\tPOSTADMIN\t1\t\n";
622 static const CHAR adm_admin_exec_seq_dat[] = "Action\tCondition\tSequence\n"
623 "s72\tS255\tI2\n"
624 "AdminExecuteSequence\tAction\n"
625 "CostFinalize\t\t1000\n"
626 "CostInitialize\t\t800\n"
627 "FileCost\t\t900\n"
628 "SetPOSTADMIN\t\t950\n"
629 "InstallFiles\t\t4000\n"
630 "InstallFinalize\t\t6600\n"
631 "InstallInitialize\t\t1500\n"
632 "InstallValidate\t\t1400\n"
633 "LaunchConditions\t\t100";
635 static const CHAR amp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
636 "s72\tS38\ts72\ti2\tS255\tS72\n"
637 "Component\tComponent\n"
638 "augustus\t\tMSITESTDIR\t0\tMYPROP=2718 and MyProp=42\taugustus\n";
640 static const CHAR rem_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
641 "s72\tS255\tI2\n"
642 "InstallExecuteSequence\tAction\n"
643 "ValidateProductID\t\t700\n"
644 "CostInitialize\t\t800\n"
645 "FileCost\t\t900\n"
646 "CostFinalize\t\t1000\n"
647 "InstallValidate\t\t1400\n"
648 "InstallInitialize\t\t1500\n"
649 "ProcessComponents\t\t1600\n"
650 "UnpublishFeatures\t\t1800\n"
651 "RemoveFiles\t\t3500\n"
652 "InstallFiles\t\t4000\n"
653 "RegisterProduct\t\t6100\n"
654 "PublishFeatures\t\t6300\n"
655 "PublishProduct\t\t6400\n"
656 "InstallFinalize\t\t6600";
658 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
659 "s72\tS38\ts72\ti2\tS255\tS72\n"
660 "Component\tComponent\n"
661 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
662 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
663 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
664 "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n"
665 "tiberius\t\tMSITESTDIR\t0\t\ttiberius\n";
667 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
668 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
669 "File\tFile\n"
670 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
671 "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
672 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
673 "gaius\tgaius\tgaius\t500\t\t\t16384\t4\n"
674 "tiberius\ttiberius\ttiberius\t500\t\t\t0\t5\n";
676 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
677 "i2\ti4\tL64\tS255\tS32\tS72\n"
678 "Media\tDiskId\n"
679 "1\t1\t\ttest1.cab\tDISK1\t\n"
680 "2\t2\t\ttest2.cab\tDISK2\t\n"
681 "3\t3\t\ttest3.cab\tDISK3\t\n"
682 "4\t4\t\ttest3.cab\tDISK3\t\n"
683 "5\t5\t\ttest4.cab\tDISK4\t\n";
685 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
686 "s72\ti2\ti4\ti4\ti4\ti4\n"
687 "MsiFileHash\tFile_\n"
688 "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
690 static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
691 "s72\tS38\ts72\ti2\tS255\tS72\n"
692 "Component\tComponent\n"
693 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
695 static const CHAR ca1_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
696 "s72\tS255\tI2\n"
697 "InstallExecuteSequence\tAction\n"
698 "embednull\t\t600\n"
699 "maintest\tMAIN_TEST\t700\n"
700 "testretval\tTEST_RETVAL\t710\n";
702 static const CHAR ca1_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
703 "s72\ti2\tS64\tS0\n"
704 "CustomAction\tAction\n"
705 "embednull\t51\tembednullprop\ta[~]b\n"
706 "nested51\t51\tnested\t1\n"
707 "nested1\t1\tcustom.dll\tnested\n"
708 "maintest\t1\tcustom.dll\tmain_test\n"
709 "testretval\t1\tcustom.dll\ttest_retval\n";
711 static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
712 "s72\tS38\ts72\ti2\tS255\tS72\n"
713 "Component\tComponent\n"
714 "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
716 static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
717 "s72\tS255\tI2\n"
718 "InstallExecuteSequence\tAction\n"
719 "ValidateProductID\t\t700\n"
720 "GoodSetProperty\t\t725\n"
721 "BadSetProperty\t\t750\n"
722 "CostInitialize\t\t800\n"
723 "ResolveSource\t\t810\n"
724 "FileCost\t\t900\n"
725 "SetSourceDir\tSRCDIR\t910\n"
726 "CostFinalize\t\t1000\n"
727 "InstallValidate\t\t1400\n"
728 "InstallInitialize\t\t1500\n"
729 "InstallFiles\t\t4000\n"
730 "InstallFinalize\t\t6600";
732 static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
733 "s72\ti2\tS64\tS0\n"
734 "CustomAction\tAction\n"
735 "GoodSetProperty\t51\tMYPROP\t42\n"
736 "BadSetProperty\t51\t\tMYPROP\n"
737 "SetSourceDir\t51\tSourceDir\t[SRCDIR]\n";
739 static const CHAR is_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
740 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
741 "Feature\tFeature\n"
742 "one\t\t\t\t2\t1\t\t0\n" /* favorLocal */
743 "two\t\t\t\t2\t1\t\t1\n" /* favorSource */
744 "three\t\t\t\t2\t1\t\t4\n" /* favorAdvertise */
745 "four\t\t\t\t2\t0\t\t0"; /* disabled */
747 static const CHAR is_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
748 "s72\tS38\ts72\ti2\tS255\tS72\n"
749 "Component\tComponent\n"
750 "alpha\t\tMSITESTDIR\t0\t\talpha_file\n" /* favorLocal:Local */
751 "beta\t\tMSITESTDIR\t1\t\tbeta_file\n" /* favorLocal:Source */
752 "gamma\t\tMSITESTDIR\t2\t\tgamma_file\n" /* favorLocal:Optional */
753 "theta\t\tMSITESTDIR\t0\t\ttheta_file\n" /* favorSource:Local */
754 "delta\t\tMSITESTDIR\t1\t\tdelta_file\n" /* favorSource:Source */
755 "epsilon\t\tMSITESTDIR\t2\t\tepsilon_file\n" /* favorSource:Optional */
756 "zeta\t\tMSITESTDIR\t0\t\tzeta_file\n" /* favorAdvertise:Local */
757 "iota\t\tMSITESTDIR\t1\t\tiota_file\n" /* favorAdvertise:Source */
758 "eta\t\tMSITESTDIR\t2\t\teta_file\n" /* favorAdvertise:Optional */
759 "kappa\t\tMSITESTDIR\t0\t\tkappa_file\n" /* disabled:Local */
760 "lambda\t\tMSITESTDIR\t1\t\tlambda_file\n" /* disabled:Source */
761 "mu\t\tMSITESTDIR\t2\t\tmu_file\n"; /* disabled:Optional */
763 static const CHAR is_feature_comp_dat[] = "Feature_\tComponent_\n"
764 "s38\ts72\n"
765 "FeatureComponents\tFeature_\tComponent_\n"
766 "one\talpha\n"
767 "one\tbeta\n"
768 "one\tgamma\n"
769 "two\ttheta\n"
770 "two\tdelta\n"
771 "two\tepsilon\n"
772 "three\tzeta\n"
773 "three\tiota\n"
774 "three\teta\n"
775 "four\tkappa\n"
776 "four\tlambda\n"
777 "four\tmu";
779 static const CHAR is_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
780 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
781 "File\tFile\n"
782 "alpha_file\talpha\talpha\t500\t\t\t8192\t1\n"
783 "beta_file\tbeta\tbeta\t500\t\t\t8291\t2\n"
784 "gamma_file\tgamma\tgamma\t500\t\t\t8192\t3\n"
785 "theta_file\ttheta\ttheta\t500\t\t\t8192\t4\n"
786 "delta_file\tdelta\tdelta\t500\t\t\t8192\t5\n"
787 "epsilon_file\tepsilon\tepsilon\t500\t\t\t8192\t6\n"
788 "zeta_file\tzeta\tzeta\t500\t\t\t8192\t7\n"
789 "iota_file\tiota\tiota\t500\t\t\t8192\t8\n"
790 "eta_file\teta\teta\t500\t\t\t8192\t9\n"
791 "kappa_file\tkappa\tkappa\t500\t\t\t8192\t10\n"
792 "lambda_file\tlambda\tlambda\t500\t\t\t8192\t11\n"
793 "mu_file\tmu\tmu\t500\t\t\t8192\t12";
795 static const CHAR is_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
796 "i2\ti4\tL64\tS255\tS32\tS72\n"
797 "Media\tDiskId\n"
798 "1\t12\t\t\tDISK1\t\n";
800 static const CHAR sp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
801 "s72\tS38\ts72\ti2\tS255\tS72\n"
802 "Component\tComponent\n"
803 "augustus\t\tTWODIR\t0\t\taugustus\n";
805 static const CHAR sp_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
806 "s72\tS72\tl255\n"
807 "Directory\tDirectory\n"
808 "TARGETDIR\t\tSourceDir\n"
809 "ProgramFilesFolder\tTARGETDIR\t.\n"
810 "MSITESTDIR\tProgramFilesFolder\tmsitest:.\n"
811 "ONEDIR\tMSITESTDIR\t.:shortone|longone\n"
812 "TWODIR\tONEDIR\t.:shorttwo|longtwo";
814 static const CHAR mcp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
815 "s72\tS38\ts72\ti2\tS255\tS72\n"
816 "Component\tComponent\n"
817 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t2\t\thydrogen\n"
818 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t2\t\thelium\n"
819 "lithium\t{4AF28FFC-71C7-4307-BDE4-B77C5338F56F}\tMSITESTDIR\t2\tPROPVAR=42\tlithium\n";
821 static const CHAR mcp_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
822 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
823 "Feature\tFeature\n"
824 "hydroxyl\t\thydroxyl\thydroxyl\t2\t1\tTARGETDIR\t0\n"
825 "heliox\t\theliox\theliox\t2\t5\tTARGETDIR\t0\n"
826 "lithia\t\tlithia\tlithia\t2\t10\tTARGETDIR\t0";
828 static const CHAR mcp_feature_comp_dat[] = "Feature_\tComponent_\n"
829 "s38\ts72\n"
830 "FeatureComponents\tFeature_\tComponent_\n"
831 "hydroxyl\thydrogen\n"
832 "heliox\thelium\n"
833 "lithia\tlithium";
835 static const CHAR mcp_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
836 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
837 "File\tFile\n"
838 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
839 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
840 "lithium\tlithium\tlithium\t0\t\t\t8192\t1\n"
841 "beryllium\tmissingcomp\tberyllium\t0\t\t\t8192\t1";
843 static const CHAR ai_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
844 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
845 "File\tFile\n"
846 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
847 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
848 "one.txt\tOne\tone.txt\t1000\t\t\t16384\t1\n"
849 "three.txt\tThree\tthree.txt\t1000\t\t\t16384\t3\n"
850 "two.txt\tTwo\ttwo.txt\t1000\t\t\t16384\t2\n"
851 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
852 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
854 static const CHAR ip_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
855 "s72\tS255\tI2\n"
856 "InstallExecuteSequence\tAction\n"
857 "CostFinalize\t\t1000\n"
858 "ValidateProductID\t\t700\n"
859 "CostInitialize\t\t800\n"
860 "FileCost\t\t900\n"
861 "RemoveFiles\t\t3500\n"
862 "InstallFiles\t\t4000\n"
863 "RegisterUser\t\t6000\n"
864 "RegisterProduct\t\t6100\n"
865 "PublishFeatures\t\t6300\n"
866 "PublishProduct\t\t6400\n"
867 "InstallFinalize\t\t6600\n"
868 "InstallInitialize\t\t1500\n"
869 "ProcessComponents\t\t1600\n"
870 "UnpublishFeatures\t\t1800\n"
871 "InstallValidate\t\t1400\n"
872 "LaunchConditions\t\t100\n"
873 "TestInstalledProp\tInstalled AND NOT REMOVE\t950\n";
875 static const CHAR ip_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
876 "s72\ti2\tS64\tS0\tS255\n"
877 "CustomAction\tAction\n"
878 "TestInstalledProp\t19\t\tTest failed\t\n";
880 static const CHAR aup_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
881 "s72\tS255\tI2\n"
882 "InstallExecuteSequence\tAction\n"
883 "CostFinalize\t\t1000\n"
884 "ValidateProductID\t\t700\n"
885 "CostInitialize\t\t800\n"
886 "FileCost\t\t900\n"
887 "RemoveFiles\t\t3500\n"
888 "InstallFiles\t\t4000\n"
889 "RegisterUser\t\t6000\n"
890 "RegisterProduct\t\t6100\n"
891 "PublishFeatures\t\t6300\n"
892 "PublishProduct\t\t6400\n"
893 "InstallFinalize\t\t6600\n"
894 "InstallInitialize\t\t1500\n"
895 "ProcessComponents\t\t1600\n"
896 "UnpublishFeatures\t\t1800\n"
897 "InstallValidate\t\t1400\n"
898 "LaunchConditions\t\t100\n"
899 "TestAllUsersProp\tALLUSERS AND NOT REMOVE\t50\n";
901 static const CHAR aup2_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
902 "s72\tS255\tI2\n"
903 "InstallExecuteSequence\tAction\n"
904 "CostFinalize\t\t1000\n"
905 "ValidateProductID\t\t700\n"
906 "CostInitialize\t\t800\n"
907 "FileCost\t\t900\n"
908 "RemoveFiles\t\t3500\n"
909 "InstallFiles\t\t4000\n"
910 "RegisterUser\t\t6000\n"
911 "RegisterProduct\t\t6100\n"
912 "PublishFeatures\t\t6300\n"
913 "PublishProduct\t\t6400\n"
914 "InstallFinalize\t\t6600\n"
915 "InstallInitialize\t\t1500\n"
916 "ProcessComponents\t\t1600\n"
917 "UnpublishFeatures\t\t1800\n"
918 "InstallValidate\t\t1400\n"
919 "LaunchConditions\t\t100\n"
920 "TestAllUsersProp\tALLUSERS=2 AND NOT REMOVE\t50\n";
922 static const CHAR aup3_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
923 "s72\tS255\tI2\n"
924 "InstallExecuteSequence\tAction\n"
925 "CostFinalize\t\t1000\n"
926 "ValidateProductID\t\t700\n"
927 "CostInitialize\t\t800\n"
928 "FileCost\t\t900\n"
929 "RemoveFiles\t\t3500\n"
930 "InstallFiles\t\t4000\n"
931 "RegisterUser\t\t6000\n"
932 "RegisterProduct\t\t6100\n"
933 "PublishFeatures\t\t6300\n"
934 "PublishProduct\t\t6400\n"
935 "InstallFinalize\t\t6600\n"
936 "InstallInitialize\t\t1500\n"
937 "ProcessComponents\t\t1600\n"
938 "UnpublishFeatures\t\t1800\n"
939 "InstallValidate\t\t1400\n"
940 "LaunchConditions\t\t100\n"
941 "TestAllUsersProp\tALLUSERS=1 AND NOT REMOVE\t50\n";
943 static const CHAR aup_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
944 "s72\ti2\tS64\tS0\tS255\n"
945 "CustomAction\tAction\n"
946 "TestAllUsersProp\t19\t\tTest failed\t\n";
948 static const CHAR fo_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
949 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
950 "File\tFile\n"
951 "override.txt\toverride\toverride.txt\t1000\t\t\t8192\t1\n"
952 "preselected.txt\tpreselected\tpreselected.txt\t1000\t\t\t8192\t2\n"
953 "notpreselected.txt\tnotpreselected\tnotpreselected.txt\t1000\t\t\t8192\t3\n";
955 static const CHAR fo_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
956 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
957 "Feature\tFeature\n"
958 "override\t\t\toverride feature\t1\t1\tMSITESTDIR\t0\n"
959 "preselected\t\t\tpreselected feature\t1\t1\tMSITESTDIR\t0\n"
960 "notpreselected\t\t\tnotpreselected feature\t1\t1\tMSITESTDIR\t0\n";
962 static const CHAR fo_condition_dat[] = "Feature_\tLevel\tCondition\n"
963 "s38\ti2\tS255\n"
964 "Condition\tFeature_\tLevel\n"
965 "preselected\t0\tPreselected\n"
966 "notpreselected\t0\tNOT Preselected\n";
968 static const CHAR fo_feature_comp_dat[] = "Feature_\tComponent_\n"
969 "s38\ts72\n"
970 "FeatureComponents\tFeature_\tComponent_\n"
971 "override\toverride\n"
972 "preselected\tpreselected\n"
973 "notpreselected\tnotpreselected\n";
975 static const CHAR fo_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
976 "s72\tS38\ts72\ti2\tS255\tS72\n"
977 "Component\tComponent\n"
978 "override\t{0A00FB1D-97B0-4B42-ADF0-BB8913416623}\tMSITESTDIR\t0\t\toverride.txt\n"
979 "preselected\t{44E1DB75-605A-43DD-8CF5-CAB17F1BBD60}\tMSITESTDIR\t0\t\tpreselected.txt\n"
980 "notpreselected\t{E1647733-5E75-400A-A92E-5E60B4D4EF9F}\tMSITESTDIR\t0\t\tnotpreselected.txt\n";
982 static const CHAR fo_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
983 "s72\ti2\tS64\tS0\tS255\n"
984 "CustomAction\tAction\n"
985 "SetPreselected\t51\tPreselected\t1\t\n";
987 static const CHAR fo_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
988 "s72\tS255\tI2\n"
989 "InstallExecuteSequence\tAction\n"
990 "LaunchConditions\t\t100\n"
991 "SetPreselected\tpreselect=1\t200\n"
992 "CostInitialize\t\t800\n"
993 "FileCost\t\t900\n"
994 "CostFinalize\t\t1000\n"
995 "InstallValidate\t\t1400\n"
996 "InstallInitialize\t\t1500\n"
997 "ProcessComponents\t\t1600\n"
998 "RemoveFiles\t\t1700\n"
999 "InstallFiles\t\t2000\n"
1000 "RegisterProduct\t\t5000\n"
1001 "PublishFeatures\t\t5100\n"
1002 "PublishProduct\t\t5200\n"
1003 "InstallFinalize\t\t6000\n";
1005 static const CHAR uc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1006 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1007 "File\tFile\n"
1008 "upgradecode.txt\tupgradecode\tupgradecode.txt\t1000\t\t\t8192\t1\n";
1010 static const CHAR uc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1011 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1012 "Feature\tFeature\n"
1013 "upgradecode\t\t\tupgradecode feature\t1\t2\tMSITESTDIR\t0\n";
1015 static const CHAR uc_feature_comp_dat[] = "Feature_\tComponent_\n"
1016 "s38\ts72\n"
1017 "FeatureComponents\tFeature_\tComponent_\n"
1018 "upgradecode\tupgradecode\n";
1020 static const CHAR uc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1021 "s72\tS38\ts72\ti2\tS255\tS72\n"
1022 "Component\tComponent\n"
1023 "upgradecode\t{6952B732-2FCB-4E47-976F-989FCBD7EDFB}\tMSITESTDIR\t0\t\tupgradecode.txt\n";
1025 static const CHAR uc_property_dat[] = "Property\tValue\n"
1026 "s72\tl0\n"
1027 "Property\tProperty\n"
1028 "INSTALLLEVEL\t3\n"
1029 "ProductCode\t{E5FB1241-F547-4BA7-A60E-8E75797268D4}\n"
1030 "ProductName\tMSITEST\n"
1031 "ProductVersion\t1.1.1\n"
1032 "UpgradeCode\t#UPGEADECODE#\n"
1033 "MSIFASTINSTALL\t1\n";
1035 static const CHAR uc_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1036 "s72\tS255\tI2\n"
1037 "InstallExecuteSequence\tAction\n"
1038 "LaunchConditions\t\t100\n"
1039 "CostInitialize\t\t200\n"
1040 "FileCost\t\t300\n"
1041 "CostFinalize\t\t400\n"
1042 "InstallInitialize\t\t500\n"
1043 "ProcessComponents\t\t600\n"
1044 "InstallValidate\t\t700\n"
1045 "RemoveFiles\t\t800\n"
1046 "InstallFiles\t\t900\n"
1047 "RegisterProduct\t\t1000\n"
1048 "PublishFeatures\t\t1100\n"
1049 "PublishProduct\t\t1200\n"
1050 "InstallFinalize\t\t1300\n";
1052 static const char mixed_feature_dat[] =
1053 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1054 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1055 "Feature\tFeature\n"
1056 "feature1\t\t\t\t1\t2\tMSITESTDIR\t0\n"
1057 "feature2\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1059 static const char mixed_feature_comp_dat[] =
1060 "Feature_\tComponent_\n"
1061 "s38\ts72\n"
1062 "FeatureComponents\tFeature_\tComponent_\n"
1063 "feature1\tcomp1\n"
1064 "feature2\tcomp2\n";
1066 static const char mixed_component_dat[] =
1067 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1068 "s72\tS38\ts72\ti2\tS255\tS72\n"
1069 "Component\tComponent\n"
1070 "comp1\t{DE9F0EF4-0ED3-495A-8105-060C0EA457B8}\tTARGETDIR\t4\t\tregdata1\n"
1071 "comp2\t{4912DBE7-FC3A-4F91-BB5C-88F5C15C19A5}\tTARGETDIR\t260\t\tregdata2\n";
1073 static const char mixed_registry_dat[] =
1074 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
1075 "s72\ti2\tl255\tL255\tL0\ts72\n"
1076 "Registry\tRegistry\n"
1077 "regdata1\t2\tSOFTWARE\\Wine\\msitest\ttest1\t\tcomp1\n"
1078 "regdata2\t2\tSOFTWARE\\Wine\\msitest\ttest2\t\tcomp2\n"
1079 "regdata3\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\t\tCLSID_Winetest32\tcomp1\n"
1080 "regdata4\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32\t\twinetest32.dll\tcomp1\n"
1081 "regdata5\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\t\tCLSID_Winetest64\tcomp2\n"
1082 "regdata6\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32\t\twinetest64.dll\tcomp2\n";
1084 static const char mixed_install_exec_seq_dat[] =
1085 "Action\tCondition\tSequence\n"
1086 "s72\tS255\tI2\n"
1087 "InstallExecuteSequence\tAction\n"
1088 "LaunchConditions\t\t100\n"
1089 "CostInitialize\t\t200\n"
1090 "FileCost\t\t300\n"
1091 "CostFinalize\t\t400\n"
1092 "InstallValidate\t\t500\n"
1093 "InstallInitialize\t\t600\n"
1094 "ProcessComponents\t\t700\n"
1095 "UnpublishFeatures\t\t800\n"
1096 "RemoveRegistryValues\t\t900\n"
1097 "WriteRegistryValues\t\t1000\n"
1098 "RegisterProduct\t\t1100\n"
1099 "PublishFeatures\t\t1200\n"
1100 "PublishProduct\t\t1300\n"
1101 "InstallFinalize\t\t1400\n";
1103 static const char vp_file_dat[] =
1104 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1105 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1106 "File\tFile\n"
1107 "volumeprop\tcomp\tvolumeprop.txt\t1000\t\t\t8192\t1\n";
1109 static const char vp_feature_dat[] =
1110 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1111 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1112 "Feature\tFeature\n"
1113 "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1115 static const char vp_feature_comp_dat[] =
1116 "Feature_\tComponent_\n"
1117 "s38\ts72\n"
1118 "FeatureComponents\tFeature_\tComponent_\n"
1119 "feature\tcomp\n";
1121 static const char vp_component_dat[] =
1122 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1123 "s72\tS38\ts72\ti2\tS255\tS72\n"
1124 "Component\tComponent\n"
1125 "comp\t{24364AE7-5B7F-496C-AF5A-54893639C567}\tMSITESTDIR\t0\t\tvolumeprop\n";
1127 static const char vp_custom_action_dat[] =
1128 "Action\tType\tSource\tTarget\tISComments\n"
1129 "s72\ti2\tS64\tS0\tS255\n"
1130 "CustomAction\tAction\n"
1131 "TestPrimaryVolumePath0\t19\t\tPrimaryVolumePath set before CostFinalize\t\n"
1132 "TestPrimaryVolumeSpaceAvailable0\t19\t\tPrimaryVolumeSpaceAvailable set before CostFinalize\t\n"
1133 "TestPrimaryVolumeSpaceRequired0\t19\t\tPrimaryVolumeSpaceRequired set before CostFinalize\t\n"
1134 "TestPrimaryVolumeSpaceRemaining0\t19\t\tPrimaryVolumeSpaceRemaining set before CostFinalize\t\n"
1135 "TestPrimaryVolumePath1\t19\t\tPrimaryVolumePath set before InstallValidate\t\n"
1136 "TestPrimaryVolumeSpaceAvailable1\t19\t\tPrimaryVolumeSpaceAvailable not set before InstallValidate\t\n"
1137 "TestPrimaryVolumeSpaceRequired1\t19\t\tPrimaryVolumeSpaceRequired not set before InstallValidate\t\n"
1138 "TestPrimaryVolumeSpaceRemaining1\t19\t\tPrimaryVolumeSpaceRemaining not set before InstallValidate\t\n"
1139 "TestPrimaryVolumePath2\t19\t\tPrimaryVolumePath not set after InstallValidate\t\n"
1140 "TestPrimaryVolumeSpaceAvailable2\t19\t\tPrimaryVolumeSpaceAvailable not set after InstallValidate\t\n"
1141 "TestPrimaryVolumeSpaceRequired2\t19\t\tPrimaryVolumeSpaceRequired not set after InstallValidate\t\n"
1142 "TestPrimaryVolumeSpaceRemaining2\t19\t\tPrimaryVolumeSpaceRemaining not set after InstallValidate\t\n";
1144 static const char vp_install_exec_seq_dat[] =
1145 "Action\tCondition\tSequence\n"
1146 "s72\tS255\tI2\n"
1147 "InstallExecuteSequence\tAction\n"
1148 "LaunchConditions\t\t100\n"
1149 "CostInitialize\t\t200\n"
1150 "FileCost\t\t300\n"
1151 "TestPrimaryVolumePath0\tPrimaryVolumePath AND NOT REMOVE\t400\n"
1152 "TestPrimaryVolumeSpaceAvailable0\tPrimaryVolumeSpaceAvailable AND NOT REMOVE\t500\n"
1153 "TestPrimaryVolumeSpaceRequired0\tPrimaryVolumeSpaceRequired AND NOT REMOVE\t510\n"
1154 "TestPrimaryVolumeSpaceRemaining0\tPrimaryVolumeSpaceRemaining AND NOT REMOVE\t520\n"
1155 "CostFinalize\t\t600\n"
1156 "TestPrimaryVolumePath1\tPrimaryVolumePath AND NOT REMOVE\t600\n"
1157 "TestPrimaryVolumeSpaceAvailable1\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t800\n"
1158 "TestPrimaryVolumeSpaceRequired1\tNOT PrimaryVolumeSpaceRequired AND NOT REMOVE\t810\n"
1159 "TestPrimaryVolumeSpaceRemaining1\tNOT PrimaryVolumeSpaceRemaining AND NOT REMOVE\t820\n"
1160 "InstallValidate\t\t900\n"
1161 "TestPrimaryVolumePath2\tNOT PrimaryVolumePath AND NOT REMOVE\t1000\n"
1162 "TestPrimaryVolumeSpaceAvailable2\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t1100\n"
1163 "TestPrimaryVolumeSpaceRequired2\tNOT PrimaryVolumeSpaceRequired AND NOT REMOVE\t1110\n"
1164 "TestPrimaryVolumeSpaceRemaining2\tNOT PrimaryVolumeSpaceRemaining AND NOT REMOVE\t1120\n"
1165 "InstallInitialize\t\t1200\n"
1166 "ProcessComponents\t\t1300\n"
1167 "RemoveFiles\t\t1400\n"
1168 "InstallFiles\t\t1500\n"
1169 "RegisterProduct\t\t1600\n"
1170 "PublishFeatures\t\t1700\n"
1171 "PublishProduct\t\t1800\n"
1172 "InstallFinalize\t\t1900\n";
1174 static const char shc_property_dat[] =
1175 "Property\tValue\n"
1176 "s72\tl0\n"
1177 "Property\tProperty\n"
1178 "INSTALLLEVEL\t3\n"
1179 "ProductCode\t{5CD99CD0-69C7-409B-9905-82DD743CC840}\n"
1180 "ProductName\tMSITEST\n"
1181 "ProductVersion\t1.1.1\n"
1182 "MSIFASTINSTALL\t1\n";
1184 static const char shc2_property_dat[] =
1185 "Property\tValue\n"
1186 "s72\tl0\n"
1187 "Property\tProperty\n"
1188 "INSTALLLEVEL\t3\n"
1189 "ProductCode\t{4CEFADE5-DAFB-4C21-8EF2-4ED4F139F340}\n"
1190 "ProductName\tMSITEST2\n"
1191 "ProductVersion\t1.1.1\n"
1192 "MSIFASTINSTALL\t1\n";
1194 static const char shc_file_dat[] =
1195 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1196 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1197 "File\tFile\n"
1198 "sharedcomponent\tsharedcomponent\tsharedcomponent.txt\t1000\t\t\t8192\t1\n";
1200 static const char shc_feature_dat[] =
1201 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1202 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1203 "Feature\tFeature\n"
1204 "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1206 static const char shc_feature_comp_dat[] =
1207 "Feature_\tComponent_\n"
1208 "s38\ts72\n"
1209 "FeatureComponents\tFeature_\tComponent_\n"
1210 "feature\tsharedcomponent\n";
1212 static const char shc_component_dat[] =
1213 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1214 "s72\tS38\ts72\ti2\tS255\tS72\n"
1215 "Component\tComponent\n"
1216 "sharedcomponent\t{900A4ACB-DC6F-4795-A04B-81B530183D41}\tMSITESTDIR\t0\t\tsharedcomponent\n";
1218 static const char shc_custom_action_dat[] =
1219 "Action\tType\tSource\tTarget\tISComments\n"
1220 "s72\ti2\tS64\tS0\tS255\n"
1221 "CustomAction\tAction\n"
1222 "TestComponentAction\t19\t\twrong component action on install\t\n";
1224 static const char shc_install_exec_seq_dat[] =
1225 "Action\tCondition\tSequence\n"
1226 "s72\tS255\tI2\n"
1227 "InstallExecuteSequence\tAction\n"
1228 "LaunchConditions\t\t100\n"
1229 "CostInitialize\t\t200\n"
1230 "FileCost\t\t300\n"
1231 "CostFinalize\t\t600\n"
1232 "InstallValidate\t\t900\n"
1233 "InstallInitialize\t\t1200\n"
1234 "ProcessComponents\t\t1300\n"
1235 "RemoveFiles\t\t1400\n"
1236 "InstallFiles\t\t1500\n"
1237 "TestComponentAction\tNOT REMOVE AND ($sharedcomponent <> 3)\t1600\n"
1238 "RegisterProduct\t\t1700\n"
1239 "PublishFeatures\t\t1800\n"
1240 "PublishProduct\t\t1900\n"
1241 "InstallFinalize\t\t2000\n";
1243 static const char ft_file_dat[] =
1244 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1245 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1246 "File\tFile\n"
1247 "featuretree\tcomp\tfeaturetree.txt\t1000\t\t\t8192\t1\n";
1249 static const char ft_comp_dat[] =
1250 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1251 "s72\tS38\ts72\ti2\tS255\tS72\n"
1252 "Component\tComponent\n"
1253 "comp\t{12345678-1234-1234-1234-222222222222}\tTARGETDIR\t0\t\t\n"
1254 "comp2\t{12345678-1234-1234-1234-333333333333}\tTARGETDIR\t0\t\tfeaturetree\n";
1256 static const char ft_feature_dat[] =
1257 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1258 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1259 "Feature\tFeature\n"
1260 "A\t\t\t\t2\t1\t\t0\n"
1261 "C\tB\t\t\t2\t1\t\t0\n"
1262 "B\tA\t\t\t4\t1\t\t0\n"
1263 "D\t\t\t\t2\t1\t\t0\n";
1265 static const char ft_feature_comp_dat[] =
1266 "Feature_\tComponent_\n"
1267 "s38\ts72\n"
1268 "FeatureComponents\tFeature_\tComponent_\n"
1269 "C\tcomp\n"
1270 "D\tcomp2\n";
1272 static const char ft_condition_dat[] =
1273 "Feature_\tLevel\tCondition\n"
1274 "s38\ti2\tS255\n"
1275 "Condition\tFeature_\tLevel\n"
1276 "A\t0\t\"0\"<>INSTALLTYPE\n";
1278 static const char ft_custom_action_dat[] =
1279 "Action\tType\tSource\tTarget\tISComments\n"
1280 "s72\ti2\tS64\tS0\tS255\n"
1281 "CustomAction\tAction\n"
1282 "Run A\t19\t\tA\t\n"
1283 "Run B\t19\t\tB\t\n"
1284 "Run C\t19\t\tC\t\n";
1286 static const char ft_install_exec_seq_dat[] =
1287 "Action\tCondition\tSequence\n"
1288 "s72\tS255\tI2\n"
1289 "InstallExecuteSequence\tAction\n"
1290 "CostInitialize\t\t100\n"
1291 "FileCost\t\t200\n"
1292 "CostFinalize\t\t300\n"
1293 "InstallValidate\t\t400\n"
1294 "InstallInitialize\t\t500\n"
1295 "Run C\t3 = &C AND NOT Installed\t600\n"
1296 "Run B\t3 = &B AND NOT Installed\t700\n"
1297 "Run A\t3 = &A AND NOT Installed\t800\n"
1298 "ProcessComponents\t\t900\n"
1299 "RemoveFiles\t\t1000\n"
1300 "InstallFiles\t\t1100\n"
1301 "RegisterProduct\t\t1200\n"
1302 "PublishFeatures\t\t1300\n"
1303 "PublishProduct\t\t1400\n"
1304 "InstallFinalize\t\t1500\n";
1306 static const char da_custom_action_dat[] =
1307 "Action\tType\tSource\tTarget\n"
1308 "s72\ti2\tS64\tS0\n"
1309 "CustomAction\tAction\n"
1310 "setprop\t51\tdeferred\t[TESTPATH]\n"
1311 "immediate\t1\tcustom.dll\tda_immediate\n"
1312 "deferred\t1025\tcustom.dll\tda_deferred\n";
1314 static const char da_install_exec_seq_dat[] =
1315 "Action\tCondition\tSequence\n"
1316 "s72\tS255\tI2\n"
1317 "InstallExecuteSequence\tAction\n"
1318 "CostInitialize\t\t200\n"
1319 "FileCost\t\t300\n"
1320 "CostFinalize\t\t400\n"
1321 "InstallInitialize\t\t500\n"
1322 "setprop\t\t600\n"
1323 "deferred\t\t700\n"
1324 "immediate\t\t800\n"
1325 "InstallFinalize\t\t1100\n";
1327 typedef struct _msi_table
1329 const CHAR *filename;
1330 const CHAR *data;
1331 int size;
1332 } msi_table;
1334 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
1336 static const msi_table tables[] =
1338 ADD_TABLE(component),
1339 ADD_TABLE(directory),
1340 ADD_TABLE(feature),
1341 ADD_TABLE(feature_comp),
1342 ADD_TABLE(file),
1343 ADD_TABLE(install_exec_seq),
1344 ADD_TABLE(media),
1345 ADD_TABLE(property),
1346 ADD_TABLE(registry),
1347 ADD_TABLE(service_install),
1348 ADD_TABLE(service_control)
1351 static const msi_table sc_tables[] =
1353 ADD_TABLE(component),
1354 ADD_TABLE(directory),
1355 ADD_TABLE(feature),
1356 ADD_TABLE(feature_comp),
1357 ADD_TABLE(file),
1358 ADD_TABLE(install_exec_seq),
1359 ADD_TABLE(media),
1360 ADD_TABLE(property),
1361 ADD_TABLE(shortcut)
1364 static const msi_table ps_tables[] =
1366 ADD_TABLE(component),
1367 ADD_TABLE(directory),
1368 ADD_TABLE(feature),
1369 ADD_TABLE(feature_comp),
1370 ADD_TABLE(file),
1371 ADD_TABLE(install_exec_seq),
1372 ADD_TABLE(media),
1373 ADD_TABLE(property),
1374 ADD_TABLE(condition)
1377 static const msi_table up_tables[] =
1379 ADD_TABLE(component),
1380 ADD_TABLE(directory),
1381 ADD_TABLE(feature),
1382 ADD_TABLE(feature_comp),
1383 ADD_TABLE(file),
1384 ADD_TABLE(install_exec_seq),
1385 ADD_TABLE(media),
1386 ADD_TABLE(up_property),
1387 ADD_TABLE(registry),
1388 ADD_TABLE(service_install),
1389 ADD_TABLE(service_control)
1392 static const msi_table up2_tables[] =
1394 ADD_TABLE(component),
1395 ADD_TABLE(directory),
1396 ADD_TABLE(feature),
1397 ADD_TABLE(feature_comp),
1398 ADD_TABLE(file),
1399 ADD_TABLE(install_exec_seq),
1400 ADD_TABLE(media),
1401 ADD_TABLE(up2_property),
1402 ADD_TABLE(registry),
1403 ADD_TABLE(service_install),
1404 ADD_TABLE(service_control)
1407 static const msi_table up3_tables[] =
1409 ADD_TABLE(component),
1410 ADD_TABLE(directory),
1411 ADD_TABLE(feature),
1412 ADD_TABLE(feature_comp),
1413 ADD_TABLE(file),
1414 ADD_TABLE(install_exec_seq),
1415 ADD_TABLE(media),
1416 ADD_TABLE(up3_property),
1417 ADD_TABLE(registry),
1418 ADD_TABLE(service_install),
1419 ADD_TABLE(service_control)
1422 static const msi_table up4_tables[] =
1424 ADD_TABLE(component),
1425 ADD_TABLE(directory),
1426 ADD_TABLE(feature),
1427 ADD_TABLE(feature_comp),
1428 ADD_TABLE(file),
1429 ADD_TABLE(pp_install_exec_seq),
1430 ADD_TABLE(media),
1431 ADD_TABLE(property),
1432 ADD_TABLE(registry),
1433 ADD_TABLE(service_install),
1434 ADD_TABLE(service_control)
1437 static const msi_table up5_tables[] =
1439 ADD_TABLE(component),
1440 ADD_TABLE(directory),
1441 ADD_TABLE(feature),
1442 ADD_TABLE(feature_comp),
1443 ADD_TABLE(file),
1444 ADD_TABLE(pp_install_exec_seq),
1445 ADD_TABLE(media),
1446 ADD_TABLE(up_property),
1447 ADD_TABLE(registry),
1448 ADD_TABLE(service_install),
1449 ADD_TABLE(service_control)
1452 static const msi_table up6_tables[] =
1454 ADD_TABLE(component),
1455 ADD_TABLE(directory),
1456 ADD_TABLE(feature),
1457 ADD_TABLE(feature_comp),
1458 ADD_TABLE(file),
1459 ADD_TABLE(pp_install_exec_seq),
1460 ADD_TABLE(media),
1461 ADD_TABLE(up2_property),
1462 ADD_TABLE(registry),
1463 ADD_TABLE(service_install),
1464 ADD_TABLE(service_control)
1467 static const msi_table up7_tables[] =
1469 ADD_TABLE(component),
1470 ADD_TABLE(directory),
1471 ADD_TABLE(feature),
1472 ADD_TABLE(feature_comp),
1473 ADD_TABLE(file),
1474 ADD_TABLE(pp_install_exec_seq),
1475 ADD_TABLE(media),
1476 ADD_TABLE(up3_property),
1477 ADD_TABLE(registry),
1478 ADD_TABLE(service_install),
1479 ADD_TABLE(service_control)
1482 static const msi_table cc_tables[] =
1484 ADD_TABLE(cc_component),
1485 ADD_TABLE(directory),
1486 ADD_TABLE(cc_feature),
1487 ADD_TABLE(cc_feature_comp),
1488 ADD_TABLE(cc_file),
1489 ADD_TABLE(install_exec_seq),
1490 ADD_TABLE(cc_media),
1491 ADD_TABLE(property),
1494 static const msi_table cc2_tables[] =
1496 ADD_TABLE(cc2_component),
1497 ADD_TABLE(directory),
1498 ADD_TABLE(cc_feature),
1499 ADD_TABLE(cc_feature_comp),
1500 ADD_TABLE(cc2_file),
1501 ADD_TABLE(install_exec_seq),
1502 ADD_TABLE(cc_media),
1503 ADD_TABLE(property),
1506 static const msi_table cc3_tables[] =
1508 ADD_TABLE(cc_component),
1509 ADD_TABLE(directory),
1510 ADD_TABLE(cc_feature),
1511 ADD_TABLE(cc_feature_comp),
1512 ADD_TABLE(cc_file),
1513 ADD_TABLE(install_exec_seq),
1514 ADD_TABLE(cc3_media),
1515 ADD_TABLE(property),
1518 static const msi_table co_tables[] =
1520 ADD_TABLE(cc_component),
1521 ADD_TABLE(directory),
1522 ADD_TABLE(cc_feature),
1523 ADD_TABLE(cc_feature_comp),
1524 ADD_TABLE(co_file),
1525 ADD_TABLE(install_exec_seq),
1526 ADD_TABLE(co_media),
1527 ADD_TABLE(property),
1530 static const msi_table co2_tables[] =
1532 ADD_TABLE(cc_component),
1533 ADD_TABLE(directory),
1534 ADD_TABLE(cc_feature),
1535 ADD_TABLE(cc_feature_comp),
1536 ADD_TABLE(cc_file),
1537 ADD_TABLE(install_exec_seq),
1538 ADD_TABLE(co2_media),
1539 ADD_TABLE(property),
1542 static const msi_table mm_tables[] =
1544 ADD_TABLE(cc_component),
1545 ADD_TABLE(directory),
1546 ADD_TABLE(cc_feature),
1547 ADD_TABLE(cc_feature_comp),
1548 ADD_TABLE(mm_file),
1549 ADD_TABLE(install_exec_seq),
1550 ADD_TABLE(mm_media),
1551 ADD_TABLE(property),
1554 static const msi_table ss_tables[] =
1556 ADD_TABLE(cc_component),
1557 ADD_TABLE(directory),
1558 ADD_TABLE(cc_feature),
1559 ADD_TABLE(cc_feature_comp),
1560 ADD_TABLE(cc_file),
1561 ADD_TABLE(install_exec_seq),
1562 ADD_TABLE(ss_media),
1563 ADD_TABLE(property),
1566 static const msi_table ui_tables[] =
1568 ADD_TABLE(ui_component),
1569 ADD_TABLE(directory),
1570 ADD_TABLE(cc_feature),
1571 ADD_TABLE(cc_feature_comp),
1572 ADD_TABLE(cc_file),
1573 ADD_TABLE(install_exec_seq),
1574 ADD_TABLE(ui_install_ui_seq),
1575 ADD_TABLE(ui_custom_action),
1576 ADD_TABLE(cc_media),
1577 ADD_TABLE(property),
1580 static const msi_table rof_tables[] =
1582 ADD_TABLE(rof_component),
1583 ADD_TABLE(directory),
1584 ADD_TABLE(rof_feature),
1585 ADD_TABLE(rof_feature_comp),
1586 ADD_TABLE(rof_file),
1587 ADD_TABLE(install_exec_seq),
1588 ADD_TABLE(rof_media),
1589 ADD_TABLE(property),
1592 static const msi_table rofc_tables[] =
1594 ADD_TABLE(rof_component),
1595 ADD_TABLE(directory),
1596 ADD_TABLE(rof_feature),
1597 ADD_TABLE(rof_feature_comp),
1598 ADD_TABLE(rofc_file),
1599 ADD_TABLE(install_exec_seq),
1600 ADD_TABLE(rofc_media),
1601 ADD_TABLE(property),
1604 static const msi_table sdp_tables[] =
1606 ADD_TABLE(rof_component),
1607 ADD_TABLE(directory),
1608 ADD_TABLE(rof_feature),
1609 ADD_TABLE(rof_feature_comp),
1610 ADD_TABLE(rof_file),
1611 ADD_TABLE(sdp_install_exec_seq),
1612 ADD_TABLE(sdp_custom_action),
1613 ADD_TABLE(rof_media),
1614 ADD_TABLE(property),
1617 static const msi_table cie_tables[] =
1619 ADD_TABLE(cie_component),
1620 ADD_TABLE(directory),
1621 ADD_TABLE(cc_feature),
1622 ADD_TABLE(cie_feature_comp),
1623 ADD_TABLE(cie_file),
1624 ADD_TABLE(install_exec_seq),
1625 ADD_TABLE(cie_media),
1626 ADD_TABLE(property),
1629 static const msi_table tp_tables[] =
1631 ADD_TABLE(tp_component),
1632 ADD_TABLE(directory),
1633 ADD_TABLE(rof_feature),
1634 ADD_TABLE(ci2_feature_comp),
1635 ADD_TABLE(ci2_file),
1636 ADD_TABLE(install_exec_seq),
1637 ADD_TABLE(rof_media),
1638 ADD_TABLE(property),
1641 static const msi_table cwd_tables[] =
1643 ADD_TABLE(cwd_component),
1644 ADD_TABLE(directory),
1645 ADD_TABLE(rof_feature),
1646 ADD_TABLE(ci2_feature_comp),
1647 ADD_TABLE(ci2_file),
1648 ADD_TABLE(install_exec_seq),
1649 ADD_TABLE(rof_media),
1650 ADD_TABLE(property),
1653 static const msi_table adm_tables[] =
1655 ADD_TABLE(adm_component),
1656 ADD_TABLE(directory),
1657 ADD_TABLE(rof_feature),
1658 ADD_TABLE(ci2_feature_comp),
1659 ADD_TABLE(ci2_file),
1660 ADD_TABLE(install_exec_seq),
1661 ADD_TABLE(rof_media),
1662 ADD_TABLE(property),
1663 ADD_TABLE(adm_custom_action),
1664 ADD_TABLE(adm_admin_exec_seq),
1667 static const msi_table amp_tables[] =
1669 ADD_TABLE(amp_component),
1670 ADD_TABLE(directory),
1671 ADD_TABLE(rof_feature),
1672 ADD_TABLE(ci2_feature_comp),
1673 ADD_TABLE(ci2_file),
1674 ADD_TABLE(install_exec_seq),
1675 ADD_TABLE(rof_media),
1676 ADD_TABLE(property),
1679 static const msi_table mc_tables[] =
1681 ADD_TABLE(mc_component),
1682 ADD_TABLE(directory),
1683 ADD_TABLE(cc_feature),
1684 ADD_TABLE(cie_feature_comp),
1685 ADD_TABLE(mc_file),
1686 ADD_TABLE(install_exec_seq),
1687 ADD_TABLE(mc_media),
1688 ADD_TABLE(property),
1689 ADD_TABLE(mc_file_hash),
1692 static const msi_table sf_tables[] =
1694 ADD_TABLE(wrv_component),
1695 ADD_TABLE(directory),
1696 ADD_TABLE(rof_feature),
1697 ADD_TABLE(ci2_feature_comp),
1698 ADD_TABLE(ci2_file),
1699 ADD_TABLE(install_exec_seq),
1700 ADD_TABLE(rof_media),
1701 ADD_TABLE(property),
1704 static const msi_table ca1_tables[] =
1706 ADD_TABLE(property),
1707 ADD_TABLE(ca1_install_exec_seq),
1708 ADD_TABLE(ca1_custom_action),
1711 static const msi_table ca51_tables[] =
1713 ADD_TABLE(ca51_component),
1714 ADD_TABLE(directory),
1715 ADD_TABLE(rof_feature),
1716 ADD_TABLE(ci2_feature_comp),
1717 ADD_TABLE(ci2_file),
1718 ADD_TABLE(ca51_install_exec_seq),
1719 ADD_TABLE(rof_media),
1720 ADD_TABLE(property),
1721 ADD_TABLE(ca51_custom_action),
1724 static const msi_table is_tables[] =
1726 ADD_TABLE(is_component),
1727 ADD_TABLE(directory),
1728 ADD_TABLE(is_feature),
1729 ADD_TABLE(is_feature_comp),
1730 ADD_TABLE(is_file),
1731 ADD_TABLE(install_exec_seq),
1732 ADD_TABLE(is_media),
1733 ADD_TABLE(property),
1736 static const msi_table sp_tables[] =
1738 ADD_TABLE(sp_component),
1739 ADD_TABLE(sp_directory),
1740 ADD_TABLE(rof_feature),
1741 ADD_TABLE(ci2_feature_comp),
1742 ADD_TABLE(ci2_file),
1743 ADD_TABLE(install_exec_seq),
1744 ADD_TABLE(rof_media),
1745 ADD_TABLE(property),
1748 static const msi_table mcp_tables[] =
1750 ADD_TABLE(mcp_component),
1751 ADD_TABLE(directory),
1752 ADD_TABLE(mcp_feature),
1753 ADD_TABLE(mcp_feature_comp),
1754 ADD_TABLE(mcp_file),
1755 ADD_TABLE(rem_install_exec_seq),
1756 ADD_TABLE(rof_media),
1757 ADD_TABLE(property),
1760 static const msi_table ai_tables[] =
1762 ADD_TABLE(component),
1763 ADD_TABLE(directory),
1764 ADD_TABLE(feature),
1765 ADD_TABLE(feature_comp),
1766 ADD_TABLE(ai_file),
1767 ADD_TABLE(install_exec_seq),
1768 ADD_TABLE(media),
1769 ADD_TABLE(property)
1772 static const msi_table pc_tables[] =
1774 ADD_TABLE(ca51_component),
1775 ADD_TABLE(directory),
1776 ADD_TABLE(rof_feature),
1777 ADD_TABLE(ci2_feature_comp),
1778 ADD_TABLE(ci2_file),
1779 ADD_TABLE(install_exec_seq),
1780 ADD_TABLE(rof_media),
1781 ADD_TABLE(property)
1784 static const msi_table ip_tables[] =
1786 ADD_TABLE(component),
1787 ADD_TABLE(directory),
1788 ADD_TABLE(feature),
1789 ADD_TABLE(feature_comp),
1790 ADD_TABLE(file),
1791 ADD_TABLE(ip_install_exec_seq),
1792 ADD_TABLE(ip_custom_action),
1793 ADD_TABLE(media),
1794 ADD_TABLE(property)
1797 static const msi_table aup_tables[] =
1799 ADD_TABLE(component),
1800 ADD_TABLE(directory),
1801 ADD_TABLE(feature),
1802 ADD_TABLE(feature_comp),
1803 ADD_TABLE(file),
1804 ADD_TABLE(aup_install_exec_seq),
1805 ADD_TABLE(aup_custom_action),
1806 ADD_TABLE(media),
1807 ADD_TABLE(property)
1810 static const msi_table aup2_tables[] =
1812 ADD_TABLE(component),
1813 ADD_TABLE(directory),
1814 ADD_TABLE(feature),
1815 ADD_TABLE(feature_comp),
1816 ADD_TABLE(file),
1817 ADD_TABLE(aup2_install_exec_seq),
1818 ADD_TABLE(aup_custom_action),
1819 ADD_TABLE(media),
1820 ADD_TABLE(aup_property)
1823 static const msi_table aup3_tables[] =
1825 ADD_TABLE(component),
1826 ADD_TABLE(directory),
1827 ADD_TABLE(feature),
1828 ADD_TABLE(feature_comp),
1829 ADD_TABLE(file),
1830 ADD_TABLE(aup2_install_exec_seq),
1831 ADD_TABLE(aup_custom_action),
1832 ADD_TABLE(media),
1833 ADD_TABLE(aup2_property)
1836 static const msi_table aup4_tables[] =
1838 ADD_TABLE(component),
1839 ADD_TABLE(directory),
1840 ADD_TABLE(feature),
1841 ADD_TABLE(feature_comp),
1842 ADD_TABLE(file),
1843 ADD_TABLE(aup3_install_exec_seq),
1844 ADD_TABLE(aup_custom_action),
1845 ADD_TABLE(media),
1846 ADD_TABLE(aup2_property)
1849 static const msi_table fiu_tables[] =
1851 ADD_TABLE(rof_component),
1852 ADD_TABLE(directory),
1853 ADD_TABLE(rof_feature),
1854 ADD_TABLE(rof_feature_comp),
1855 ADD_TABLE(rof_file),
1856 ADD_TABLE(pp_install_exec_seq),
1857 ADD_TABLE(rof_media),
1858 ADD_TABLE(property),
1861 static const msi_table fiuc_tables[] =
1863 ADD_TABLE(rof_component),
1864 ADD_TABLE(directory),
1865 ADD_TABLE(rof_feature),
1866 ADD_TABLE(rof_feature_comp),
1867 ADD_TABLE(rofc_file),
1868 ADD_TABLE(pp_install_exec_seq),
1869 ADD_TABLE(rofc_media),
1870 ADD_TABLE(property),
1873 static const msi_table fo_tables[] =
1875 ADD_TABLE(directory),
1876 ADD_TABLE(fo_file),
1877 ADD_TABLE(fo_component),
1878 ADD_TABLE(fo_feature),
1879 ADD_TABLE(fo_condition),
1880 ADD_TABLE(fo_feature_comp),
1881 ADD_TABLE(fo_custom_action),
1882 ADD_TABLE(fo_install_exec_seq),
1883 ADD_TABLE(media),
1884 ADD_TABLE(property)
1887 static const msi_table icon_base_tables[] =
1889 ADD_TABLE(ci_component),
1890 ADD_TABLE(directory),
1891 ADD_TABLE(rof_feature),
1892 ADD_TABLE(rof_feature_comp),
1893 ADD_TABLE(rof_file),
1894 ADD_TABLE(pp_install_exec_seq),
1895 ADD_TABLE(rof_media),
1896 ADD_TABLE(icon_property),
1899 static const msi_table pv_tables[] =
1901 ADD_TABLE(rof_component),
1902 ADD_TABLE(directory),
1903 ADD_TABLE(rof_feature),
1904 ADD_TABLE(rof_feature_comp),
1905 ADD_TABLE(rof_file),
1906 ADD_TABLE(pv_install_exec_seq),
1907 ADD_TABLE(rof_media),
1908 ADD_TABLE(property)
1911 static const msi_table uc_tables[] =
1913 ADD_TABLE(directory),
1914 ADD_TABLE(uc_component),
1915 ADD_TABLE(uc_feature),
1916 ADD_TABLE(uc_feature_comp),
1917 ADD_TABLE(uc_file),
1918 ADD_TABLE(uc_install_exec_seq),
1919 ADD_TABLE(media),
1920 ADD_TABLE(uc_property)
1923 static const msi_table mixed_tables[] =
1925 ADD_TABLE(directory),
1926 ADD_TABLE(mixed_component),
1927 ADD_TABLE(mixed_feature),
1928 ADD_TABLE(mixed_feature_comp),
1929 ADD_TABLE(mixed_install_exec_seq),
1930 ADD_TABLE(mixed_registry),
1931 ADD_TABLE(media),
1932 ADD_TABLE(property)
1935 static const msi_table vp_tables[] =
1937 ADD_TABLE(directory),
1938 ADD_TABLE(vp_file),
1939 ADD_TABLE(vp_component),
1940 ADD_TABLE(vp_feature),
1941 ADD_TABLE(vp_feature_comp),
1942 ADD_TABLE(vp_custom_action),
1943 ADD_TABLE(vp_install_exec_seq),
1944 ADD_TABLE(media),
1945 ADD_TABLE(property)
1948 static const msi_table shc_tables[] =
1950 ADD_TABLE(media),
1951 ADD_TABLE(directory),
1952 ADD_TABLE(shc_file),
1953 ADD_TABLE(shc_component),
1954 ADD_TABLE(shc_feature),
1955 ADD_TABLE(shc_feature_comp),
1956 ADD_TABLE(shc_custom_action),
1957 ADD_TABLE(shc_install_exec_seq),
1958 ADD_TABLE(shc_property)
1961 static const msi_table shc2_tables[] =
1963 ADD_TABLE(media),
1964 ADD_TABLE(directory),
1965 ADD_TABLE(shc_file),
1966 ADD_TABLE(shc_component),
1967 ADD_TABLE(shc_feature),
1968 ADD_TABLE(shc_feature_comp),
1969 ADD_TABLE(shc_custom_action),
1970 ADD_TABLE(shc_install_exec_seq),
1971 ADD_TABLE(shc2_property)
1974 static const msi_table ft_tables[] =
1976 ADD_TABLE(media),
1977 ADD_TABLE(directory),
1978 ADD_TABLE(ft_file),
1979 ADD_TABLE(ft_comp),
1980 ADD_TABLE(ft_feature),
1981 ADD_TABLE(ft_feature_comp),
1982 ADD_TABLE(ft_condition),
1983 ADD_TABLE(ft_custom_action),
1984 ADD_TABLE(ft_install_exec_seq),
1985 ADD_TABLE(property)
1988 static const msi_table da_tables[] =
1990 ADD_TABLE(media),
1991 ADD_TABLE(directory),
1992 ADD_TABLE(file),
1993 ADD_TABLE(component),
1994 ADD_TABLE(feature),
1995 ADD_TABLE(feature_comp),
1996 ADD_TABLE(property),
1997 ADD_TABLE(da_install_exec_seq),
1998 ADD_TABLE(da_custom_action),
2001 /* cabinet definitions */
2003 /* make the max size large so there is only one cab file */
2004 #define MEDIA_SIZE 0x7FFFFFFF
2005 #define FOLDER_THRESHOLD 900000
2007 /* the FCI callbacks */
2009 static void * CDECL mem_alloc(ULONG cb)
2011 return HeapAlloc(GetProcessHeap(), 0, cb);
2014 static void CDECL mem_free(void *memory)
2016 HeapFree(GetProcessHeap(), 0, memory);
2019 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
2021 sprintf(pccab->szCab, pv, pccab->iCab);
2022 return TRUE;
2025 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
2027 return 0;
2030 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
2031 BOOL fContinuation, void *pv)
2033 return 0;
2036 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
2038 HANDLE handle;
2039 DWORD dwAccess = 0;
2040 DWORD dwShareMode = 0;
2041 DWORD dwCreateDisposition = OPEN_EXISTING;
2043 dwAccess = GENERIC_READ | GENERIC_WRITE;
2044 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
2045 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
2047 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
2048 dwCreateDisposition = OPEN_EXISTING;
2049 else
2050 dwCreateDisposition = CREATE_NEW;
2052 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
2053 dwCreateDisposition, 0, NULL);
2055 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
2057 return (INT_PTR)handle;
2060 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2062 HANDLE handle = (HANDLE)hf;
2063 DWORD dwRead;
2064 BOOL res;
2066 res = ReadFile(handle, memory, cb, &dwRead, NULL);
2067 ok(res, "Failed to ReadFile\n");
2069 return dwRead;
2072 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2074 HANDLE handle = (HANDLE)hf;
2075 DWORD dwWritten;
2076 BOOL res;
2078 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2079 ok(res, "Failed to WriteFile\n");
2081 return dwWritten;
2084 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
2086 HANDLE handle = (HANDLE)hf;
2087 ok(CloseHandle(handle), "Failed to CloseHandle\n");
2089 return 0;
2092 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
2094 HANDLE handle = (HANDLE)hf;
2095 DWORD ret;
2097 ret = SetFilePointer(handle, dist, NULL, seektype);
2098 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2100 return ret;
2103 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
2105 BOOL ret = DeleteFileA(pszFile);
2106 ok(ret, "Failed to DeleteFile %s\n", pszFile);
2108 return 0;
2111 static void init_functionpointers(void)
2113 HMODULE hmsi = GetModuleHandleA("msi.dll");
2114 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2115 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2117 #define GET_PROC(mod, func) \
2118 p ## func = (void*)GetProcAddress(mod, #func); \
2119 if(!p ## func) \
2120 trace("GetProcAddress(%s) failed\n", #func);
2122 GET_PROC(hmsi, MsiQueryComponentStateA);
2123 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
2124 GET_PROC(hmsi, MsiGetComponentPathExA);
2126 GET_PROC(hadvapi32, CheckTokenMembership);
2127 GET_PROC(hadvapi32, ConvertSidToStringSidA);
2128 GET_PROC(hadvapi32, OpenProcessToken);
2129 GET_PROC(hadvapi32, RegDeleteKeyExA)
2130 GET_PROC(hkernel32, IsWow64Process)
2132 hsrclient = LoadLibraryA("srclient.dll");
2133 GET_PROC(hsrclient, SRRemoveRestorePoint);
2134 GET_PROC(hsrclient, SRSetRestorePointA);
2136 #undef GET_PROC
2139 static BOOL is_process_limited(void)
2141 SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
2142 PSID Group = NULL;
2143 BOOL IsInGroup;
2144 HANDLE token;
2146 if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
2148 if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
2149 DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
2150 !pCheckTokenMembership(NULL, Group, &IsInGroup))
2152 trace("Could not check if the current user is an administrator\n");
2153 FreeSid(Group);
2154 return FALSE;
2156 FreeSid(Group);
2158 if (!IsInGroup)
2160 /* Only administrators have enough privileges for these tests */
2161 return TRUE;
2164 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2166 BOOL ret;
2167 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
2168 DWORD size;
2170 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2171 CloseHandle(token);
2172 return (ret && type == TokenElevationTypeLimited);
2174 return FALSE;
2177 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
2179 CHAR buffer[0x20];
2180 UINT r;
2181 DWORD sz;
2183 sz = sizeof buffer;
2184 r = MsiRecordGetStringA(rec, field, buffer, &sz);
2185 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
2188 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2190 LPSTR tempname;
2192 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2193 GetTempFileNameA(".", "xx", 0, tempname);
2195 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2197 lstrcpyA(pszTempName, tempname);
2198 HeapFree(GetProcessHeap(), 0, tempname);
2199 return TRUE;
2202 HeapFree(GetProcessHeap(), 0, tempname);
2204 return FALSE;
2207 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2208 USHORT *pattribs, int *err, void *pv)
2210 BY_HANDLE_FILE_INFORMATION finfo;
2211 FILETIME filetime;
2212 HANDLE handle;
2213 DWORD attrs;
2214 BOOL res;
2216 handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2217 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2219 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2221 res = GetFileInformationByHandle(handle, &finfo);
2222 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2224 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2225 FileTimeToDosDateTime(&filetime, pdate, ptime);
2227 attrs = GetFileAttributesA(pszName);
2228 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2230 return (INT_PTR)handle;
2233 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2235 char path[MAX_PATH];
2236 char filename[MAX_PATH];
2238 lstrcpyA(path, CURR_DIR);
2239 lstrcatA(path, "\\");
2240 lstrcatA(path, file);
2242 lstrcpyA(filename, file);
2244 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2245 progress, get_open_info, compress);
2248 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2250 ZeroMemory(pCabParams, sizeof(CCAB));
2252 pCabParams->cb = max_size;
2253 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2254 pCabParams->setID = 0xbeef;
2255 pCabParams->iCab = 1;
2256 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2257 lstrcatA(pCabParams->szCabPath, "\\");
2258 lstrcpyA(pCabParams->szCab, name);
2261 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2263 CCAB cabParams;
2264 LPCSTR ptr;
2265 HFCI hfci;
2266 ERF erf;
2267 BOOL res;
2269 set_cab_parameters(&cabParams, name, max_size);
2271 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2272 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2273 get_temp_file, &cabParams, NULL);
2275 ok(hfci != NULL, "Failed to create an FCI context\n");
2277 ptr = files;
2278 while (*ptr)
2280 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2281 ok(res, "Failed to add file: %s\n", ptr);
2282 ptr += lstrlenA(ptr) + 1;
2285 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2286 ok(res, "Failed to flush the cabinet\n");
2288 res = FCIDestroy(hfci);
2289 ok(res, "Failed to destroy the cabinet\n");
2292 static BOOL get_user_dirs(void)
2294 HKEY hkey;
2295 DWORD type, size;
2297 if (RegOpenKeyA(HKEY_CURRENT_USER,
2298 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2299 return FALSE;
2301 size = MAX_PATH;
2302 if(RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size)){
2303 RegCloseKey(hkey);
2304 return FALSE;
2307 RegCloseKey(hkey);
2308 return TRUE;
2311 static BOOL get_system_dirs(void)
2313 HKEY hkey;
2314 DWORD type, size;
2316 if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2317 return FALSE;
2319 size = MAX_PATH;
2320 if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2321 RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size)) {
2322 RegCloseKey(hkey);
2323 return FALSE;
2326 size = MAX_PATH;
2327 if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2328 RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size)) {
2329 RegCloseKey(hkey);
2330 return FALSE;
2333 size = MAX_PATH;
2334 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR_NATIVE, &size)) {
2335 RegCloseKey(hkey);
2336 return FALSE;
2339 RegCloseKey(hkey);
2341 if(!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH))
2342 return FALSE;
2344 return TRUE;
2347 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2349 HANDLE file;
2350 DWORD written;
2352 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2353 if (file == INVALID_HANDLE_VALUE)
2354 return;
2356 WriteFile(file, data, strlen(data), &written, NULL);
2358 if (size)
2360 SetFilePointer(file, size, NULL, FILE_BEGIN);
2361 SetEndOfFile(file);
2364 CloseHandle(file);
2367 #define create_file(name, size) create_file_data(name, name, size)
2369 static void create_test_files(void)
2371 CreateDirectoryA("msitest", NULL);
2372 create_file("msitest\\one.txt", 100);
2373 CreateDirectoryA("msitest\\first", NULL);
2374 create_file("msitest\\first\\two.txt", 100);
2375 CreateDirectoryA("msitest\\second", NULL);
2376 create_file("msitest\\second\\three.txt", 100);
2378 create_file("four.txt", 100);
2379 create_file("five.txt", 100);
2380 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2382 create_file("msitest\\filename", 100);
2383 create_file("msitest\\service.exe", 100);
2385 DeleteFileA("four.txt");
2386 DeleteFileA("five.txt");
2389 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2391 CHAR path[MAX_PATH];
2393 lstrcpyA(path, PROG_FILES_DIR);
2394 lstrcatA(path, "\\");
2395 lstrcatA(path, rel_path);
2397 if (is_file)
2398 return DeleteFileA(path);
2399 else
2400 return RemoveDirectoryA(path);
2403 static BOOL delete_pf_native(const CHAR *rel_path, BOOL is_file)
2405 CHAR path[MAX_PATH];
2407 lstrcpyA(path, PROG_FILES_DIR_NATIVE);
2408 lstrcatA(path, "\\");
2409 lstrcatA(path, rel_path);
2411 if (is_file)
2412 return DeleteFileA(path);
2413 else
2414 return RemoveDirectoryA(path);
2417 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
2419 CHAR path[MAX_PATH];
2421 lstrcpyA(path, COMMON_FILES_DIR);
2422 lstrcatA(path, "\\");
2423 lstrcatA(path, rel_path);
2425 if (is_file)
2426 return DeleteFileA(path);
2427 else
2428 return RemoveDirectoryA(path);
2431 static BOOL compare_pf_data(const char *filename, const char *data, DWORD size)
2433 DWORD read;
2434 HANDLE handle;
2435 BOOL ret = FALSE;
2436 char *buffer, path[MAX_PATH];
2438 lstrcpyA(path, PROG_FILES_DIR);
2439 lstrcatA(path, "\\");
2440 lstrcatA(path, filename);
2442 handle = CreateFileA(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2443 buffer = HeapAlloc(GetProcessHeap(), 0, size);
2444 if (buffer)
2446 ReadFile(handle, buffer, size, &read, NULL);
2447 if (read == size && !memcmp(data, buffer, size)) ret = TRUE;
2448 HeapFree(GetProcessHeap(), 0, buffer);
2450 CloseHandle(handle);
2451 return ret;
2454 static void delete_test_files(void)
2456 DeleteFileA("msitest.msi");
2457 DeleteFileA("msitest.cab");
2458 DeleteFileA("msitest\\second\\three.txt");
2459 DeleteFileA("msitest\\first\\two.txt");
2460 DeleteFileA("msitest\\one.txt");
2461 DeleteFileA("msitest\\service.exe");
2462 DeleteFileA("msitest\\filename");
2463 RemoveDirectoryA("msitest\\second");
2464 RemoveDirectoryA("msitest\\first");
2465 RemoveDirectoryA("msitest");
2468 static void delete_pf_files(void)
2470 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2471 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2472 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2473 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2474 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2475 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2476 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2477 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2478 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2479 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2480 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2481 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2484 static void write_file(const CHAR *filename, const char *data, int data_size)
2486 DWORD size;
2488 HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
2489 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2490 WriteFile(hf, data, data_size, &size, NULL);
2491 CloseHandle(hf);
2494 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount,
2495 const char *template, const char *packagecode)
2497 MSIHANDLE summary;
2498 UINT r;
2500 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2501 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2503 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2504 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2506 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL, packagecode);
2507 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2509 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL);
2510 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2512 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2513 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2515 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2516 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2518 /* write the summary changes back to the stream */
2519 r = MsiSummaryInfoPersist(summary);
2520 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2522 MsiCloseHandle(summary);
2525 #define create_database(name, tables, num_tables) \
2526 create_database_wordcount(name, tables, num_tables, 100, 0, ";1033", \
2527 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2529 #define create_database_template(name, tables, num_tables, version, template) \
2530 create_database_wordcount(name, tables, num_tables, version, 0, template, \
2531 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2533 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2534 int num_tables, INT version, INT wordcount,
2535 const char *template, const char *packagecode)
2537 MSIHANDLE db;
2538 UINT r;
2539 WCHAR *nameW;
2540 int j, len;
2542 len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2543 if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
2544 MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2546 r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
2547 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2549 /* import the tables into the database */
2550 for (j = 0; j < num_tables; j++)
2552 const msi_table *table = &tables[j];
2554 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2556 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2559 DeleteFileA(table->filename);
2562 write_msi_summary_info(db, version, wordcount, template, packagecode);
2564 r = MsiDatabaseCommit(db);
2565 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2567 MsiCloseHandle(db);
2568 HeapFree( GetProcessHeap(), 0, nameW );
2571 static void check_service_is_installed(void)
2573 SC_HANDLE scm, service;
2574 BOOL res;
2576 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
2577 ok(scm != NULL, "Failed to open the SC Manager\n");
2579 service = OpenServiceA(scm, "TestService", SC_MANAGER_ALL_ACCESS);
2580 ok(service != NULL, "Failed to open TestService\n");
2582 res = DeleteService(service);
2583 ok(res, "Failed to delete TestService\n");
2585 CloseServiceHandle(service);
2586 CloseServiceHandle(scm);
2589 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2591 RESTOREPOINTINFOA spec;
2593 spec.dwEventType = event_type;
2594 spec.dwRestorePtType = APPLICATION_INSTALL;
2595 spec.llSequenceNumber = status->llSequenceNumber;
2596 lstrcpyA(spec.szDescription, "msitest restore point");
2598 return pSRSetRestorePointA(&spec, status);
2601 static void remove_restore_point(DWORD seq_number)
2603 DWORD res;
2605 res = pSRRemoveRestorePoint(seq_number);
2606 if (res != ERROR_SUCCESS)
2607 trace("Failed to remove the restore point : %08x\n", res);
2610 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
2612 if (pRegDeleteKeyExA)
2613 return pRegDeleteKeyExA( key, subkey, access, 0 );
2614 return RegDeleteKeyA( key, subkey );
2617 static char *load_resource(const char *name)
2619 static char path[MAX_PATH];
2620 DWORD written;
2621 HANDLE file;
2622 HRSRC res;
2623 void *ptr;
2625 GetTempFileNameA(".", name, 0, path);
2627 file = CreateFileA(path, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
2628 ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", path, GetLastError());
2630 res = FindResourceA(NULL, name, "TESTDLL");
2631 ok( res != 0, "couldn't find resource\n" );
2632 ptr = LockResource( LoadResource( GetModuleHandleA(NULL), res ));
2633 WriteFile( file, ptr, SizeofResource( GetModuleHandleA(NULL), res ), &written, NULL );
2634 ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" );
2635 CloseHandle( file );
2637 return path;
2640 static void test_MsiInstallProduct(void)
2642 UINT r;
2643 CHAR path[MAX_PATH];
2644 LONG res;
2645 HKEY hkey;
2646 DWORD num, size, type;
2647 REGSAM access = KEY_ALL_ACCESS;
2649 if (is_process_limited())
2651 skip("process is limited\n");
2652 return;
2655 if (is_wow64)
2656 access |= KEY_WOW64_64KEY;
2658 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2660 /* szPackagePath is NULL */
2661 r = MsiInstallProductA(NULL, "INSTALL=ALL");
2662 ok(r == ERROR_INVALID_PARAMETER,
2663 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2665 /* both szPackagePath and szCommandLine are NULL */
2666 r = MsiInstallProductA(NULL, NULL);
2667 ok(r == ERROR_INVALID_PARAMETER,
2668 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2670 /* szPackagePath is empty */
2671 r = MsiInstallProductA("", "INSTALL=ALL");
2672 ok(r == ERROR_PATH_NOT_FOUND,
2673 "Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
2675 create_test_files();
2676 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2678 /* install, don't publish */
2679 r = MsiInstallProductA(msifile, NULL);
2680 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2682 skip("Not enough rights to perform tests\n");
2683 goto error;
2685 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2687 delete_pf_files();
2689 res = RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", 0, access, &hkey);
2690 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2692 size = MAX_PATH;
2693 type = REG_SZ;
2694 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
2695 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2696 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
2698 size = MAX_PATH;
2699 type = REG_SZ;
2700 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
2701 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2703 size = sizeof(num);
2704 type = REG_DWORD;
2705 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
2706 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2707 ok(num == 314, "Expected 314, got %d\n", num);
2709 size = MAX_PATH;
2710 type = REG_SZ;
2711 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
2712 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2713 ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
2715 check_service_is_installed();
2717 delete_key(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", access);
2719 /* not published, reinstall */
2720 r = MsiInstallProductA(msifile, NULL);
2721 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2723 delete_pf_files();
2725 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2726 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2727 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2729 create_database(msifile, up_tables, sizeof(up_tables) / sizeof(msi_table));
2731 /* not published, RemovePreviousVersions set */
2732 r = MsiInstallProductA(msifile, NULL);
2733 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2735 delete_pf_files();
2737 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2738 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2739 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2741 create_database(msifile, up2_tables, sizeof(up2_tables) / sizeof(msi_table));
2743 /* not published, version number bumped */
2744 r = MsiInstallProductA(msifile, NULL);
2745 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2747 delete_pf_files();
2749 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2750 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2751 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2753 create_database(msifile, up3_tables, sizeof(up3_tables) / sizeof(msi_table));
2755 /* not published, RemovePreviousVersions set and version number bumped */
2756 r = MsiInstallProductA(msifile, NULL);
2757 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2759 delete_pf_files();
2761 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2762 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2763 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2765 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2767 /* install, publish product */
2768 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2769 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2771 delete_pf_files();
2773 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2774 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2776 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2778 /* published, reinstall */
2779 r = MsiInstallProductA(msifile, NULL);
2780 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2782 delete_pf_files();
2784 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2785 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2787 create_database(msifile, up5_tables, sizeof(up5_tables) / sizeof(msi_table));
2789 /* published product, RemovePreviousVersions set */
2790 r = MsiInstallProductA(msifile, NULL);
2791 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2793 delete_pf_files();
2795 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2796 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2798 create_database(msifile, up6_tables, sizeof(up6_tables) / sizeof(msi_table));
2800 /* published product, version number bumped */
2801 r = MsiInstallProductA(msifile, NULL);
2802 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2804 delete_pf_files();
2806 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2807 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2809 create_database(msifile, up7_tables, sizeof(up7_tables) / sizeof(msi_table));
2811 /* published product, RemovePreviousVersions set and version number bumped */
2812 r = MsiInstallProductA(msifile, NULL);
2813 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2815 delete_pf_files();
2817 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2818 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2820 r = MsiInstallProductA(msifile, "REMOVE=ALL");
2821 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2823 error:
2824 delete_test_files();
2825 DeleteFileA(msifile);
2828 static void test_MsiSetComponentState(void)
2830 INSTALLSTATE installed, action;
2831 MSIHANDLE package;
2832 char path[MAX_PATH];
2833 UINT r;
2835 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2837 CoInitialize(NULL);
2839 lstrcpyA(path, CURR_DIR);
2840 lstrcatA(path, "\\");
2841 lstrcatA(path, msifile);
2843 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2845 r = MsiOpenPackageA(path, &package);
2846 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2848 skip("Not enough rights to perform tests\n");
2849 goto error;
2851 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2853 r = MsiDoActionA(package, "CostInitialize");
2854 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2856 r = MsiDoActionA(package, "FileCost");
2857 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2859 r = MsiDoActionA(package, "CostFinalize");
2860 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2862 r = MsiGetComponentStateA(package, "dangler", &installed, &action);
2863 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2864 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
2865 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2867 r = MsiSetComponentStateA(package, "dangler", INSTALLSTATE_SOURCE);
2868 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2870 MsiCloseHandle(package);
2872 error:
2873 CoUninitialize();
2874 DeleteFileA(msifile);
2877 static void test_packagecoltypes(void)
2879 MSIHANDLE hdb, view, rec;
2880 char path[MAX_PATH];
2881 WCHAR pathW[MAX_PATH];
2882 LPCSTR query;
2883 UINT r, count;
2885 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2887 CoInitialize(NULL);
2889 lstrcpyA(path, CURR_DIR);
2890 lstrcatA(path, "\\");
2891 lstrcatA(path, msifile);
2892 MultiByteToWideChar( CP_ACP, 0, path, -1, pathW, MAX_PATH );
2894 r = MsiOpenDatabaseW(pathW, MSIDBOPEN_READONLY, &hdb);
2895 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2897 query = "SELECT * FROM `Media`";
2898 r = MsiDatabaseOpenViewA( hdb, query, &view );
2899 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2901 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
2902 count = MsiRecordGetFieldCount( rec );
2903 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2904 ok(count == 6, "Expected 6, got %d\n", count);
2905 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
2906 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
2907 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
2908 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
2909 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
2910 ok(check_record(rec, 6, "Source"), "wrong column label\n");
2911 MsiCloseHandle(rec);
2913 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
2914 count = MsiRecordGetFieldCount( rec );
2915 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2916 ok(count == 6, "Expected 6, got %d\n", count);
2917 ok(check_record(rec, 1, "i2"), "wrong column label\n");
2918 ok(check_record(rec, 2, "i4"), "wrong column label\n");
2919 ok(check_record(rec, 3, "L64"), "wrong column label\n");
2920 ok(check_record(rec, 4, "S255"), "wrong column label\n");
2921 ok(check_record(rec, 5, "S32"), "wrong column label\n");
2922 ok(check_record(rec, 6, "S72"), "wrong column label\n");
2924 MsiCloseHandle(rec);
2925 MsiCloseHandle(view);
2926 MsiCloseHandle(hdb);
2927 CoUninitialize();
2929 DeleteFileA(msifile);
2932 static void create_cc_test_files(void)
2934 CCAB cabParams;
2935 HFCI hfci;
2936 ERF erf;
2937 static CHAR cab_context[] = "test%d.cab";
2938 BOOL res;
2940 create_file("maximus", 500);
2941 create_file("augustus", 50000);
2942 create_file("tiberius", 500);
2943 create_file("caesar", 500);
2945 set_cab_parameters(&cabParams, "test1.cab", 40000);
2947 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2948 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2949 get_temp_file, &cabParams, cab_context);
2950 ok(hfci != NULL, "Failed to create an FCI context\n");
2952 res = add_file(hfci, "maximus", tcompTYPE_NONE);
2953 ok(res, "Failed to add file maximus\n");
2955 res = add_file(hfci, "augustus", tcompTYPE_NONE);
2956 ok(res, "Failed to add file augustus\n");
2958 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
2959 ok(res, "Failed to add file tiberius\n");
2961 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2962 ok(res, "Failed to flush the cabinet\n");
2964 res = FCIDestroy(hfci);
2965 ok(res, "Failed to destroy the cabinet\n");
2967 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2969 DeleteFileA("maximus");
2970 DeleteFileA("augustus");
2971 DeleteFileA("tiberius");
2972 DeleteFileA("caesar");
2975 static void delete_cab_files(void)
2977 SHFILEOPSTRUCTA shfl;
2978 CHAR path[MAX_PATH+10];
2980 lstrcpyA(path, CURR_DIR);
2981 lstrcatA(path, "\\*.cab");
2982 path[strlen(path) + 1] = '\0';
2984 shfl.hwnd = NULL;
2985 shfl.wFunc = FO_DELETE;
2986 shfl.pFrom = path;
2987 shfl.pTo = NULL;
2988 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
2990 SHFileOperationA(&shfl);
2993 static void test_continuouscabs(void)
2995 UINT r;
2997 if (is_process_limited())
2999 skip("process is limited\n");
3000 return;
3003 create_cc_test_files();
3004 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
3006 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3008 r = MsiInstallProductA(msifile, NULL);
3009 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3011 skip("Not enough rights to perform tests\n");
3012 goto error;
3014 else
3016 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3017 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3018 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3019 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3020 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3023 delete_cab_files();
3024 DeleteFileA(msifile);
3026 create_cc_test_files();
3027 create_database(msifile, cc2_tables, sizeof(cc2_tables) / sizeof(msi_table));
3029 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3031 r = MsiInstallProductA(msifile, NULL);
3032 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3034 skip("Not enough rights to perform tests\n");
3036 else
3038 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3039 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3040 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3041 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
3042 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3043 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3046 delete_cab_files();
3047 DeleteFileA(msifile);
3049 /* Tests to show that only msi cab filename is taken in case of mismatch with the one given by previous cab */
3051 /* Filename from cab is right and the one from msi is wrong */
3052 create_cc_test_files();
3053 create_database(msifile, cc3_tables, sizeof(cc3_tables) / sizeof(msi_table));
3055 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3057 r = MsiInstallProductA(msifile, NULL);
3058 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3060 skip("Not enough rights to perform tests\n");
3062 else
3064 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3065 todo_wine ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3066 ok(!delete_pf("msitest\\caesar", TRUE), "File installed\n");
3067 todo_wine ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
3068 todo_wine ok(!delete_pf("msitest", FALSE), "Directory created\n");
3071 delete_cab_files();
3072 DeleteFileA(msifile);
3074 /* Filename from msi is right and the one from cab is wrong */
3075 create_cc_test_files();
3076 ok(MoveFileA("test2.cab", "test2_.cab"), "Cannot rename test2.cab to test2_.cab\n");
3077 create_database(msifile, cc3_tables, sizeof(cc3_tables) / sizeof(msi_table));
3079 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3081 r = MsiInstallProductA(msifile, NULL);
3082 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3084 skip("Not enough rights to perform tests\n");
3086 else
3088 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
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");
3095 error:
3096 delete_cab_files();
3097 DeleteFileA(msifile);
3100 static void test_caborder(void)
3102 UINT r;
3104 create_file("imperator", 100);
3105 create_file("maximus", 500);
3106 create_file("augustus", 50000);
3107 create_file("caesar", 500);
3109 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
3111 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3113 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3114 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3115 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3117 r = MsiInstallProductA(msifile, NULL);
3118 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3120 skip("Not enough rights to perform tests\n");
3121 goto error;
3123 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3124 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3125 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3126 todo_wine
3128 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3129 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3132 delete_cab_files();
3134 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
3135 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
3136 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3138 r = MsiInstallProductA(msifile, NULL);
3139 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3140 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3141 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3142 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3143 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3145 delete_cab_files();
3146 DeleteFileA(msifile);
3148 create_cc_test_files();
3149 create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
3151 r = MsiInstallProductA(msifile, NULL);
3152 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3153 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3154 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3155 todo_wine
3157 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3158 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3161 delete_cab_files();
3162 DeleteFileA(msifile);
3164 create_cc_test_files();
3165 create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
3167 r = MsiInstallProductA(msifile, NULL);
3168 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3169 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3170 todo_wine
3172 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3173 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3174 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3177 error:
3178 delete_cab_files();
3179 DeleteFileA("imperator");
3180 DeleteFileA("maximus");
3181 DeleteFileA("augustus");
3182 DeleteFileA("caesar");
3183 DeleteFileA(msifile);
3186 static void test_mixedmedia(void)
3188 UINT r;
3190 if (is_process_limited())
3192 skip("process is limited\n");
3193 return;
3196 CreateDirectoryA("msitest", NULL);
3197 create_file("msitest\\maximus", 500);
3198 create_file("msitest\\augustus", 500);
3199 create_file("caesar", 500);
3201 create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
3203 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3205 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
3207 r = MsiInstallProductA(msifile, NULL);
3208 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3210 skip("Not enough rights to perform tests\n");
3211 goto error;
3213 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3214 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3215 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3216 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3217 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3219 error:
3220 /* Delete the files in the temp (current) folder */
3221 DeleteFileA("msitest\\maximus");
3222 DeleteFileA("msitest\\augustus");
3223 RemoveDirectoryA("msitest");
3224 DeleteFileA("caesar");
3225 DeleteFileA("test1.cab");
3226 DeleteFileA(msifile);
3229 static void test_samesequence(void)
3231 UINT r;
3233 create_cc_test_files();
3234 create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
3236 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3238 r = MsiInstallProductA(msifile, NULL);
3239 if (r == ERROR_INSTALL_FAILURE)
3241 win_skip("unprivileged user?\n");
3242 goto error;
3244 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3245 if (r == ERROR_SUCCESS)
3247 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3248 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3249 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3250 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3253 error:
3254 delete_cab_files();
3255 DeleteFileA(msifile);
3258 static void test_uiLevelFlags(void)
3260 UINT r;
3262 create_cc_test_files();
3263 create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
3265 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
3267 r = MsiInstallProductA(msifile, NULL);
3268 if (r == ERROR_INSTALL_FAILURE)
3270 win_skip("unprivileged user?\n");
3271 goto error;
3274 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3275 if (r == ERROR_SUCCESS)
3277 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
3278 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3279 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3280 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3283 error:
3284 delete_cab_files();
3285 DeleteFileA(msifile);
3288 static BOOL file_matches(LPSTR path)
3290 CHAR buf[MAX_PATH];
3291 HANDLE file;
3292 DWORD size;
3294 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3295 NULL, OPEN_EXISTING, 0, NULL);
3296 ZeroMemory(buf, MAX_PATH);
3297 ReadFile(file, buf, 15, &size, NULL);
3298 CloseHandle(file);
3300 return !lstrcmpA(buf, "msitest\\maximus");
3303 static void test_readonlyfile(void)
3305 UINT r;
3306 DWORD size;
3307 HANDLE file;
3308 CHAR path[MAX_PATH];
3310 if (is_process_limited())
3312 skip("process is limited\n");
3313 return;
3316 CreateDirectoryA("msitest", NULL);
3317 create_file("msitest\\maximus", 500);
3318 create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
3320 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3322 lstrcpyA(path, PROG_FILES_DIR);
3323 lstrcatA(path, "\\msitest");
3324 CreateDirectoryA(path, NULL);
3326 lstrcatA(path, "\\maximus");
3327 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3328 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3330 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3331 CloseHandle(file);
3333 r = MsiInstallProductA(msifile, NULL);
3334 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3336 skip("Not enough rights to perform tests\n");
3337 goto error;
3339 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3340 ok(file_matches(path), "Expected file to be overwritten\n");
3341 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3342 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3344 error:
3345 /* Delete the files in the temp (current) folder */
3346 DeleteFileA("msitest\\maximus");
3347 RemoveDirectoryA("msitest");
3348 DeleteFileA(msifile);
3351 static void test_readonlyfile_cab(void)
3353 UINT r;
3354 DWORD size;
3355 HANDLE file;
3356 CHAR path[MAX_PATH];
3357 CHAR buf[16];
3359 if (is_process_limited())
3361 skip("process is limited\n");
3362 return;
3365 CreateDirectoryA("msitest", NULL);
3366 create_file("maximus", 500);
3367 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3368 DeleteFileA("maximus");
3370 create_database(msifile, rofc_tables, sizeof(rofc_tables) / sizeof(msi_table));
3372 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3374 lstrcpyA(path, PROG_FILES_DIR);
3375 lstrcatA(path, "\\msitest");
3376 CreateDirectoryA(path, NULL);
3378 lstrcatA(path, "\\maximus");
3379 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3380 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3382 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3383 CloseHandle(file);
3385 r = MsiInstallProductA(msifile, NULL);
3386 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3388 skip("Not enough rights to perform tests\n");
3389 goto error;
3391 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3393 memset( buf, 0, sizeof(buf) );
3394 if ((file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3395 NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
3397 ReadFile(file, buf, sizeof(buf) - 1, &size, NULL);
3398 CloseHandle(file);
3400 ok(!memcmp( buf, "maximus", sizeof("maximus")-1 ), "Expected file to be overwritten, got '%s'\n", buf);
3401 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3402 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3404 error:
3405 /* Delete the files in the temp (current) folder */
3406 delete_cab_files();
3407 DeleteFileA("msitest\\maximus");
3408 RemoveDirectoryA("msitest");
3409 DeleteFileA(msifile);
3412 static void test_setdirproperty(void)
3414 UINT r;
3416 if (is_process_limited())
3418 skip("process is limited\n");
3419 return;
3422 CreateDirectoryA("msitest", NULL);
3423 create_file("msitest\\maximus", 500);
3424 create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
3426 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3428 r = MsiInstallProductA(msifile, NULL);
3429 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3431 skip("Not enough rights to perform tests\n");
3432 goto error;
3434 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3435 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
3436 ok(delete_cf("msitest", FALSE), "Directory not created\n");
3438 error:
3439 /* Delete the files in the temp (current) folder */
3440 DeleteFileA(msifile);
3441 DeleteFileA("msitest\\maximus");
3442 RemoveDirectoryA("msitest");
3445 static void test_cabisextracted(void)
3447 UINT r;
3449 if (is_process_limited())
3451 skip("process is limited\n");
3452 return;
3455 CreateDirectoryA("msitest", NULL);
3456 create_file("msitest\\gaius", 500);
3457 create_file("maximus", 500);
3458 create_file("augustus", 500);
3459 create_file("caesar", 500);
3461 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3462 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3463 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3465 create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
3467 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3469 r = MsiInstallProductA(msifile, NULL);
3470 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3472 skip("Not enough rights to perform tests\n");
3473 goto error;
3475 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3476 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3477 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3478 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3479 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
3480 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3482 error:
3483 /* Delete the files in the temp (current) folder */
3484 delete_cab_files();
3485 DeleteFileA(msifile);
3486 DeleteFileA("maximus");
3487 DeleteFileA("augustus");
3488 DeleteFileA("caesar");
3489 DeleteFileA("msitest\\gaius");
3490 RemoveDirectoryA("msitest");
3493 static BOOL file_exists(LPCSTR file)
3495 return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES;
3498 static BOOL pf_exists(LPCSTR file)
3500 CHAR path[MAX_PATH];
3502 lstrcpyA(path, PROG_FILES_DIR);
3503 lstrcatA(path, "\\");
3504 lstrcatA(path, file);
3506 return file_exists(path);
3509 static void delete_pfmsitest_files(void)
3511 SHFILEOPSTRUCTA shfl;
3512 CHAR path[MAX_PATH+11];
3514 lstrcpyA(path, PROG_FILES_DIR);
3515 lstrcatA(path, "\\msitest\\*");
3516 path[strlen(path) + 1] = '\0';
3518 shfl.hwnd = NULL;
3519 shfl.wFunc = FO_DELETE;
3520 shfl.pFrom = path;
3521 shfl.pTo = NULL;
3522 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT | FOF_NOERRORUI;
3524 SHFileOperationA(&shfl);
3526 lstrcpyA(path, PROG_FILES_DIR);
3527 lstrcatA(path, "\\msitest");
3528 RemoveDirectoryA(path);
3531 static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
3533 MSIHANDLE hview = 0;
3534 UINT r;
3536 r = MsiDatabaseOpenViewA(hdb, query, &hview);
3537 if(r != ERROR_SUCCESS)
3538 return r;
3540 r = MsiViewExecute(hview, hrec);
3541 if(r == ERROR_SUCCESS)
3542 r = MsiViewClose(hview);
3543 MsiCloseHandle(hview);
3544 return r;
3547 static void set_transform_summary_info(void)
3549 UINT r;
3550 MSIHANDLE suminfo = 0;
3552 /* build summary info */
3553 r = MsiGetSummaryInformationA(0, mstfile, 3, &suminfo);
3554 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
3556 r = MsiSummaryInfoSetPropertyA(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
3557 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3559 r = MsiSummaryInfoSetPropertyA(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
3560 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3561 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3562 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
3563 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
3565 r = MsiSummaryInfoSetPropertyA(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
3566 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3568 r = MsiSummaryInfoPersist(suminfo);
3569 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
3571 r = MsiCloseHandle(suminfo);
3572 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
3575 static void generate_transform(void)
3577 MSIHANDLE hdb1, hdb2;
3578 LPCSTR query;
3579 UINT r;
3581 /* start with two identical databases */
3582 CopyFileA(msifile, msifile2, FALSE);
3584 r = MsiOpenDatabaseW(msifile2W, MSIDBOPEN_TRANSACT, &hdb1);
3585 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3587 r = MsiDatabaseCommit(hdb1);
3588 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
3590 r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_READONLY, &hdb2);
3591 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3593 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
3594 r = run_query(hdb1, 0, query);
3595 ok(r == ERROR_SUCCESS, "failed to add property\n");
3597 /* database needs to be committed */
3598 MsiDatabaseCommit(hdb1);
3600 r = MsiDatabaseGenerateTransformA(hdb1, hdb2, mstfile, 0, 0);
3601 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3603 r = MsiCreateTransformSummaryInfoA(hdb2, hdb2, mstfile, 0, 0);
3604 todo_wine ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3606 MsiCloseHandle(hdb1);
3607 MsiCloseHandle(hdb2);
3610 /* data for generating a transform */
3612 /* tables transform names - encoded as they would be in an msi database file */
3613 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
3614 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
3615 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
3617 /* data in each table */
3618 static const char data1[] = /* _StringData */
3619 "propval"; /* all the strings squashed together */
3621 static const WCHAR data2[] = { /* _StringPool */
3622 /* len, refs */
3623 0, 0, /* string 0 '' */
3624 4, 1, /* string 1 'prop' */
3625 3, 1, /* string 2 'val' */
3628 static const WCHAR data3[] = { /* Property */
3629 0x0201, 0x0001, 0x0002,
3632 static const struct {
3633 LPCWSTR name;
3634 const void *data;
3635 DWORD size;
3636 } table_transform_data[] =
3638 { name1, data1, sizeof data1 - 1 },
3639 { name2, data2, sizeof data2 },
3640 { name3, data3, sizeof data3 },
3643 #define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
3645 static void generate_transform_manual(void)
3647 IStorage *stg = NULL;
3648 IStream *stm;
3649 WCHAR name[0x20];
3650 HRESULT r;
3651 DWORD i, count;
3652 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
3654 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
3656 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
3658 r = StgCreateDocfile(name, mode, 0, &stg);
3659 ok(r == S_OK, "failed to create storage\n");
3660 if (!stg)
3661 return;
3663 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
3664 ok(r == S_OK, "failed to set storage type\n");
3666 for (i=0; i<NUM_TRANSFORM_TABLES; i++)
3668 r = IStorage_CreateStream(stg, table_transform_data[i].name,
3669 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3670 if (FAILED(r))
3672 ok(0, "failed to create stream %08x\n", r);
3673 continue;
3676 r = IStream_Write(stm, table_transform_data[i].data,
3677 table_transform_data[i].size, &count);
3678 if (FAILED(r) || count != table_transform_data[i].size)
3679 ok(0, "failed to write stream\n");
3680 IStream_Release(stm);
3683 IStorage_Release(stg);
3685 set_transform_summary_info();
3688 static void test_transformprop(void)
3690 UINT r;
3692 if (is_process_limited())
3694 skip("process is limited\n");
3695 return;
3698 CreateDirectoryA("msitest", NULL);
3699 create_file("msitest\\augustus", 500);
3701 create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
3703 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3705 r = MsiInstallProductA(msifile, NULL);
3706 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3708 skip("Not enough rights to perform tests\n");
3709 goto error;
3711 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3712 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3713 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3715 if (0)
3716 generate_transform();
3717 else
3718 generate_transform_manual();
3720 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
3721 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3722 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3723 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3725 error:
3726 /* Delete the files in the temp (current) folder */
3727 DeleteFileA(msifile);
3728 DeleteFileA(msifile2);
3729 DeleteFileA(mstfile);
3730 DeleteFileA("msitest\\augustus");
3731 RemoveDirectoryA("msitest");
3734 static void test_currentworkingdir(void)
3736 UINT r;
3737 CHAR drive[MAX_PATH], path[MAX_PATH];
3738 LPSTR ptr;
3740 if (is_process_limited())
3742 skip("process is limited\n");
3743 return;
3746 CreateDirectoryA("msitest", NULL);
3747 create_file("msitest\\augustus", 500);
3749 create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
3751 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3753 CreateDirectoryA("diffdir", NULL);
3754 SetCurrentDirectoryA("diffdir");
3756 sprintf(path, "..\\%s", msifile);
3757 r = MsiInstallProductA(path, NULL);
3758 todo_wine
3760 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
3761 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3762 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3765 sprintf(path, "%s\\%s", CURR_DIR, msifile);
3766 r = MsiInstallProductA(path, NULL);
3767 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3769 skip("Not enough rights to perform tests\n");
3770 goto error;
3772 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3773 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3774 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3776 lstrcpyA(drive, CURR_DIR);
3777 drive[2] = '\\';
3778 drive[3] = '\0';
3779 SetCurrentDirectoryA(drive);
3781 lstrcpyA(path, CURR_DIR);
3782 if (path[lstrlenA(path) - 1] != '\\') lstrcatA(path, "\\");
3783 lstrcatA(path, msifile);
3784 ptr = strchr(path, ':');
3785 ptr +=2;
3787 r = MsiInstallProductA(ptr, NULL);
3788 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3789 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3790 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3792 error:
3793 SetCurrentDirectoryA(CURR_DIR);
3794 DeleteFileA(msifile);
3795 DeleteFileA("msitest\\augustus");
3796 RemoveDirectoryA("msitest");
3797 RemoveDirectoryA("diffdir");
3800 static void set_admin_summary_info(const WCHAR *name)
3802 MSIHANDLE db, summary;
3803 UINT r;
3805 r = MsiOpenDatabaseW(name, MSIDBOPEN_DIRECT, &db);
3806 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3808 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
3809 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3811 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
3812 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3814 /* write the summary changes back to the stream */
3815 r = MsiSummaryInfoPersist(summary);
3816 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3818 MsiCloseHandle(summary);
3820 r = MsiDatabaseCommit(db);
3821 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3823 MsiCloseHandle(db);
3826 static void test_admin(void)
3828 UINT r;
3830 CreateDirectoryA("msitest", NULL);
3831 create_file("msitest\\augustus", 500);
3833 create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
3834 set_admin_summary_info(msifileW);
3836 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3838 r = MsiInstallProductA(msifile, NULL);
3839 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3841 skip("Not enough rights to perform tests\n");
3842 goto error;
3844 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3845 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3846 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3847 ok(!DeleteFileA("c:\\msitest\\augustus"), "File installed\n");
3848 ok(!RemoveDirectoryA("c:\\msitest"), "File installed\n");
3850 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
3851 todo_wine
3852 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3853 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3854 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3855 todo_wine
3857 ok(DeleteFileA("c:\\msitest\\augustus"), "File not installed\n");
3858 ok(RemoveDirectoryA("c:\\msitest"), "File not installed\n");
3861 error:
3862 DeleteFileA(msifile);
3863 DeleteFileA("msitest\\augustus");
3864 RemoveDirectoryA("msitest");
3867 static void set_admin_property_stream(LPCSTR file)
3869 IStorage *stg;
3870 IStream *stm;
3871 WCHAR fileW[MAX_PATH];
3872 HRESULT hr;
3873 DWORD count;
3874 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
3876 /* AdminProperties */
3877 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
3878 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',' ',
3879 'M','y','P','r','o','p','=','4','2',0};
3881 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
3883 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
3884 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3885 if (!stg)
3886 return;
3888 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3889 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3891 hr = IStream_Write(stm, data, sizeof(data), &count);
3892 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3894 IStream_Release(stm);
3895 IStorage_Release(stg);
3898 static void test_adminprops(void)
3900 UINT r;
3902 if (is_process_limited())
3904 skip("process is limited\n");
3905 return;
3908 CreateDirectoryA("msitest", NULL);
3909 create_file("msitest\\augustus", 500);
3911 create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
3912 set_admin_summary_info(msifileW);
3913 set_admin_property_stream(msifile);
3915 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3917 r = MsiInstallProductA(msifile, NULL);
3918 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3920 skip("Not enough rights to perform tests\n");
3921 goto error;
3923 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3924 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
3925 ok(delete_pf("msitest", FALSE), "Directory created\n");
3927 error:
3928 DeleteFileA(msifile);
3929 DeleteFileA("msitest\\augustus");
3930 RemoveDirectoryA("msitest");
3933 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
3935 CHAR path[MAX_PATH];
3937 lstrcpyA(path, PROG_FILES_DIR);
3938 lstrcatA(path, "\\");
3939 lstrcatA(path, file);
3941 if (is_file)
3942 create_file_data(path, data, 500);
3943 else
3944 CreateDirectoryA(path, NULL);
3947 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
3949 static void test_missingcab(void)
3951 UINT r;
3953 if (is_process_limited())
3955 skip("process is limited\n");
3956 return;
3959 CreateDirectoryA("msitest", NULL);
3960 create_file("msitest\\augustus", 500);
3961 create_file("maximus", 500);
3962 create_file("tiberius", 500);
3964 create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
3966 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3968 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3969 create_cab_file("test4.cab", MEDIA_SIZE, "tiberius\0");
3971 create_pf("msitest", FALSE);
3972 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
3973 create_pf_data("msitest\\tiberius", "abcdefgh", TRUE);
3975 r = MsiInstallProductA(msifile, NULL);
3976 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3978 skip("Not enough rights to perform tests\n");
3979 goto error;
3981 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3982 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3983 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3984 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3985 ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
3986 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
3987 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
3988 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3990 create_pf("msitest", FALSE);
3991 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
3992 create_pf_data("msitest\\tiberius", "abcdefgh", TRUE);
3993 create_pf("msitest\\gaius", TRUE);
3995 r = MsiInstallProductA(msifile, "GAIUS=1");
3996 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3997 todo_wine
3999 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
4000 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4002 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
4003 ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
4004 ok(delete_pf("msitest\\tiberius", TRUE), "File removed\n");
4005 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
4006 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4008 error:
4009 delete_pf("msitest", FALSE);
4010 DeleteFileA("msitest\\augustus");
4011 RemoveDirectoryA("msitest");
4012 DeleteFileA("maximus");
4013 DeleteFileA("tiberius");
4014 DeleteFileA("test1.cab");
4015 DeleteFileA("test4.cab");
4016 DeleteFileA(msifile);
4019 static void test_sourcefolder(void)
4021 UINT r;
4023 if (is_process_limited())
4025 skip("process is limited\n");
4026 return;
4029 CreateDirectoryA("msitest", NULL);
4030 create_file("augustus", 500);
4032 create_database(msifile, sf_tables, sizeof(sf_tables) / sizeof(msi_table));
4034 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4036 r = MsiInstallProductA(msifile, NULL);
4037 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4039 skip("Not enough rights to perform tests\n");
4040 goto error;
4042 ok(r == ERROR_INSTALL_FAILURE,
4043 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4044 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4045 todo_wine
4047 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4049 RemoveDirectoryA("msitest");
4051 r = MsiInstallProductA(msifile, NULL);
4052 ok(r == ERROR_INSTALL_FAILURE,
4053 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4054 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4055 todo_wine
4057 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4060 error:
4061 DeleteFileA(msifile);
4062 DeleteFileA("augustus");
4065 static void add_custom_dll(void)
4067 MSIHANDLE hdb = 0, record;
4068 UINT res;
4070 res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb);
4071 ok(res == ERROR_SUCCESS, "failed to open db: %u\n", res);
4073 res = run_query(hdb, 0, "CREATE TABLE `Binary` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)");
4074 ok(res == ERROR_SUCCESS, "failed to create Binary table: %u\n", res);
4076 record = MsiCreateRecord(1);
4077 res = MsiRecordSetStreamA(record, 1, customdll);
4078 ok(res == ERROR_SUCCESS, "failed to add %s to stream: %u\n", customdll, res);
4080 res = run_query(hdb, record, "INSERT INTO `Binary` (`Name`, `Data`) VALUES ('custom.dll', ?)");
4081 ok(res == ERROR_SUCCESS, "failed to insert into Binary table: %u\n", res);
4083 res = MsiDatabaseCommit(hdb);
4084 ok(res == ERROR_SUCCESS, "failed to commit database: %u\n", res);
4086 MsiCloseHandle(record);
4087 MsiCloseHandle(hdb);
4090 static INT CALLBACK ok_callback(void *context, UINT message_type, MSIHANDLE record)
4092 if (message_type == INSTALLMESSAGE_USER)
4094 char file[200];
4095 char msg[2000];
4096 DWORD len;
4098 len = sizeof(file);
4099 MsiRecordGetStringA(record, 2, file, &len);
4100 len = sizeof(msg);
4101 MsiRecordGetStringA(record, 5, msg, &len);
4103 todo_wine_if(MsiRecordGetInteger(record, 1))
4104 ok_(file, MsiRecordGetInteger(record, 3)) (MsiRecordGetInteger(record, 4), "%s", msg);
4106 return 1;
4108 return 0;
4111 static void test_customaction1(void)
4113 MSIHANDLE hdb, record;
4114 UINT r;
4116 create_database(msifile, ca1_tables, sizeof(ca1_tables) / sizeof(msi_table));
4117 add_custom_dll();
4119 /* create a test table */
4120 MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb);
4121 run_query(hdb, 0, "CREATE TABLE `Test` (`Name` CHAR(10), `Number` INTEGER, `Data` OBJECT PRIMARY KEY `Name`)");
4122 create_file("unus", 10);
4123 create_file("duo", 10);
4124 record = MsiCreateRecord(1);
4125 MsiRecordSetStreamA(record, 1, "unus");
4126 run_query(hdb, record, "INSERT INTO `Test` (`Name`, `Number`, `Data`) VALUES ('one', 1, ?)");
4127 MsiRecordSetStreamA(record, 1, "duo");
4128 run_query(hdb, record, "INSERT INTO `Test` (`Name`, `Number`, `Data`) VALUES ('two', 2, ?)");
4129 MsiDatabaseCommit(hdb);
4130 MsiCloseHandle(hdb);
4132 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4134 r = MsiInstallProductA(msifile, "MAIN_TEST=1");
4135 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4137 /* Test return values */
4138 r = MsiInstallProductA(msifile, "TEST_RETVAL=0");
4139 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4141 r = MsiInstallProductA(msifile, "TEST_RETVAL=1626"); /* ERROR_FUNCTION_NOT_CALLED*/
4142 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4144 r = MsiInstallProductA(msifile, "TEST_RETVAL=1602");
4145 ok(r == ERROR_INSTALL_USEREXIT, "Expected ERROR_INSTALL_USEREXIT, got %u\n", r);
4147 r = MsiInstallProductA(msifile, "TEST_RETVAL=259"); /* ERROR_NO_MORE_ITEMS */
4148 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4150 /* any other error maps to ERROR_INSTALL_FAILURE */
4151 r = MsiInstallProductA(msifile, "TEST_RETVAL=1");
4152 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4154 DeleteFileA(msifile);
4155 DeleteFileA("unus");
4156 DeleteFileA("duo");
4159 static void test_customaction51(void)
4161 UINT r;
4163 if (is_process_limited())
4165 skip("process is limited\n");
4166 return;
4169 CreateDirectoryA("msitest", NULL);
4170 create_file("msitest\\augustus", 500);
4172 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
4174 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4176 r = MsiInstallProductA(msifile, NULL);
4177 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4179 skip("Not enough rights to perform tests\n");
4180 goto error;
4182 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4183 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4184 ok(delete_pf("msitest", FALSE), "Directory created\n");
4186 error:
4187 DeleteFileA(msifile);
4188 DeleteFileA("msitest\\augustus");
4189 RemoveDirectoryA("msitest");
4192 static void test_installstate(void)
4194 UINT r;
4196 if (is_process_limited())
4198 skip("process is limited\n");
4199 return;
4202 CreateDirectoryA("msitest", NULL);
4203 create_file("msitest\\alpha", 500);
4204 create_file("msitest\\beta", 500);
4205 create_file("msitest\\gamma", 500);
4206 create_file("msitest\\theta", 500);
4207 create_file("msitest\\delta", 500);
4208 create_file("msitest\\epsilon", 500);
4209 create_file("msitest\\zeta", 500);
4210 create_file("msitest\\iota", 500);
4211 create_file("msitest\\eta", 500);
4212 create_file("msitest\\kappa", 500);
4213 create_file("msitest\\lambda", 500);
4214 create_file("msitest\\mu", 500);
4216 create_database(msifile, is_tables, sizeof(is_tables) / sizeof(msi_table));
4218 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4220 r = MsiInstallProductA(msifile, NULL);
4221 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4223 skip("Not enough rights to perform tests\n");
4224 goto error;
4226 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4227 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4228 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4229 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4230 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4231 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4232 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4233 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4234 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4235 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4236 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4237 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4238 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4239 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4241 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
4242 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4243 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4244 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4245 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4246 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4247 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4248 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
4249 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4250 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4251 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
4252 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4253 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4254 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4255 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4257 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
4258 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4259 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4260 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4261 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4262 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4263 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4264 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4265 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4266 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4267 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4268 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4269 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4270 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4271 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4273 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
4274 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4275 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
4276 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4277 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4278 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
4279 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4280 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4281 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4282 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4283 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4284 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4285 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4286 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4287 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4289 error:
4290 DeleteFileA(msifile);
4291 DeleteFileA("msitest\\alpha");
4292 DeleteFileA("msitest\\beta");
4293 DeleteFileA("msitest\\gamma");
4294 DeleteFileA("msitest\\theta");
4295 DeleteFileA("msitest\\delta");
4296 DeleteFileA("msitest\\epsilon");
4297 DeleteFileA("msitest\\zeta");
4298 DeleteFileA("msitest\\iota");
4299 DeleteFileA("msitest\\eta");
4300 DeleteFileA("msitest\\kappa");
4301 DeleteFileA("msitest\\lambda");
4302 DeleteFileA("msitest\\mu");
4303 RemoveDirectoryA("msitest");
4306 static const struct sourcepathmap
4308 BOOL sost; /* shortone\shorttwo */
4309 BOOL solt; /* shortone\longtwo */
4310 BOOL lost; /* longone\shorttwo */
4311 BOOL lolt; /* longone\longtwo */
4312 BOOL soste; /* shortone\shorttwo source exists */
4313 BOOL solte; /* shortone\longtwo source exists */
4314 BOOL loste; /* longone\shorttwo source exists */
4315 BOOL lolte; /* longone\longtwo source exists */
4316 UINT err;
4317 DWORD size;
4318 } spmap[256] =
4320 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4321 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4322 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4323 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4324 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4325 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4326 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4327 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4328 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4329 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4330 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4331 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4332 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4333 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4334 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4335 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4336 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4337 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4338 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4339 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4340 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4341 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4342 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4343 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4344 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4345 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4346 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4347 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4348 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4349 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4350 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4351 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4352 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4353 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4354 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4355 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4356 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4357 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4358 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4359 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4360 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4361 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4362 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4363 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4364 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4365 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4366 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4367 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4368 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4369 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4370 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4371 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4372 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4373 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4374 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4375 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4376 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4377 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4378 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4379 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4380 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4381 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4382 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4383 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4384 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4385 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4386 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4387 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4388 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4389 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4390 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4391 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4392 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4393 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4394 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4395 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4396 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4397 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4398 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4399 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4400 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4401 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4402 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4403 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4404 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4405 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4406 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4407 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4408 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4409 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4410 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4411 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4412 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4413 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4414 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4415 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4416 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4417 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4418 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4419 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4420 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4421 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4422 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4423 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4424 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4425 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4426 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4427 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4428 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4429 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4430 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4431 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4432 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4433 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4434 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4435 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4436 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4437 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4438 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4439 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4440 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4441 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4442 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4443 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4444 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4445 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4446 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4447 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4448 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4449 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4450 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4451 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4452 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4453 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4454 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4455 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4456 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4457 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4458 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4459 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4460 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4461 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4462 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4463 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4464 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4465 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4466 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4467 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4468 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4469 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4470 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4471 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4472 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4473 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4474 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4475 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4476 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4477 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4478 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4479 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4480 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4481 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4482 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4483 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4484 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4485 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4486 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4487 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4488 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4489 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4490 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4491 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4492 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4493 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4494 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4495 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4496 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4497 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4498 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4499 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4500 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4501 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4502 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4503 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4504 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4505 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4506 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4507 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4508 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4509 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4510 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4511 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4512 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4513 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4514 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4515 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4516 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4517 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4518 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4519 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4520 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4521 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4522 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4523 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4524 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4525 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4526 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4527 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4528 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4529 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4530 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4531 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4532 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4533 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4534 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4535 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4536 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4537 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4538 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4539 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4540 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4541 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4542 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4543 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4544 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4545 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4546 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4547 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4548 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4549 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4550 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4551 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4552 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4553 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4554 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4555 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4556 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4557 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4558 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4559 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4560 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4561 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4562 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4563 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4564 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4565 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4566 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4567 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4568 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4569 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4570 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4571 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4572 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4573 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4574 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4575 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4578 static DWORD get_pf_file_size(LPCSTR file)
4580 CHAR path[MAX_PATH];
4581 HANDLE hfile;
4582 DWORD size;
4584 lstrcpyA(path, PROG_FILES_DIR);
4585 lstrcatA(path, "\\");
4586 lstrcatA(path, file);
4588 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
4589 if (hfile == INVALID_HANDLE_VALUE)
4590 return INVALID_FILE_SIZE;
4592 size = GetFileSize(hfile, NULL);
4593 CloseHandle(hfile);
4594 return size;
4597 static void test_sourcepath(void)
4599 UINT r, i;
4601 if (!winetest_interactive)
4603 skip("Run in interactive mode to run source path tests.\n");
4604 return;
4607 create_database(msifile, sp_tables, sizeof(sp_tables) / sizeof(msi_table));
4609 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4611 for (i = 0; i < sizeof(spmap) / sizeof(spmap[0]); i++)
4613 if (spmap[i].sost)
4615 CreateDirectoryA("shortone", NULL);
4616 CreateDirectoryA("shortone\\shorttwo", NULL);
4619 if (spmap[i].solt)
4621 CreateDirectoryA("shortone", NULL);
4622 CreateDirectoryA("shortone\\longtwo", NULL);
4625 if (spmap[i].lost)
4627 CreateDirectoryA("longone", NULL);
4628 CreateDirectoryA("longone\\shorttwo", NULL);
4631 if (spmap[i].lolt)
4633 CreateDirectoryA("longone", NULL);
4634 CreateDirectoryA("longone\\longtwo", NULL);
4637 if (spmap[i].soste)
4638 create_file("shortone\\shorttwo\\augustus", 50);
4639 if (spmap[i].solte)
4640 create_file("shortone\\longtwo\\augustus", 100);
4641 if (spmap[i].loste)
4642 create_file("longone\\shorttwo\\augustus", 150);
4643 if (spmap[i].lolte)
4644 create_file("longone\\longtwo\\augustus", 200);
4646 r = MsiInstallProductA(msifile, NULL);
4647 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
4648 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
4649 "%d: Expected %d, got %d\n", i, spmap[i].size,
4650 get_pf_file_size("msitest\\augustus"));
4652 if (r == ERROR_SUCCESS)
4654 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
4655 ok(delete_pf("msitest", FALSE), "%d: Directory not created\n", i);
4657 else
4659 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
4660 todo_wine ok(!delete_pf("msitest", FALSE), "%d: Directory installed\n", i);
4663 DeleteFileA("shortone\\shorttwo\\augustus");
4664 DeleteFileA("shortone\\longtwo\\augustus");
4665 DeleteFileA("longone\\shorttwo\\augustus");
4666 DeleteFileA("longone\\longtwo\\augustus");
4667 RemoveDirectoryA("shortone\\shorttwo");
4668 RemoveDirectoryA("shortone\\longtwo");
4669 RemoveDirectoryA("longone\\shorttwo");
4670 RemoveDirectoryA("longone\\longtwo");
4671 RemoveDirectoryA("shortone");
4672 RemoveDirectoryA("longone");
4675 DeleteFileA(msifile);
4678 static void test_missingcomponent(void)
4680 UINT r;
4682 if (is_process_limited())
4684 skip("process is limited\n");
4685 return;
4688 CreateDirectoryA("msitest", NULL);
4689 create_file("msitest\\hydrogen", 500);
4690 create_file("msitest\\helium", 500);
4691 create_file("msitest\\lithium", 500);
4692 create_file("beryllium", 500);
4694 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
4696 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4698 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
4699 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4701 skip("Not enough rights to perform tests\n");
4702 goto error;
4704 else if (r == ERROR_INSTALL_FAILURE)
4706 win_skip("broken result\n");
4707 goto error;
4709 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4710 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4711 ok(pf_exists("msitest\\helium"), "File not installed\n");
4712 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4713 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
4714 ok(pf_exists("msitest"), "File not installed\n");
4716 r = MsiInstallProductA(msifile, "REMOVE=ALL INSTALLLEVEL=10 PROPVAR=42");
4717 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4718 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
4719 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
4720 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
4721 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
4722 ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
4724 error:
4725 DeleteFileA(msifile);
4726 DeleteFileA("msitest\\hydrogen");
4727 DeleteFileA("msitest\\helium");
4728 DeleteFileA("msitest\\lithium");
4729 DeleteFileA("beryllium");
4730 RemoveDirectoryA("msitest");
4733 static void test_sourcedirprop(void)
4735 UINT r;
4736 CHAR props[MAX_PATH];
4738 if (is_process_limited())
4740 skip("process is limited\n");
4741 return;
4744 CreateDirectoryA("msitest", NULL);
4745 create_file("msitest\\augustus", 500);
4747 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
4749 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4751 r = MsiInstallProductA(msifile, NULL);
4752 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4754 skip("Not enough rights to perform tests\n");
4755 goto error;
4757 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4758 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4759 ok(delete_pf("msitest", FALSE), "Directory created\n");
4761 DeleteFileA("msitest\\augustus");
4762 RemoveDirectoryA("msitest");
4764 CreateDirectoryA("altsource", NULL);
4765 CreateDirectoryA("altsource\\msitest", NULL);
4766 create_file("altsource\\msitest\\augustus", 500);
4768 sprintf(props, "SRCDIR=%s\\altsource\\", CURR_DIR);
4770 r = MsiInstallProductA(msifile, props);
4771 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4772 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4773 ok(delete_pf("msitest", FALSE), "Directory created\n");
4775 DeleteFileA("altsource\\msitest\\augustus");
4776 RemoveDirectoryA("altsource\\msitest");
4777 RemoveDirectoryA("altsource");
4779 error:
4780 DeleteFileA("msitest\\augustus");
4781 RemoveDirectoryA("msitest");
4782 DeleteFileA(msifile);
4785 static void test_adminimage(void)
4787 UINT r;
4789 if (is_process_limited())
4791 skip("process is limited\n");
4792 return;
4795 CreateDirectoryA("msitest", NULL);
4796 CreateDirectoryA("msitest\\first", NULL);
4797 CreateDirectoryA("msitest\\second", NULL);
4798 CreateDirectoryA("msitest\\cabout", NULL);
4799 CreateDirectoryA("msitest\\cabout\\new", NULL);
4800 create_file("msitest\\one.txt", 100);
4801 create_file("msitest\\first\\two.txt", 100);
4802 create_file("msitest\\second\\three.txt", 100);
4803 create_file("msitest\\cabout\\four.txt", 100);
4804 create_file("msitest\\cabout\\new\\five.txt", 100);
4805 create_file("msitest\\filename", 100);
4806 create_file("msitest\\service.exe", 100);
4808 create_database_wordcount(msifile, ai_tables,
4809 sizeof(ai_tables) / sizeof(msi_table),
4810 100, msidbSumInfoSourceTypeAdminImage, ";1033",
4811 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
4813 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4815 r = MsiInstallProductA(msifile, NULL);
4816 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4818 skip("Not enough rights to perform tests\n");
4819 goto error;
4821 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4823 delete_pf_files();
4825 error:
4826 DeleteFileA("msifile");
4827 DeleteFileA("msitest\\cabout\\new\\five.txt");
4828 DeleteFileA("msitest\\cabout\\four.txt");
4829 DeleteFileA("msitest\\second\\three.txt");
4830 DeleteFileA("msitest\\first\\two.txt");
4831 DeleteFileA("msitest\\one.txt");
4832 DeleteFileA("msitest\\service.exe");
4833 DeleteFileA("msitest\\filename");
4834 RemoveDirectoryA("msitest\\cabout\\new");
4835 RemoveDirectoryA("msitest\\cabout");
4836 RemoveDirectoryA("msitest\\second");
4837 RemoveDirectoryA("msitest\\first");
4838 RemoveDirectoryA("msitest");
4841 static void test_propcase(void)
4843 UINT r;
4845 if (is_process_limited())
4847 skip("process is limited\n");
4848 return;
4851 CreateDirectoryA("msitest", NULL);
4852 create_file("msitest\\augustus", 500);
4854 create_database(msifile, pc_tables, sizeof(pc_tables) / sizeof(msi_table));
4856 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4858 r = MsiInstallProductA(msifile, "MyProp=42");
4859 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4861 skip("Not enough rights to perform tests\n");
4862 goto error;
4864 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4865 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4866 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4868 r = MsiInstallProductA(msifile, "Prop1=\"Copyright \"\"My Company\"\" 2015\" MyProp=42");
4869 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4870 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4871 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4873 r = MsiInstallProductA(msifile, "Prop1=\"\"\"install.exe\"\" /Install\" MyProp=\"42\"");
4874 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4875 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4876 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4878 error:
4879 DeleteFileA(msifile);
4880 DeleteFileA("msitest\\augustus");
4881 RemoveDirectoryA("msitest");
4884 static void test_int_widths( void )
4886 static const WCHAR msitestW[] = {'m','s','i','t','e','s','t','.','m','s','i',0};
4887 static const WCHAR msitableW[] = {'m','s','i','t','a','b','l','e','.','i','d','t',0};
4888 static const WCHAR slashW[] = {'\\',0};
4889 static const char int0[] = "int0\ni0\nint0\tint0\n1";
4890 static const char int1[] = "int1\ni1\nint1\tint1\n1";
4891 static const char int2[] = "int2\ni2\nint2\tint2\n1";
4892 static const char int3[] = "int3\ni3\nint3\tint3\n1";
4893 static const char int4[] = "int4\ni4\nint4\tint4\n1";
4894 static const char int5[] = "int5\ni5\nint5\tint5\n1";
4895 static const char int8[] = "int8\ni8\nint8\tint8\n1";
4896 static const struct
4898 const char *data;
4899 unsigned int size;
4900 UINT ret;
4902 tests[] =
4904 { int0, sizeof(int0) - 1, ERROR_SUCCESS },
4905 { int1, sizeof(int1) - 1, ERROR_SUCCESS },
4906 { int2, sizeof(int2) - 1, ERROR_SUCCESS },
4907 { int3, sizeof(int3) - 1, ERROR_FUNCTION_FAILED },
4908 { int4, sizeof(int4) - 1, ERROR_SUCCESS },
4909 { int5, sizeof(int5) - 1, ERROR_FUNCTION_FAILED },
4910 { int8, sizeof(int8) - 1, ERROR_FUNCTION_FAILED }
4912 WCHAR tmpdir[MAX_PATH], msitable[MAX_PATH], msidb[MAX_PATH];
4913 MSIHANDLE db;
4914 UINT r, i;
4916 GetTempPathW(MAX_PATH, tmpdir);
4917 CreateDirectoryW(tmpdir, NULL);
4919 lstrcpyW(msitable, tmpdir);
4920 lstrcatW(msitable, slashW);
4921 lstrcatW(msitable, msitableW);
4923 lstrcpyW(msidb, tmpdir);
4924 lstrcatW(msidb, slashW);
4925 lstrcatW(msidb, msitestW);
4927 r = MsiOpenDatabaseW(msidb, MSIDBOPEN_CREATE, &db);
4928 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4930 for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
4932 DWORD count;
4933 HANDLE handle = CreateFileW(msitable, GENERIC_WRITE, 0, NULL,
4934 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
4935 WriteFile(handle, tests[i].data, tests[i].size, &count, NULL);
4936 CloseHandle(handle);
4938 r = MsiDatabaseImportW(db, tmpdir, msitableW);
4939 ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r);
4941 r = MsiDatabaseCommit(db);
4942 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4943 DeleteFileW(msitable);
4946 MsiCloseHandle(db);
4947 DeleteFileW(msidb);
4948 RemoveDirectoryW(tmpdir);
4951 static void test_shortcut(void)
4953 UINT r;
4954 HRESULT hr;
4956 if (is_process_limited())
4958 skip("process is limited\n");
4959 return;
4962 create_test_files();
4963 create_database(msifile, sc_tables, sizeof(sc_tables) / sizeof(msi_table));
4965 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4967 r = MsiInstallProductA(msifile, NULL);
4968 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4970 skip("Not enough rights to perform tests\n");
4971 goto error;
4973 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4975 hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
4976 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
4978 r = MsiInstallProductA(msifile, NULL);
4979 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4981 CoUninitialize();
4983 hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
4984 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
4986 r = MsiInstallProductA(msifile, NULL);
4987 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4989 CoUninitialize();
4991 while (!delete_pf("msitest\\Shortcut.lnk", TRUE) && GetLastError() == ERROR_SHARING_VIOLATION) Sleep(1000);
4992 delete_pf_files();
4994 error:
4995 delete_test_files();
4996 DeleteFileA(msifile);
4999 static void test_preselected(void)
5001 UINT r;
5003 if (is_process_limited())
5005 skip("process is limited\n");
5006 return;
5009 create_test_files();
5010 create_database(msifile, ps_tables, sizeof(ps_tables) / sizeof(msi_table));
5012 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5014 r = MsiInstallProductA(msifile, "ADDLOCAL=One");
5015 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5017 skip("Not enough rights to perform tests\n");
5018 goto error;
5020 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5022 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
5023 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
5024 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
5025 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
5026 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
5027 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
5028 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
5029 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
5030 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
5031 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5032 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
5033 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5035 r = MsiInstallProductA(msifile, NULL);
5036 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5038 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5039 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5040 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5041 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5042 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5043 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5044 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5045 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5046 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5047 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5048 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5049 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5051 error:
5052 delete_test_files();
5053 DeleteFileA(msifile);
5056 static void test_installed_prop(void)
5058 static const char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}";
5059 UINT r;
5061 if (is_process_limited())
5063 skip("process is limited\n");
5064 return;
5067 create_test_files();
5068 create_database(msifile, ip_tables, sizeof(ip_tables) / sizeof(msi_table));
5070 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5072 r = MsiInstallProductA(msifile, "FULL=1");
5073 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5075 skip("Not enough rights to perform tests\n");
5076 goto error;
5078 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5080 r = MsiInstallProductA(msifile, "FULL=1");
5081 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5083 r = MsiConfigureProductExA(prodcode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, "FULL=1");
5084 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5086 delete_pf_files();
5088 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5089 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5091 error:
5092 delete_test_files();
5093 DeleteFileA(msifile);
5096 static void test_allusers_prop(void)
5098 UINT r;
5100 if (is_process_limited())
5102 skip("process is limited\n");
5103 return;
5106 create_test_files();
5107 create_database(msifile, aup_tables, sizeof(aup_tables) / sizeof(msi_table));
5109 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5111 /* ALLUSERS property unset */
5112 r = MsiInstallProductA(msifile, "FULL=1");
5113 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5115 skip("Not enough rights to perform tests\n");
5116 goto error;
5118 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5120 delete_pf_files();
5122 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5123 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5125 delete_test_files();
5127 create_test_files();
5128 create_database(msifile, aup2_tables, sizeof(aup2_tables) / sizeof(msi_table));
5130 /* ALLUSERS property set to 1 */
5131 r = MsiInstallProductA(msifile, "FULL=1");
5132 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5134 delete_pf_files();
5136 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5137 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5139 delete_test_files();
5141 create_test_files();
5142 create_database(msifile, aup3_tables, sizeof(aup3_tables) / sizeof(msi_table));
5144 /* ALLUSERS property set to 2 */
5145 r = MsiInstallProductA(msifile, "FULL=1");
5146 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5148 delete_pf_files();
5150 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5151 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5153 delete_test_files();
5155 create_test_files();
5156 create_database(msifile, aup4_tables, sizeof(aup4_tables) / sizeof(msi_table));
5158 /* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */
5159 r = MsiInstallProductA(msifile, "FULL=1");
5160 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5162 error:
5163 delete_test_files();
5164 DeleteFileA(msifile);
5167 static const char session_manager[] = "System\\CurrentControlSet\\Control\\Session Manager";
5168 static const char rename_ops[] = "PendingFileRenameOperations";
5170 static void process_pending_renames(HKEY hkey)
5172 char *buf, *src, *dst, *buf2, *buf2ptr;
5173 DWORD size;
5174 LONG ret;
5175 BOOL found = FALSE;
5177 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size);
5178 ok(!ret, "RegQueryValueExA failed %d\n", ret);
5180 buf = HeapAlloc(GetProcessHeap(), 0, size + 1);
5181 buf2ptr = buf2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 1);
5183 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size);
5184 buf[size] = 0;
5185 ok(!ret, "RegQueryValueExA failed %d\n", ret);
5186 if (ret) return;
5188 for (src = buf; *src; src = dst + strlen(dst) + 1)
5190 DWORD flags = MOVEFILE_COPY_ALLOWED;
5191 BOOL fileret;
5193 dst = src + strlen(src) + 1;
5195 if (!strstr(src, "msitest"))
5197 lstrcpyA(buf2ptr, src);
5198 buf2ptr += strlen(src) + 1;
5199 lstrcpyA(buf2ptr, dst);
5200 buf2ptr += strlen(dst) + 1;
5201 continue;
5204 found = TRUE;
5206 if (*dst == '!')
5208 flags |= MOVEFILE_REPLACE_EXISTING;
5209 dst++;
5211 if (src[0] == '\\' && src[1] == '?' && src[2] == '?' && src[3] == '\\') src += 4;
5212 if (*dst)
5214 if (dst[0] == '\\' && dst[1] == '?' && dst[2] == '?' && dst[3] == '\\') dst += 4;
5215 fileret = MoveFileExA(src, dst, flags);
5216 ok(fileret, "Failed to move file %s -> %s (%u)\n", src, dst, GetLastError());
5218 else
5220 fileret = DeleteFileA(src);
5221 ok(fileret || broken(!fileret) /* win2k3 */, "Failed to delete file %s (%u)\n", src, GetLastError());
5225 ok(found, "Expected a 'msitest' entry\n");
5227 if (*buf2)
5228 RegSetValueExA(hkey, rename_ops, 0, REG_MULTI_SZ, (LPBYTE)buf2, buf2ptr + 1 - buf2);
5229 else
5230 RegDeleteValueA(hkey, rename_ops);
5232 HeapFree(GetProcessHeap(), 0, buf);
5233 HeapFree(GetProcessHeap(), 0, buf2);
5236 static BOOL file_matches_data(LPCSTR file, LPCSTR data)
5238 DWORD len, data_len = strlen(data);
5239 HANDLE handle;
5240 char buf[128];
5242 handle = CreateFileA(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
5243 ok(handle != INVALID_HANDLE_VALUE, "failed to open %s (%u)\n", file, GetLastError());
5245 if (ReadFile(handle, buf, sizeof(buf), &len, NULL) && len >= data_len)
5247 CloseHandle(handle);
5248 return !memcmp(buf, data, data_len);
5250 CloseHandle(handle);
5251 return FALSE;
5254 static void test_file_in_use(void)
5256 UINT r;
5257 HANDLE file;
5258 HKEY hkey;
5259 char path[MAX_PATH];
5261 if (is_process_limited())
5263 skip("process is limited\n");
5264 return;
5267 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
5269 CreateDirectoryA("msitest", NULL);
5270 create_file("msitest\\maximus", 500);
5271 create_database(msifile, fiu_tables, sizeof(fiu_tables) / sizeof(msi_table));
5273 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5275 lstrcpyA(path, PROG_FILES_DIR);
5276 lstrcatA(path, "\\msitest");
5277 CreateDirectoryA(path, NULL);
5279 lstrcatA(path, "\\maximus");
5280 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
5282 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
5283 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5285 skip("Not enough rights to perform tests\n");
5286 goto error;
5288 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
5289 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
5290 CloseHandle(file);
5291 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
5293 process_pending_renames(hkey);
5294 RegCloseKey(hkey);
5296 ok(file_matches_data(path, "msitest\\maximus"), "Expected file to match\n");
5297 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
5298 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
5300 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5301 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5303 error:
5304 RegCloseKey(hkey);
5306 delete_pf("msitest\\maximus", TRUE);
5307 delete_pf("msitest", FALSE);
5308 DeleteFileA("msitest\\maximus");
5309 delete_test_files();
5310 DeleteFileA(msifile);
5313 static void test_file_in_use_cab(void)
5315 UINT r;
5316 HANDLE file;
5317 HKEY hkey;
5318 char path[MAX_PATH];
5320 if (is_process_limited())
5322 skip("process is limited\n");
5323 return;
5326 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
5328 CreateDirectoryA("msitest", NULL);
5329 create_file("maximus", 500);
5330 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
5331 DeleteFileA("maximus");
5333 create_database(msifile, fiuc_tables, sizeof(fiuc_tables) / sizeof(msi_table));
5335 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5337 lstrcpyA(path, PROG_FILES_DIR);
5338 lstrcatA(path, "\\msitest");
5339 CreateDirectoryA(path, NULL);
5341 lstrcatA(path, "\\maximus");
5342 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
5344 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
5345 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5347 skip("Not enough rights to perform tests\n");
5348 goto error;
5350 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
5351 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
5352 CloseHandle(file);
5353 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
5355 process_pending_renames(hkey);
5356 RegCloseKey(hkey);
5358 ok(file_matches_data(path, "maximus"), "Expected file to match\n");
5359 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
5360 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
5362 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5363 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5365 error:
5366 RegCloseKey(hkey);
5368 delete_pf("msitest\\maximus", TRUE);
5369 delete_pf("msitest", FALSE);
5370 DeleteFileA("msitest\\maximus");
5371 delete_cab_files();
5372 delete_test_files();
5373 DeleteFileA(msifile);
5376 static void test_feature_override(void)
5378 UINT r;
5379 REGSAM access = KEY_ALL_ACCESS;
5381 if (is_process_limited())
5383 skip("process is limited\n");
5384 return;
5387 create_test_files();
5388 create_file("msitest\\override.txt", 1000);
5389 create_file("msitest\\preselected.txt", 1000);
5390 create_file("msitest\\notpreselected.txt", 1000);
5391 create_database(msifile, fo_tables, sizeof(fo_tables) / sizeof(msi_table));
5393 if (is_wow64)
5394 access |= KEY_WOW64_64KEY;
5396 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5398 r = MsiInstallProductA(msifile, "ADDLOCAL=override");
5399 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5401 skip("Not enough rights to perform tests\n");
5402 goto error;
5404 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5406 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5407 ok(!pf_exists("msitest\\preselected.txt"), "file installed\n");
5408 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5410 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5411 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5413 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5415 r = MsiInstallProductA(msifile, "preselect=1");
5416 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5418 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5419 ok(pf_exists("msitest\\preselected.txt"), "file not installed\n");
5420 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5422 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5423 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5425 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5426 todo_wine {
5427 ok(delete_pf("msitest\\preselected.txt", TRUE), "file removed\n");
5428 ok(delete_pf("msitest", FALSE), "directory removed\n");
5431 r = MsiInstallProductA(msifile, NULL);
5432 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5434 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5435 ok(pf_exists("msitest\\preselected.txt"), "file not installed\n");
5436 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5438 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5439 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5441 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5442 todo_wine {
5443 ok(delete_pf("msitest\\preselected.txt", TRUE), "file removed\n");
5444 ok(delete_pf("msitest", FALSE), "directory removed\n");
5447 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", access);
5449 error:
5450 DeleteFileA("msitest\\override.txt");
5451 DeleteFileA("msitest\\preselected.txt");
5452 DeleteFileA("msitest\\notpreselected.txt");
5453 delete_test_files();
5454 DeleteFileA(msifile);
5457 static void test_icon_table(void)
5459 MSIHANDLE hdb = 0, record;
5460 LPCSTR query;
5461 UINT res;
5462 CHAR path[MAX_PATH];
5463 static const char prodcode[] = "{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}";
5465 if (is_process_limited())
5467 skip("process is limited\n");
5468 return;
5471 create_database(msifile, icon_base_tables, sizeof(icon_base_tables) / sizeof(msi_table));
5473 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5475 res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb);
5476 ok(res == ERROR_SUCCESS, "failed to open db: %d\n", res);
5478 query = "CREATE TABLE `Icon` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)";
5479 res = run_query( hdb, 0, query );
5480 ok(res == ERROR_SUCCESS, "Can't create Icon table: %d\n", res);
5482 create_file("icon.ico", 100);
5483 record = MsiCreateRecord(1);
5484 res = MsiRecordSetStreamA(record, 1, "icon.ico");
5485 ok(res == ERROR_SUCCESS, "Failed to add stream data to record: %d\n", res);
5487 query = "INSERT INTO `Icon` (`Name`, `Data`) VALUES ('testicon', ?)";
5488 res = run_query(hdb, record, query);
5489 ok(res == ERROR_SUCCESS, "Insert into Icon table failed: %d\n", res);
5491 res = MsiCloseHandle(record);
5492 ok(res == ERROR_SUCCESS, "Failed to close record handle: %d\n", res);
5493 DeleteFileA("icon.ico");
5494 res = MsiDatabaseCommit(hdb);
5495 ok(res == ERROR_SUCCESS, "Failed to commit database: %d\n", res);
5496 res = MsiCloseHandle(hdb);
5497 ok(res == ERROR_SUCCESS, "Failed to close database: %d\n", res);
5499 /* per-user */
5500 res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
5501 if (res == ERROR_INSTALL_PACKAGE_REJECTED)
5503 skip("Not enough rights to perform tests\n");
5504 DeleteFileA(msifile);
5505 return;
5507 ok(res == ERROR_SUCCESS, "Failed to do per-user install: %d\n", res);
5509 lstrcpyA(path, APP_DATA_DIR);
5510 lstrcatA(path, "\\");
5511 lstrcatA(path, "Microsoft\\Installer\\");
5512 lstrcatA(path, prodcode);
5513 lstrcatA(path, "\\testicon");
5514 ok(file_exists(path), "Per-user icon file isn't where it's expected (%s)\n", path);
5516 res = MsiInstallProductA(msifile, "REMOVE=ALL");
5517 ok(res == ERROR_SUCCESS, "Failed to uninstall per-user\n");
5518 ok(!file_exists(path), "Per-user icon file not removed (%s)\n", path);
5520 /* system-wide */
5521 res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
5522 ok(res == ERROR_SUCCESS, "Failed to system-wide install: %d\n", res);
5524 lstrcpyA(path, WINDOWS_DIR);
5525 lstrcatA(path, "\\");
5526 lstrcatA(path, "Installer\\");
5527 lstrcatA(path, prodcode);
5528 lstrcatA(path, "\\testicon");
5529 ok(file_exists(path), "System-wide icon file isn't where it's expected (%s)\n", path);
5531 res = MsiInstallProductA(msifile, "REMOVE=ALL");
5532 ok(res == ERROR_SUCCESS, "Failed to uninstall system-wide\n");
5533 ok(!file_exists(path), "System-wide icon file not removed (%s)\n", path);
5535 delete_pfmsitest_files();
5536 DeleteFileA(msifile);
5539 static void test_package_validation(void)
5541 UINT r;
5543 if (is_process_limited())
5545 skip("process is limited\n");
5546 return;
5549 CreateDirectoryA("msitest", NULL);
5550 create_file("msitest\\maximus", 500);
5551 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;1033");
5553 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5555 r = MsiInstallProductA(msifile, NULL);
5556 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5558 skip("Not enough rights to perform tests\n");
5559 goto error;
5561 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5562 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5563 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5565 DeleteFileA(msifile);
5566 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,9999;9999");
5568 r = MsiInstallProductA(msifile, NULL);
5569 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5571 DeleteFileA(msifile);
5572 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,1033;9999");
5574 r = MsiInstallProductA(msifile, NULL);
5575 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5577 DeleteFileA(msifile);
5578 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel,9999;1033");
5580 r = MsiInstallProductA(msifile, NULL);
5581 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5582 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5583 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5585 DeleteFileA(msifile);
5586 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel64,9999;1033");
5588 r = MsiInstallProductA(msifile, NULL);
5589 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5591 DeleteFileA(msifile);
5592 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel32,1033;1033");
5594 r = MsiInstallProductA(msifile, NULL);
5595 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5597 DeleteFileA(msifile);
5598 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "Intel32,9999;1033");
5600 r = MsiInstallProductA(msifile, NULL);
5601 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5603 DeleteFileA(msifile);
5604 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;9999");
5606 r = MsiInstallProductA(msifile, NULL);
5607 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5608 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5609 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5611 if (GetSystemDefaultLangID() == MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ))
5613 DeleteFileA(msifile);
5614 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;9");
5615 r = MsiInstallProductA(msifile, NULL);
5616 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5617 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5618 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5620 DeleteFileA(msifile);
5621 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;1024");
5622 r = MsiInstallProductA(msifile, NULL);
5623 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5624 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5625 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5628 DeleteFileA(msifile);
5629 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel32;0");
5631 r = MsiInstallProductA(msifile, NULL);
5632 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5633 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5634 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5636 if (is_64bit && !is_wow64)
5638 DeleteFileA(msifile);
5639 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5641 r = MsiInstallProductA(msifile, NULL);
5642 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5643 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5644 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5646 DeleteFileA(msifile);
5647 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5649 r = MsiInstallProductA(msifile, NULL);
5650 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
5651 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5652 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5654 DeleteFileA(msifile);
5655 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5657 r = MsiInstallProductA(msifile, NULL);
5658 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5659 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5660 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5662 else if (is_wow64)
5664 DeleteFileA(msifile);
5665 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5667 r = MsiInstallProductA(msifile, NULL);
5668 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5669 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5670 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5672 DeleteFileA(msifile);
5673 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5675 r = MsiInstallProductA(msifile, NULL);
5676 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
5677 ok(!delete_pf_native("msitest\\maximus", TRUE), "file exists\n");
5678 ok(!delete_pf_native("msitest", FALSE), "directory exists\n");
5680 DeleteFileA(msifile);
5681 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5683 r = MsiInstallProductA(msifile, NULL);
5684 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5685 ok(delete_pf_native("msitest\\maximus", TRUE), "file exists\n");
5686 ok(delete_pf_native("msitest", FALSE), "directory exists\n");
5688 else
5690 DeleteFileA(msifile);
5691 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Intel;0");
5693 r = MsiInstallProductA(msifile, NULL);
5694 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5695 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5696 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5698 DeleteFileA(msifile);
5699 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Alpha,Beta,Intel;0");
5701 r = MsiInstallProductA(msifile, NULL);
5702 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5703 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5704 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5706 DeleteFileA(msifile);
5707 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
5709 r = MsiInstallProductA(msifile, NULL);
5710 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5711 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5712 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5714 DeleteFileA(msifile);
5715 create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 200, "x64;0");
5717 r = MsiInstallProductA(msifile, NULL);
5718 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5719 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5720 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5723 error:
5724 /* Delete the files in the temp (current) folder */
5725 DeleteFileA(msifile);
5726 DeleteFileA("msitest\\maximus");
5727 RemoveDirectoryA("msitest");
5730 static void test_upgrade_code(void)
5732 UINT r;
5734 if (is_process_limited())
5736 skip("process is limited\n");
5737 return;
5740 CreateDirectoryA("msitest", NULL);
5741 create_file("msitest\\upgradecode.txt", 1000);
5742 create_database(msifile, uc_tables, sizeof(uc_tables) / sizeof(msi_table));
5744 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5746 r = MsiInstallProductA(msifile, NULL);
5747 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5749 ok(pf_exists("msitest\\upgradecode.txt"), "file not installed\n");
5751 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5752 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5754 ok(!delete_pf("msitest\\upgradecode.txt", TRUE), "file not removed\n");
5755 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5757 DeleteFileA("msitest\\upgradecode.txt");
5758 RemoveDirectoryA("msitest");
5759 DeleteFileA(msifile);
5762 static void test_mixed_package(void)
5764 UINT r;
5765 LONG res;
5766 HKEY hkey;
5767 char value[MAX_PATH];
5768 DWORD size;
5770 if (is_process_limited())
5772 skip("process is limited\n");
5773 return;
5775 if (!is_wow64 && !is_64bit)
5777 skip("this test must be run on 64-bit\n");
5778 return;
5780 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5781 create_database_template(msifile, mixed_tables, sizeof(mixed_tables)/sizeof(msi_table), 200, "x64;1033");
5783 r = MsiInstallProductA(msifile, NULL);
5784 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5786 skip("Not enough rights to perform tests\n");
5787 goto error;
5789 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5791 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5792 ok(!res, "can't open 32-bit component key, got %d\n", res);
5793 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5794 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5795 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5796 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5797 RegCloseKey(hkey);
5799 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5800 ok(!res, "can't open 64-bit component key, got %d\n", res);
5801 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5802 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5803 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5804 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5805 RegCloseKey(hkey);
5807 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5808 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5809 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5810 ok(res == ERROR_SUCCESS, "can't open 32-bit CLSID key, got %d\n", res);
5811 if (res == ERROR_SUCCESS) {
5812 size = sizeof(value);
5813 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5814 ok(!strcmp(value, "winetest32.dll"), "got %s\n", value);
5815 RegCloseKey(hkey);
5818 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5819 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5820 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5821 ok(res == ERROR_SUCCESS, "can't open 64-bit CLSID key, got %d\n", res);
5822 if (res == ERROR_SUCCESS) {
5823 size = sizeof(value);
5824 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5825 ok(!strcmp(value, "winetest64.dll"), "got %s\n", value);
5826 RegCloseKey(hkey);
5829 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5830 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5832 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5833 ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
5835 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5836 ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
5838 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5839 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5840 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5841 ok(res == ERROR_FILE_NOT_FOUND, "32-bit CLSID key not removed\n");
5843 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5844 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5845 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5846 ok(res == ERROR_FILE_NOT_FOUND, "64-bit CLSID key not removed\n");
5848 DeleteFileA( msifile );
5849 create_database_template(msifile, mixed_tables, sizeof(mixed_tables)/sizeof(msi_table), 200, "Intel;1033");
5851 r = MsiInstallProductA(msifile, NULL);
5852 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5854 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5855 ok(!res, "can't open 32-bit component key, got %d\n", res);
5856 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5857 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5858 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5859 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5860 RegCloseKey(hkey);
5862 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5863 ok(!res, "can't open 64-bit component key, got %d\n", res);
5864 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5865 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5866 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5867 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5868 RegCloseKey(hkey);
5870 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5871 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5872 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5873 ok(res == ERROR_SUCCESS, "can't open 32-bit CLSID key, got %d\n", res);
5874 if (res == ERROR_SUCCESS) {
5875 size = sizeof(value);
5876 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5877 ok(!strcmp(value, "winetest32.dll"), "got %s\n", value);
5878 RegCloseKey(hkey);
5881 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5882 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5883 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5884 ok(res == ERROR_SUCCESS, "can't open 64-bit CLSID key, got %d\n", res);
5885 if (res == ERROR_SUCCESS) {
5886 size = sizeof(value);
5887 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5888 ok(!strcmp(value, "winetest64.dll"), "got %s\n", value);
5889 RegCloseKey(hkey);
5892 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5893 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5895 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5896 ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
5898 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5899 ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
5901 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5902 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5903 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5904 ok(res == ERROR_FILE_NOT_FOUND, "32-bit CLSID key not removed\n");
5906 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5907 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5908 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5909 ok(res == ERROR_FILE_NOT_FOUND, "64-bit CLSID key not removed\n");
5911 error:
5912 DeleteFileA( msifile );
5915 static void test_volume_props(void)
5917 UINT r;
5919 if (is_process_limited())
5921 skip("process is limited\n");
5922 return;
5924 CreateDirectoryA("msitest", NULL);
5925 create_file("msitest\\volumeprop.txt", 1000);
5926 create_database(msifile, vp_tables, sizeof(vp_tables)/sizeof(msi_table));
5928 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5930 r = MsiInstallProductA(msifile, NULL);
5931 ok(r == ERROR_SUCCESS, "got %u\n", r);
5933 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5934 ok(r == ERROR_SUCCESS, "got %u\n", r);
5936 DeleteFileA("msitest\\volumeprop.txt");
5937 RemoveDirectoryA("msitest");
5938 DeleteFileA(msifile);
5941 static void test_shared_component(void)
5943 UINT r;
5945 if (is_process_limited())
5947 skip("process is limited\n");
5948 return;
5950 CreateDirectoryA("msitest", NULL);
5951 create_file("msitest\\sharedcomponent.txt", 1000);
5952 create_database_wordcount(msifile, shc_tables, sizeof(shc_tables)/sizeof(shc_tables[0]),
5953 100, 0, ";", "{A8826420-FD72-4E61-9E15-C1944CF4CBE1}");
5954 create_database_wordcount(msifile2, shc2_tables, sizeof(shc2_tables)/sizeof(shc2_tables[0]),
5955 100, 0, ";", "{A8B50B30-0E8A-4ACD-B3CF-1A5DC58B2739}");
5957 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5959 r = MsiInstallProductA(msifile, NULL);
5960 ok(r == ERROR_SUCCESS, "got %u\n", r);
5962 ok(pf_exists("msitest\\sharedcomponent.txt"), "file not installed\n");
5964 r = MsiInstallProductA(msifile2, NULL);
5965 ok(r == ERROR_SUCCESS, "got %u\n", r);
5967 ok(pf_exists("msitest\\sharedcomponent.txt"), "file not installed\n");
5969 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5970 ok(r == ERROR_SUCCESS, "got %u\n", r);
5972 ok(pf_exists("msitest\\sharedcomponent.txt"), "file removed\n");
5974 r = MsiInstallProductA(msifile2, "REMOVE=ALL");
5975 ok(r == ERROR_SUCCESS, "got %u\n", r);
5977 ok(!pf_exists("msitest\\sharedcomponent.txt"), "file not removed\n");
5979 DeleteFileA("msitest\\sharedcomponent.txt");
5980 RemoveDirectoryA("msitest");
5981 DeleteFileA(msifile);
5982 DeleteFileA(msifile2);
5985 static void test_remove_upgrade_code(void)
5987 UINT r;
5988 LONG res;
5989 HKEY hkey;
5990 REGSAM access = KEY_ALL_ACCESS;
5991 DWORD type, size;
5992 char buf[1];
5994 if (is_process_limited())
5996 skip( "process is limited\n" );
5997 return;
5999 if (is_wow64) access |= KEY_WOW64_64KEY;
6001 create_test_files();
6002 create_database( msifile, icon_base_tables, sizeof(icon_base_tables)/sizeof(icon_base_tables[0]) );
6004 MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
6006 r = MsiInstallProductA( msifile, "FULL=1" );
6007 ok(r == ERROR_SUCCESS, "got %u\n", r);
6009 res = RegOpenKeyExA( HKEY_LOCAL_MACHINE,
6010 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2",
6011 0, access, &hkey );
6012 ok( res == ERROR_SUCCESS, "got %d\n", res );
6014 type = 0xdeadbeef;
6015 buf[0] = 0x55;
6016 size = sizeof(buf);
6017 res = RegQueryValueExA( hkey, "94A88FD7F6998CE40A22FB59F6B9C2BB", NULL, &type, (BYTE *)buf, &size );
6018 ok( res == ERROR_SUCCESS, "got %d\n", res );
6019 ok( type == REG_SZ, "got %u\n", type );
6020 ok( size == 1, "got %u\n", size );
6021 ok( !buf[0], "wrong data\n" );
6022 RegCloseKey( hkey );
6024 r = MsiInstallProductA( msifile, "REMOVE=ALL" );
6025 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6027 res = RegOpenKeyExA( HKEY_LOCAL_MACHINE,
6028 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2",
6029 0, access, &hkey );
6030 ok( res == ERROR_FILE_NOT_FOUND, "got %d\n", res );
6032 RemoveDirectoryA( "msitest" );
6033 DeleteFileA( msifile );
6036 static void test_feature_tree(void)
6038 UINT r;
6040 if (is_process_limited())
6042 skip( "process is limited\n" );
6043 return;
6046 create_file( "msitest\\featuretree.txt", 1000 );
6047 create_database( msifile, ft_tables, sizeof(ft_tables)/sizeof(ft_tables[0]) );
6049 MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
6051 r = MsiInstallProductA( msifile, "INSTALLTYPE=\"0\"" );
6052 ok( r == ERROR_INSTALL_FAILURE, "got %u\n", r );
6054 r = MsiInstallProductA( msifile, "INSTALLTYPE=\"1\"" );
6055 ok( r == ERROR_SUCCESS, "got %u\n", r );
6057 r = MsiInstallProductA( msifile, "REMOVE=ALL" );
6058 ok( r == ERROR_SUCCESS, "got %u\n", r );
6060 DeleteFileA( "msitest\\featuretree.txt" );
6061 RemoveDirectoryA( "msitest" );
6062 DeleteFileA( msifile );
6065 static void check_file_matches(const char *filename, const char *text)
6067 char buffer[200];
6068 HANDLE file;
6069 DWORD size;
6071 file = CreateFileA(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
6072 ReadFile(file, buffer, sizeof(buffer), &size, NULL);
6073 ok(size == strlen(text) && !memcmp(buffer, text, size), "got %.*s\n", size, buffer);
6074 CloseHandle(file);
6077 static void test_deferred_action(void)
6079 char path[200], file[200], buffer[200];
6080 UINT r;
6082 GetTempPathA(sizeof(path), path);
6083 GetTempFileNameA(path, "da", 0, file);
6084 sprintf(buffer, "TESTPATH=\"%s\"", file);
6086 create_database(msifile, da_tables, sizeof(da_tables) / sizeof(da_tables[0]));
6087 add_custom_dll();
6089 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6091 r = MsiInstallProductA(msifile, buffer);
6092 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6094 skip("Not enough rights to perform tests\n");
6095 goto error;
6097 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6099 todo_wine
6100 check_file_matches(file, "onetwo");
6102 ok(DeleteFileA(file), "Directory not created\n");
6104 error:
6105 DeleteFileA(msifile);
6108 START_TEST(install)
6110 DWORD len;
6111 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6112 STATEMGRSTATUS status;
6113 BOOL ret = FALSE;
6115 init_functionpointers();
6117 if (pIsWow64Process)
6118 pIsWow64Process(GetCurrentProcess(), &is_wow64);
6120 GetCurrentDirectoryA(MAX_PATH, prev_path);
6121 GetTempPathA(MAX_PATH, temp_path);
6122 SetCurrentDirectoryA(temp_path);
6124 lstrcpyA(CURR_DIR, temp_path);
6125 len = lstrlenA(CURR_DIR);
6127 if(len && (CURR_DIR[len - 1] == '\\'))
6128 CURR_DIR[len - 1] = 0;
6130 ok(get_system_dirs(), "failed to retrieve system dirs\n");
6131 ok(get_user_dirs(), "failed to retrieve user dirs\n");
6133 /* Create a restore point ourselves so we circumvent the multitude of restore points
6134 * that would have been created by all the installation and removal tests.
6136 * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
6137 * creation of restore points.
6139 if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
6141 memset(&status, 0, sizeof(status));
6142 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
6145 /* Create only one log file and don't append. We have to pass something
6146 * for the log mode for this to work. The logfile needs to have an absolute
6147 * path otherwise we still end up with some extra logfiles as some tests
6148 * change the current directory.
6150 lstrcpyA(log_file, temp_path);
6151 lstrcatA(log_file, "\\msitest.log");
6152 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
6154 customdll = load_resource("custom.dll");
6155 MsiSetExternalUIRecord(ok_callback, INSTALLLOGMODE_USER, NULL, NULL);
6157 if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */
6158 test_MsiInstallProduct();
6159 test_MsiSetComponentState();
6160 test_packagecoltypes();
6161 test_continuouscabs();
6162 test_caborder();
6163 test_mixedmedia();
6164 test_samesequence();
6165 test_uiLevelFlags();
6166 test_readonlyfile();
6167 test_readonlyfile_cab();
6168 test_setdirproperty();
6169 test_cabisextracted();
6170 test_transformprop();
6171 test_currentworkingdir();
6172 test_admin();
6173 test_adminprops();
6174 test_missingcab();
6175 test_sourcefolder();
6176 test_customaction1();
6177 test_customaction51();
6178 test_installstate();
6179 test_sourcepath();
6180 test_missingcomponent();
6181 test_sourcedirprop();
6182 test_adminimage();
6183 test_propcase();
6184 test_int_widths();
6185 test_shortcut();
6186 test_preselected();
6187 test_installed_prop();
6188 test_file_in_use();
6189 test_file_in_use_cab();
6190 test_allusers_prop();
6191 test_feature_override();
6192 test_icon_table();
6193 test_package_validation();
6194 test_upgrade_code();
6195 test_mixed_package();
6196 test_volume_props();
6197 test_shared_component();
6198 test_remove_upgrade_code();
6199 test_feature_tree();
6200 test_deferred_action();
6202 DeleteFileA(customdll);
6204 DeleteFileA(log_file);
6206 if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
6208 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
6209 if (ret)
6210 remove_restore_point(status.llSequenceNumber);
6212 FreeLibrary(hsrclient);
6214 SetCurrentDirectoryA(prev_path);