msi: Implement deferral for standard and custom actions.
[wine.git] / dlls / msi / tests / install.c
blobe147df6a3a5922b00f8757d1baee7f00605d3073
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"
38 #include "utils.h"
40 static UINT (WINAPI *pMsiQueryComponentStateA)
41 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*);
42 static UINT (WINAPI *pMsiSourceListEnumSourcesA)
43 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
44 static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
45 (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
47 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
48 static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
49 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
50 static BOOL (WINAPI *pWow64DisableWow64FsRedirection)(void **);
51 static BOOL (WINAPI *pWow64RevertWow64FsRedirection)(void *);
53 static HMODULE hsrclient = 0;
54 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
55 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
57 static BOOL is_wow64;
58 static const BOOL is_64bit = sizeof(void *) > sizeof(int);
60 static const char *msifile = "msitest.msi";
61 static const char *msifile2 = "winetest2.msi";
62 static const char *mstfile = "winetest.mst";
64 static const WCHAR msifileW[] = {'m','s','i','t','e','s','t','.','m','s','i',0};
65 static const WCHAR msifile2W[] = {'w','i','n','e','t','e','s','t','2','.','m','s','i',0};
67 char CURR_DIR[MAX_PATH];
68 char PROG_FILES_DIR[MAX_PATH];
69 char PROG_FILES_DIR_NATIVE[MAX_PATH];
70 char COMMON_FILES_DIR[MAX_PATH];
71 char APP_DATA_DIR[MAX_PATH];
72 char WINDOWS_DIR[MAX_PATH];
74 static const char *customdll;
76 /* msi database data */
78 static const CHAR component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
79 "s72\tS38\ts72\ti2\tS255\tS72\n"
80 "Component\tComponent\n"
81 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
82 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
83 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n"
84 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
85 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
86 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
87 "component\t\tMSITESTDIR\t0\t1\tfile\n";
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";
110 static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
111 "s38\ts72\n"
112 "FeatureComponents\tFeature_\tComponent_\n"
113 "Five\tFive\n"
114 "Four\tFour\n"
115 "One\tOne\n"
116 "Three\tThree\n"
117 "Two\tTwo\n"
118 "feature\tcomponent\n";
120 static const CHAR file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
121 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
122 "File\tFile\n"
123 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
124 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
125 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
126 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
127 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
128 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n";
130 static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
131 "s72\tS255\tI2\n"
132 "InstallExecuteSequence\tAction\n"
133 "AllocateRegistrySpace\tNOT Installed\t1550\n"
134 "CostFinalize\t\t1000\n"
135 "CostInitialize\t\t800\n"
136 "FileCost\t\t900\n"
137 "ResolveSource\t\t950\n"
138 "MoveFiles\t\t1700\n"
139 "InstallFiles\t\t4000\n"
140 "DuplicateFiles\t\t4500\n"
141 "WriteEnvironmentStrings\t\t4550\n"
142 "CreateShortcuts\t\t4600\n"
143 "InstallFinalize\t\t6600\n"
144 "InstallInitialize\t\t1500\n"
145 "InstallValidate\t\t1400\n"
146 "LaunchConditions\t\t100\n"
147 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
149 static const CHAR media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
150 "i2\ti4\tL64\tS255\tS32\tS72\n"
151 "Media\tDiskId\n"
152 "1\t3\t\t\tDISK1\t\n"
153 "2\t5\t\tmsitest.cab\tDISK2\t\n";
155 static const CHAR property_dat[] = "Property\tValue\n"
156 "s72\tl0\n"
157 "Property\tProperty\n"
158 "DefaultUIFont\tDlgFont8\n"
159 "HASUIRUN\t0\n"
160 "INSTALLLEVEL\t3\n"
161 "InstallMode\tTypical\n"
162 "Manufacturer\tWine\n"
163 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
164 "PRIMARYFOLDER\tTARGETDIR\n"
165 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
166 "ProductID\tnone\n"
167 "ProductLanguage\t1033\n"
168 "ProductName\tMSITEST\n"
169 "ProductVersion\t1.1.1\n"
170 "PROMPTROLLBACKCOST\tP\n"
171 "Setup\tSetup\n"
172 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
173 "AdminProperties\tPOSTADMIN\n"
174 "ROOTDRIVE\tC:\\\n"
175 "MSIFASTINSTALL\t1\n";
177 static const CHAR aup_property_dat[] = "Property\tValue\n"
178 "s72\tl0\n"
179 "Property\tProperty\n"
180 "DefaultUIFont\tDlgFont8\n"
181 "HASUIRUN\t0\n"
182 "ALLUSERS\t1\n"
183 "INSTALLLEVEL\t3\n"
184 "InstallMode\tTypical\n"
185 "Manufacturer\tWine\n"
186 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
187 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
188 "ProductID\tnone\n"
189 "ProductLanguage\t1033\n"
190 "ProductName\tMSITEST\n"
191 "ProductVersion\t1.1.1\n"
192 "PROMPTROLLBACKCOST\tP\n"
193 "Setup\tSetup\n"
194 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
195 "AdminProperties\tPOSTADMIN\n"
196 "ROOTDRIVE\tC:\\\n"
197 "MSIFASTINSTALL\t1\n";
199 static const CHAR aup2_property_dat[] = "Property\tValue\n"
200 "s72\tl0\n"
201 "Property\tProperty\n"
202 "DefaultUIFont\tDlgFont8\n"
203 "HASUIRUN\t0\n"
204 "ALLUSERS\t2\n"
205 "INSTALLLEVEL\t3\n"
206 "InstallMode\tTypical\n"
207 "Manufacturer\tWine\n"
208 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
209 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
210 "ProductID\tnone\n"
211 "ProductLanguage\t1033\n"
212 "ProductName\tMSITEST\n"
213 "ProductVersion\t1.1.1\n"
214 "PROMPTROLLBACKCOST\tP\n"
215 "Setup\tSetup\n"
216 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
217 "AdminProperties\tPOSTADMIN\n"
218 "ROOTDRIVE\tC:\\\n"
219 "MSIFASTINSTALL\t1\n";
221 static const CHAR icon_property_dat[] = "Property\tValue\n"
222 "s72\tl0\n"
223 "Property\tProperty\n"
224 "DefaultUIFont\tDlgFont8\n"
225 "HASUIRUN\t0\n"
226 "INSTALLLEVEL\t3\n"
227 "InstallMode\tTypical\n"
228 "Manufacturer\tWine\n"
229 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
230 "ProductCode\t{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}\n"
231 "ProductID\tnone\n"
232 "ProductLanguage\t1033\n"
233 "ProductName\tMSITEST\n"
234 "ProductVersion\t1.1.1\n"
235 "PROMPTROLLBACKCOST\tP\n"
236 "Setup\tSetup\n"
237 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
238 "AdminProperties\tPOSTADMIN\n"
239 "ROOTDRIVE\tC:\\\n"
240 "MSIFASTINSTALL\t1\n";
242 static const CHAR shortcut_dat[] = "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
243 "s72\ts72\tl128\ts72\ts72\tS255\tL255\tI2\tS72\tI2\tI2\tS72\n"
244 "Shortcut\tShortcut\n"
245 "Shortcut\tMSITESTDIR\tShortcut\tcomponent\tShortcut\t\tShortcut\t\t\t\t\t\n";
247 static const CHAR condition_dat[] = "Feature_\tLevel\tCondition\n"
248 "s38\ti2\tS255\n"
249 "Condition\tFeature_\tLevel\n"
250 "One\t4\t1\n";
252 static const CHAR up_property_dat[] = "Property\tValue\n"
253 "s72\tl0\n"
254 "Property\tProperty\n"
255 "DefaultUIFont\tDlgFont8\n"
256 "HASUIRUN\t0\n"
257 "INSTALLLEVEL\t3\n"
258 "InstallMode\tTypical\n"
259 "Manufacturer\tWine\n"
260 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
261 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
262 "ProductID\tnone\n"
263 "ProductLanguage\t1033\n"
264 "ProductName\tMSITEST\n"
265 "ProductVersion\t1.1.1\n"
266 "PROMPTROLLBACKCOST\tP\n"
267 "Setup\tSetup\n"
268 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
269 "AdminProperties\tPOSTADMIN\n"
270 "ROOTDRIVE\tC:\\\n"
271 "RemovePreviousVersions\t1\n"
272 "MSIFASTINSTALL\t1\n";
274 static const CHAR up2_property_dat[] = "Property\tValue\n"
275 "s72\tl0\n"
276 "Property\tProperty\n"
277 "DefaultUIFont\tDlgFont8\n"
278 "HASUIRUN\t0\n"
279 "INSTALLLEVEL\t3\n"
280 "InstallMode\tTypical\n"
281 "Manufacturer\tWine\n"
282 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
283 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
284 "ProductID\tnone\n"
285 "ProductLanguage\t1033\n"
286 "ProductName\tMSITEST\n"
287 "ProductVersion\t1.1.2\n"
288 "PROMPTROLLBACKCOST\tP\n"
289 "Setup\tSetup\n"
290 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
291 "AdminProperties\tPOSTADMIN\n"
292 "ROOTDRIVE\tC:\\\n"
293 "MSIFASTINSTALL\t1\n";
295 static const CHAR up3_property_dat[] = "Property\tValue\n"
296 "s72\tl0\n"
297 "Property\tProperty\n"
298 "DefaultUIFont\tDlgFont8\n"
299 "HASUIRUN\t0\n"
300 "INSTALLLEVEL\t3\n"
301 "InstallMode\tTypical\n"
302 "Manufacturer\tWine\n"
303 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
304 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
305 "ProductID\tnone\n"
306 "ProductLanguage\t1033\n"
307 "ProductName\tMSITEST\n"
308 "ProductVersion\t1.1.2\n"
309 "PROMPTROLLBACKCOST\tP\n"
310 "Setup\tSetup\n"
311 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
312 "AdminProperties\tPOSTADMIN\n"
313 "ROOTDRIVE\tC:\\\n"
314 "RemovePreviousVersions\t1\n"
315 "MSIFASTINSTALL\t1\n";
317 static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
318 "s72\ti2\tl255\tL255\tL0\ts72\n"
319 "Registry\tRegistry\n"
320 "Apples\t1\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
321 "Oranges\t1\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
322 "regdata\t1\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
323 "OrderTest\t1\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
325 /* tables for test_continuouscabs */
326 static const CHAR cc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
327 "s72\tS38\ts72\ti2\tS255\tS72\n"
328 "Component\tComponent\n"
329 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
330 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
331 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
333 static const CHAR cc2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
334 "s72\tS38\ts72\ti2\tS255\tS72\n"
335 "Component\tComponent\n"
336 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
337 "augustus\t\tMSITESTDIR\t0\t0\taugustus\n"
338 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
340 static const CHAR cc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
341 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
342 "Feature\tFeature\n"
343 "feature\t\t\t\t2\t1\tTARGETDIR\t0";
345 static const CHAR cc_feature_comp_dat[] = "Feature_\tComponent_\n"
346 "s38\ts72\n"
347 "FeatureComponents\tFeature_\tComponent_\n"
348 "feature\tmaximus\n"
349 "feature\taugustus\n"
350 "feature\tcaesar";
352 static const CHAR cc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
353 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
354 "File\tFile\n"
355 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
356 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
357 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
359 static const CHAR cc2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
360 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
361 "File\tFile\n"
362 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
363 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
364 "tiberius\tmaximus\ttiberius\t500\t\t\t16384\t3\n"
365 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
367 static const CHAR cc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
368 "i2\ti4\tL64\tS255\tS32\tS72\n"
369 "Media\tDiskId\n"
370 "1\t10\t\ttest1.cab\tDISK1\t\n"
371 "2\t2\t\ttest2.cab\tDISK2\t\n"
372 "3\t12\t\ttest3.cab\tDISK3\t\n";
374 static const CHAR cc3_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
375 "i2\ti4\tL64\tS255\tS32\tS72\n"
376 "Media\tDiskId\n"
377 "1\t10\t\ttest1.cab\tDISK1\t\n"
378 "2\t2\t\ttest2_.cab\tDISK2\t\n"
379 "3\t12\t\ttest3.cab\tDISK3\t\n";
381 static const CHAR co_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\t3";
388 static const CHAR co_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
389 "i2\ti4\tL64\tS255\tS32\tS72\n"
390 "Media\tDiskId\n"
391 "1\t10\t\ttest1.cab\tDISK1\t\n"
392 "2\t2\t\ttest2.cab\tDISK2\t\n"
393 "3\t3\t\ttest3.cab\tDISK3\t\n";
395 static const CHAR co2_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
396 "i2\ti4\tL64\tS255\tS32\tS72\n"
397 "Media\tDiskId\n"
398 "1\t10\t\ttest1.cab\tDISK1\t\n"
399 "2\t12\t\ttest3.cab\tDISK3\t\n"
400 "3\t2\t\ttest2.cab\tDISK2\t\n";
402 static const CHAR mm_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
403 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
404 "File\tFile\n"
405 "maximus\tmaximus\tmaximus\t500\t\t\t512\t1\n"
406 "augustus\taugustus\taugustus\t500\t\t\t512\t2\n"
407 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
409 static const CHAR mm_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
410 "i2\ti4\tL64\tS255\tS32\tS72\n"
411 "Media\tDiskId\n"
412 "1\t3\t\ttest1.cab\tDISK1\t\n";
414 static const CHAR ss_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
415 "i2\ti4\tL64\tS255\tS32\tS72\n"
416 "Media\tDiskId\n"
417 "1\t2\t\ttest1.cab\tDISK1\t\n"
418 "2\t2\t\ttest2.cab\tDISK2\t\n"
419 "3\t12\t\ttest3.cab\tDISK3\t\n";
421 /* tables for test_uiLevelFlags */
422 static const CHAR ui_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
423 "s72\tS38\ts72\ti2\tS255\tS72\n"
424 "Component\tComponent\n"
425 "maximus\t\tMSITESTDIR\t0\tHASUIRUN=1\tmaximus\n"
426 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
427 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
429 static const CHAR ui_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
430 "s72\tS255\tI2\n"
431 "InstallUISequence\tAction\n"
432 "SetUIProperty\t\t5\n"
433 "ExecuteAction\t\t1100\n";
435 static const CHAR ui_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
436 "s72\ti2\tS64\tS0\tS255\n"
437 "CustomAction\tAction\n"
438 "SetUIProperty\t51\tHASUIRUN\t1\t\n";
440 static const CHAR rof_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
441 "s72\tS38\ts72\ti2\tS255\tS72\n"
442 "Component\tComponent\n"
443 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
445 static const CHAR rof_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
446 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
447 "Feature\tFeature\n"
448 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
449 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
451 static const CHAR rof_feature_comp_dat[] = "Feature_\tComponent_\n"
452 "s38\ts72\n"
453 "FeatureComponents\tFeature_\tComponent_\n"
454 "feature\tmaximus\n"
455 "montecristo\tmaximus";
457 static const CHAR rof_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
458 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
459 "File\tFile\n"
460 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
462 static const CHAR rof_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
463 "i2\ti4\tL64\tS255\tS32\tS72\n"
464 "Media\tDiskId\n"
465 "1\t1\t\t\tDISK1\t\n";
467 static const CHAR rofc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
468 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
469 "File\tFile\n"
470 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1";
472 static const CHAR rofc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
473 "i2\ti4\tL64\tS255\tS32\tS72\n"
474 "Media\tDiskId\n"
475 "1\t1\t\ttest1.cab\tDISK1\t\n";
477 static const CHAR sdp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
478 "s72\tS255\tI2\n"
479 "InstallExecuteSequence\tAction\n"
480 "AllocateRegistrySpace\tNOT Installed\t1550\n"
481 "CostFinalize\t\t1000\n"
482 "CostInitialize\t\t800\n"
483 "FileCost\t\t900\n"
484 "InstallFiles\t\t4000\n"
485 "InstallFinalize\t\t6600\n"
486 "InstallInitialize\t\t1500\n"
487 "InstallValidate\t\t1400\n"
488 "LaunchConditions\t\t100\n"
489 "SetDirProperty\t\t950";
491 static const CHAR sdp_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
492 "s72\ti2\tS64\tS0\tS255\n"
493 "CustomAction\tAction\n"
494 "SetDirProperty\t51\tMSITESTDIR\t[CommonFilesFolder]msitest\\\t\n";
496 static const CHAR pv_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
497 "s72\tS255\tI2\n"
498 "InstallExecuteSequence\tAction\n"
499 "LaunchConditions\t\t100\n"
500 "CostInitialize\t\t800\n"
501 "FileCost\t\t900\n"
502 "CostFinalize\t\t1000\n"
503 "InstallValidate\t\t1400\n"
504 "InstallInitialize\t\t1500\n"
505 "InstallFiles\t\t4000\n"
506 "InstallFinalize\t\t6600\n";
508 static const CHAR cie_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
509 "s72\tS38\ts72\ti2\tS255\tS72\n"
510 "Component\tComponent\n"
511 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
512 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
513 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
514 "gaius\t\tMSITESTDIR\t0\t1\tgaius\n";
516 static const CHAR cie_feature_comp_dat[] = "Feature_\tComponent_\n"
517 "s38\ts72\n"
518 "FeatureComponents\tFeature_\tComponent_\n"
519 "feature\tmaximus\n"
520 "feature\taugustus\n"
521 "feature\tcaesar\n"
522 "feature\tgaius";
524 static const CHAR cie_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
525 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
526 "File\tFile\n"
527 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
528 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
529 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12\n"
530 "gaius\tgaius\tgaius\t500\t\t\t8192\t11";
532 static const CHAR cie_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
533 "i2\ti4\tL64\tS255\tS32\tS72\n"
534 "Media\tDiskId\n"
535 "1\t1\t\ttest1.cab\tDISK1\t\n"
536 "2\t2\t\ttest2.cab\tDISK2\t\n"
537 "3\t12\t\ttest3.cab\tDISK3\t\n";
539 static const CHAR ci_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
540 "s72\tS38\ts72\ti2\tS255\tS72\n"
541 "Component\tComponent\n"
542 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n";
544 static const CHAR ci2_feature_comp_dat[] = "Feature_\tComponent_\n"
545 "s38\ts72\n"
546 "FeatureComponents\tFeature_\tComponent_\n"
547 "feature\taugustus";
549 static const CHAR ci2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
550 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
551 "File\tFile\n"
552 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
554 static const CHAR pp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
555 "s72\tS255\tI2\n"
556 "InstallExecuteSequence\tAction\n"
557 "ValidateProductID\t\t700\n"
558 "CostInitialize\t\t800\n"
559 "FileCost\t\t900\n"
560 "CostFinalize\t\t1000\n"
561 "InstallValidate\t\t1400\n"
562 "InstallInitialize\t\t1500\n"
563 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
564 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
565 "RemoveFiles\t\t3500\n"
566 "InstallFiles\t\t4000\n"
567 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
568 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
569 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
570 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
571 "InstallFinalize\t\t6600";
573 static const CHAR tp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
574 "s72\tS38\ts72\ti2\tS255\tS72\n"
575 "Component\tComponent\n"
576 "augustus\t\tMSITESTDIR\t0\tprop=\"val\"\taugustus\n";
578 static const CHAR cwd_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
579 "s72\tS38\ts72\ti2\tS255\tS72\n"
580 "Component\tComponent\n"
581 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
583 static const CHAR adm_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
584 "s72\tS38\ts72\ti2\tS255\tS72\n"
585 "Component\tComponent\n"
586 "augustus\t\tMSITESTDIR\t0\tPOSTADMIN=1\taugustus";
588 static const CHAR adm_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
589 "s72\ti2\tS64\tS0\tS255\n"
590 "CustomAction\tAction\n"
591 "SetPOSTADMIN\t51\tPOSTADMIN\t1\t\n";
593 static const CHAR adm_admin_exec_seq_dat[] = "Action\tCondition\tSequence\n"
594 "s72\tS255\tI2\n"
595 "AdminExecuteSequence\tAction\n"
596 "CostFinalize\t\t1000\n"
597 "CostInitialize\t\t800\n"
598 "FileCost\t\t900\n"
599 "SetPOSTADMIN\t\t950\n"
600 "InstallFiles\t\t4000\n"
601 "InstallFinalize\t\t6600\n"
602 "InstallInitialize\t\t1500\n"
603 "InstallValidate\t\t1400\n"
604 "LaunchConditions\t\t100";
606 static const CHAR amp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
607 "s72\tS38\ts72\ti2\tS255\tS72\n"
608 "Component\tComponent\n"
609 "augustus\t\tMSITESTDIR\t0\tMYPROP=2718 and MyProp=42\taugustus\n";
611 static const CHAR rem_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
612 "s72\tS255\tI2\n"
613 "InstallExecuteSequence\tAction\n"
614 "ValidateProductID\t\t700\n"
615 "CostInitialize\t\t800\n"
616 "FileCost\t\t900\n"
617 "CostFinalize\t\t1000\n"
618 "InstallValidate\t\t1400\n"
619 "InstallInitialize\t\t1500\n"
620 "ProcessComponents\t\t1600\n"
621 "UnpublishFeatures\t\t1800\n"
622 "RemoveFiles\t\t3500\n"
623 "InstallFiles\t\t4000\n"
624 "RegisterProduct\t\t6100\n"
625 "PublishFeatures\t\t6300\n"
626 "PublishProduct\t\t6400\n"
627 "InstallFinalize\t\t6600";
629 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
630 "s72\tS38\ts72\ti2\tS255\tS72\n"
631 "Component\tComponent\n"
632 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
633 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
634 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
635 "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n"
636 "tiberius\t\tMSITESTDIR\t0\t\ttiberius\n";
638 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
639 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
640 "File\tFile\n"
641 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
642 "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
643 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
644 "gaius\tgaius\tgaius\t500\t\t\t16384\t4\n"
645 "tiberius\ttiberius\ttiberius\t500\t\t\t0\t5\n";
647 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
648 "i2\ti4\tL64\tS255\tS32\tS72\n"
649 "Media\tDiskId\n"
650 "1\t1\t\ttest1.cab\tDISK1\t\n"
651 "2\t2\t\ttest2.cab\tDISK2\t\n"
652 "3\t3\t\ttest3.cab\tDISK3\t\n"
653 "4\t4\t\ttest3.cab\tDISK3\t\n"
654 "5\t5\t\ttest4.cab\tDISK4\t\n";
656 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
657 "s72\ti2\ti4\ti4\ti4\ti4\n"
658 "MsiFileHash\tFile_\n"
659 "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
661 static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
662 "s72\tS38\ts72\ti2\tS255\tS72\n"
663 "Component\tComponent\n"
664 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
666 static const CHAR ca1_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
667 "s72\tS255\tI2\n"
668 "InstallExecuteSequence\tAction\n"
669 "CostInitialize\t\t100\n"
670 "FileCost\t\t200\n"
671 "CostFinalize\t\t300\n"
672 "InstallValidate\t\t400\n"
673 "InstallInitialize\t\t500\n"
674 "embednull\t\t600\n"
675 "maintest\tMAIN_TEST\t700\n"
676 "testretval\tTEST_RETVAL\t710\n"
677 "process1\tTEST_PROCESS\t720\n"
678 "process2\tTEST_PROCESS\t721\n"
679 "process_deferred\tTEST_PROCESS\t722\n"
680 "InstallFinalize\t\t800\n";
682 static const CHAR ca1_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
683 "s72\ti2\tS64\tS0\n"
684 "CustomAction\tAction\n"
685 "embednull\t51\tembednullprop\ta[~]b\n"
686 "nested51\t51\tnested\t1\n"
687 "nested1\t1\tcustom.dll\tnested\n"
688 "maintest\t1\tcustom.dll\tmain_test\n"
689 "process1\t1\tcustom.dll\tprocess1\n"
690 "process2\t1\tcustom.dll\tprocess2\n"
691 "process_deferred\t1025\tcustom.dll\tprocess2\n"
692 "testretval\t1\tcustom.dll\ttest_retval\n";
694 static const CHAR ca1_test_seq_dat[] = "Action\tCondition\tSequence\n"
695 "s72\tS255\tI2\n"
696 "TestSequence\tAction\n"
697 "nested1\t\t1\n"
698 "nested51\t\t2\n";
700 static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
701 "s72\tS38\ts72\ti2\tS255\tS72\n"
702 "Component\tComponent\n"
703 "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
705 static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
706 "s72\tS255\tI2\n"
707 "InstallExecuteSequence\tAction\n"
708 "ValidateProductID\t\t700\n"
709 "GoodSetProperty\t\t725\n"
710 "BadSetProperty\t\t750\n"
711 "CostInitialize\t\t800\n"
712 "ResolveSource\t\t810\n"
713 "FileCost\t\t900\n"
714 "SetSourceDir\tSRCDIR\t910\n"
715 "CostFinalize\t\t1000\n"
716 "InstallValidate\t\t1400\n"
717 "InstallInitialize\t\t1500\n"
718 "InstallFiles\t\t4000\n"
719 "InstallFinalize\t\t6600";
721 static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
722 "s72\ti2\tS64\tS0\n"
723 "CustomAction\tAction\n"
724 "GoodSetProperty\t51\tMYPROP\t42\n"
725 "BadSetProperty\t51\t\tMYPROP\n"
726 "SetSourceDir\t51\tSourceDir\t[SRCDIR]\n";
728 static const CHAR is_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
729 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
730 "Feature\tFeature\n"
731 "one\t\t\t\t2\t1\t\t0\n" /* favorLocal */
732 "two\t\t\t\t2\t1\t\t1\n" /* favorSource */
733 "three\t\t\t\t2\t1\t\t4\n" /* favorAdvertise */
734 "four\t\t\t\t2\t0\t\t0"; /* disabled */
736 static const CHAR is_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
737 "s72\tS38\ts72\ti2\tS255\tS72\n"
738 "Component\tComponent\n"
739 "alpha\t\tMSITESTDIR\t0\t\talpha_file\n" /* favorLocal:Local */
740 "beta\t\tMSITESTDIR\t1\t\tbeta_file\n" /* favorLocal:Source */
741 "gamma\t\tMSITESTDIR\t2\t\tgamma_file\n" /* favorLocal:Optional */
742 "theta\t\tMSITESTDIR\t0\t\ttheta_file\n" /* favorSource:Local */
743 "delta\t\tMSITESTDIR\t1\t\tdelta_file\n" /* favorSource:Source */
744 "epsilon\t\tMSITESTDIR\t2\t\tepsilon_file\n" /* favorSource:Optional */
745 "zeta\t\tMSITESTDIR\t0\t\tzeta_file\n" /* favorAdvertise:Local */
746 "iota\t\tMSITESTDIR\t1\t\tiota_file\n" /* favorAdvertise:Source */
747 "eta\t\tMSITESTDIR\t2\t\teta_file\n" /* favorAdvertise:Optional */
748 "kappa\t\tMSITESTDIR\t0\t\tkappa_file\n" /* disabled:Local */
749 "lambda\t\tMSITESTDIR\t1\t\tlambda_file\n" /* disabled:Source */
750 "mu\t\tMSITESTDIR\t2\t\tmu_file\n"; /* disabled:Optional */
752 static const CHAR is_feature_comp_dat[] = "Feature_\tComponent_\n"
753 "s38\ts72\n"
754 "FeatureComponents\tFeature_\tComponent_\n"
755 "one\talpha\n"
756 "one\tbeta\n"
757 "one\tgamma\n"
758 "two\ttheta\n"
759 "two\tdelta\n"
760 "two\tepsilon\n"
761 "three\tzeta\n"
762 "three\tiota\n"
763 "three\teta\n"
764 "four\tkappa\n"
765 "four\tlambda\n"
766 "four\tmu";
768 static const CHAR is_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
769 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
770 "File\tFile\n"
771 "alpha_file\talpha\talpha\t500\t\t\t8192\t1\n"
772 "beta_file\tbeta\tbeta\t500\t\t\t8291\t2\n"
773 "gamma_file\tgamma\tgamma\t500\t\t\t8192\t3\n"
774 "theta_file\ttheta\ttheta\t500\t\t\t8192\t4\n"
775 "delta_file\tdelta\tdelta\t500\t\t\t8192\t5\n"
776 "epsilon_file\tepsilon\tepsilon\t500\t\t\t8192\t6\n"
777 "zeta_file\tzeta\tzeta\t500\t\t\t8192\t7\n"
778 "iota_file\tiota\tiota\t500\t\t\t8192\t8\n"
779 "eta_file\teta\teta\t500\t\t\t8192\t9\n"
780 "kappa_file\tkappa\tkappa\t500\t\t\t8192\t10\n"
781 "lambda_file\tlambda\tlambda\t500\t\t\t8192\t11\n"
782 "mu_file\tmu\tmu\t500\t\t\t8192\t12";
784 static const CHAR is_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
785 "i2\ti4\tL64\tS255\tS32\tS72\n"
786 "Media\tDiskId\n"
787 "1\t12\t\t\tDISK1\t\n";
789 static const CHAR sp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
790 "s72\tS38\ts72\ti2\tS255\tS72\n"
791 "Component\tComponent\n"
792 "augustus\t\tTWODIR\t0\t\taugustus\n";
794 static const CHAR sp_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
795 "s72\tS72\tl255\n"
796 "Directory\tDirectory\n"
797 "TARGETDIR\t\tSourceDir\n"
798 "ProgramFilesFolder\tTARGETDIR\t.\n"
799 "MSITESTDIR\tProgramFilesFolder\tmsitest:.\n"
800 "ONEDIR\tMSITESTDIR\t.:shortone|longone\n"
801 "TWODIR\tONEDIR\t.:shorttwo|longtwo";
803 static const CHAR mcp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
804 "s72\tS38\ts72\ti2\tS255\tS72\n"
805 "Component\tComponent\n"
806 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t2\t\thydrogen\n"
807 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t2\t\thelium\n"
808 "lithium\t{4AF28FFC-71C7-4307-BDE4-B77C5338F56F}\tMSITESTDIR\t2\tPROPVAR=42\tlithium\n";
810 static const CHAR mcp_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
811 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
812 "Feature\tFeature\n"
813 "hydroxyl\t\thydroxyl\thydroxyl\t2\t1\tTARGETDIR\t0\n"
814 "heliox\t\theliox\theliox\t2\t5\tTARGETDIR\t0\n"
815 "lithia\t\tlithia\tlithia\t2\t10\tTARGETDIR\t0";
817 static const CHAR mcp_feature_comp_dat[] = "Feature_\tComponent_\n"
818 "s38\ts72\n"
819 "FeatureComponents\tFeature_\tComponent_\n"
820 "hydroxyl\thydrogen\n"
821 "heliox\thelium\n"
822 "lithia\tlithium";
824 static const CHAR mcp_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
825 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
826 "File\tFile\n"
827 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
828 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
829 "lithium\tlithium\tlithium\t0\t\t\t8192\t1\n"
830 "beryllium\tmissingcomp\tberyllium\t0\t\t\t8192\t1";
832 static const CHAR ai_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
833 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
834 "File\tFile\n"
835 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
836 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
837 "one.txt\tOne\tone.txt\t1000\t\t\t16384\t1\n"
838 "three.txt\tThree\tthree.txt\t1000\t\t\t16384\t3\n"
839 "two.txt\tTwo\ttwo.txt\t1000\t\t\t16384\t2\n"
840 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n";
842 static const CHAR ip_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
843 "s72\tS255\tI2\n"
844 "InstallExecuteSequence\tAction\n"
845 "CostFinalize\t\t1000\n"
846 "ValidateProductID\t\t700\n"
847 "CostInitialize\t\t800\n"
848 "FileCost\t\t900\n"
849 "RemoveFiles\t\t3500\n"
850 "InstallFiles\t\t4000\n"
851 "RegisterUser\t\t6000\n"
852 "RegisterProduct\t\t6100\n"
853 "PublishFeatures\t\t6300\n"
854 "PublishProduct\t\t6400\n"
855 "InstallFinalize\t\t6600\n"
856 "InstallInitialize\t\t1500\n"
857 "ProcessComponents\t\t1600\n"
858 "UnpublishFeatures\t\t1800\n"
859 "InstallValidate\t\t1400\n"
860 "LaunchConditions\t\t100\n"
861 "TestInstalledProp\tInstalled AND NOT REMOVE\t950\n";
863 static const CHAR ip_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
864 "s72\ti2\tS64\tS0\tS255\n"
865 "CustomAction\tAction\n"
866 "TestInstalledProp\t19\t\tTest failed\t\n";
868 static const CHAR aup_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
869 "s72\tS255\tI2\n"
870 "InstallExecuteSequence\tAction\n"
871 "CostFinalize\t\t1000\n"
872 "ValidateProductID\t\t700\n"
873 "CostInitialize\t\t800\n"
874 "FileCost\t\t900\n"
875 "RemoveFiles\t\t3500\n"
876 "InstallFiles\t\t4000\n"
877 "RegisterUser\t\t6000\n"
878 "RegisterProduct\t\t6100\n"
879 "PublishFeatures\t\t6300\n"
880 "PublishProduct\t\t6400\n"
881 "InstallFinalize\t\t6600\n"
882 "InstallInitialize\t\t1500\n"
883 "ProcessComponents\t\t1600\n"
884 "UnpublishFeatures\t\t1800\n"
885 "InstallValidate\t\t1400\n"
886 "LaunchConditions\t\t100\n"
887 "TestAllUsersProp\tALLUSERS AND NOT REMOVE\t50\n";
889 static const CHAR aup2_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
890 "s72\tS255\tI2\n"
891 "InstallExecuteSequence\tAction\n"
892 "CostFinalize\t\t1000\n"
893 "ValidateProductID\t\t700\n"
894 "CostInitialize\t\t800\n"
895 "FileCost\t\t900\n"
896 "RemoveFiles\t\t3500\n"
897 "InstallFiles\t\t4000\n"
898 "RegisterUser\t\t6000\n"
899 "RegisterProduct\t\t6100\n"
900 "PublishFeatures\t\t6300\n"
901 "PublishProduct\t\t6400\n"
902 "InstallFinalize\t\t6600\n"
903 "InstallInitialize\t\t1500\n"
904 "ProcessComponents\t\t1600\n"
905 "UnpublishFeatures\t\t1800\n"
906 "InstallValidate\t\t1400\n"
907 "LaunchConditions\t\t100\n"
908 "TestAllUsersProp\tALLUSERS=2 AND NOT REMOVE\t50\n";
910 static const CHAR aup3_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
911 "s72\tS255\tI2\n"
912 "InstallExecuteSequence\tAction\n"
913 "CostFinalize\t\t1000\n"
914 "ValidateProductID\t\t700\n"
915 "CostInitialize\t\t800\n"
916 "FileCost\t\t900\n"
917 "RemoveFiles\t\t3500\n"
918 "InstallFiles\t\t4000\n"
919 "RegisterUser\t\t6000\n"
920 "RegisterProduct\t\t6100\n"
921 "PublishFeatures\t\t6300\n"
922 "PublishProduct\t\t6400\n"
923 "InstallFinalize\t\t6600\n"
924 "InstallInitialize\t\t1500\n"
925 "ProcessComponents\t\t1600\n"
926 "UnpublishFeatures\t\t1800\n"
927 "InstallValidate\t\t1400\n"
928 "LaunchConditions\t\t100\n"
929 "TestAllUsersProp\tALLUSERS=1 AND NOT REMOVE\t50\n";
931 static const CHAR aup_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
932 "s72\ti2\tS64\tS0\tS255\n"
933 "CustomAction\tAction\n"
934 "TestAllUsersProp\t19\t\tTest failed\t\n";
936 static const CHAR fo_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
937 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
938 "File\tFile\n"
939 "override.txt\toverride\toverride.txt\t1000\t\t\t8192\t1\n"
940 "preselected.txt\tpreselected\tpreselected.txt\t1000\t\t\t8192\t2\n"
941 "notpreselected.txt\tnotpreselected\tnotpreselected.txt\t1000\t\t\t8192\t3\n";
943 static const CHAR fo_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
944 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
945 "Feature\tFeature\n"
946 "override\t\t\toverride feature\t1\t1\tMSITESTDIR\t0\n"
947 "preselected\t\t\tpreselected feature\t1\t1\tMSITESTDIR\t0\n"
948 "notpreselected\t\t\tnotpreselected feature\t1\t1\tMSITESTDIR\t0\n";
950 static const CHAR fo_condition_dat[] = "Feature_\tLevel\tCondition\n"
951 "s38\ti2\tS255\n"
952 "Condition\tFeature_\tLevel\n"
953 "preselected\t0\tPreselected\n"
954 "notpreselected\t0\tNOT Preselected\n";
956 static const CHAR fo_feature_comp_dat[] = "Feature_\tComponent_\n"
957 "s38\ts72\n"
958 "FeatureComponents\tFeature_\tComponent_\n"
959 "override\toverride\n"
960 "preselected\tpreselected\n"
961 "notpreselected\tnotpreselected\n";
963 static const CHAR fo_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
964 "s72\tS38\ts72\ti2\tS255\tS72\n"
965 "Component\tComponent\n"
966 "override\t{0A00FB1D-97B0-4B42-ADF0-BB8913416623}\tMSITESTDIR\t0\t\toverride.txt\n"
967 "preselected\t{44E1DB75-605A-43DD-8CF5-CAB17F1BBD60}\tMSITESTDIR\t0\t\tpreselected.txt\n"
968 "notpreselected\t{E1647733-5E75-400A-A92E-5E60B4D4EF9F}\tMSITESTDIR\t0\t\tnotpreselected.txt\n";
970 static const CHAR fo_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
971 "s72\ti2\tS64\tS0\tS255\n"
972 "CustomAction\tAction\n"
973 "SetPreselected\t51\tPreselected\t1\t\n";
975 static const CHAR fo_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
976 "s72\tS255\tI2\n"
977 "InstallExecuteSequence\tAction\n"
978 "LaunchConditions\t\t100\n"
979 "SetPreselected\tpreselect=1\t200\n"
980 "CostInitialize\t\t800\n"
981 "FileCost\t\t900\n"
982 "CostFinalize\t\t1000\n"
983 "InstallValidate\t\t1400\n"
984 "InstallInitialize\t\t1500\n"
985 "ProcessComponents\t\t1600\n"
986 "RemoveFiles\t\t1700\n"
987 "InstallFiles\t\t2000\n"
988 "RegisterProduct\t\t5000\n"
989 "PublishFeatures\t\t5100\n"
990 "PublishProduct\t\t5200\n"
991 "InstallFinalize\t\t6000\n";
993 static const CHAR uc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
994 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
995 "File\tFile\n"
996 "upgradecode.txt\tupgradecode\tupgradecode.txt\t1000\t\t\t8192\t1\n";
998 static const CHAR uc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
999 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1000 "Feature\tFeature\n"
1001 "upgradecode\t\t\tupgradecode feature\t1\t2\tMSITESTDIR\t0\n";
1003 static const CHAR uc_feature_comp_dat[] = "Feature_\tComponent_\n"
1004 "s38\ts72\n"
1005 "FeatureComponents\tFeature_\tComponent_\n"
1006 "upgradecode\tupgradecode\n";
1008 static const CHAR uc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1009 "s72\tS38\ts72\ti2\tS255\tS72\n"
1010 "Component\tComponent\n"
1011 "upgradecode\t{6952B732-2FCB-4E47-976F-989FCBD7EDFB}\tMSITESTDIR\t0\t\tupgradecode.txt\n";
1013 static const CHAR uc_property_dat[] = "Property\tValue\n"
1014 "s72\tl0\n"
1015 "Property\tProperty\n"
1016 "INSTALLLEVEL\t3\n"
1017 "ProductCode\t{E5FB1241-F547-4BA7-A60E-8E75797268D4}\n"
1018 "ProductName\tMSITEST\n"
1019 "ProductVersion\t1.1.1\n"
1020 "UpgradeCode\t#UPGEADECODE#\n"
1021 "MSIFASTINSTALL\t1\n";
1023 static const CHAR uc_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1024 "s72\tS255\tI2\n"
1025 "InstallExecuteSequence\tAction\n"
1026 "LaunchConditions\t\t100\n"
1027 "CostInitialize\t\t200\n"
1028 "FileCost\t\t300\n"
1029 "CostFinalize\t\t400\n"
1030 "InstallInitialize\t\t500\n"
1031 "ProcessComponents\t\t600\n"
1032 "InstallValidate\t\t700\n"
1033 "RemoveFiles\t\t800\n"
1034 "InstallFiles\t\t900\n"
1035 "RegisterProduct\t\t1000\n"
1036 "PublishFeatures\t\t1100\n"
1037 "PublishProduct\t\t1200\n"
1038 "InstallFinalize\t\t1300\n";
1040 static const char mixed_feature_dat[] =
1041 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1042 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1043 "Feature\tFeature\n"
1044 "feature1\t\t\t\t1\t2\tMSITESTDIR\t0\n"
1045 "feature2\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1047 static const char mixed_feature_comp_dat[] =
1048 "Feature_\tComponent_\n"
1049 "s38\ts72\n"
1050 "FeatureComponents\tFeature_\tComponent_\n"
1051 "feature1\tcomp1\n"
1052 "feature2\tcomp2\n";
1054 static const char mixed_component_dat[] =
1055 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1056 "s72\tS38\ts72\ti2\tS255\tS72\n"
1057 "Component\tComponent\n"
1058 "comp1\t{DE9F0EF4-0ED3-495A-8105-060C0EA457B8}\tTARGETDIR\t4\t\tregdata1\n"
1059 "comp2\t{4912DBE7-FC3A-4F91-BB5C-88F5C15C19A5}\tTARGETDIR\t260\t\tregdata2\n";
1061 static const char mixed_registry_dat[] =
1062 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
1063 "s72\ti2\tl255\tL255\tL0\ts72\n"
1064 "Registry\tRegistry\n"
1065 "regdata1\t2\tSOFTWARE\\Wine\\msitest\ttest1\t\tcomp1\n"
1066 "regdata2\t2\tSOFTWARE\\Wine\\msitest\ttest2\t\tcomp2\n"
1067 "regdata3\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\t\tCLSID_Winetest32\tcomp1\n"
1068 "regdata4\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32\t\twinetest32.dll\tcomp1\n"
1069 "regdata5\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\t\tCLSID_Winetest64\tcomp2\n"
1070 "regdata6\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32\t\twinetest64.dll\tcomp2\n";
1072 static const char mixed_install_exec_seq_dat[] =
1073 "Action\tCondition\tSequence\n"
1074 "s72\tS255\tI2\n"
1075 "InstallExecuteSequence\tAction\n"
1076 "LaunchConditions\t\t100\n"
1077 "CostInitialize\t\t200\n"
1078 "FileCost\t\t300\n"
1079 "CostFinalize\t\t400\n"
1080 "InstallValidate\t\t500\n"
1081 "InstallInitialize\t\t600\n"
1082 "ProcessComponents\t\t700\n"
1083 "UnpublishFeatures\t\t800\n"
1084 "RemoveRegistryValues\t\t900\n"
1085 "WriteRegistryValues\t\t1000\n"
1086 "RegisterProduct\t\t1100\n"
1087 "PublishFeatures\t\t1200\n"
1088 "PublishProduct\t\t1300\n"
1089 "InstallFinalize\t\t1400\n";
1091 static const char vp_file_dat[] =
1092 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1093 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1094 "File\tFile\n"
1095 "volumeprop\tcomp\tvolumeprop.txt\t1000\t\t\t8192\t1\n";
1097 static const char vp_feature_dat[] =
1098 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1099 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1100 "Feature\tFeature\n"
1101 "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1103 static const char vp_feature_comp_dat[] =
1104 "Feature_\tComponent_\n"
1105 "s38\ts72\n"
1106 "FeatureComponents\tFeature_\tComponent_\n"
1107 "feature\tcomp\n";
1109 static const char vp_component_dat[] =
1110 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1111 "s72\tS38\ts72\ti2\tS255\tS72\n"
1112 "Component\tComponent\n"
1113 "comp\t{24364AE7-5B7F-496C-AF5A-54893639C567}\tMSITESTDIR\t0\t\tvolumeprop\n";
1115 static const char vp_custom_action_dat[] =
1116 "Action\tType\tSource\tTarget\tISComments\n"
1117 "s72\ti2\tS64\tS0\tS255\n"
1118 "CustomAction\tAction\n"
1119 "TestPrimaryVolumePath0\t19\t\tPrimaryVolumePath set before CostFinalize\t\n"
1120 "TestPrimaryVolumeSpaceAvailable0\t19\t\tPrimaryVolumeSpaceAvailable set before CostFinalize\t\n"
1121 "TestPrimaryVolumeSpaceRequired0\t19\t\tPrimaryVolumeSpaceRequired set before CostFinalize\t\n"
1122 "TestPrimaryVolumeSpaceRemaining0\t19\t\tPrimaryVolumeSpaceRemaining set before CostFinalize\t\n"
1123 "TestPrimaryVolumePath1\t19\t\tPrimaryVolumePath set before InstallValidate\t\n"
1124 "TestPrimaryVolumeSpaceAvailable1\t19\t\tPrimaryVolumeSpaceAvailable not set before InstallValidate\t\n"
1125 "TestPrimaryVolumeSpaceRequired1\t19\t\tPrimaryVolumeSpaceRequired not set before InstallValidate\t\n"
1126 "TestPrimaryVolumeSpaceRemaining1\t19\t\tPrimaryVolumeSpaceRemaining not set before InstallValidate\t\n"
1127 "TestPrimaryVolumePath2\t19\t\tPrimaryVolumePath not set after InstallValidate\t\n"
1128 "TestPrimaryVolumeSpaceAvailable2\t19\t\tPrimaryVolumeSpaceAvailable not set after InstallValidate\t\n"
1129 "TestPrimaryVolumeSpaceRequired2\t19\t\tPrimaryVolumeSpaceRequired not set after InstallValidate\t\n"
1130 "TestPrimaryVolumeSpaceRemaining2\t19\t\tPrimaryVolumeSpaceRemaining not set after InstallValidate\t\n";
1132 static const char vp_install_exec_seq_dat[] =
1133 "Action\tCondition\tSequence\n"
1134 "s72\tS255\tI2\n"
1135 "InstallExecuteSequence\tAction\n"
1136 "LaunchConditions\t\t100\n"
1137 "CostInitialize\t\t200\n"
1138 "FileCost\t\t300\n"
1139 "TestPrimaryVolumePath0\tPrimaryVolumePath AND NOT REMOVE\t400\n"
1140 "TestPrimaryVolumeSpaceAvailable0\tPrimaryVolumeSpaceAvailable AND NOT REMOVE\t500\n"
1141 "TestPrimaryVolumeSpaceRequired0\tPrimaryVolumeSpaceRequired AND NOT REMOVE\t510\n"
1142 "TestPrimaryVolumeSpaceRemaining0\tPrimaryVolumeSpaceRemaining AND NOT REMOVE\t520\n"
1143 "CostFinalize\t\t600\n"
1144 "TestPrimaryVolumePath1\tPrimaryVolumePath AND NOT REMOVE\t600\n"
1145 "TestPrimaryVolumeSpaceAvailable1\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t800\n"
1146 "TestPrimaryVolumeSpaceRequired1\tNOT PrimaryVolumeSpaceRequired AND NOT REMOVE\t810\n"
1147 "TestPrimaryVolumeSpaceRemaining1\tNOT PrimaryVolumeSpaceRemaining AND NOT REMOVE\t820\n"
1148 "InstallValidate\t\t900\n"
1149 "TestPrimaryVolumePath2\tNOT PrimaryVolumePath AND NOT REMOVE\t1000\n"
1150 "TestPrimaryVolumeSpaceAvailable2\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t1100\n"
1151 "TestPrimaryVolumeSpaceRequired2\tNOT PrimaryVolumeSpaceRequired AND NOT REMOVE\t1110\n"
1152 "TestPrimaryVolumeSpaceRemaining2\tNOT PrimaryVolumeSpaceRemaining AND NOT REMOVE\t1120\n"
1153 "InstallInitialize\t\t1200\n"
1154 "ProcessComponents\t\t1300\n"
1155 "RemoveFiles\t\t1400\n"
1156 "InstallFiles\t\t1500\n"
1157 "RegisterProduct\t\t1600\n"
1158 "PublishFeatures\t\t1700\n"
1159 "PublishProduct\t\t1800\n"
1160 "InstallFinalize\t\t1900\n";
1162 static const char shc_property_dat[] =
1163 "Property\tValue\n"
1164 "s72\tl0\n"
1165 "Property\tProperty\n"
1166 "INSTALLLEVEL\t3\n"
1167 "ProductCode\t{5CD99CD0-69C7-409B-9905-82DD743CC840}\n"
1168 "ProductName\tMSITEST\n"
1169 "ProductVersion\t1.1.1\n"
1170 "MSIFASTINSTALL\t1\n";
1172 static const char shc2_property_dat[] =
1173 "Property\tValue\n"
1174 "s72\tl0\n"
1175 "Property\tProperty\n"
1176 "INSTALLLEVEL\t3\n"
1177 "ProductCode\t{4CEFADE5-DAFB-4C21-8EF2-4ED4F139F340}\n"
1178 "ProductName\tMSITEST2\n"
1179 "ProductVersion\t1.1.1\n"
1180 "MSIFASTINSTALL\t1\n";
1182 static const char shc_file_dat[] =
1183 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1184 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1185 "File\tFile\n"
1186 "sharedcomponent\tsharedcomponent\tsharedcomponent.txt\t1000\t\t\t8192\t1\n";
1188 static const char shc_feature_dat[] =
1189 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1190 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1191 "Feature\tFeature\n"
1192 "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1194 static const char shc_feature_comp_dat[] =
1195 "Feature_\tComponent_\n"
1196 "s38\ts72\n"
1197 "FeatureComponents\tFeature_\tComponent_\n"
1198 "feature\tsharedcomponent\n";
1200 static const char shc_component_dat[] =
1201 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1202 "s72\tS38\ts72\ti2\tS255\tS72\n"
1203 "Component\tComponent\n"
1204 "sharedcomponent\t{900A4ACB-DC6F-4795-A04B-81B530183D41}\tMSITESTDIR\t0\t\tsharedcomponent\n";
1206 static const char shc_custom_action_dat[] =
1207 "Action\tType\tSource\tTarget\tISComments\n"
1208 "s72\ti2\tS64\tS0\tS255\n"
1209 "CustomAction\tAction\n"
1210 "TestComponentAction\t19\t\twrong component action on install\t\n";
1212 static const char shc_install_exec_seq_dat[] =
1213 "Action\tCondition\tSequence\n"
1214 "s72\tS255\tI2\n"
1215 "InstallExecuteSequence\tAction\n"
1216 "LaunchConditions\t\t100\n"
1217 "CostInitialize\t\t200\n"
1218 "FileCost\t\t300\n"
1219 "CostFinalize\t\t600\n"
1220 "InstallValidate\t\t900\n"
1221 "InstallInitialize\t\t1200\n"
1222 "ProcessComponents\t\t1300\n"
1223 "RemoveFiles\t\t1400\n"
1224 "InstallFiles\t\t1500\n"
1225 "TestComponentAction\tNOT REMOVE AND ($sharedcomponent <> 3)\t1600\n"
1226 "RegisterProduct\t\t1700\n"
1227 "PublishFeatures\t\t1800\n"
1228 "PublishProduct\t\t1900\n"
1229 "InstallFinalize\t\t2000\n";
1231 static const char ft_file_dat[] =
1232 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1233 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1234 "File\tFile\n"
1235 "featuretree\tcomp\tfeaturetree.txt\t1000\t\t\t8192\t1\n";
1237 static const char ft_comp_dat[] =
1238 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1239 "s72\tS38\ts72\ti2\tS255\tS72\n"
1240 "Component\tComponent\n"
1241 "comp\t{12345678-1234-1234-1234-222222222222}\tTARGETDIR\t0\t\t\n"
1242 "comp2\t{12345678-1234-1234-1234-333333333333}\tTARGETDIR\t0\t\tfeaturetree\n";
1244 static const char ft_feature_dat[] =
1245 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1246 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1247 "Feature\tFeature\n"
1248 "A\t\t\t\t2\t1\t\t0\n"
1249 "C\tB\t\t\t2\t1\t\t0\n"
1250 "B\tA\t\t\t4\t1\t\t0\n"
1251 "D\t\t\t\t2\t1\t\t0\n";
1253 static const char ft_feature_comp_dat[] =
1254 "Feature_\tComponent_\n"
1255 "s38\ts72\n"
1256 "FeatureComponents\tFeature_\tComponent_\n"
1257 "C\tcomp\n"
1258 "D\tcomp2\n";
1260 static const char ft_condition_dat[] =
1261 "Feature_\tLevel\tCondition\n"
1262 "s38\ti2\tS255\n"
1263 "Condition\tFeature_\tLevel\n"
1264 "A\t0\t\"0\"<>INSTALLTYPE\n";
1266 static const char ft_custom_action_dat[] =
1267 "Action\tType\tSource\tTarget\tISComments\n"
1268 "s72\ti2\tS64\tS0\tS255\n"
1269 "CustomAction\tAction\n"
1270 "Run A\t19\t\tA\t\n"
1271 "Run B\t19\t\tB\t\n"
1272 "Run C\t19\t\tC\t\n";
1274 static const char ft_install_exec_seq_dat[] =
1275 "Action\tCondition\tSequence\n"
1276 "s72\tS255\tI2\n"
1277 "InstallExecuteSequence\tAction\n"
1278 "CostInitialize\t\t100\n"
1279 "FileCost\t\t200\n"
1280 "CostFinalize\t\t300\n"
1281 "InstallValidate\t\t400\n"
1282 "InstallInitialize\t\t500\n"
1283 "Run C\t3 = &C AND NOT Installed\t600\n"
1284 "Run B\t3 = &B AND NOT Installed\t700\n"
1285 "Run A\t3 = &A AND NOT Installed\t800\n"
1286 "ProcessComponents\t\t900\n"
1287 "RemoveFiles\t\t1000\n"
1288 "InstallFiles\t\t1100\n"
1289 "RegisterProduct\t\t1200\n"
1290 "PublishFeatures\t\t1300\n"
1291 "PublishProduct\t\t1400\n"
1292 "InstallFinalize\t\t1500\n";
1294 static const char da_custom_action_dat[] =
1295 "Action\tType\tSource\tTarget\n"
1296 "s72\ti2\tS64\tS0\n"
1297 "CustomAction\tAction\n"
1298 "setprop\t51\tdeferred\t[TESTPATH]\n"
1299 "immediate\t1\tcustom.dll\tda_immediate\n"
1300 "deferred\t1025\tcustom.dll\tda_deferred\n";
1302 static const char da_install_exec_seq_dat[] =
1303 "Action\tCondition\tSequence\n"
1304 "s72\tS255\tI2\n"
1305 "InstallExecuteSequence\tAction\n"
1306 "CostInitialize\t\t200\n"
1307 "FileCost\t\t300\n"
1308 "CostFinalize\t\t400\n"
1309 "InstallInitialize\t\t500\n"
1310 "setprop\t\t600\n"
1311 "deferred\t\t700\n"
1312 "immediate\t\t800\n"
1313 "InstallFinalize\t\t1100\n";
1315 static const CHAR x64_directory_dat[] =
1316 "Directory\tDirectory_Parent\tDefaultDir\n"
1317 "s72\tS72\tl255\n"
1318 "Directory\tDirectory\n"
1319 "CABOUTDIR\tMSITESTDIR\tcabout\n"
1320 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
1321 "FIRSTDIR\tMSITESTDIR\tfirst\n"
1322 "MSITESTDIR\tProgramFiles64Folder\tmsitest\n"
1323 "NEWDIR\tCABOUTDIR\tnew\n"
1324 "ProgramFiles64Folder\tTARGETDIR\t.\n"
1325 "TARGETDIR\t\tSourceDir";
1327 static const CHAR sr_install_exec_seq_dat[] =
1328 "Action\tCondition\tSequence\n"
1329 "s72\tS255\tI2\n"
1330 "InstallExecuteSequence\tAction\n"
1331 "CostInitialize\t\t200\n"
1332 "FileCost\t\t300\n"
1333 "CostFinalize\t\t400\n"
1334 "InstallValidate\t\t500\n"
1335 "InstallInitialize\t\t600\n"
1336 "sourcedir_unset\tSourceDir\t700\n"
1337 "ResolveSource\tRESOLVE_SOURCE\t800\n"
1338 "ProcessComponents\tPROCESS_COMPONENTS\t800\n"
1339 "InstallFiles\tINSTALL_FILES\t800\n"
1340 "sourcedir_set\tNOT SourceDir\t900\n"
1341 "InstallFinalize\t\t1000\n";
1343 static const CHAR sr_custom_action_dat[] =
1344 "Action\tType\tSource\tTarget\n"
1345 "s72\ti2\tS64\tS0\n"
1346 "CustomAction\tAction\n"
1347 "sourcedir_unset\t19\t\tSourceDir should not be set\n"
1348 "sourcedir_set\t19\t\tSourceDir should be set\n";
1350 static const msi_table tables[] =
1352 ADD_TABLE(component),
1353 ADD_TABLE(directory),
1354 ADD_TABLE(feature),
1355 ADD_TABLE(feature_comp),
1356 ADD_TABLE(file),
1357 ADD_TABLE(install_exec_seq),
1358 ADD_TABLE(media),
1359 ADD_TABLE(property),
1360 ADD_TABLE(registry),
1363 static const msi_table sc_tables[] =
1365 ADD_TABLE(component),
1366 ADD_TABLE(directory),
1367 ADD_TABLE(feature),
1368 ADD_TABLE(feature_comp),
1369 ADD_TABLE(file),
1370 ADD_TABLE(install_exec_seq),
1371 ADD_TABLE(media),
1372 ADD_TABLE(property),
1373 ADD_TABLE(shortcut)
1376 static const msi_table ps_tables[] =
1378 ADD_TABLE(component),
1379 ADD_TABLE(directory),
1380 ADD_TABLE(feature),
1381 ADD_TABLE(feature_comp),
1382 ADD_TABLE(file),
1383 ADD_TABLE(install_exec_seq),
1384 ADD_TABLE(media),
1385 ADD_TABLE(property),
1386 ADD_TABLE(condition)
1389 static const msi_table up_tables[] =
1391 ADD_TABLE(component),
1392 ADD_TABLE(directory),
1393 ADD_TABLE(feature),
1394 ADD_TABLE(feature_comp),
1395 ADD_TABLE(file),
1396 ADD_TABLE(install_exec_seq),
1397 ADD_TABLE(media),
1398 ADD_TABLE(up_property),
1399 ADD_TABLE(registry),
1402 static const msi_table up2_tables[] =
1404 ADD_TABLE(component),
1405 ADD_TABLE(directory),
1406 ADD_TABLE(feature),
1407 ADD_TABLE(feature_comp),
1408 ADD_TABLE(file),
1409 ADD_TABLE(install_exec_seq),
1410 ADD_TABLE(media),
1411 ADD_TABLE(up2_property),
1412 ADD_TABLE(registry),
1415 static const msi_table up3_tables[] =
1417 ADD_TABLE(component),
1418 ADD_TABLE(directory),
1419 ADD_TABLE(feature),
1420 ADD_TABLE(feature_comp),
1421 ADD_TABLE(file),
1422 ADD_TABLE(install_exec_seq),
1423 ADD_TABLE(media),
1424 ADD_TABLE(up3_property),
1425 ADD_TABLE(registry),
1428 static const msi_table up4_tables[] =
1430 ADD_TABLE(component),
1431 ADD_TABLE(directory),
1432 ADD_TABLE(feature),
1433 ADD_TABLE(feature_comp),
1434 ADD_TABLE(file),
1435 ADD_TABLE(pp_install_exec_seq),
1436 ADD_TABLE(media),
1437 ADD_TABLE(property),
1438 ADD_TABLE(registry),
1441 static const msi_table up5_tables[] =
1443 ADD_TABLE(component),
1444 ADD_TABLE(directory),
1445 ADD_TABLE(feature),
1446 ADD_TABLE(feature_comp),
1447 ADD_TABLE(file),
1448 ADD_TABLE(pp_install_exec_seq),
1449 ADD_TABLE(media),
1450 ADD_TABLE(up_property),
1451 ADD_TABLE(registry),
1454 static const msi_table up6_tables[] =
1456 ADD_TABLE(component),
1457 ADD_TABLE(directory),
1458 ADD_TABLE(feature),
1459 ADD_TABLE(feature_comp),
1460 ADD_TABLE(file),
1461 ADD_TABLE(pp_install_exec_seq),
1462 ADD_TABLE(media),
1463 ADD_TABLE(up2_property),
1464 ADD_TABLE(registry),
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),
1480 static const msi_table cc_tables[] =
1482 ADD_TABLE(cc_component),
1483 ADD_TABLE(directory),
1484 ADD_TABLE(cc_feature),
1485 ADD_TABLE(cc_feature_comp),
1486 ADD_TABLE(cc_file),
1487 ADD_TABLE(install_exec_seq),
1488 ADD_TABLE(cc_media),
1489 ADD_TABLE(property),
1492 static const msi_table cc2_tables[] =
1494 ADD_TABLE(cc2_component),
1495 ADD_TABLE(directory),
1496 ADD_TABLE(cc_feature),
1497 ADD_TABLE(cc_feature_comp),
1498 ADD_TABLE(cc2_file),
1499 ADD_TABLE(install_exec_seq),
1500 ADD_TABLE(cc_media),
1501 ADD_TABLE(property),
1504 static const msi_table cc3_tables[] =
1506 ADD_TABLE(cc_component),
1507 ADD_TABLE(directory),
1508 ADD_TABLE(cc_feature),
1509 ADD_TABLE(cc_feature_comp),
1510 ADD_TABLE(cc_file),
1511 ADD_TABLE(install_exec_seq),
1512 ADD_TABLE(cc3_media),
1513 ADD_TABLE(property),
1516 static const msi_table co_tables[] =
1518 ADD_TABLE(cc_component),
1519 ADD_TABLE(directory),
1520 ADD_TABLE(cc_feature),
1521 ADD_TABLE(cc_feature_comp),
1522 ADD_TABLE(co_file),
1523 ADD_TABLE(install_exec_seq),
1524 ADD_TABLE(co_media),
1525 ADD_TABLE(property),
1528 static const msi_table co2_tables[] =
1530 ADD_TABLE(cc_component),
1531 ADD_TABLE(directory),
1532 ADD_TABLE(cc_feature),
1533 ADD_TABLE(cc_feature_comp),
1534 ADD_TABLE(cc_file),
1535 ADD_TABLE(install_exec_seq),
1536 ADD_TABLE(co2_media),
1537 ADD_TABLE(property),
1540 static const msi_table mm_tables[] =
1542 ADD_TABLE(cc_component),
1543 ADD_TABLE(directory),
1544 ADD_TABLE(cc_feature),
1545 ADD_TABLE(cc_feature_comp),
1546 ADD_TABLE(mm_file),
1547 ADD_TABLE(install_exec_seq),
1548 ADD_TABLE(mm_media),
1549 ADD_TABLE(property),
1552 static const msi_table ss_tables[] =
1554 ADD_TABLE(cc_component),
1555 ADD_TABLE(directory),
1556 ADD_TABLE(cc_feature),
1557 ADD_TABLE(cc_feature_comp),
1558 ADD_TABLE(cc_file),
1559 ADD_TABLE(install_exec_seq),
1560 ADD_TABLE(ss_media),
1561 ADD_TABLE(property),
1564 static const msi_table ui_tables[] =
1566 ADD_TABLE(ui_component),
1567 ADD_TABLE(directory),
1568 ADD_TABLE(cc_feature),
1569 ADD_TABLE(cc_feature_comp),
1570 ADD_TABLE(cc_file),
1571 ADD_TABLE(install_exec_seq),
1572 ADD_TABLE(ui_install_ui_seq),
1573 ADD_TABLE(ui_custom_action),
1574 ADD_TABLE(cc_media),
1575 ADD_TABLE(property),
1578 static const msi_table rof_tables[] =
1580 ADD_TABLE(rof_component),
1581 ADD_TABLE(directory),
1582 ADD_TABLE(rof_feature),
1583 ADD_TABLE(rof_feature_comp),
1584 ADD_TABLE(rof_file),
1585 ADD_TABLE(install_exec_seq),
1586 ADD_TABLE(rof_media),
1587 ADD_TABLE(property),
1590 static const msi_table rofc_tables[] =
1592 ADD_TABLE(rof_component),
1593 ADD_TABLE(directory),
1594 ADD_TABLE(rof_feature),
1595 ADD_TABLE(rof_feature_comp),
1596 ADD_TABLE(rofc_file),
1597 ADD_TABLE(install_exec_seq),
1598 ADD_TABLE(rofc_media),
1599 ADD_TABLE(property),
1602 static const msi_table sdp_tables[] =
1604 ADD_TABLE(rof_component),
1605 ADD_TABLE(directory),
1606 ADD_TABLE(rof_feature),
1607 ADD_TABLE(rof_feature_comp),
1608 ADD_TABLE(rof_file),
1609 ADD_TABLE(sdp_install_exec_seq),
1610 ADD_TABLE(sdp_custom_action),
1611 ADD_TABLE(rof_media),
1612 ADD_TABLE(property),
1615 static const msi_table cie_tables[] =
1617 ADD_TABLE(cie_component),
1618 ADD_TABLE(directory),
1619 ADD_TABLE(cc_feature),
1620 ADD_TABLE(cie_feature_comp),
1621 ADD_TABLE(cie_file),
1622 ADD_TABLE(install_exec_seq),
1623 ADD_TABLE(cie_media),
1624 ADD_TABLE(property),
1627 static const msi_table tp_tables[] =
1629 ADD_TABLE(tp_component),
1630 ADD_TABLE(directory),
1631 ADD_TABLE(rof_feature),
1632 ADD_TABLE(ci2_feature_comp),
1633 ADD_TABLE(ci2_file),
1634 ADD_TABLE(install_exec_seq),
1635 ADD_TABLE(rof_media),
1636 ADD_TABLE(property),
1639 static const msi_table cwd_tables[] =
1641 ADD_TABLE(cwd_component),
1642 ADD_TABLE(directory),
1643 ADD_TABLE(rof_feature),
1644 ADD_TABLE(ci2_feature_comp),
1645 ADD_TABLE(ci2_file),
1646 ADD_TABLE(install_exec_seq),
1647 ADD_TABLE(rof_media),
1648 ADD_TABLE(property),
1651 static const msi_table adm_tables[] =
1653 ADD_TABLE(adm_component),
1654 ADD_TABLE(directory),
1655 ADD_TABLE(rof_feature),
1656 ADD_TABLE(ci2_feature_comp),
1657 ADD_TABLE(ci2_file),
1658 ADD_TABLE(install_exec_seq),
1659 ADD_TABLE(rof_media),
1660 ADD_TABLE(property),
1661 ADD_TABLE(adm_custom_action),
1662 ADD_TABLE(adm_admin_exec_seq),
1665 static const msi_table amp_tables[] =
1667 ADD_TABLE(amp_component),
1668 ADD_TABLE(directory),
1669 ADD_TABLE(rof_feature),
1670 ADD_TABLE(ci2_feature_comp),
1671 ADD_TABLE(ci2_file),
1672 ADD_TABLE(install_exec_seq),
1673 ADD_TABLE(rof_media),
1674 ADD_TABLE(property),
1677 static const msi_table mc_tables[] =
1679 ADD_TABLE(mc_component),
1680 ADD_TABLE(directory),
1681 ADD_TABLE(cc_feature),
1682 ADD_TABLE(cie_feature_comp),
1683 ADD_TABLE(mc_file),
1684 ADD_TABLE(install_exec_seq),
1685 ADD_TABLE(mc_media),
1686 ADD_TABLE(property),
1687 ADD_TABLE(mc_file_hash),
1690 static const msi_table sf_tables[] =
1692 ADD_TABLE(wrv_component),
1693 ADD_TABLE(directory),
1694 ADD_TABLE(rof_feature),
1695 ADD_TABLE(ci2_feature_comp),
1696 ADD_TABLE(ci2_file),
1697 ADD_TABLE(install_exec_seq),
1698 ADD_TABLE(rof_media),
1699 ADD_TABLE(property),
1702 static const msi_table ca1_tables[] =
1704 ADD_TABLE(component),
1705 ADD_TABLE(directory),
1706 ADD_TABLE(feature),
1707 ADD_TABLE(feature_comp),
1708 ADD_TABLE(file),
1709 ADD_TABLE(property),
1710 ADD_TABLE(directory),
1711 ADD_TABLE(ca1_install_exec_seq),
1712 ADD_TABLE(ca1_custom_action),
1713 ADD_TABLE(ca1_test_seq),
1716 static const msi_table ca51_tables[] =
1718 ADD_TABLE(ca51_component),
1719 ADD_TABLE(directory),
1720 ADD_TABLE(rof_feature),
1721 ADD_TABLE(ci2_feature_comp),
1722 ADD_TABLE(ci2_file),
1723 ADD_TABLE(ca51_install_exec_seq),
1724 ADD_TABLE(rof_media),
1725 ADD_TABLE(property),
1726 ADD_TABLE(ca51_custom_action),
1729 static const msi_table is_tables[] =
1731 ADD_TABLE(is_component),
1732 ADD_TABLE(directory),
1733 ADD_TABLE(is_feature),
1734 ADD_TABLE(is_feature_comp),
1735 ADD_TABLE(is_file),
1736 ADD_TABLE(install_exec_seq),
1737 ADD_TABLE(is_media),
1738 ADD_TABLE(property),
1741 static const msi_table sp_tables[] =
1743 ADD_TABLE(sp_component),
1744 ADD_TABLE(sp_directory),
1745 ADD_TABLE(rof_feature),
1746 ADD_TABLE(ci2_feature_comp),
1747 ADD_TABLE(ci2_file),
1748 ADD_TABLE(install_exec_seq),
1749 ADD_TABLE(rof_media),
1750 ADD_TABLE(property),
1753 static const msi_table mcp_tables[] =
1755 ADD_TABLE(mcp_component),
1756 ADD_TABLE(directory),
1757 ADD_TABLE(mcp_feature),
1758 ADD_TABLE(mcp_feature_comp),
1759 ADD_TABLE(mcp_file),
1760 ADD_TABLE(rem_install_exec_seq),
1761 ADD_TABLE(rof_media),
1762 ADD_TABLE(property),
1765 static const msi_table ai_tables[] =
1767 ADD_TABLE(component),
1768 ADD_TABLE(directory),
1769 ADD_TABLE(feature),
1770 ADD_TABLE(feature_comp),
1771 ADD_TABLE(ai_file),
1772 ADD_TABLE(install_exec_seq),
1773 ADD_TABLE(media),
1774 ADD_TABLE(property)
1777 static const msi_table pc_tables[] =
1779 ADD_TABLE(ca51_component),
1780 ADD_TABLE(directory),
1781 ADD_TABLE(rof_feature),
1782 ADD_TABLE(ci2_feature_comp),
1783 ADD_TABLE(ci2_file),
1784 ADD_TABLE(install_exec_seq),
1785 ADD_TABLE(rof_media),
1786 ADD_TABLE(property)
1789 static const msi_table ip_tables[] =
1791 ADD_TABLE(component),
1792 ADD_TABLE(directory),
1793 ADD_TABLE(feature),
1794 ADD_TABLE(feature_comp),
1795 ADD_TABLE(file),
1796 ADD_TABLE(ip_install_exec_seq),
1797 ADD_TABLE(ip_custom_action),
1798 ADD_TABLE(media),
1799 ADD_TABLE(property)
1802 static const msi_table aup_tables[] =
1804 ADD_TABLE(component),
1805 ADD_TABLE(directory),
1806 ADD_TABLE(feature),
1807 ADD_TABLE(feature_comp),
1808 ADD_TABLE(file),
1809 ADD_TABLE(aup_install_exec_seq),
1810 ADD_TABLE(aup_custom_action),
1811 ADD_TABLE(media),
1812 ADD_TABLE(property)
1815 static const msi_table aup2_tables[] =
1817 ADD_TABLE(component),
1818 ADD_TABLE(directory),
1819 ADD_TABLE(feature),
1820 ADD_TABLE(feature_comp),
1821 ADD_TABLE(file),
1822 ADD_TABLE(aup2_install_exec_seq),
1823 ADD_TABLE(aup_custom_action),
1824 ADD_TABLE(media),
1825 ADD_TABLE(aup_property)
1828 static const msi_table aup3_tables[] =
1830 ADD_TABLE(component),
1831 ADD_TABLE(directory),
1832 ADD_TABLE(feature),
1833 ADD_TABLE(feature_comp),
1834 ADD_TABLE(file),
1835 ADD_TABLE(aup2_install_exec_seq),
1836 ADD_TABLE(aup_custom_action),
1837 ADD_TABLE(media),
1838 ADD_TABLE(aup2_property)
1841 static const msi_table aup4_tables[] =
1843 ADD_TABLE(component),
1844 ADD_TABLE(directory),
1845 ADD_TABLE(feature),
1846 ADD_TABLE(feature_comp),
1847 ADD_TABLE(file),
1848 ADD_TABLE(aup3_install_exec_seq),
1849 ADD_TABLE(aup_custom_action),
1850 ADD_TABLE(media),
1851 ADD_TABLE(aup2_property)
1854 static const msi_table fiu_tables[] =
1856 ADD_TABLE(rof_component),
1857 ADD_TABLE(directory),
1858 ADD_TABLE(rof_feature),
1859 ADD_TABLE(rof_feature_comp),
1860 ADD_TABLE(rof_file),
1861 ADD_TABLE(pp_install_exec_seq),
1862 ADD_TABLE(rof_media),
1863 ADD_TABLE(property),
1866 static const msi_table fiuc_tables[] =
1868 ADD_TABLE(rof_component),
1869 ADD_TABLE(directory),
1870 ADD_TABLE(rof_feature),
1871 ADD_TABLE(rof_feature_comp),
1872 ADD_TABLE(rofc_file),
1873 ADD_TABLE(pp_install_exec_seq),
1874 ADD_TABLE(rofc_media),
1875 ADD_TABLE(property),
1878 static const msi_table fo_tables[] =
1880 ADD_TABLE(directory),
1881 ADD_TABLE(fo_file),
1882 ADD_TABLE(fo_component),
1883 ADD_TABLE(fo_feature),
1884 ADD_TABLE(fo_condition),
1885 ADD_TABLE(fo_feature_comp),
1886 ADD_TABLE(fo_custom_action),
1887 ADD_TABLE(fo_install_exec_seq),
1888 ADD_TABLE(media),
1889 ADD_TABLE(property)
1892 static const msi_table icon_base_tables[] =
1894 ADD_TABLE(ci_component),
1895 ADD_TABLE(directory),
1896 ADD_TABLE(rof_feature),
1897 ADD_TABLE(rof_feature_comp),
1898 ADD_TABLE(rof_file),
1899 ADD_TABLE(pp_install_exec_seq),
1900 ADD_TABLE(rof_media),
1901 ADD_TABLE(icon_property),
1904 static const msi_table pv_tables[] =
1906 ADD_TABLE(rof_component),
1907 ADD_TABLE(directory),
1908 ADD_TABLE(rof_feature),
1909 ADD_TABLE(rof_feature_comp),
1910 ADD_TABLE(rof_file),
1911 ADD_TABLE(pv_install_exec_seq),
1912 ADD_TABLE(rof_media),
1913 ADD_TABLE(property)
1916 static const msi_table uc_tables[] =
1918 ADD_TABLE(directory),
1919 ADD_TABLE(uc_component),
1920 ADD_TABLE(uc_feature),
1921 ADD_TABLE(uc_feature_comp),
1922 ADD_TABLE(uc_file),
1923 ADD_TABLE(uc_install_exec_seq),
1924 ADD_TABLE(media),
1925 ADD_TABLE(uc_property)
1928 static const msi_table mixed_tables[] =
1930 ADD_TABLE(directory),
1931 ADD_TABLE(mixed_component),
1932 ADD_TABLE(mixed_feature),
1933 ADD_TABLE(mixed_feature_comp),
1934 ADD_TABLE(mixed_install_exec_seq),
1935 ADD_TABLE(mixed_registry),
1936 ADD_TABLE(media),
1937 ADD_TABLE(property)
1940 static const msi_table vp_tables[] =
1942 ADD_TABLE(directory),
1943 ADD_TABLE(vp_file),
1944 ADD_TABLE(vp_component),
1945 ADD_TABLE(vp_feature),
1946 ADD_TABLE(vp_feature_comp),
1947 ADD_TABLE(vp_custom_action),
1948 ADD_TABLE(vp_install_exec_seq),
1949 ADD_TABLE(media),
1950 ADD_TABLE(property)
1953 static const msi_table shc_tables[] =
1955 ADD_TABLE(media),
1956 ADD_TABLE(directory),
1957 ADD_TABLE(shc_file),
1958 ADD_TABLE(shc_component),
1959 ADD_TABLE(shc_feature),
1960 ADD_TABLE(shc_feature_comp),
1961 ADD_TABLE(shc_custom_action),
1962 ADD_TABLE(shc_install_exec_seq),
1963 ADD_TABLE(shc_property)
1966 static const msi_table shc2_tables[] =
1968 ADD_TABLE(media),
1969 ADD_TABLE(directory),
1970 ADD_TABLE(shc_file),
1971 ADD_TABLE(shc_component),
1972 ADD_TABLE(shc_feature),
1973 ADD_TABLE(shc_feature_comp),
1974 ADD_TABLE(shc_custom_action),
1975 ADD_TABLE(shc_install_exec_seq),
1976 ADD_TABLE(shc2_property)
1979 static const msi_table ft_tables[] =
1981 ADD_TABLE(media),
1982 ADD_TABLE(directory),
1983 ADD_TABLE(ft_file),
1984 ADD_TABLE(ft_comp),
1985 ADD_TABLE(ft_feature),
1986 ADD_TABLE(ft_feature_comp),
1987 ADD_TABLE(ft_condition),
1988 ADD_TABLE(ft_custom_action),
1989 ADD_TABLE(ft_install_exec_seq),
1990 ADD_TABLE(property)
1993 static const msi_table da_tables[] =
1995 ADD_TABLE(media),
1996 ADD_TABLE(directory),
1997 ADD_TABLE(file),
1998 ADD_TABLE(component),
1999 ADD_TABLE(feature),
2000 ADD_TABLE(feature_comp),
2001 ADD_TABLE(property),
2002 ADD_TABLE(da_install_exec_seq),
2003 ADD_TABLE(da_custom_action),
2006 static const msi_table x64_tables[] =
2008 ADD_TABLE(media),
2009 ADD_TABLE(x64_directory),
2010 ADD_TABLE(file),
2011 ADD_TABLE(component),
2012 ADD_TABLE(feature),
2013 ADD_TABLE(feature_comp),
2014 ADD_TABLE(property),
2015 ADD_TABLE(install_exec_seq),
2018 static const msi_table sr_tables[] =
2020 ADD_TABLE(media),
2021 ADD_TABLE(directory),
2022 ADD_TABLE(file),
2023 ADD_TABLE(component),
2024 ADD_TABLE(feature),
2025 ADD_TABLE(feature_comp),
2026 ADD_TABLE(property),
2027 ADD_TABLE(sr_install_exec_seq),
2028 ADD_TABLE(sr_custom_action),
2031 /* cabinet definitions */
2033 /* make the max size large so there is only one cab file */
2034 #define MEDIA_SIZE 0x7FFFFFFF
2035 #define FOLDER_THRESHOLD 900000
2037 /* the FCI callbacks */
2039 static void * CDECL mem_alloc(ULONG cb)
2041 return HeapAlloc(GetProcessHeap(), 0, cb);
2044 static void CDECL mem_free(void *memory)
2046 HeapFree(GetProcessHeap(), 0, memory);
2049 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
2051 sprintf(pccab->szCab, pv, pccab->iCab);
2052 return TRUE;
2055 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
2057 return 0;
2060 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
2061 BOOL fContinuation, void *pv)
2063 return 0;
2066 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
2068 HANDLE handle;
2069 DWORD dwAccess = 0;
2070 DWORD dwShareMode = 0;
2071 DWORD dwCreateDisposition = OPEN_EXISTING;
2073 dwAccess = GENERIC_READ | GENERIC_WRITE;
2074 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
2076 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
2077 dwCreateDisposition = OPEN_EXISTING;
2078 else
2079 dwCreateDisposition = CREATE_NEW;
2081 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
2082 dwCreateDisposition, 0, NULL);
2084 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
2086 return (INT_PTR)handle;
2089 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2091 HANDLE handle = (HANDLE)hf;
2092 DWORD dwRead;
2093 BOOL res;
2095 res = ReadFile(handle, memory, cb, &dwRead, NULL);
2096 ok(res, "Failed to ReadFile\n");
2098 return dwRead;
2101 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2103 HANDLE handle = (HANDLE)hf;
2104 DWORD dwWritten;
2105 BOOL res;
2107 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2108 ok(res, "Failed to WriteFile\n");
2110 return dwWritten;
2113 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
2115 HANDLE handle = (HANDLE)hf;
2116 ok(CloseHandle(handle), "Failed to CloseHandle\n");
2118 return 0;
2121 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
2123 HANDLE handle = (HANDLE)hf;
2124 DWORD ret;
2126 ret = SetFilePointer(handle, dist, NULL, seektype);
2127 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2129 return ret;
2132 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
2134 BOOL ret = DeleteFileA(pszFile);
2135 ok(ret, "Failed to DeleteFile %s\n", pszFile);
2137 return 0;
2140 static void init_functionpointers(void)
2142 HMODULE hmsi = GetModuleHandleA("msi.dll");
2143 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2144 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2146 #define GET_PROC(mod, func) \
2147 p ## func = (void*)GetProcAddress(mod, #func); \
2148 if(!p ## func) \
2149 trace("GetProcAddress(%s) failed\n", #func);
2151 GET_PROC(hmsi, MsiQueryComponentStateA);
2152 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
2153 GET_PROC(hmsi, MsiGetComponentPathExA);
2155 GET_PROC(hadvapi32, ConvertSidToStringSidA);
2156 GET_PROC(hadvapi32, RegDeleteKeyExA)
2157 GET_PROC(hkernel32, IsWow64Process)
2158 GET_PROC(hkernel32, Wow64DisableWow64FsRedirection);
2159 GET_PROC(hkernel32, Wow64RevertWow64FsRedirection);
2161 hsrclient = LoadLibraryA("srclient.dll");
2162 GET_PROC(hsrclient, SRRemoveRestorePoint);
2163 GET_PROC(hsrclient, SRSetRestorePointA);
2165 #undef GET_PROC
2168 BOOL is_process_limited(void)
2170 SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
2171 PSID Group = NULL;
2172 BOOL IsInGroup;
2173 HANDLE token;
2175 if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
2176 DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
2177 !CheckTokenMembership(NULL, Group, &IsInGroup))
2179 trace("Could not check if the current user is an administrator\n");
2180 FreeSid(Group);
2181 return FALSE;
2183 FreeSid(Group);
2185 if (!IsInGroup)
2187 /* Only administrators have enough privileges for these tests */
2188 return TRUE;
2191 if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2193 BOOL ret;
2194 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
2195 DWORD size;
2197 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2198 CloseHandle(token);
2199 return (ret && type == TokenElevationTypeLimited);
2201 return FALSE;
2204 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
2206 CHAR buffer[0x20];
2207 UINT r;
2208 DWORD sz;
2210 sz = sizeof buffer;
2211 r = MsiRecordGetStringA(rec, field, buffer, &sz);
2212 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
2215 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2217 LPSTR tempname;
2219 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2220 GetTempFileNameA(".", "xx", 0, tempname);
2222 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2224 lstrcpyA(pszTempName, tempname);
2225 HeapFree(GetProcessHeap(), 0, tempname);
2226 return TRUE;
2229 HeapFree(GetProcessHeap(), 0, tempname);
2231 return FALSE;
2234 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2235 USHORT *pattribs, int *err, void *pv)
2237 BY_HANDLE_FILE_INFORMATION finfo;
2238 FILETIME filetime;
2239 HANDLE handle;
2240 DWORD attrs;
2241 BOOL res;
2243 handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2244 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2246 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2248 res = GetFileInformationByHandle(handle, &finfo);
2249 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2251 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2252 FileTimeToDosDateTime(&filetime, pdate, ptime);
2254 attrs = GetFileAttributesA(pszName);
2255 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2257 return (INT_PTR)handle;
2260 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2262 char path[MAX_PATH];
2263 char filename[MAX_PATH];
2265 lstrcpyA(path, CURR_DIR);
2266 lstrcatA(path, "\\");
2267 lstrcatA(path, file);
2269 lstrcpyA(filename, file);
2271 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2272 progress, get_open_info, compress);
2275 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2277 ZeroMemory(pCabParams, sizeof(CCAB));
2279 pCabParams->cb = max_size;
2280 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2281 pCabParams->setID = 0xbeef;
2282 pCabParams->iCab = 1;
2283 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2284 lstrcatA(pCabParams->szCabPath, "\\");
2285 lstrcpyA(pCabParams->szCab, name);
2288 void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2290 CCAB cabParams;
2291 LPCSTR ptr;
2292 HFCI hfci;
2293 ERF erf;
2294 BOOL res;
2296 set_cab_parameters(&cabParams, name, max_size);
2298 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2299 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2300 get_temp_file, &cabParams, NULL);
2302 ok(hfci != NULL, "Failed to create an FCI context\n");
2304 ptr = files;
2305 while (*ptr)
2307 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2308 ok(res, "Failed to add file: %s\n", ptr);
2309 ptr += lstrlenA(ptr) + 1;
2312 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2313 ok(res, "Failed to flush the cabinet\n");
2315 res = FCIDestroy(hfci);
2316 ok(res, "Failed to destroy the cabinet\n");
2319 BOOL get_user_dirs(void)
2321 HKEY hkey;
2322 DWORD type, size;
2324 if (RegOpenKeyA(HKEY_CURRENT_USER,
2325 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2326 return FALSE;
2328 size = MAX_PATH;
2329 if(RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size)){
2330 RegCloseKey(hkey);
2331 return FALSE;
2334 RegCloseKey(hkey);
2335 return TRUE;
2338 BOOL get_system_dirs(void)
2340 HKEY hkey;
2341 DWORD type, size;
2343 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion",
2344 0, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &hkey))
2345 return FALSE;
2347 size = MAX_PATH;
2348 if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2349 RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size)) {
2350 RegCloseKey(hkey);
2351 return FALSE;
2354 size = MAX_PATH;
2355 if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2356 RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size)) {
2357 RegCloseKey(hkey);
2358 return FALSE;
2361 size = MAX_PATH;
2362 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR_NATIVE, &size)) {
2363 RegCloseKey(hkey);
2364 return FALSE;
2367 RegCloseKey(hkey);
2369 if(!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH))
2370 return FALSE;
2372 return TRUE;
2375 void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2377 HANDLE file;
2378 DWORD written;
2380 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2381 if (file == INVALID_HANDLE_VALUE)
2382 return;
2384 WriteFile(file, data, strlen(data), &written, NULL);
2386 if (size)
2388 SetFilePointer(file, size, NULL, FILE_BEGIN);
2389 SetEndOfFile(file);
2392 CloseHandle(file);
2395 static void create_test_files(void)
2397 CreateDirectoryA("msitest", NULL);
2398 create_file("msitest\\one.txt", 100);
2399 CreateDirectoryA("msitest\\first", NULL);
2400 create_file("msitest\\first\\two.txt", 100);
2401 CreateDirectoryA("msitest\\second", NULL);
2402 create_file("msitest\\second\\three.txt", 100);
2404 create_file("four.txt", 100);
2405 create_file("five.txt", 100);
2406 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2408 create_file("msitest\\filename", 100);
2410 DeleteFileA("four.txt");
2411 DeleteFileA("five.txt");
2414 BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2416 CHAR path[MAX_PATH];
2418 lstrcpyA(path, PROG_FILES_DIR);
2419 lstrcatA(path, "\\");
2420 lstrcatA(path, rel_path);
2422 if (is_file)
2423 return DeleteFileA(path);
2424 else
2425 return RemoveDirectoryA(path);
2428 static BOOL delete_pf_native(const CHAR *rel_path, BOOL is_file)
2430 CHAR path[MAX_PATH];
2432 lstrcpyA(path, PROG_FILES_DIR_NATIVE);
2433 lstrcatA(path, "\\");
2434 lstrcatA(path, rel_path);
2436 if (is_file)
2437 return DeleteFileA(path);
2438 else
2439 return RemoveDirectoryA(path);
2442 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
2444 CHAR path[MAX_PATH];
2446 lstrcpyA(path, COMMON_FILES_DIR);
2447 lstrcatA(path, "\\");
2448 lstrcatA(path, rel_path);
2450 if (is_file)
2451 return DeleteFileA(path);
2452 else
2453 return RemoveDirectoryA(path);
2456 static BOOL compare_pf_data(const char *filename, const char *data, DWORD size)
2458 DWORD read;
2459 HANDLE handle;
2460 BOOL ret = FALSE;
2461 char *buffer, path[MAX_PATH];
2463 lstrcpyA(path, PROG_FILES_DIR);
2464 lstrcatA(path, "\\");
2465 lstrcatA(path, filename);
2467 handle = CreateFileA(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2468 buffer = HeapAlloc(GetProcessHeap(), 0, size);
2469 if (buffer)
2471 ReadFile(handle, buffer, size, &read, NULL);
2472 if (read == size && !memcmp(data, buffer, size)) ret = TRUE;
2473 HeapFree(GetProcessHeap(), 0, buffer);
2475 CloseHandle(handle);
2476 return ret;
2479 static void delete_test_files(void)
2481 DeleteFileA("msitest.msi");
2482 DeleteFileA("msitest.cab");
2483 DeleteFileA("msitest\\second\\three.txt");
2484 DeleteFileA("msitest\\first\\two.txt");
2485 DeleteFileA("msitest\\one.txt");
2486 DeleteFileA("msitest\\filename");
2487 RemoveDirectoryA("msitest\\second");
2488 RemoveDirectoryA("msitest\\first");
2489 RemoveDirectoryA("msitest");
2492 static void delete_pf_files(void)
2494 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2495 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2496 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2497 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2498 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2499 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2500 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2501 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2502 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2503 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2504 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2507 static void write_file(const CHAR *filename, const char *data, int data_size)
2509 DWORD size;
2511 HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
2512 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2513 WriteFile(hf, data, data_size, &size, NULL);
2514 CloseHandle(hf);
2517 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount,
2518 const char *template, const char *packagecode)
2520 MSIHANDLE summary;
2521 UINT r;
2523 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2524 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2526 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2527 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2529 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL, packagecode);
2530 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2532 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL);
2533 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2535 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2536 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2538 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2539 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2541 /* write the summary changes back to the stream */
2542 r = MsiSummaryInfoPersist(summary);
2543 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2545 MsiCloseHandle(summary);
2548 static char *load_resource(const char *name)
2550 static char path[MAX_PATH];
2551 DWORD written;
2552 HANDLE file;
2553 HRSRC res;
2554 void *ptr;
2556 GetTempFileNameA(".", name, 0, path);
2558 file = CreateFileA(path, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
2559 ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", path, GetLastError());
2561 res = FindResourceA(NULL, name, "TESTDLL");
2562 ok( res != 0, "couldn't find resource\n" );
2563 ptr = LockResource( LoadResource( GetModuleHandleA(NULL), res ));
2564 WriteFile( file, ptr, SizeofResource( GetModuleHandleA(NULL), res ), &written, NULL );
2565 ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" );
2566 CloseHandle( file );
2568 return path;
2571 static INT CALLBACK ok_callback(void *context, UINT message_type, MSIHANDLE record)
2573 if (message_type == INSTALLMESSAGE_USER)
2575 char file[200];
2576 char msg[2000];
2577 DWORD len;
2579 len = sizeof(file);
2580 MsiRecordGetStringA(record, 2, file, &len);
2581 len = sizeof(msg);
2582 MsiRecordGetStringA(record, 5, msg, &len);
2584 todo_wine_if(MsiRecordGetInteger(record, 1))
2585 ok_(file, MsiRecordGetInteger(record, 3)) (MsiRecordGetInteger(record, 4), "%s", msg);
2587 return 1;
2589 return 0;
2592 static void add_custom_dll(MSIHANDLE hdb)
2594 MSIHANDLE record;
2595 UINT res;
2597 if (!customdll)
2598 customdll = load_resource("custom.dll");
2600 MsiSetExternalUIRecord(ok_callback, INSTALLLOGMODE_USER, NULL, NULL);
2602 res = run_query(hdb, 0, "CREATE TABLE `Binary` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)");
2603 ok(res == ERROR_SUCCESS, "failed to create Binary table: %u\n", res);
2605 record = MsiCreateRecord(1);
2606 res = MsiRecordSetStreamA(record, 1, customdll);
2607 ok(res == ERROR_SUCCESS, "failed to add %s to stream: %u\n", customdll, res);
2609 res = run_query(hdb, record, "INSERT INTO `Binary` (`Name`, `Data`) VALUES ('custom.dll', ?)");
2610 ok(res == ERROR_SUCCESS, "failed to insert into Binary table: %u\n", res);
2612 MsiCloseHandle(record);
2615 void create_database_wordcount(const CHAR *name, const msi_table *tables, int num_tables,
2616 INT version, INT wordcount, const char *template, const char *packagecode)
2618 MSIHANDLE db;
2619 UINT r;
2620 WCHAR *nameW;
2621 int j, len;
2623 len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2624 if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
2625 MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2627 r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
2628 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2630 /* import the tables into the database */
2631 for (j = 0; j < num_tables; j++)
2633 const msi_table *table = &tables[j];
2635 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2637 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2638 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2640 DeleteFileA(table->filename);
2643 write_msi_summary_info(db, version, wordcount, template, packagecode);
2644 add_custom_dll(db);
2646 r = MsiDatabaseCommit(db);
2647 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2649 MsiCloseHandle(db);
2650 HeapFree( GetProcessHeap(), 0, nameW );
2653 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2655 RESTOREPOINTINFOA spec;
2657 spec.dwEventType = event_type;
2658 spec.dwRestorePtType = APPLICATION_INSTALL;
2659 spec.llSequenceNumber = status->llSequenceNumber;
2660 lstrcpyA(spec.szDescription, "msitest restore point");
2662 return pSRSetRestorePointA(&spec, status);
2665 static void remove_restore_point(DWORD seq_number)
2667 DWORD res;
2669 res = pSRRemoveRestorePoint(seq_number);
2670 if (res != ERROR_SUCCESS)
2671 trace("Failed to remove the restore point : %08x\n", res);
2674 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
2676 if (pRegDeleteKeyExA)
2677 return pRegDeleteKeyExA( key, subkey, access, 0 );
2678 return RegDeleteKeyA( key, subkey );
2681 static void test_MsiInstallProduct(void)
2683 UINT r;
2684 CHAR path[MAX_PATH];
2685 LONG res;
2686 HKEY hkey;
2687 DWORD num, size, type;
2688 REGSAM access = KEY_ALL_ACCESS;
2690 if (is_process_limited())
2692 skip("process is limited\n");
2693 return;
2696 if (is_wow64)
2697 access |= KEY_WOW64_64KEY;
2699 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2701 /* szPackagePath is NULL */
2702 r = MsiInstallProductA(NULL, "INSTALL=ALL");
2703 ok(r == ERROR_INVALID_PARAMETER,
2704 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2706 /* both szPackagePath and szCommandLine are NULL */
2707 r = MsiInstallProductA(NULL, NULL);
2708 ok(r == ERROR_INVALID_PARAMETER,
2709 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2711 /* szPackagePath is empty */
2712 r = MsiInstallProductA("", "INSTALL=ALL");
2713 ok(r == ERROR_PATH_NOT_FOUND,
2714 "Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
2716 create_test_files();
2717 create_database(msifile, tables, ARRAY_SIZE(tables));
2719 /* install, don't publish */
2720 r = MsiInstallProductA(msifile, NULL);
2721 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2723 skip("Not enough rights to perform tests\n");
2724 goto error;
2726 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2728 delete_pf_files();
2730 res = RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", 0, access, &hkey);
2731 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2733 size = MAX_PATH;
2734 type = REG_SZ;
2735 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
2736 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2737 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
2739 size = MAX_PATH;
2740 type = REG_SZ;
2741 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
2742 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2744 size = sizeof(num);
2745 type = REG_DWORD;
2746 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
2747 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2748 ok(num == 314, "Expected 314, got %d\n", num);
2750 size = MAX_PATH;
2751 type = REG_SZ;
2752 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
2753 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2754 ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
2756 delete_key(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", access);
2758 /* not published, reinstall */
2759 r = MsiInstallProductA(msifile, NULL);
2760 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2762 delete_pf_files();
2764 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2765 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2766 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2768 create_database(msifile, up_tables, ARRAY_SIZE(up_tables));
2770 /* not published, RemovePreviousVersions set */
2771 r = MsiInstallProductA(msifile, NULL);
2772 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2774 delete_pf_files();
2776 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2777 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2778 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2780 create_database(msifile, up2_tables, ARRAY_SIZE(up2_tables));
2782 /* not published, version number bumped */
2783 r = MsiInstallProductA(msifile, NULL);
2784 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2786 delete_pf_files();
2788 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2789 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2790 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2792 create_database(msifile, up3_tables, ARRAY_SIZE(up3_tables));
2794 /* not published, RemovePreviousVersions set and version number bumped */
2795 r = MsiInstallProductA(msifile, NULL);
2796 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2798 delete_pf_files();
2800 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2801 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2802 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2804 create_database(msifile, up4_tables, ARRAY_SIZE(up4_tables));
2806 /* install, publish product */
2807 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2808 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2810 delete_pf_files();
2812 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2813 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2815 create_database(msifile, up4_tables, ARRAY_SIZE(up4_tables));
2817 /* published, reinstall */
2818 r = MsiInstallProductA(msifile, NULL);
2819 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2821 delete_pf_files();
2823 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2824 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2826 create_database(msifile, up5_tables, ARRAY_SIZE(up5_tables));
2828 /* published product, RemovePreviousVersions set */
2829 r = MsiInstallProductA(msifile, NULL);
2830 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2832 delete_pf_files();
2834 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2835 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2837 create_database(msifile, up6_tables, ARRAY_SIZE(up6_tables));
2839 /* published product, version number bumped */
2840 r = MsiInstallProductA(msifile, NULL);
2841 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2843 delete_pf_files();
2845 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2846 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2848 create_database(msifile, up7_tables, ARRAY_SIZE(up7_tables));
2850 /* published product, RemovePreviousVersions set and version number bumped */
2851 r = MsiInstallProductA(msifile, NULL);
2852 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2854 delete_pf_files();
2856 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2857 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2859 r = MsiInstallProductA(msifile, "REMOVE=ALL");
2860 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2862 error:
2863 delete_test_files();
2864 DeleteFileA(msifile);
2867 static void test_MsiSetComponentState(void)
2869 INSTALLSTATE installed, action;
2870 MSIHANDLE package;
2871 char path[MAX_PATH];
2872 UINT r;
2874 create_database(msifile, tables, ARRAY_SIZE(tables));
2876 CoInitialize(NULL);
2878 lstrcpyA(path, CURR_DIR);
2879 lstrcatA(path, "\\");
2880 lstrcatA(path, msifile);
2882 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2884 r = MsiOpenPackageA(path, &package);
2885 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2887 skip("Not enough rights to perform tests\n");
2888 goto error;
2890 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2892 r = MsiDoActionA(package, "CostInitialize");
2893 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2895 r = MsiDoActionA(package, "FileCost");
2896 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2898 r = MsiDoActionA(package, "CostFinalize");
2899 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2901 r = MsiGetComponentStateA(package, "dangler", &installed, &action);
2902 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2903 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
2904 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2906 r = MsiSetComponentStateA(package, "dangler", INSTALLSTATE_SOURCE);
2907 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2909 MsiCloseHandle(package);
2911 error:
2912 CoUninitialize();
2913 DeleteFileA(msifile);
2916 static void test_packagecoltypes(void)
2918 MSIHANDLE hdb, view, rec;
2919 char path[MAX_PATH];
2920 WCHAR pathW[MAX_PATH];
2921 LPCSTR query;
2922 UINT r, count;
2924 create_database(msifile, tables, ARRAY_SIZE(tables));
2926 CoInitialize(NULL);
2928 lstrcpyA(path, CURR_DIR);
2929 lstrcatA(path, "\\");
2930 lstrcatA(path, msifile);
2931 MultiByteToWideChar( CP_ACP, 0, path, -1, pathW, MAX_PATH );
2933 r = MsiOpenDatabaseW(pathW, MSIDBOPEN_READONLY, &hdb);
2934 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2936 query = "SELECT * FROM `Media`";
2937 r = MsiDatabaseOpenViewA( hdb, query, &view );
2938 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2940 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
2941 count = MsiRecordGetFieldCount( rec );
2942 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2943 ok(count == 6, "Expected 6, got %d\n", count);
2944 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
2945 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
2946 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
2947 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
2948 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
2949 ok(check_record(rec, 6, "Source"), "wrong column label\n");
2950 MsiCloseHandle(rec);
2952 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
2953 count = MsiRecordGetFieldCount( rec );
2954 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2955 ok(count == 6, "Expected 6, got %d\n", count);
2956 ok(check_record(rec, 1, "i2"), "wrong column label\n");
2957 ok(check_record(rec, 2, "i4"), "wrong column label\n");
2958 ok(check_record(rec, 3, "L64"), "wrong column label\n");
2959 ok(check_record(rec, 4, "S255"), "wrong column label\n");
2960 ok(check_record(rec, 5, "S32"), "wrong column label\n");
2961 ok(check_record(rec, 6, "S72"), "wrong column label\n");
2963 MsiCloseHandle(rec);
2964 MsiCloseHandle(view);
2965 MsiCloseHandle(hdb);
2966 CoUninitialize();
2968 DeleteFileA(msifile);
2971 static void create_cc_test_files(void)
2973 CCAB cabParams;
2974 HFCI hfci;
2975 ERF erf;
2976 static CHAR cab_context[] = "test%d.cab";
2977 BOOL res;
2979 create_file("maximus", 500);
2980 create_file("augustus", 50000);
2981 create_file("tiberius", 500);
2982 create_file("caesar", 500);
2984 set_cab_parameters(&cabParams, "test1.cab", 40000);
2986 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2987 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2988 get_temp_file, &cabParams, cab_context);
2989 ok(hfci != NULL, "Failed to create an FCI context\n");
2991 res = add_file(hfci, "maximus", tcompTYPE_NONE);
2992 ok(res, "Failed to add file maximus\n");
2994 res = add_file(hfci, "augustus", tcompTYPE_NONE);
2995 ok(res, "Failed to add file augustus\n");
2997 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
2998 ok(res, "Failed to add file tiberius\n");
3000 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
3001 ok(res, "Failed to flush the cabinet\n");
3003 res = FCIDestroy(hfci);
3004 ok(res, "Failed to destroy the cabinet\n");
3006 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3008 DeleteFileA("maximus");
3009 DeleteFileA("augustus");
3010 DeleteFileA("tiberius");
3011 DeleteFileA("caesar");
3014 void delete_cab_files(void)
3016 SHFILEOPSTRUCTA shfl;
3017 CHAR path[MAX_PATH+10];
3019 lstrcpyA(path, CURR_DIR);
3020 lstrcatA(path, "\\*.cab");
3021 path[strlen(path) + 1] = '\0';
3023 shfl.hwnd = NULL;
3024 shfl.wFunc = FO_DELETE;
3025 shfl.pFrom = path;
3026 shfl.pTo = NULL;
3027 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
3029 SHFileOperationA(&shfl);
3032 static void test_continuouscabs(void)
3034 UINT r;
3036 if (is_process_limited())
3038 skip("process is limited\n");
3039 return;
3042 create_cc_test_files();
3043 create_database(msifile, cc_tables, ARRAY_SIZE(cc_tables));
3045 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3047 r = MsiInstallProductA(msifile, NULL);
3048 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3050 skip("Not enough rights to perform tests\n");
3051 goto error;
3053 else
3055 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3056 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3057 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3058 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3059 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3062 delete_cab_files();
3063 DeleteFileA(msifile);
3065 create_cc_test_files();
3066 create_database(msifile, cc2_tables, ARRAY_SIZE(cc2_tables));
3068 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3070 r = MsiInstallProductA(msifile, NULL);
3071 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3073 skip("Not enough rights to perform tests\n");
3075 else
3077 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3078 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3079 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3080 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
3081 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3082 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3085 delete_cab_files();
3086 DeleteFileA(msifile);
3088 /* Tests to show that only msi cab filename is taken in case of mismatch with the one given by previous cab */
3090 /* Filename from cab is right and the one from msi is wrong */
3091 create_cc_test_files();
3092 create_database(msifile, cc3_tables, ARRAY_SIZE(cc3_tables));
3094 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3096 r = MsiInstallProductA(msifile, NULL);
3097 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3099 skip("Not enough rights to perform tests\n");
3101 else
3103 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3104 todo_wine ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3105 ok(!delete_pf("msitest\\caesar", TRUE), "File installed\n");
3106 todo_wine ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
3107 todo_wine ok(!delete_pf("msitest", FALSE), "Directory created\n");
3110 delete_cab_files();
3111 DeleteFileA(msifile);
3113 /* Filename from msi is right and the one from cab is wrong */
3114 create_cc_test_files();
3115 ok(MoveFileA("test2.cab", "test2_.cab"), "Cannot rename test2.cab to test2_.cab\n");
3116 create_database(msifile, cc3_tables, ARRAY_SIZE(cc3_tables));
3118 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3120 r = MsiInstallProductA(msifile, NULL);
3121 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3123 skip("Not enough rights to perform tests\n");
3125 else
3127 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3128 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3129 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3130 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3131 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3134 error:
3135 delete_cab_files();
3136 DeleteFileA(msifile);
3139 static void test_caborder(void)
3141 UINT r;
3143 create_file("imperator", 100);
3144 create_file("maximus", 500);
3145 create_file("augustus", 50000);
3146 create_file("caesar", 500);
3148 create_database(msifile, cc_tables, ARRAY_SIZE(cc_tables));
3150 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3152 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3153 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3154 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3156 r = MsiInstallProductA(msifile, NULL);
3157 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3159 skip("Not enough rights to perform tests\n");
3160 goto error;
3162 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3163 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3164 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3165 todo_wine
3167 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3168 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3171 delete_cab_files();
3173 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
3174 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
3175 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3177 r = MsiInstallProductA(msifile, NULL);
3178 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3179 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3180 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3181 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3182 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3184 delete_cab_files();
3185 DeleteFileA(msifile);
3187 create_cc_test_files();
3188 create_database(msifile, co_tables, ARRAY_SIZE(co_tables));
3190 r = MsiInstallProductA(msifile, NULL);
3191 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3192 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3193 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3194 todo_wine
3196 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3197 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3200 delete_cab_files();
3201 DeleteFileA(msifile);
3203 create_cc_test_files();
3204 create_database(msifile, co2_tables, ARRAY_SIZE(co2_tables));
3206 r = MsiInstallProductA(msifile, NULL);
3207 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3208 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3209 todo_wine
3211 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3212 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3213 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3216 error:
3217 delete_cab_files();
3218 DeleteFileA("imperator");
3219 DeleteFileA("maximus");
3220 DeleteFileA("augustus");
3221 DeleteFileA("caesar");
3222 DeleteFileA(msifile);
3225 static void test_mixedmedia(void)
3227 UINT r;
3229 if (is_process_limited())
3231 skip("process is limited\n");
3232 return;
3235 CreateDirectoryA("msitest", NULL);
3236 create_file("msitest\\maximus", 500);
3237 create_file("msitest\\augustus", 500);
3238 create_file("caesar", 500);
3240 create_database(msifile, mm_tables, ARRAY_SIZE(mm_tables));
3242 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3244 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
3246 r = MsiInstallProductA(msifile, NULL);
3247 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3249 skip("Not enough rights to perform tests\n");
3250 goto error;
3252 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3253 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3254 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3255 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3256 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3258 error:
3259 /* Delete the files in the temp (current) folder */
3260 DeleteFileA("msitest\\maximus");
3261 DeleteFileA("msitest\\augustus");
3262 RemoveDirectoryA("msitest");
3263 DeleteFileA("caesar");
3264 DeleteFileA("test1.cab");
3265 DeleteFileA(msifile);
3268 static void test_samesequence(void)
3270 UINT r;
3272 create_cc_test_files();
3273 create_database(msifile, ss_tables, ARRAY_SIZE(ss_tables));
3275 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3277 r = MsiInstallProductA(msifile, NULL);
3278 if (r == ERROR_INSTALL_FAILURE)
3280 win_skip("unprivileged user?\n");
3281 goto error;
3283 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3284 if (r == ERROR_SUCCESS)
3286 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3287 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3288 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3289 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3292 error:
3293 delete_cab_files();
3294 DeleteFileA(msifile);
3297 static void test_uiLevelFlags(void)
3299 UINT r;
3301 create_cc_test_files();
3302 create_database(msifile, ui_tables, ARRAY_SIZE(ui_tables));
3304 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
3306 r = MsiInstallProductA(msifile, NULL);
3307 if (r == ERROR_INSTALL_FAILURE)
3309 win_skip("unprivileged user?\n");
3310 goto error;
3313 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3314 if (r == ERROR_SUCCESS)
3316 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
3317 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3318 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3319 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3322 error:
3323 delete_cab_files();
3324 DeleteFileA(msifile);
3327 static BOOL file_matches(LPSTR path)
3329 CHAR buf[MAX_PATH];
3330 HANDLE file;
3331 DWORD size;
3333 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3334 NULL, OPEN_EXISTING, 0, NULL);
3335 ZeroMemory(buf, MAX_PATH);
3336 ReadFile(file, buf, 15, &size, NULL);
3337 CloseHandle(file);
3339 return !lstrcmpA(buf, "msitest\\maximus");
3342 static void test_readonlyfile(void)
3344 UINT r;
3345 DWORD size;
3346 HANDLE file;
3347 CHAR path[MAX_PATH];
3349 if (is_process_limited())
3351 skip("process is limited\n");
3352 return;
3355 CreateDirectoryA("msitest", NULL);
3356 create_file("msitest\\maximus", 500);
3357 create_database(msifile, rof_tables, ARRAY_SIZE(rof_tables));
3359 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3361 lstrcpyA(path, PROG_FILES_DIR);
3362 lstrcatA(path, "\\msitest");
3363 CreateDirectoryA(path, NULL);
3365 lstrcatA(path, "\\maximus");
3366 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3367 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3369 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3370 CloseHandle(file);
3372 r = MsiInstallProductA(msifile, NULL);
3373 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3375 skip("Not enough rights to perform tests\n");
3376 goto error;
3378 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3379 ok(file_matches(path), "Expected file to be overwritten\n");
3380 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3381 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3383 error:
3384 /* Delete the files in the temp (current) folder */
3385 DeleteFileA("msitest\\maximus");
3386 RemoveDirectoryA("msitest");
3387 DeleteFileA(msifile);
3390 static void test_readonlyfile_cab(void)
3392 UINT r;
3393 DWORD size;
3394 HANDLE file;
3395 CHAR path[MAX_PATH];
3396 CHAR buf[16];
3398 if (is_process_limited())
3400 skip("process is limited\n");
3401 return;
3404 CreateDirectoryA("msitest", NULL);
3405 create_file("maximus", 500);
3406 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3407 DeleteFileA("maximus");
3409 create_database(msifile, rofc_tables, ARRAY_SIZE(rofc_tables));
3411 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3413 lstrcpyA(path, PROG_FILES_DIR);
3414 lstrcatA(path, "\\msitest");
3415 CreateDirectoryA(path, NULL);
3417 lstrcatA(path, "\\maximus");
3418 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3419 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3421 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3422 CloseHandle(file);
3424 r = MsiInstallProductA(msifile, NULL);
3425 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3427 skip("Not enough rights to perform tests\n");
3428 goto error;
3430 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3432 memset( buf, 0, sizeof(buf) );
3433 if ((file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3434 NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
3436 ReadFile(file, buf, sizeof(buf) - 1, &size, NULL);
3437 CloseHandle(file);
3439 ok(!memcmp( buf, "maximus", sizeof("maximus")-1 ), "Expected file to be overwritten, got '%s'\n", buf);
3440 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3441 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3443 error:
3444 /* Delete the files in the temp (current) folder */
3445 delete_cab_files();
3446 DeleteFileA("msitest\\maximus");
3447 RemoveDirectoryA("msitest");
3448 DeleteFileA(msifile);
3451 static void test_setdirproperty(void)
3453 UINT r;
3455 if (is_process_limited())
3457 skip("process is limited\n");
3458 return;
3461 CreateDirectoryA("msitest", NULL);
3462 create_file("msitest\\maximus", 500);
3463 create_database(msifile, sdp_tables, ARRAY_SIZE(sdp_tables));
3465 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3467 r = MsiInstallProductA(msifile, NULL);
3468 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3470 skip("Not enough rights to perform tests\n");
3471 goto error;
3473 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3474 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
3475 ok(delete_cf("msitest", FALSE), "Directory not created\n");
3477 error:
3478 /* Delete the files in the temp (current) folder */
3479 DeleteFileA(msifile);
3480 DeleteFileA("msitest\\maximus");
3481 RemoveDirectoryA("msitest");
3484 static void test_cabisextracted(void)
3486 UINT r;
3488 if (is_process_limited())
3490 skip("process is limited\n");
3491 return;
3494 CreateDirectoryA("msitest", NULL);
3495 create_file("msitest\\gaius", 500);
3496 create_file("maximus", 500);
3497 create_file("augustus", 500);
3498 create_file("caesar", 500);
3500 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3501 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3502 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3504 create_database(msifile, cie_tables, ARRAY_SIZE(cie_tables));
3506 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3508 r = MsiInstallProductA(msifile, NULL);
3509 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3511 skip("Not enough rights to perform tests\n");
3512 goto error;
3514 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3515 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3516 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3517 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3518 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
3519 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3521 error:
3522 /* Delete the files in the temp (current) folder */
3523 delete_cab_files();
3524 DeleteFileA(msifile);
3525 DeleteFileA("maximus");
3526 DeleteFileA("augustus");
3527 DeleteFileA("caesar");
3528 DeleteFileA("msitest\\gaius");
3529 RemoveDirectoryA("msitest");
3532 BOOL file_exists(const char *file)
3534 return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES;
3537 BOOL pf_exists(const char *file)
3539 CHAR path[MAX_PATH];
3541 lstrcpyA(path, PROG_FILES_DIR);
3542 lstrcatA(path, "\\");
3543 lstrcatA(path, file);
3545 return file_exists(path);
3548 static void delete_pfmsitest_files(void)
3550 SHFILEOPSTRUCTA shfl;
3551 CHAR path[MAX_PATH+11];
3553 lstrcpyA(path, PROG_FILES_DIR);
3554 lstrcatA(path, "\\msitest\\*");
3555 path[strlen(path) + 1] = '\0';
3557 shfl.hwnd = NULL;
3558 shfl.wFunc = FO_DELETE;
3559 shfl.pFrom = path;
3560 shfl.pTo = NULL;
3561 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT | FOF_NOERRORUI;
3563 SHFileOperationA(&shfl);
3565 lstrcpyA(path, PROG_FILES_DIR);
3566 lstrcatA(path, "\\msitest");
3567 RemoveDirectoryA(path);
3570 UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
3572 MSIHANDLE hview = 0;
3573 UINT r;
3575 r = MsiDatabaseOpenViewA(hdb, query, &hview);
3576 if(r != ERROR_SUCCESS)
3577 return r;
3579 r = MsiViewExecute(hview, hrec);
3580 if(r == ERROR_SUCCESS)
3581 r = MsiViewClose(hview);
3582 MsiCloseHandle(hview);
3583 return r;
3586 static void set_transform_summary_info(void)
3588 UINT r;
3589 MSIHANDLE suminfo = 0;
3591 /* build summary info */
3592 r = MsiGetSummaryInformationA(0, mstfile, 3, &suminfo);
3593 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
3595 r = MsiSummaryInfoSetPropertyA(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
3596 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3598 r = MsiSummaryInfoSetPropertyA(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
3599 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3600 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3601 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
3602 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
3604 r = MsiSummaryInfoSetPropertyA(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
3605 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3607 r = MsiSummaryInfoPersist(suminfo);
3608 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
3610 r = MsiCloseHandle(suminfo);
3611 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
3614 static void generate_transform(void)
3616 MSIHANDLE hdb1, hdb2;
3617 LPCSTR query;
3618 UINT r;
3620 /* start with two identical databases */
3621 CopyFileA(msifile, msifile2, FALSE);
3623 r = MsiOpenDatabaseW(msifile2W, MSIDBOPEN_TRANSACT, &hdb1);
3624 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3626 r = MsiDatabaseCommit(hdb1);
3627 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
3629 r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_READONLY, &hdb2);
3630 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3632 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
3633 r = run_query(hdb1, 0, query);
3634 ok(r == ERROR_SUCCESS, "failed to add property\n");
3636 /* database needs to be committed */
3637 MsiDatabaseCommit(hdb1);
3639 r = MsiDatabaseGenerateTransformA(hdb1, hdb2, mstfile, 0, 0);
3640 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3642 r = MsiCreateTransformSummaryInfoA(hdb2, hdb2, mstfile, 0, 0);
3643 todo_wine ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3645 MsiCloseHandle(hdb1);
3646 MsiCloseHandle(hdb2);
3649 /* data for generating a transform */
3651 /* tables transform names - encoded as they would be in an msi database file */
3652 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
3653 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
3654 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
3656 /* data in each table */
3657 static const char data1[] = /* _StringData */
3658 "propval"; /* all the strings squashed together */
3660 static const WCHAR data2[] = { /* _StringPool */
3661 /* len, refs */
3662 0, 0, /* string 0 '' */
3663 4, 1, /* string 1 'prop' */
3664 3, 1, /* string 2 'val' */
3667 static const WCHAR data3[] = { /* Property */
3668 0x0201, 0x0001, 0x0002,
3671 static const struct {
3672 LPCWSTR name;
3673 const void *data;
3674 DWORD size;
3675 } table_transform_data[] =
3677 { name1, data1, sizeof data1 - 1 },
3678 { name2, data2, sizeof data2 },
3679 { name3, data3, sizeof data3 },
3682 static void generate_transform_manual(void)
3684 IStorage *stg = NULL;
3685 IStream *stm;
3686 WCHAR name[0x20];
3687 HRESULT r;
3688 DWORD i, count;
3689 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
3691 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
3693 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
3695 r = StgCreateDocfile(name, mode, 0, &stg);
3696 ok(r == S_OK, "failed to create storage\n");
3697 if (!stg)
3698 return;
3700 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
3701 ok(r == S_OK, "failed to set storage type\n");
3703 for (i=0; i<ARRAY_SIZE(table_transform_data); i++)
3705 r = IStorage_CreateStream(stg, table_transform_data[i].name,
3706 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3707 if (FAILED(r))
3709 ok(0, "failed to create stream %08x\n", r);
3710 continue;
3713 r = IStream_Write(stm, table_transform_data[i].data,
3714 table_transform_data[i].size, &count);
3715 if (FAILED(r) || count != table_transform_data[i].size)
3716 ok(0, "failed to write stream\n");
3717 IStream_Release(stm);
3720 IStorage_Release(stg);
3722 set_transform_summary_info();
3725 static void test_transformprop(void)
3727 UINT r;
3729 if (is_process_limited())
3731 skip("process is limited\n");
3732 return;
3735 CreateDirectoryA("msitest", NULL);
3736 create_file("msitest\\augustus", 500);
3738 create_database(msifile, tp_tables, ARRAY_SIZE(tp_tables));
3740 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3742 r = MsiInstallProductA(msifile, NULL);
3743 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3745 skip("Not enough rights to perform tests\n");
3746 goto error;
3748 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3749 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3750 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3752 if (0)
3753 generate_transform();
3754 else
3755 generate_transform_manual();
3757 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
3758 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3759 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3760 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3762 error:
3763 /* Delete the files in the temp (current) folder */
3764 DeleteFileA(msifile);
3765 DeleteFileA(msifile2);
3766 DeleteFileA(mstfile);
3767 DeleteFileA("msitest\\augustus");
3768 RemoveDirectoryA("msitest");
3771 static void test_currentworkingdir(void)
3773 UINT r;
3774 CHAR drive[MAX_PATH], path[MAX_PATH];
3775 LPSTR ptr;
3777 if (is_process_limited())
3779 skip("process is limited\n");
3780 return;
3783 CreateDirectoryA("msitest", NULL);
3784 create_file("msitest\\augustus", 500);
3786 create_database(msifile, cwd_tables, ARRAY_SIZE(cwd_tables));
3788 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3790 CreateDirectoryA("diffdir", NULL);
3791 SetCurrentDirectoryA("diffdir");
3793 sprintf(path, "..\\%s", msifile);
3794 r = MsiInstallProductA(path, NULL);
3795 todo_wine
3797 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
3798 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3799 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3802 sprintf(path, "%s\\%s", CURR_DIR, msifile);
3803 r = MsiInstallProductA(path, NULL);
3804 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3806 skip("Not enough rights to perform tests\n");
3807 goto error;
3809 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3810 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3811 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3813 lstrcpyA(drive, CURR_DIR);
3814 drive[2] = '\\';
3815 drive[3] = '\0';
3816 SetCurrentDirectoryA(drive);
3818 lstrcpyA(path, CURR_DIR);
3819 if (path[lstrlenA(path) - 1] != '\\') lstrcatA(path, "\\");
3820 lstrcatA(path, msifile);
3821 ptr = strchr(path, ':');
3822 ptr +=2;
3824 r = MsiInstallProductA(ptr, NULL);
3825 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3826 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3827 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3829 error:
3830 SetCurrentDirectoryA(CURR_DIR);
3831 DeleteFileA(msifile);
3832 DeleteFileA("msitest\\augustus");
3833 RemoveDirectoryA("msitest");
3834 RemoveDirectoryA("diffdir");
3837 static void set_admin_summary_info(const WCHAR *name)
3839 MSIHANDLE db, summary;
3840 UINT r;
3842 r = MsiOpenDatabaseW(name, MSIDBOPEN_DIRECT, &db);
3843 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3845 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
3846 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3848 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
3849 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3851 /* write the summary changes back to the stream */
3852 r = MsiSummaryInfoPersist(summary);
3853 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3855 MsiCloseHandle(summary);
3857 r = MsiDatabaseCommit(db);
3858 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3860 MsiCloseHandle(db);
3863 static void test_admin(void)
3865 UINT r;
3867 CreateDirectoryA("msitest", NULL);
3868 create_file("msitest\\augustus", 500);
3870 create_database(msifile, adm_tables, ARRAY_SIZE(adm_tables));
3871 set_admin_summary_info(msifileW);
3873 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3875 r = MsiInstallProductA(msifile, NULL);
3876 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3878 skip("Not enough rights to perform tests\n");
3879 goto error;
3881 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3882 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3883 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3884 ok(!DeleteFileA("c:\\msitest\\augustus"), "File installed\n");
3885 ok(!RemoveDirectoryA("c:\\msitest"), "File installed\n");
3887 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
3888 todo_wine
3889 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3890 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3891 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3892 todo_wine
3894 ok(DeleteFileA("c:\\msitest\\augustus"), "File not installed\n");
3895 ok(RemoveDirectoryA("c:\\msitest"), "File not installed\n");
3898 error:
3899 DeleteFileA(msifile);
3900 DeleteFileA("msitest\\augustus");
3901 RemoveDirectoryA("msitest");
3904 static void set_admin_property_stream(LPCSTR file)
3906 IStorage *stg;
3907 IStream *stm;
3908 WCHAR fileW[MAX_PATH];
3909 HRESULT hr;
3910 DWORD count;
3911 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
3913 /* AdminProperties */
3914 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
3915 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',' ',
3916 'M','y','P','r','o','p','=','4','2',0};
3918 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
3920 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
3921 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3922 if (!stg)
3923 return;
3925 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3926 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3928 hr = IStream_Write(stm, data, sizeof(data), &count);
3929 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3931 IStream_Release(stm);
3932 IStorage_Release(stg);
3935 static void test_adminprops(void)
3937 UINT r;
3939 if (is_process_limited())
3941 skip("process is limited\n");
3942 return;
3945 CreateDirectoryA("msitest", NULL);
3946 create_file("msitest\\augustus", 500);
3948 create_database(msifile, amp_tables, ARRAY_SIZE(amp_tables));
3949 set_admin_summary_info(msifileW);
3950 set_admin_property_stream(msifile);
3952 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3954 r = MsiInstallProductA(msifile, NULL);
3955 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3957 skip("Not enough rights to perform tests\n");
3958 goto error;
3960 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3961 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
3962 ok(delete_pf("msitest", FALSE), "Directory created\n");
3964 error:
3965 DeleteFileA(msifile);
3966 DeleteFileA("msitest\\augustus");
3967 RemoveDirectoryA("msitest");
3970 void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
3972 CHAR path[MAX_PATH];
3974 lstrcpyA(path, PROG_FILES_DIR);
3975 lstrcatA(path, "\\");
3976 lstrcatA(path, file);
3978 if (is_file)
3979 create_file_data(path, data, 500);
3980 else
3981 CreateDirectoryA(path, NULL);
3984 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
3986 static void test_missingcab(void)
3988 UINT r;
3990 if (is_process_limited())
3992 skip("process is limited\n");
3993 return;
3996 CreateDirectoryA("msitest", NULL);
3997 create_file("msitest\\augustus", 500);
3998 create_file("maximus", 500);
3999 create_file("tiberius", 500);
4001 create_database(msifile, mc_tables, ARRAY_SIZE(mc_tables));
4003 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4005 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
4006 create_cab_file("test4.cab", MEDIA_SIZE, "tiberius\0");
4008 create_pf("msitest", FALSE);
4009 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
4010 create_pf_data("msitest\\tiberius", "abcdefgh", TRUE);
4012 r = MsiInstallProductA(msifile, NULL);
4013 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4015 skip("Not enough rights to perform tests\n");
4016 goto error;
4018 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4019 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4020 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4021 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
4022 ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
4023 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
4024 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
4025 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4027 create_pf("msitest", FALSE);
4028 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
4029 create_pf_data("msitest\\tiberius", "abcdefgh", TRUE);
4030 create_pf("msitest\\gaius", TRUE);
4032 r = MsiInstallProductA(msifile, "GAIUS=1");
4033 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4034 todo_wine
4036 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
4037 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4039 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
4040 ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
4041 ok(delete_pf("msitest\\tiberius", TRUE), "File removed\n");
4042 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
4043 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4045 error:
4046 delete_pf("msitest", FALSE);
4047 DeleteFileA("msitest\\augustus");
4048 RemoveDirectoryA("msitest");
4049 DeleteFileA("maximus");
4050 DeleteFileA("tiberius");
4051 DeleteFileA("test1.cab");
4052 DeleteFileA("test4.cab");
4053 DeleteFileA(msifile);
4056 static void test_sourcefolder(void)
4058 UINT r;
4060 if (is_process_limited())
4062 skip("process is limited\n");
4063 return;
4066 CreateDirectoryA("msitest", NULL);
4067 create_file("augustus", 500);
4069 create_database(msifile, sf_tables, ARRAY_SIZE(sf_tables));
4071 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4073 r = MsiInstallProductA(msifile, NULL);
4074 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4076 skip("Not enough rights to perform tests\n");
4077 goto error;
4079 ok(r == ERROR_INSTALL_FAILURE,
4080 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4081 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4082 todo_wine
4084 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4086 RemoveDirectoryA("msitest");
4088 r = MsiInstallProductA(msifile, NULL);
4089 ok(r == ERROR_INSTALL_FAILURE,
4090 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4091 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4092 todo_wine
4094 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4097 error:
4098 DeleteFileA(msifile);
4099 DeleteFileA("augustus");
4102 static void test_customaction1(void)
4104 MSIHANDLE hdb, record;
4105 UINT r;
4107 create_test_files();
4108 create_database(msifile, ca1_tables, ARRAY_SIZE(ca1_tables));
4110 /* create a test table */
4111 MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb);
4112 run_query(hdb, 0, "CREATE TABLE `Test` (`Name` CHAR(10), `Number` INTEGER, `Data` OBJECT PRIMARY KEY `Name`)");
4113 create_file("unus", 10);
4114 create_file("duo", 10);
4115 record = MsiCreateRecord(1);
4116 MsiRecordSetStreamA(record, 1, "unus");
4117 run_query(hdb, record, "INSERT INTO `Test` (`Name`, `Number`, `Data`) VALUES ('one', 1, ?)");
4118 MsiRecordSetStreamA(record, 1, "duo");
4119 run_query(hdb, record, "INSERT INTO `Test` (`Name`, `Number`, `Data`) VALUES ('two', 2, ?)");
4120 MsiDatabaseCommit(hdb);
4121 MsiCloseHandle(hdb);
4123 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4125 r = MsiInstallProductA(msifile, "MAIN_TEST=1");
4126 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4128 /* Test return values */
4129 r = MsiInstallProductA(msifile, "TEST_RETVAL=0");
4130 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4132 r = MsiInstallProductA(msifile, "TEST_RETVAL=1626"); /* ERROR_FUNCTION_NOT_CALLED*/
4133 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4135 r = MsiInstallProductA(msifile, "TEST_RETVAL=1602");
4136 ok(r == ERROR_INSTALL_USEREXIT, "Expected ERROR_INSTALL_USEREXIT, got %u\n", r);
4138 r = MsiInstallProductA(msifile, "TEST_RETVAL=259"); /* ERROR_NO_MORE_ITEMS */
4139 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4141 /* any other error maps to ERROR_INSTALL_FAILURE */
4142 r = MsiInstallProductA(msifile, "TEST_RETVAL=1");
4143 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4145 /* Custom actions execute in the same process, but they don't retain state */
4146 r = MsiInstallProductA(msifile, "TEST_PROCESS=1");
4147 ok(!r, "got %u\n", r);
4149 delete_test_files();
4150 DeleteFileA(msifile);
4151 DeleteFileA("unus");
4152 DeleteFileA("duo");
4155 static void test_customaction51(void)
4157 UINT r;
4159 if (is_process_limited())
4161 skip("process is limited\n");
4162 return;
4165 CreateDirectoryA("msitest", NULL);
4166 create_file("msitest\\augustus", 500);
4168 create_database(msifile, ca51_tables, ARRAY_SIZE(ca51_tables));
4170 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4172 r = MsiInstallProductA(msifile, NULL);
4173 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4175 skip("Not enough rights to perform tests\n");
4176 goto error;
4178 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4179 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4180 ok(delete_pf("msitest", FALSE), "Directory created\n");
4182 error:
4183 DeleteFileA(msifile);
4184 DeleteFileA("msitest\\augustus");
4185 RemoveDirectoryA("msitest");
4188 static void test_installstate(void)
4190 UINT r;
4192 if (is_process_limited())
4194 skip("process is limited\n");
4195 return;
4198 CreateDirectoryA("msitest", NULL);
4199 create_file("msitest\\alpha", 500);
4200 create_file("msitest\\beta", 500);
4201 create_file("msitest\\gamma", 500);
4202 create_file("msitest\\theta", 500);
4203 create_file("msitest\\delta", 500);
4204 create_file("msitest\\epsilon", 500);
4205 create_file("msitest\\zeta", 500);
4206 create_file("msitest\\iota", 500);
4207 create_file("msitest\\eta", 500);
4208 create_file("msitest\\kappa", 500);
4209 create_file("msitest\\lambda", 500);
4210 create_file("msitest\\mu", 500);
4212 create_database(msifile, is_tables, ARRAY_SIZE(is_tables));
4214 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4216 r = MsiInstallProductA(msifile, NULL);
4217 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4219 skip("Not enough rights to perform tests\n");
4220 goto error;
4222 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4223 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4224 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4225 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4226 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4227 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4228 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4229 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4230 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4231 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4232 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4233 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4234 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4235 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4237 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
4238 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4239 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4240 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4241 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4242 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4243 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4244 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
4245 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4246 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4247 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
4248 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4249 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4250 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4251 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4253 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
4254 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4255 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4256 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4257 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4258 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4259 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4260 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4261 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4262 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4263 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4264 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4265 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4266 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4267 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4269 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
4270 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4271 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
4272 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4273 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4274 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
4275 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4276 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4277 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4278 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4279 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4280 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4281 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4282 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4283 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4285 error:
4286 DeleteFileA(msifile);
4287 DeleteFileA("msitest\\alpha");
4288 DeleteFileA("msitest\\beta");
4289 DeleteFileA("msitest\\gamma");
4290 DeleteFileA("msitest\\theta");
4291 DeleteFileA("msitest\\delta");
4292 DeleteFileA("msitest\\epsilon");
4293 DeleteFileA("msitest\\zeta");
4294 DeleteFileA("msitest\\iota");
4295 DeleteFileA("msitest\\eta");
4296 DeleteFileA("msitest\\kappa");
4297 DeleteFileA("msitest\\lambda");
4298 DeleteFileA("msitest\\mu");
4299 RemoveDirectoryA("msitest");
4302 static const struct sourcepathmap
4304 BOOL sost; /* shortone\shorttwo */
4305 BOOL solt; /* shortone\longtwo */
4306 BOOL lost; /* longone\shorttwo */
4307 BOOL lolt; /* longone\longtwo */
4308 BOOL soste; /* shortone\shorttwo source exists */
4309 BOOL solte; /* shortone\longtwo source exists */
4310 BOOL loste; /* longone\shorttwo source exists */
4311 BOOL lolte; /* longone\longtwo source exists */
4312 UINT err;
4313 DWORD size;
4314 } spmap[256] =
4316 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4317 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4318 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4319 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4320 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4321 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4322 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4323 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4324 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4325 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4326 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4327 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4328 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4329 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4330 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4331 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4332 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4333 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4334 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4335 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4336 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4337 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4338 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4339 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4340 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4341 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4342 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4343 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4344 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4345 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4346 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4347 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4348 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4349 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4350 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4351 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4352 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4353 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4354 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4355 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4356 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4357 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4358 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4359 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4360 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4361 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4362 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4363 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4364 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4365 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4366 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4367 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4368 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4369 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4370 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4371 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4372 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4373 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4374 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4375 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4376 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4377 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4378 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4379 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4380 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4381 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4382 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4383 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4384 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4385 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4386 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4387 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4388 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4389 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4390 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4391 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4392 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4393 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4394 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4395 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4396 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4397 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4398 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4399 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4400 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4401 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4402 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4403 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4404 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4405 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4406 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4407 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4408 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4409 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4410 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4411 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4412 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4413 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4414 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4415 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4416 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4417 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4418 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4419 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4420 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4421 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4422 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4423 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4424 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4425 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4426 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4427 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4428 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4429 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4430 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4431 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4432 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4433 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4434 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4435 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4436 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4437 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4438 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4439 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4440 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4441 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4442 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4443 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4444 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4445 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4446 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4447 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4448 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4449 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4450 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4451 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4452 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4453 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4454 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4455 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4456 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4457 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4458 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4459 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4460 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4461 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4462 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4463 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4464 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4465 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4466 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4467 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4468 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4469 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4470 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4471 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4472 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4473 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4474 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4475 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4476 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4477 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4478 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4479 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4480 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4481 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4482 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4483 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4484 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4485 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4486 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4487 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4488 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4489 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4490 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4491 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4492 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4493 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4494 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4495 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4496 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4497 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4498 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4499 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4500 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4501 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4502 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4503 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4504 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4505 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4506 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4507 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4508 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4509 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4510 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4511 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4512 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4513 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4514 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4515 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4516 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4517 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4518 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4519 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4520 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4521 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4522 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4523 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4524 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4525 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4526 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4527 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4528 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4529 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4530 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4531 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4532 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4533 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4534 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4535 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4536 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4537 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4538 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4539 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4540 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4541 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4542 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4543 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4544 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4545 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4546 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4547 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4548 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4549 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4550 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4551 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4552 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4553 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4554 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4555 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4556 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4557 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4558 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4559 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4560 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4561 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4562 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4563 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4564 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4565 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4566 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4567 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4568 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4569 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4570 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4571 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4574 static DWORD get_pf_file_size(LPCSTR file)
4576 CHAR path[MAX_PATH];
4577 HANDLE hfile;
4578 DWORD size;
4580 lstrcpyA(path, PROG_FILES_DIR);
4581 lstrcatA(path, "\\");
4582 lstrcatA(path, file);
4584 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
4585 if (hfile == INVALID_HANDLE_VALUE)
4586 return INVALID_FILE_SIZE;
4588 size = GetFileSize(hfile, NULL);
4589 CloseHandle(hfile);
4590 return size;
4593 static void test_sourcepath(void)
4595 UINT r, i;
4597 if (!winetest_interactive)
4599 skip("Run in interactive mode to run source path tests.\n");
4600 return;
4603 create_database(msifile, sp_tables, ARRAY_SIZE(sp_tables));
4605 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4607 for (i = 0; i < ARRAY_SIZE(spmap); i++)
4609 if (spmap[i].sost)
4611 CreateDirectoryA("shortone", NULL);
4612 CreateDirectoryA("shortone\\shorttwo", NULL);
4615 if (spmap[i].solt)
4617 CreateDirectoryA("shortone", NULL);
4618 CreateDirectoryA("shortone\\longtwo", NULL);
4621 if (spmap[i].lost)
4623 CreateDirectoryA("longone", NULL);
4624 CreateDirectoryA("longone\\shorttwo", NULL);
4627 if (spmap[i].lolt)
4629 CreateDirectoryA("longone", NULL);
4630 CreateDirectoryA("longone\\longtwo", NULL);
4633 if (spmap[i].soste)
4634 create_file("shortone\\shorttwo\\augustus", 50);
4635 if (spmap[i].solte)
4636 create_file("shortone\\longtwo\\augustus", 100);
4637 if (spmap[i].loste)
4638 create_file("longone\\shorttwo\\augustus", 150);
4639 if (spmap[i].lolte)
4640 create_file("longone\\longtwo\\augustus", 200);
4642 r = MsiInstallProductA(msifile, NULL);
4643 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
4644 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
4645 "%d: Expected %d, got %d\n", i, spmap[i].size,
4646 get_pf_file_size("msitest\\augustus"));
4648 if (r == ERROR_SUCCESS)
4650 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
4651 ok(delete_pf("msitest", FALSE), "%d: Directory not created\n", i);
4653 else
4655 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
4656 todo_wine ok(!delete_pf("msitest", FALSE), "%d: Directory installed\n", i);
4659 DeleteFileA("shortone\\shorttwo\\augustus");
4660 DeleteFileA("shortone\\longtwo\\augustus");
4661 DeleteFileA("longone\\shorttwo\\augustus");
4662 DeleteFileA("longone\\longtwo\\augustus");
4663 RemoveDirectoryA("shortone\\shorttwo");
4664 RemoveDirectoryA("shortone\\longtwo");
4665 RemoveDirectoryA("longone\\shorttwo");
4666 RemoveDirectoryA("longone\\longtwo");
4667 RemoveDirectoryA("shortone");
4668 RemoveDirectoryA("longone");
4671 DeleteFileA(msifile);
4674 static void test_missingcomponent(void)
4676 UINT r;
4678 if (is_process_limited())
4680 skip("process is limited\n");
4681 return;
4684 CreateDirectoryA("msitest", NULL);
4685 create_file("msitest\\hydrogen", 500);
4686 create_file("msitest\\helium", 500);
4687 create_file("msitest\\lithium", 500);
4688 create_file("beryllium", 500);
4690 create_database(msifile, mcp_tables, ARRAY_SIZE(mcp_tables));
4692 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4694 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
4695 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4697 skip("Not enough rights to perform tests\n");
4698 goto error;
4700 else if (r == ERROR_INSTALL_FAILURE)
4702 win_skip("broken result\n");
4703 goto error;
4705 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4706 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4707 ok(pf_exists("msitest\\helium"), "File not installed\n");
4708 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4709 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
4710 ok(pf_exists("msitest"), "File not installed\n");
4712 r = MsiInstallProductA(msifile, "REMOVE=ALL INSTALLLEVEL=10 PROPVAR=42");
4713 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4714 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
4715 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
4716 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
4717 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
4718 ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
4720 error:
4721 DeleteFileA(msifile);
4722 DeleteFileA("msitest\\hydrogen");
4723 DeleteFileA("msitest\\helium");
4724 DeleteFileA("msitest\\lithium");
4725 DeleteFileA("beryllium");
4726 RemoveDirectoryA("msitest");
4729 static void test_sourcedirprop(void)
4731 UINT r;
4732 CHAR props[MAX_PATH];
4734 if (is_process_limited())
4736 skip("process is limited\n");
4737 return;
4740 CreateDirectoryA("msitest", NULL);
4741 create_file("msitest\\augustus", 500);
4743 create_database(msifile, ca51_tables, ARRAY_SIZE(ca51_tables));
4745 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4747 r = MsiInstallProductA(msifile, NULL);
4748 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4750 skip("Not enough rights to perform tests\n");
4751 goto error;
4753 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4754 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4755 ok(delete_pf("msitest", FALSE), "Directory created\n");
4757 DeleteFileA("msitest\\augustus");
4758 RemoveDirectoryA("msitest");
4760 CreateDirectoryA("altsource", NULL);
4761 CreateDirectoryA("altsource\\msitest", NULL);
4762 create_file("altsource\\msitest\\augustus", 500);
4764 sprintf(props, "SRCDIR=%s\\altsource\\", CURR_DIR);
4766 r = MsiInstallProductA(msifile, props);
4767 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4768 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4769 ok(delete_pf("msitest", FALSE), "Directory created\n");
4771 DeleteFileA("altsource\\msitest\\augustus");
4772 RemoveDirectoryA("altsource\\msitest");
4773 RemoveDirectoryA("altsource");
4775 error:
4776 DeleteFileA("msitest\\augustus");
4777 RemoveDirectoryA("msitest");
4778 DeleteFileA(msifile);
4781 static void test_adminimage(void)
4783 UINT r;
4785 if (is_process_limited())
4787 skip("process is limited\n");
4788 return;
4791 CreateDirectoryA("msitest", NULL);
4792 CreateDirectoryA("msitest\\first", NULL);
4793 CreateDirectoryA("msitest\\second", NULL);
4794 CreateDirectoryA("msitest\\cabout", NULL);
4795 CreateDirectoryA("msitest\\cabout\\new", NULL);
4796 create_file("msitest\\one.txt", 100);
4797 create_file("msitest\\first\\two.txt", 100);
4798 create_file("msitest\\second\\three.txt", 100);
4799 create_file("msitest\\cabout\\four.txt", 100);
4800 create_file("msitest\\cabout\\new\\five.txt", 100);
4801 create_file("msitest\\filename", 100);
4803 create_database_wordcount(msifile, ai_tables, ARRAY_SIZE(ai_tables),
4804 100, msidbSumInfoSourceTypeAdminImage, ";1033",
4805 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
4807 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4809 r = MsiInstallProductA(msifile, NULL);
4810 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4812 skip("Not enough rights to perform tests\n");
4813 goto error;
4815 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4817 delete_pf_files();
4819 error:
4820 DeleteFileA("msifile");
4821 DeleteFileA("msitest\\cabout\\new\\five.txt");
4822 DeleteFileA("msitest\\cabout\\four.txt");
4823 DeleteFileA("msitest\\second\\three.txt");
4824 DeleteFileA("msitest\\first\\two.txt");
4825 DeleteFileA("msitest\\one.txt");
4826 DeleteFileA("msitest\\filename");
4827 RemoveDirectoryA("msitest\\cabout\\new");
4828 RemoveDirectoryA("msitest\\cabout");
4829 RemoveDirectoryA("msitest\\second");
4830 RemoveDirectoryA("msitest\\first");
4831 RemoveDirectoryA("msitest");
4834 static void test_propcase(void)
4836 UINT r;
4838 if (is_process_limited())
4840 skip("process is limited\n");
4841 return;
4844 CreateDirectoryA("msitest", NULL);
4845 create_file("msitest\\augustus", 500);
4847 create_database(msifile, pc_tables, ARRAY_SIZE(pc_tables));
4849 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4851 r = MsiInstallProductA(msifile, "MyProp=42");
4852 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4854 skip("Not enough rights to perform tests\n");
4855 goto error;
4857 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4858 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4859 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4861 r = MsiInstallProductA(msifile, "Prop1=\"Copyright \"\"My Company\"\" 2015\" MyProp=42");
4862 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4863 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4864 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4866 r = MsiInstallProductA(msifile, "Prop1=\"\"\"install.exe\"\" /Install\" MyProp=\"42\"");
4867 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4868 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4869 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4871 error:
4872 DeleteFileA(msifile);
4873 DeleteFileA("msitest\\augustus");
4874 RemoveDirectoryA("msitest");
4877 static void test_int_widths( void )
4879 static const WCHAR msitestW[] = {'m','s','i','t','e','s','t','.','m','s','i',0};
4880 static const WCHAR msitableW[] = {'m','s','i','t','a','b','l','e','.','i','d','t',0};
4881 static const WCHAR slashW[] = {'\\',0};
4882 static const char int0[] = "int0\ni0\nint0\tint0\n1";
4883 static const char int1[] = "int1\ni1\nint1\tint1\n1";
4884 static const char int2[] = "int2\ni2\nint2\tint2\n1";
4885 static const char int3[] = "int3\ni3\nint3\tint3\n1";
4886 static const char int4[] = "int4\ni4\nint4\tint4\n1";
4887 static const char int5[] = "int5\ni5\nint5\tint5\n1";
4888 static const char int8[] = "int8\ni8\nint8\tint8\n1";
4889 static const struct
4891 const char *data;
4892 unsigned int size;
4893 UINT ret;
4895 tests[] =
4897 { int0, sizeof(int0) - 1, ERROR_SUCCESS },
4898 { int1, sizeof(int1) - 1, ERROR_SUCCESS },
4899 { int2, sizeof(int2) - 1, ERROR_SUCCESS },
4900 { int3, sizeof(int3) - 1, ERROR_FUNCTION_FAILED },
4901 { int4, sizeof(int4) - 1, ERROR_SUCCESS },
4902 { int5, sizeof(int5) - 1, ERROR_FUNCTION_FAILED },
4903 { int8, sizeof(int8) - 1, ERROR_FUNCTION_FAILED }
4905 WCHAR tmpdir[MAX_PATH], msitable[MAX_PATH], msidb[MAX_PATH];
4906 MSIHANDLE db;
4907 UINT r, i;
4909 GetTempPathW(MAX_PATH, tmpdir);
4910 CreateDirectoryW(tmpdir, NULL);
4912 lstrcpyW(msitable, tmpdir);
4913 lstrcatW(msitable, slashW);
4914 lstrcatW(msitable, msitableW);
4916 lstrcpyW(msidb, tmpdir);
4917 lstrcatW(msidb, slashW);
4918 lstrcatW(msidb, msitestW);
4920 r = MsiOpenDatabaseW(msidb, MSIDBOPEN_CREATE, &db);
4921 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4923 for (i = 0; i < ARRAY_SIZE(tests); i++)
4925 DWORD count;
4926 HANDLE handle = CreateFileW(msitable, GENERIC_WRITE, 0, NULL,
4927 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
4928 WriteFile(handle, tests[i].data, tests[i].size, &count, NULL);
4929 CloseHandle(handle);
4931 r = MsiDatabaseImportW(db, tmpdir, msitableW);
4932 ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r);
4934 r = MsiDatabaseCommit(db);
4935 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4936 DeleteFileW(msitable);
4939 MsiCloseHandle(db);
4940 DeleteFileW(msidb);
4941 RemoveDirectoryW(tmpdir);
4944 static void test_shortcut(void)
4946 UINT r;
4947 HRESULT hr;
4949 if (is_process_limited())
4951 skip("process is limited\n");
4952 return;
4955 create_test_files();
4956 create_database(msifile, sc_tables, ARRAY_SIZE(sc_tables));
4958 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4960 r = MsiInstallProductA(msifile, NULL);
4961 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4963 skip("Not enough rights to perform tests\n");
4964 goto error;
4966 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4968 hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
4969 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
4971 r = MsiInstallProductA(msifile, NULL);
4972 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4974 CoUninitialize();
4976 hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
4977 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
4979 r = MsiInstallProductA(msifile, NULL);
4980 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4982 CoUninitialize();
4984 while (!delete_pf("msitest\\Shortcut.lnk", TRUE) && GetLastError() == ERROR_SHARING_VIOLATION) Sleep(1000);
4985 delete_pf_files();
4987 error:
4988 delete_test_files();
4989 DeleteFileA(msifile);
4992 static void test_preselected(void)
4994 UINT r;
4996 if (is_process_limited())
4998 skip("process is limited\n");
4999 return;
5002 create_test_files();
5003 create_database(msifile, ps_tables, ARRAY_SIZE(ps_tables));
5005 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5007 r = MsiInstallProductA(msifile, "ADDLOCAL=One");
5008 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5010 skip("Not enough rights to perform tests\n");
5011 goto error;
5013 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5015 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
5016 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
5017 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
5018 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
5019 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
5020 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
5021 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
5022 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
5023 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
5024 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5025 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5027 r = MsiInstallProductA(msifile, NULL);
5028 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5030 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5031 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5032 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5033 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5034 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5035 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5036 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5037 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5038 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5039 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5040 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5042 error:
5043 delete_test_files();
5044 DeleteFileA(msifile);
5047 static void test_installed_prop(void)
5049 static const char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}";
5050 UINT r;
5052 if (is_process_limited())
5054 skip("process is limited\n");
5055 return;
5058 create_test_files();
5059 create_database(msifile, ip_tables, ARRAY_SIZE(ip_tables));
5061 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5063 r = MsiInstallProductA(msifile, "FULL=1");
5064 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5066 skip("Not enough rights to perform tests\n");
5067 goto error;
5069 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5071 r = MsiInstallProductA(msifile, "FULL=1");
5072 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5074 r = MsiConfigureProductExA(prodcode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, "FULL=1");
5075 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5077 delete_pf_files();
5079 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5080 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5082 error:
5083 delete_test_files();
5084 DeleteFileA(msifile);
5087 static void test_allusers_prop(void)
5089 UINT r;
5091 if (is_process_limited())
5093 skip("process is limited\n");
5094 return;
5097 create_test_files();
5098 create_database(msifile, aup_tables, ARRAY_SIZE(aup_tables));
5100 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5102 /* ALLUSERS property unset */
5103 r = MsiInstallProductA(msifile, "FULL=1");
5104 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5106 skip("Not enough rights to perform tests\n");
5107 goto error;
5109 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5111 delete_pf_files();
5113 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5114 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5116 delete_test_files();
5118 create_test_files();
5119 create_database(msifile, aup2_tables, ARRAY_SIZE(aup2_tables));
5121 /* ALLUSERS property set to 1 */
5122 r = MsiInstallProductA(msifile, "FULL=1");
5123 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5125 delete_pf_files();
5127 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5128 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5130 delete_test_files();
5132 create_test_files();
5133 create_database(msifile, aup3_tables, ARRAY_SIZE(aup3_tables));
5135 /* ALLUSERS property set to 2 */
5136 r = MsiInstallProductA(msifile, "FULL=1");
5137 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5139 delete_pf_files();
5141 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5142 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5144 delete_test_files();
5146 create_test_files();
5147 create_database(msifile, aup4_tables, ARRAY_SIZE(aup4_tables));
5149 /* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */
5150 r = MsiInstallProductA(msifile, "FULL=1");
5151 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5153 error:
5154 delete_test_files();
5155 DeleteFileA(msifile);
5158 static const char session_manager[] = "System\\CurrentControlSet\\Control\\Session Manager";
5159 static const char rename_ops[] = "PendingFileRenameOperations";
5161 static void process_pending_renames(HKEY hkey)
5163 char *buf, *src, *dst, *buf2, *buf2ptr;
5164 DWORD size;
5165 LONG ret;
5166 BOOL found = FALSE;
5168 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size);
5169 ok(!ret, "RegQueryValueExA failed %d\n", ret);
5171 buf = HeapAlloc(GetProcessHeap(), 0, size + 1);
5172 buf2ptr = buf2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 1);
5174 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size);
5175 buf[size] = 0;
5176 ok(!ret, "RegQueryValueExA failed %d\n", ret);
5177 if (ret) return;
5179 for (src = buf; *src; src = dst + strlen(dst) + 1)
5181 DWORD flags = MOVEFILE_COPY_ALLOWED;
5182 BOOL fileret;
5184 dst = src + strlen(src) + 1;
5186 if (!strstr(src, "msitest"))
5188 lstrcpyA(buf2ptr, src);
5189 buf2ptr += strlen(src) + 1;
5190 lstrcpyA(buf2ptr, dst);
5191 buf2ptr += strlen(dst) + 1;
5192 continue;
5195 found = TRUE;
5197 if (*dst == '!')
5199 flags |= MOVEFILE_REPLACE_EXISTING;
5200 dst++;
5202 if (src[0] == '\\' && src[1] == '?' && src[2] == '?' && src[3] == '\\') src += 4;
5203 if (*dst)
5205 if (dst[0] == '\\' && dst[1] == '?' && dst[2] == '?' && dst[3] == '\\') dst += 4;
5206 fileret = MoveFileExA(src, dst, flags);
5207 ok(fileret, "Failed to move file %s -> %s (%u)\n", src, dst, GetLastError());
5209 else
5211 fileret = DeleteFileA(src);
5212 ok(fileret || broken(!fileret) /* win2k3 */, "Failed to delete file %s (%u)\n", src, GetLastError());
5216 ok(found, "Expected a 'msitest' entry\n");
5218 if (*buf2)
5219 RegSetValueExA(hkey, rename_ops, 0, REG_MULTI_SZ, (LPBYTE)buf2, buf2ptr + 1 - buf2);
5220 else
5221 RegDeleteValueA(hkey, rename_ops);
5223 HeapFree(GetProcessHeap(), 0, buf);
5224 HeapFree(GetProcessHeap(), 0, buf2);
5227 static BOOL file_matches_data(LPCSTR file, LPCSTR data)
5229 DWORD len, data_len = strlen(data);
5230 HANDLE handle;
5231 char buf[128];
5233 handle = CreateFileA(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
5234 ok(handle != INVALID_HANDLE_VALUE, "failed to open %s (%u)\n", file, GetLastError());
5236 if (ReadFile(handle, buf, sizeof(buf), &len, NULL) && len >= data_len)
5238 CloseHandle(handle);
5239 return !memcmp(buf, data, data_len);
5241 CloseHandle(handle);
5242 return FALSE;
5245 static void test_file_in_use(void)
5247 UINT r;
5248 HANDLE file;
5249 HKEY hkey;
5250 char path[MAX_PATH];
5252 if (is_process_limited())
5254 skip("process is limited\n");
5255 return;
5258 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
5260 CreateDirectoryA("msitest", NULL);
5261 create_file("msitest\\maximus", 500);
5262 create_database(msifile, fiu_tables, ARRAY_SIZE(fiu_tables));
5264 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5266 lstrcpyA(path, PROG_FILES_DIR);
5267 lstrcatA(path, "\\msitest");
5268 CreateDirectoryA(path, NULL);
5270 lstrcatA(path, "\\maximus");
5271 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
5273 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
5274 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5276 skip("Not enough rights to perform tests\n");
5277 goto error;
5279 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
5280 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
5281 CloseHandle(file);
5282 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
5284 process_pending_renames(hkey);
5285 RegCloseKey(hkey);
5287 ok(file_matches_data(path, "msitest\\maximus"), "Expected file to match\n");
5288 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
5289 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
5291 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5292 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5294 error:
5295 RegCloseKey(hkey);
5297 delete_pf("msitest\\maximus", TRUE);
5298 delete_pf("msitest", FALSE);
5299 DeleteFileA("msitest\\maximus");
5300 delete_test_files();
5301 DeleteFileA(msifile);
5304 static void test_file_in_use_cab(void)
5306 UINT r;
5307 HANDLE file;
5308 HKEY hkey;
5309 char path[MAX_PATH];
5311 if (is_process_limited())
5313 skip("process is limited\n");
5314 return;
5317 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
5319 CreateDirectoryA("msitest", NULL);
5320 create_file("maximus", 500);
5321 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
5322 DeleteFileA("maximus");
5324 create_database(msifile, fiuc_tables, ARRAY_SIZE(fiuc_tables));
5326 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5328 lstrcpyA(path, PROG_FILES_DIR);
5329 lstrcatA(path, "\\msitest");
5330 CreateDirectoryA(path, NULL);
5332 lstrcatA(path, "\\maximus");
5333 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
5335 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
5336 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5338 skip("Not enough rights to perform tests\n");
5339 goto error;
5341 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
5342 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
5343 CloseHandle(file);
5344 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
5346 process_pending_renames(hkey);
5347 RegCloseKey(hkey);
5349 ok(file_matches_data(path, "maximus"), "Expected file to match\n");
5350 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
5351 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
5353 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5354 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5356 error:
5357 RegCloseKey(hkey);
5359 delete_pf("msitest\\maximus", TRUE);
5360 delete_pf("msitest", FALSE);
5361 DeleteFileA("msitest\\maximus");
5362 delete_cab_files();
5363 delete_test_files();
5364 DeleteFileA(msifile);
5367 static void test_feature_override(void)
5369 UINT r;
5370 REGSAM access = KEY_ALL_ACCESS;
5372 if (is_process_limited())
5374 skip("process is limited\n");
5375 return;
5378 create_test_files();
5379 create_file("msitest\\override.txt", 1000);
5380 create_file("msitest\\preselected.txt", 1000);
5381 create_file("msitest\\notpreselected.txt", 1000);
5382 create_database(msifile, fo_tables, ARRAY_SIZE(fo_tables));
5384 if (is_wow64)
5385 access |= KEY_WOW64_64KEY;
5387 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5389 r = MsiInstallProductA(msifile, "ADDLOCAL=override");
5390 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5392 skip("Not enough rights to perform tests\n");
5393 goto error;
5395 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5397 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5398 ok(!pf_exists("msitest\\preselected.txt"), "file installed\n");
5399 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5401 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5402 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5404 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5406 r = MsiInstallProductA(msifile, "preselect=1");
5407 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5409 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5410 ok(pf_exists("msitest\\preselected.txt"), "file not installed\n");
5411 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5413 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5414 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5416 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5417 todo_wine {
5418 ok(delete_pf("msitest\\preselected.txt", TRUE), "file removed\n");
5419 ok(delete_pf("msitest", FALSE), "directory removed\n");
5422 r = MsiInstallProductA(msifile, NULL);
5423 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5425 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5426 ok(pf_exists("msitest\\preselected.txt"), "file not installed\n");
5427 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5429 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5430 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5432 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5433 todo_wine {
5434 ok(delete_pf("msitest\\preselected.txt", TRUE), "file removed\n");
5435 ok(delete_pf("msitest", FALSE), "directory removed\n");
5438 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", access);
5440 error:
5441 DeleteFileA("msitest\\override.txt");
5442 DeleteFileA("msitest\\preselected.txt");
5443 DeleteFileA("msitest\\notpreselected.txt");
5444 delete_test_files();
5445 DeleteFileA(msifile);
5448 static void test_icon_table(void)
5450 MSIHANDLE hdb = 0, record;
5451 LPCSTR query;
5452 UINT res;
5453 CHAR path[MAX_PATH];
5454 static const char prodcode[] = "{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}";
5456 if (is_process_limited())
5458 skip("process is limited\n");
5459 return;
5462 create_database(msifile, icon_base_tables, ARRAY_SIZE(icon_base_tables));
5464 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5466 res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb);
5467 ok(res == ERROR_SUCCESS, "failed to open db: %d\n", res);
5469 query = "CREATE TABLE `Icon` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)";
5470 res = run_query( hdb, 0, query );
5471 ok(res == ERROR_SUCCESS, "Can't create Icon table: %d\n", res);
5473 create_file("icon.ico", 100);
5474 record = MsiCreateRecord(1);
5475 res = MsiRecordSetStreamA(record, 1, "icon.ico");
5476 ok(res == ERROR_SUCCESS, "Failed to add stream data to record: %d\n", res);
5478 query = "INSERT INTO `Icon` (`Name`, `Data`) VALUES ('testicon', ?)";
5479 res = run_query(hdb, record, query);
5480 ok(res == ERROR_SUCCESS, "Insert into Icon table failed: %d\n", res);
5482 res = MsiCloseHandle(record);
5483 ok(res == ERROR_SUCCESS, "Failed to close record handle: %d\n", res);
5484 DeleteFileA("icon.ico");
5485 res = MsiDatabaseCommit(hdb);
5486 ok(res == ERROR_SUCCESS, "Failed to commit database: %d\n", res);
5487 res = MsiCloseHandle(hdb);
5488 ok(res == ERROR_SUCCESS, "Failed to close database: %d\n", res);
5490 /* per-user */
5491 res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
5492 if (res == ERROR_INSTALL_PACKAGE_REJECTED)
5494 skip("Not enough rights to perform tests\n");
5495 DeleteFileA(msifile);
5496 return;
5498 ok(res == ERROR_SUCCESS, "Failed to do per-user install: %d\n", res);
5500 lstrcpyA(path, APP_DATA_DIR);
5501 lstrcatA(path, "\\");
5502 lstrcatA(path, "Microsoft\\Installer\\");
5503 lstrcatA(path, prodcode);
5504 lstrcatA(path, "\\testicon");
5505 ok(file_exists(path), "Per-user icon file isn't where it's expected (%s)\n", path);
5507 res = MsiInstallProductA(msifile, "REMOVE=ALL");
5508 ok(res == ERROR_SUCCESS, "Failed to uninstall per-user\n");
5509 ok(!file_exists(path), "Per-user icon file not removed (%s)\n", path);
5511 /* system-wide */
5512 res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
5513 ok(res == ERROR_SUCCESS, "Failed to system-wide install: %d\n", res);
5515 lstrcpyA(path, WINDOWS_DIR);
5516 lstrcatA(path, "\\");
5517 lstrcatA(path, "Installer\\");
5518 lstrcatA(path, prodcode);
5519 lstrcatA(path, "\\testicon");
5520 ok(file_exists(path), "System-wide icon file isn't where it's expected (%s)\n", path);
5522 res = MsiInstallProductA(msifile, "REMOVE=ALL");
5523 ok(res == ERROR_SUCCESS, "Failed to uninstall system-wide\n");
5524 ok(!file_exists(path), "System-wide icon file not removed (%s)\n", path);
5526 delete_pfmsitest_files();
5527 DeleteFileA(msifile);
5530 static void test_package_validation(void)
5532 UINT r;
5534 if (is_process_limited())
5536 skip("process is limited\n");
5537 return;
5540 CreateDirectoryA("msitest", NULL);
5541 create_file("msitest\\maximus", 500);
5542 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;1033");
5544 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5546 r = MsiInstallProductA(msifile, NULL);
5547 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5549 skip("Not enough rights to perform tests\n");
5550 goto error;
5552 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5553 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5554 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5556 DeleteFileA(msifile);
5557 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel,9999;9999");
5559 r = MsiInstallProductA(msifile, NULL);
5560 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5562 DeleteFileA(msifile);
5563 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel,1033;9999");
5565 r = MsiInstallProductA(msifile, NULL);
5566 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5568 DeleteFileA(msifile);
5569 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel,9999;1033");
5571 r = MsiInstallProductA(msifile, NULL);
5572 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5573 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5574 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5576 DeleteFileA(msifile);
5577 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel64,9999;1033");
5579 r = MsiInstallProductA(msifile, NULL);
5580 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5582 DeleteFileA(msifile);
5583 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel32,1033;1033");
5585 r = MsiInstallProductA(msifile, NULL);
5586 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5588 DeleteFileA(msifile);
5589 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel32,9999;1033");
5591 r = MsiInstallProductA(msifile, NULL);
5592 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5594 DeleteFileA(msifile);
5595 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;9999");
5597 r = MsiInstallProductA(msifile, NULL);
5598 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5599 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5600 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5602 if (GetSystemDefaultLangID() == MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ))
5604 DeleteFileA(msifile);
5605 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;9");
5606 r = MsiInstallProductA(msifile, NULL);
5607 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5608 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5609 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5611 DeleteFileA(msifile);
5612 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;1024");
5613 r = MsiInstallProductA(msifile, NULL);
5614 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5615 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5616 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5619 DeleteFileA(msifile);
5620 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel32;0");
5622 r = MsiInstallProductA(msifile, NULL);
5623 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5624 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5625 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5627 if (is_64bit && !is_wow64)
5629 DeleteFileA(msifile);
5630 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;0");
5632 r = MsiInstallProductA(msifile, NULL);
5633 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5634 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5635 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5637 DeleteFileA(msifile);
5638 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "x64;0");
5640 r = MsiInstallProductA(msifile, NULL);
5641 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
5642 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5643 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5645 DeleteFileA(msifile);
5646 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "x64;0");
5648 r = MsiInstallProductA(msifile, NULL);
5649 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5650 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5651 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5653 else if (is_wow64)
5655 DeleteFileA(msifile);
5656 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;0");
5658 r = MsiInstallProductA(msifile, NULL);
5659 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5660 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5661 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5663 DeleteFileA(msifile);
5664 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "x64;0");
5666 r = MsiInstallProductA(msifile, NULL);
5667 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
5668 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5669 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5671 DeleteFileA(msifile);
5672 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "x64;0");
5674 r = MsiInstallProductA(msifile, NULL);
5675 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5676 ok(delete_pf("msitest\\maximus", TRUE), "file exists\n");
5677 ok(delete_pf("msitest", FALSE), "directory exists\n");
5679 else
5681 DeleteFileA(msifile);
5682 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;0");
5684 r = MsiInstallProductA(msifile, NULL);
5685 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5686 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5687 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5689 DeleteFileA(msifile);
5690 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Alpha,Beta,Intel;0");
5692 r = MsiInstallProductA(msifile, NULL);
5693 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5694 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5695 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5697 DeleteFileA(msifile);
5698 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "x64;0");
5700 r = MsiInstallProductA(msifile, NULL);
5701 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5702 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5703 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5705 DeleteFileA(msifile);
5706 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "x64;0");
5708 r = MsiInstallProductA(msifile, NULL);
5709 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5710 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5711 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5714 error:
5715 /* Delete the files in the temp (current) folder */
5716 DeleteFileA(msifile);
5717 DeleteFileA("msitest\\maximus");
5718 RemoveDirectoryA("msitest");
5721 static void test_upgrade_code(void)
5723 UINT r;
5725 if (is_process_limited())
5727 skip("process is limited\n");
5728 return;
5731 CreateDirectoryA("msitest", NULL);
5732 create_file("msitest\\upgradecode.txt", 1000);
5733 create_database(msifile, uc_tables, ARRAY_SIZE(uc_tables));
5735 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5737 r = MsiInstallProductA(msifile, NULL);
5738 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5740 ok(pf_exists("msitest\\upgradecode.txt"), "file not installed\n");
5742 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5743 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5745 ok(!delete_pf("msitest\\upgradecode.txt", TRUE), "file not removed\n");
5746 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5748 DeleteFileA("msitest\\upgradecode.txt");
5749 RemoveDirectoryA("msitest");
5750 DeleteFileA(msifile);
5753 static void test_mixed_package(void)
5755 UINT r;
5756 LONG res;
5757 HKEY hkey;
5758 char value[MAX_PATH];
5759 DWORD size;
5761 if (is_process_limited())
5763 skip("process is limited\n");
5764 return;
5766 if (!is_wow64 && !is_64bit)
5768 skip("this test must be run on 64-bit\n");
5769 return;
5771 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5772 create_database_template(msifile, mixed_tables, ARRAY_SIZE(mixed_tables), 200, "x64;1033");
5774 r = MsiInstallProductA(msifile, NULL);
5775 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5777 skip("Not enough rights to perform tests\n");
5778 goto error;
5780 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5782 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5783 ok(!res, "can't open 32-bit component key, got %d\n", res);
5784 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5785 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5786 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5787 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5788 RegCloseKey(hkey);
5790 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5791 ok(!res, "can't open 64-bit component key, got %d\n", res);
5792 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5793 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5794 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5795 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5796 RegCloseKey(hkey);
5798 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5799 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5800 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5801 ok(res == ERROR_SUCCESS, "can't open 32-bit CLSID key, got %d\n", res);
5802 if (res == ERROR_SUCCESS) {
5803 size = sizeof(value);
5804 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5805 ok(!strcmp(value, "winetest32.dll"), "got %s\n", value);
5806 RegCloseKey(hkey);
5809 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5810 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5811 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5812 ok(res == ERROR_SUCCESS, "can't open 64-bit CLSID key, got %d\n", res);
5813 if (res == ERROR_SUCCESS) {
5814 size = sizeof(value);
5815 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5816 ok(!strcmp(value, "winetest64.dll"), "got %s\n", value);
5817 RegCloseKey(hkey);
5820 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5821 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5823 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5824 ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
5826 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5827 ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
5829 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5830 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5831 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5832 ok(res == ERROR_FILE_NOT_FOUND, "32-bit CLSID key not removed\n");
5834 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5835 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5836 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5837 ok(res == ERROR_FILE_NOT_FOUND, "64-bit CLSID key not removed\n");
5839 DeleteFileA( msifile );
5840 create_database_template(msifile, mixed_tables, ARRAY_SIZE(mixed_tables), 200, "Intel;1033");
5842 r = MsiInstallProductA(msifile, NULL);
5843 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5845 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5846 ok(!res, "can't open 32-bit component key, got %d\n", res);
5847 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5848 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5849 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5850 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5851 RegCloseKey(hkey);
5853 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5854 ok(!res, "can't open 64-bit component key, got %d\n", res);
5855 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5856 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5857 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5858 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5859 RegCloseKey(hkey);
5861 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5862 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5863 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5864 ok(res == ERROR_SUCCESS, "can't open 32-bit CLSID key, got %d\n", res);
5865 if (res == ERROR_SUCCESS) {
5866 size = sizeof(value);
5867 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5868 ok(!strcmp(value, "winetest32.dll"), "got %s\n", value);
5869 RegCloseKey(hkey);
5872 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5873 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5874 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5875 ok(res == ERROR_SUCCESS, "can't open 64-bit CLSID key, got %d\n", res);
5876 if (res == ERROR_SUCCESS) {
5877 size = sizeof(value);
5878 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5879 ok(!strcmp(value, "winetest64.dll"), "got %s\n", value);
5880 RegCloseKey(hkey);
5883 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5884 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5886 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5887 ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
5889 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5890 ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
5892 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5893 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5894 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5895 ok(res == ERROR_FILE_NOT_FOUND, "32-bit CLSID key not removed\n");
5897 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5898 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5899 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5900 ok(res == ERROR_FILE_NOT_FOUND, "64-bit CLSID key not removed\n");
5902 error:
5903 DeleteFileA( msifile );
5906 static void test_volume_props(void)
5908 UINT r;
5910 if (is_process_limited())
5912 skip("process is limited\n");
5913 return;
5915 CreateDirectoryA("msitest", NULL);
5916 create_file("msitest\\volumeprop.txt", 1000);
5917 create_database(msifile, vp_tables, ARRAY_SIZE(vp_tables));
5919 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5921 r = MsiInstallProductA(msifile, NULL);
5922 ok(r == ERROR_SUCCESS, "got %u\n", r);
5924 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5925 ok(r == ERROR_SUCCESS, "got %u\n", r);
5927 DeleteFileA("msitest\\volumeprop.txt");
5928 RemoveDirectoryA("msitest");
5929 DeleteFileA(msifile);
5932 static void test_shared_component(void)
5934 UINT r;
5936 if (is_process_limited())
5938 skip("process is limited\n");
5939 return;
5941 CreateDirectoryA("msitest", NULL);
5942 create_file("msitest\\sharedcomponent.txt", 1000);
5943 create_database_wordcount(msifile, shc_tables, ARRAY_SIZE(shc_tables),
5944 100, 0, ";", "{A8826420-FD72-4E61-9E15-C1944CF4CBE1}");
5945 create_database_wordcount(msifile2, shc2_tables, ARRAY_SIZE(shc2_tables),
5946 100, 0, ";", "{A8B50B30-0E8A-4ACD-B3CF-1A5DC58B2739}");
5948 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5950 r = MsiInstallProductA(msifile, NULL);
5951 ok(r == ERROR_SUCCESS, "got %u\n", r);
5953 ok(pf_exists("msitest\\sharedcomponent.txt"), "file not installed\n");
5955 r = MsiInstallProductA(msifile2, NULL);
5956 ok(r == ERROR_SUCCESS, "got %u\n", r);
5958 ok(pf_exists("msitest\\sharedcomponent.txt"), "file not installed\n");
5960 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5961 ok(r == ERROR_SUCCESS, "got %u\n", r);
5963 ok(pf_exists("msitest\\sharedcomponent.txt"), "file removed\n");
5965 r = MsiInstallProductA(msifile2, "REMOVE=ALL");
5966 ok(r == ERROR_SUCCESS, "got %u\n", r);
5968 ok(!pf_exists("msitest\\sharedcomponent.txt"), "file not removed\n");
5970 DeleteFileA("msitest\\sharedcomponent.txt");
5971 RemoveDirectoryA("msitest");
5972 DeleteFileA(msifile);
5973 DeleteFileA(msifile2);
5976 static void test_remove_upgrade_code(void)
5978 UINT r;
5979 LONG res;
5980 HKEY hkey;
5981 REGSAM access = KEY_ALL_ACCESS;
5982 DWORD type, size;
5983 char buf[1];
5985 if (is_process_limited())
5987 skip( "process is limited\n" );
5988 return;
5990 if (is_wow64) access |= KEY_WOW64_64KEY;
5992 create_test_files();
5993 create_database( msifile, icon_base_tables, ARRAY_SIZE( icon_base_tables ));
5995 MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
5997 r = MsiInstallProductA( msifile, "FULL=1" );
5998 ok(r == ERROR_SUCCESS, "got %u\n", r);
6000 res = RegOpenKeyExA( HKEY_LOCAL_MACHINE,
6001 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2",
6002 0, access, &hkey );
6003 ok( res == ERROR_SUCCESS, "got %d\n", res );
6005 type = 0xdeadbeef;
6006 buf[0] = 0x55;
6007 size = sizeof(buf);
6008 res = RegQueryValueExA( hkey, "94A88FD7F6998CE40A22FB59F6B9C2BB", NULL, &type, (BYTE *)buf, &size );
6009 ok( res == ERROR_SUCCESS, "got %d\n", res );
6010 ok( type == REG_SZ, "got %u\n", type );
6011 ok( size == 1, "got %u\n", size );
6012 ok( !buf[0], "wrong data\n" );
6013 RegCloseKey( hkey );
6015 r = MsiInstallProductA( msifile, "REMOVE=ALL" );
6016 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6018 res = RegOpenKeyExA( HKEY_LOCAL_MACHINE,
6019 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2",
6020 0, access, &hkey );
6021 ok( res == ERROR_FILE_NOT_FOUND, "got %d\n", res );
6023 RemoveDirectoryA( "msitest" );
6024 DeleteFileA( msifile );
6027 static void test_feature_tree(void)
6029 UINT r;
6031 if (is_process_limited())
6033 skip( "process is limited\n" );
6034 return;
6037 create_file( "msitest\\featuretree.txt", 1000 );
6038 create_database( msifile, ft_tables, ARRAY_SIZE( ft_tables ));
6040 MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
6042 r = MsiInstallProductA( msifile, "INSTALLTYPE=\"0\"" );
6043 ok( r == ERROR_INSTALL_FAILURE, "got %u\n", r );
6045 r = MsiInstallProductA( msifile, "INSTALLTYPE=\"1\"" );
6046 ok( r == ERROR_SUCCESS, "got %u\n", r );
6048 r = MsiInstallProductA( msifile, "REMOVE=ALL" );
6049 ok( r == ERROR_SUCCESS, "got %u\n", r );
6051 DeleteFileA( "msitest\\featuretree.txt" );
6052 RemoveDirectoryA( "msitest" );
6053 DeleteFileA( msifile );
6056 static void check_file_matches(const char *filename, const char *text)
6058 char buffer[200];
6059 HANDLE file;
6060 DWORD size;
6062 file = CreateFileA(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
6063 ReadFile(file, buffer, sizeof(buffer), &size, NULL);
6064 ok(size == strlen(text) && !memcmp(buffer, text, size), "got %.*s\n", size, buffer);
6065 CloseHandle(file);
6068 static void test_deferred_action(void)
6070 char path[200], file[200], buffer[200];
6071 UINT r;
6073 GetTempPathA(sizeof(path), path);
6074 GetTempFileNameA(path, "da", 0, file);
6075 sprintf(buffer, "TESTPATH=\"%s\"", file);
6077 create_database(msifile, da_tables, ARRAY_SIZE(da_tables));
6079 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6081 r = MsiInstallProductA(msifile, buffer);
6082 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6084 skip("Not enough rights to perform tests\n");
6085 goto error;
6087 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6089 check_file_matches(file, "onetwo");
6091 ok(DeleteFileA(file), "Directory not created\n");
6093 error:
6094 DeleteFileA(msifile);
6097 static void test_wow64(void)
6099 void *cookie;
6100 UINT r;
6102 if (!is_wow64)
6104 skip("test must be run on WoW64\n");
6105 return;
6108 if (is_process_limited())
6110 skip("process is limited\n");
6111 return;
6114 create_test_files();
6115 create_database_template(msifile, x64_tables, ARRAY_SIZE(x64_tables), 200, "x64;0");
6116 r = MsiInstallProductA(msifile, NULL);
6117 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6119 skip("Not enough rights to perform tests\n");
6120 goto error;
6123 pWow64DisableWow64FsRedirection(&cookie);
6125 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
6126 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
6127 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
6128 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
6129 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
6130 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
6131 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
6132 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
6133 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
6134 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
6135 ok(!delete_pf("msitest", FALSE), "Directory created\n");
6137 ok(delete_pf_native("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
6138 ok(delete_pf_native("msitest\\cabout\\new", FALSE), "Directory not created\n");
6139 ok(delete_pf_native("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
6140 ok(delete_pf_native("msitest\\cabout", FALSE), "Directory not created\n");
6141 ok(delete_pf_native("msitest\\changed\\three.txt", TRUE), "File not installed\n");
6142 ok(delete_pf_native("msitest\\changed", FALSE), "Directory not created\n");
6143 ok(delete_pf_native("msitest\\first\\two.txt", TRUE), "File not installed\n");
6144 ok(delete_pf_native("msitest\\first", FALSE), "Directory not created\n");
6145 ok(delete_pf_native("msitest\\one.txt", TRUE), "File not installed\n");
6146 ok(delete_pf_native("msitest\\filename", TRUE), "File not installed\n");
6147 ok(delete_pf_native("msitest", FALSE), "Directory not created\n");
6149 pWow64RevertWow64FsRedirection(cookie);
6151 error:
6152 delete_test_files();
6153 DeleteFileA(msifile);
6156 /* Test what actions cause resolution of SourceDir when executed. */
6157 static void test_source_resolution(void)
6159 UINT r;
6161 if (is_process_limited())
6163 skip( "process is limited\n" );
6164 return;
6167 create_test_files();
6168 create_database(msifile, sr_tables, ARRAY_SIZE(sr_tables));
6170 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6172 r = MsiInstallProductA(msifile, "RESOLVE_SOURCE=1");
6173 ok(r == ERROR_SUCCESS, "got %u\n", r);
6175 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
6176 ok(r == ERROR_SUCCESS, "got %u\n", r);
6178 r = MsiInstallProductA(msifile, "INSTALL_FILES=1");
6179 ok(r == ERROR_SUCCESS, "got %u\n", r);
6181 delete_pf_files();
6182 delete_test_files();
6183 DeleteFileA(msifile);
6186 START_TEST(install)
6188 DWORD len;
6189 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6190 STATEMGRSTATUS status;
6191 BOOL ret = FALSE;
6193 init_functionpointers();
6195 if (pIsWow64Process)
6196 pIsWow64Process(GetCurrentProcess(), &is_wow64);
6198 GetCurrentDirectoryA(MAX_PATH, prev_path);
6199 GetTempPathA(MAX_PATH, temp_path);
6200 SetCurrentDirectoryA(temp_path);
6202 lstrcpyA(CURR_DIR, temp_path);
6203 len = lstrlenA(CURR_DIR);
6205 if(len && (CURR_DIR[len - 1] == '\\'))
6206 CURR_DIR[len - 1] = 0;
6208 ok(get_system_dirs(), "failed to retrieve system dirs\n");
6209 ok(get_user_dirs(), "failed to retrieve user dirs\n");
6211 /* Create a restore point ourselves so we circumvent the multitude of restore points
6212 * that would have been created by all the installation and removal tests.
6214 * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
6215 * creation of restore points.
6217 if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
6219 memset(&status, 0, sizeof(status));
6220 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
6223 /* Create only one log file and don't append. We have to pass something
6224 * for the log mode for this to work. The logfile needs to have an absolute
6225 * path otherwise we still end up with some extra logfiles as some tests
6226 * change the current directory.
6228 lstrcpyA(log_file, temp_path);
6229 lstrcatA(log_file, "\\msitest.log");
6230 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
6232 if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */
6233 test_MsiInstallProduct();
6234 test_MsiSetComponentState();
6235 test_packagecoltypes();
6236 test_continuouscabs();
6237 test_caborder();
6238 test_mixedmedia();
6239 test_samesequence();
6240 test_uiLevelFlags();
6241 test_readonlyfile();
6242 test_readonlyfile_cab();
6243 test_setdirproperty();
6244 test_cabisextracted();
6245 test_transformprop();
6246 test_currentworkingdir();
6247 test_admin();
6248 test_adminprops();
6249 test_missingcab();
6250 test_sourcefolder();
6251 test_customaction1();
6252 test_customaction51();
6253 test_installstate();
6254 test_sourcepath();
6255 test_missingcomponent();
6256 test_sourcedirprop();
6257 test_adminimage();
6258 test_propcase();
6259 test_int_widths();
6260 test_shortcut();
6261 test_preselected();
6262 test_installed_prop();
6263 test_file_in_use();
6264 test_file_in_use_cab();
6265 test_allusers_prop();
6266 test_feature_override();
6267 test_icon_table();
6268 test_package_validation();
6269 test_upgrade_code();
6270 test_mixed_package();
6271 test_volume_props();
6272 test_shared_component();
6273 test_remove_upgrade_code();
6274 test_feature_tree();
6275 test_deferred_action();
6276 test_wow64();
6277 test_source_resolution();
6279 DeleteFileA(customdll);
6281 DeleteFileA(log_file);
6283 if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
6285 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
6286 if (ret)
6287 remove_restore_point(status.llSequenceNumber);
6289 FreeLibrary(hsrclient);
6291 SetCurrentDirectoryA(prev_path);