mf/session: Forward more events to the application.
[wine/zf.git] / dlls / msi / tests / install.c
blobce650b84d6118633984d13ad1e1484de2ce3ac62
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 LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
48 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
49 static BOOL (WINAPI *pWow64DisableWow64FsRedirection)(void **);
50 static BOOL (WINAPI *pWow64RevertWow64FsRedirection)(void *);
52 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
53 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
55 static BOOL is_wow64;
56 static const BOOL is_64bit = sizeof(void *) > sizeof(int);
58 static const char *msifile = "msitest.msi";
59 static const char *msifile2 = "winetest2.msi";
60 static const char *mstfile = "winetest.mst";
62 static const WCHAR msifileW[] = L"msitest.msi";
63 static const WCHAR msifile2W[] = L"msitest2.msi";
65 char CURR_DIR[MAX_PATH];
66 char PROG_FILES_DIR[MAX_PATH];
67 char PROG_FILES_DIR_NATIVE[MAX_PATH];
68 char COMMON_FILES_DIR[MAX_PATH];
69 char APP_DATA_DIR[MAX_PATH];
70 char WINDOWS_DIR[MAX_PATH];
72 static const char *customdll;
74 /* msi database data */
76 static const CHAR component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
77 "s72\tS38\ts72\ti2\tS255\tS72\n"
78 "Component\tComponent\n"
79 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
80 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
81 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n"
82 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
83 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
84 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
85 "component\t\tMSITESTDIR\t0\t1\tfile\n";
87 static const CHAR directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
88 "s72\tS72\tl255\n"
89 "Directory\tDirectory\n"
90 "CABOUTDIR\tMSITESTDIR\tcabout\n"
91 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
92 "FIRSTDIR\tMSITESTDIR\tfirst\n"
93 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
94 "NEWDIR\tCABOUTDIR\tnew\n"
95 "ProgramFilesFolder\tTARGETDIR\t.\n"
96 "TARGETDIR\t\tSourceDir";
98 static const CHAR feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
99 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
100 "Feature\tFeature\n"
101 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
102 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
103 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
104 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
105 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
106 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n";
108 static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
109 "s38\ts72\n"
110 "FeatureComponents\tFeature_\tComponent_\n"
111 "Five\tFive\n"
112 "Four\tFour\n"
113 "One\tOne\n"
114 "Three\tThree\n"
115 "Two\tTwo\n"
116 "feature\tcomponent\n";
118 static const CHAR file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
119 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
120 "File\tFile\n"
121 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
122 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
123 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
124 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
125 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
126 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n";
128 static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
129 "s72\tS255\tI2\n"
130 "InstallExecuteSequence\tAction\n"
131 "AllocateRegistrySpace\tNOT Installed\t1550\n"
132 "CostFinalize\t\t1000\n"
133 "CostInitialize\t\t800\n"
134 "FileCost\t\t900\n"
135 "ResolveSource\t\t950\n"
136 "MoveFiles\t\t1700\n"
137 "InstallFiles\t\t4000\n"
138 "BindImage\t\t4100\n"
139 "DuplicateFiles\t\t4500\n"
140 "WriteEnvironmentStrings\t\t4550\n"
141 "CreateShortcuts\t\t4600\n"
142 "InstallFinalize\t\t6600\n"
143 "InstallInitialize\t\t1500\n"
144 "InstallValidate\t\t1400\n"
145 "LaunchConditions\t\t100\n"
146 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
148 static const CHAR media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
149 "i2\ti4\tL64\tS255\tS32\tS72\n"
150 "Media\tDiskId\n"
151 "1\t3\t\t\tDISK1\t\n"
152 "2\t5\t\tmsitest.cab\tDISK2\t\n";
154 static const CHAR property_dat[] = "Property\tValue\n"
155 "s72\tl0\n"
156 "Property\tProperty\n"
157 "DefaultUIFont\tDlgFont8\n"
158 "HASUIRUN\t0\n"
159 "INSTALLLEVEL\t3\n"
160 "InstallMode\tTypical\n"
161 "Manufacturer\tWine\n"
162 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
163 "PRIMARYFOLDER\tTARGETDIR\n"
164 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
165 "ProductID\tnone\n"
166 "ProductLanguage\t1033\n"
167 "ProductName\tMSITEST\n"
168 "ProductVersion\t1.1.1\n"
169 "PROMPTROLLBACKCOST\tP\n"
170 "Setup\tSetup\n"
171 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
172 "AdminProperties\tPOSTADMIN\n"
173 "ROOTDRIVE\tC:\\\n"
174 "MSIFASTINSTALL\t1\n";
176 static const CHAR aup_property_dat[] = "Property\tValue\n"
177 "s72\tl0\n"
178 "Property\tProperty\n"
179 "DefaultUIFont\tDlgFont8\n"
180 "HASUIRUN\t0\n"
181 "ALLUSERS\t1\n"
182 "INSTALLLEVEL\t3\n"
183 "InstallMode\tTypical\n"
184 "Manufacturer\tWine\n"
185 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
186 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
187 "ProductID\tnone\n"
188 "ProductLanguage\t1033\n"
189 "ProductName\tMSITEST\n"
190 "ProductVersion\t1.1.1\n"
191 "PROMPTROLLBACKCOST\tP\n"
192 "Setup\tSetup\n"
193 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
194 "AdminProperties\tPOSTADMIN\n"
195 "ROOTDRIVE\tC:\\\n"
196 "MSIFASTINSTALL\t1\n";
198 static const CHAR aup2_property_dat[] = "Property\tValue\n"
199 "s72\tl0\n"
200 "Property\tProperty\n"
201 "DefaultUIFont\tDlgFont8\n"
202 "HASUIRUN\t0\n"
203 "ALLUSERS\t2\n"
204 "INSTALLLEVEL\t3\n"
205 "InstallMode\tTypical\n"
206 "Manufacturer\tWine\n"
207 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
208 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
209 "ProductID\tnone\n"
210 "ProductLanguage\t1033\n"
211 "ProductName\tMSITEST\n"
212 "ProductVersion\t1.1.1\n"
213 "PROMPTROLLBACKCOST\tP\n"
214 "Setup\tSetup\n"
215 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
216 "AdminProperties\tPOSTADMIN\n"
217 "ROOTDRIVE\tC:\\\n"
218 "MSIFASTINSTALL\t1\n";
220 static const CHAR icon_property_dat[] = "Property\tValue\n"
221 "s72\tl0\n"
222 "Property\tProperty\n"
223 "DefaultUIFont\tDlgFont8\n"
224 "HASUIRUN\t0\n"
225 "INSTALLLEVEL\t3\n"
226 "InstallMode\tTypical\n"
227 "Manufacturer\tWine\n"
228 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
229 "ProductCode\t{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}\n"
230 "ProductID\tnone\n"
231 "ProductLanguage\t1033\n"
232 "ProductName\tMSITEST\n"
233 "ProductVersion\t1.1.1\n"
234 "PROMPTROLLBACKCOST\tP\n"
235 "Setup\tSetup\n"
236 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
237 "AdminProperties\tPOSTADMIN\n"
238 "ROOTDRIVE\tC:\\\n"
239 "MSIFASTINSTALL\t1\n";
241 static const CHAR shortcut_dat[] = "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
242 "s72\ts72\tl128\ts72\ts72\tS255\tL255\tI2\tS72\tI2\tI2\tS72\n"
243 "Shortcut\tShortcut\n"
244 "Shortcut\tMSITESTDIR\tShortcut\tcomponent\tShortcut\t\tShortcut\t\t\t\t\t\n";
246 static const CHAR condition_dat[] = "Feature_\tLevel\tCondition\n"
247 "s38\ti2\tS255\n"
248 "Condition\tFeature_\tLevel\n"
249 "One\t4\t1\n";
251 static const CHAR up_property_dat[] = "Property\tValue\n"
252 "s72\tl0\n"
253 "Property\tProperty\n"
254 "DefaultUIFont\tDlgFont8\n"
255 "HASUIRUN\t0\n"
256 "INSTALLLEVEL\t3\n"
257 "InstallMode\tTypical\n"
258 "Manufacturer\tWine\n"
259 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
260 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
261 "ProductID\tnone\n"
262 "ProductLanguage\t1033\n"
263 "ProductName\tMSITEST\n"
264 "ProductVersion\t1.1.1\n"
265 "PROMPTROLLBACKCOST\tP\n"
266 "Setup\tSetup\n"
267 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
268 "AdminProperties\tPOSTADMIN\n"
269 "ROOTDRIVE\tC:\\\n"
270 "RemovePreviousVersions\t1\n"
271 "MSIFASTINSTALL\t1\n";
273 static const CHAR up2_property_dat[] = "Property\tValue\n"
274 "s72\tl0\n"
275 "Property\tProperty\n"
276 "DefaultUIFont\tDlgFont8\n"
277 "HASUIRUN\t0\n"
278 "INSTALLLEVEL\t3\n"
279 "InstallMode\tTypical\n"
280 "Manufacturer\tWine\n"
281 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
282 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
283 "ProductID\tnone\n"
284 "ProductLanguage\t1033\n"
285 "ProductName\tMSITEST\n"
286 "ProductVersion\t1.1.2\n"
287 "PROMPTROLLBACKCOST\tP\n"
288 "Setup\tSetup\n"
289 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
290 "AdminProperties\tPOSTADMIN\n"
291 "ROOTDRIVE\tC:\\\n"
292 "MSIFASTINSTALL\t1\n";
294 static const CHAR up3_property_dat[] = "Property\tValue\n"
295 "s72\tl0\n"
296 "Property\tProperty\n"
297 "DefaultUIFont\tDlgFont8\n"
298 "HASUIRUN\t0\n"
299 "INSTALLLEVEL\t3\n"
300 "InstallMode\tTypical\n"
301 "Manufacturer\tWine\n"
302 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
303 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
304 "ProductID\tnone\n"
305 "ProductLanguage\t1033\n"
306 "ProductName\tMSITEST\n"
307 "ProductVersion\t1.1.2\n"
308 "PROMPTROLLBACKCOST\tP\n"
309 "Setup\tSetup\n"
310 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
311 "AdminProperties\tPOSTADMIN\n"
312 "ROOTDRIVE\tC:\\\n"
313 "RemovePreviousVersions\t1\n"
314 "MSIFASTINSTALL\t1\n";
316 static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
317 "s72\ti2\tl255\tL255\tL0\ts72\n"
318 "Registry\tRegistry\n"
319 "Apples\t1\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
320 "Oranges\t1\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
321 "regdata\t1\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
322 "OrderTest\t1\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
324 /* tables for test_continuouscabs */
325 static const CHAR cc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
326 "s72\tS38\ts72\ti2\tS255\tS72\n"
327 "Component\tComponent\n"
328 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
329 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
330 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
332 static const CHAR cc2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
333 "s72\tS38\ts72\ti2\tS255\tS72\n"
334 "Component\tComponent\n"
335 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
336 "augustus\t\tMSITESTDIR\t0\t0\taugustus\n"
337 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
339 static const CHAR cc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
340 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
341 "Feature\tFeature\n"
342 "feature\t\t\t\t2\t1\tTARGETDIR\t0";
344 static const CHAR cc_feature_comp_dat[] = "Feature_\tComponent_\n"
345 "s38\ts72\n"
346 "FeatureComponents\tFeature_\tComponent_\n"
347 "feature\tmaximus\n"
348 "feature\taugustus\n"
349 "feature\tcaesar";
351 static const CHAR cc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
352 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
353 "File\tFile\n"
354 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
355 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
356 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
358 static const CHAR cc2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
359 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
360 "File\tFile\n"
361 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
362 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
363 "tiberius\tmaximus\ttiberius\t500\t\t\t16384\t3\n"
364 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
366 static const CHAR cc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
367 "i2\ti4\tL64\tS255\tS32\tS72\n"
368 "Media\tDiskId\n"
369 "1\t10\t\ttest1.cab\tDISK1\t\n"
370 "2\t2\t\ttest2.cab\tDISK2\t\n"
371 "3\t12\t\ttest3.cab\tDISK3\t\n";
373 static const CHAR cc3_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
374 "i2\ti4\tL64\tS255\tS32\tS72\n"
375 "Media\tDiskId\n"
376 "1\t10\t\ttest1.cab\tDISK1\t\n"
377 "2\t2\t\ttest2_.cab\tDISK2\t\n"
378 "3\t12\t\ttest3.cab\tDISK3\t\n";
380 static const CHAR co_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
381 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
382 "File\tFile\n"
383 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
384 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
385 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
387 static const CHAR co_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
388 "i2\ti4\tL64\tS255\tS32\tS72\n"
389 "Media\tDiskId\n"
390 "1\t10\t\ttest1.cab\tDISK1\t\n"
391 "2\t2\t\ttest2.cab\tDISK2\t\n"
392 "3\t3\t\ttest3.cab\tDISK3\t\n";
394 static const CHAR co2_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
395 "i2\ti4\tL64\tS255\tS32\tS72\n"
396 "Media\tDiskId\n"
397 "1\t10\t\ttest1.cab\tDISK1\t\n"
398 "2\t12\t\ttest3.cab\tDISK3\t\n"
399 "3\t2\t\ttest2.cab\tDISK2\t\n";
401 static const CHAR mm_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
402 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
403 "File\tFile\n"
404 "maximus\tmaximus\tmaximus\t500\t\t\t512\t1\n"
405 "augustus\taugustus\taugustus\t500\t\t\t512\t2\n"
406 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
408 static const CHAR mm_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
409 "i2\ti4\tL64\tS255\tS32\tS72\n"
410 "Media\tDiskId\n"
411 "1\t3\t\ttest1.cab\tDISK1\t\n";
413 static const CHAR ss_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
414 "i2\ti4\tL64\tS255\tS32\tS72\n"
415 "Media\tDiskId\n"
416 "1\t2\t\ttest1.cab\tDISK1\t\n"
417 "2\t2\t\ttest2.cab\tDISK2\t\n"
418 "3\t12\t\ttest3.cab\tDISK3\t\n";
420 /* tables for test_uiLevelFlags */
421 static const CHAR ui_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
422 "s72\tS38\ts72\ti2\tS255\tS72\n"
423 "Component\tComponent\n"
424 "maximus\t\tMSITESTDIR\t0\tHASUIRUN=1\tmaximus\n"
425 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
426 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
428 static const CHAR ui_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
429 "s72\tS255\tI2\n"
430 "InstallUISequence\tAction\n"
431 "SetUIProperty\t\t5\n"
432 "ExecuteAction\t\t1100\n";
434 static const CHAR ui_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
435 "s72\ti2\tS64\tS0\tS255\n"
436 "CustomAction\tAction\n"
437 "SetUIProperty\t51\tHASUIRUN\t1\t\n";
439 static const CHAR rof_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
440 "s72\tS38\ts72\ti2\tS255\tS72\n"
441 "Component\tComponent\n"
442 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
444 static const CHAR rof_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
445 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
446 "Feature\tFeature\n"
447 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
448 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
450 static const CHAR rof_feature_comp_dat[] = "Feature_\tComponent_\n"
451 "s38\ts72\n"
452 "FeatureComponents\tFeature_\tComponent_\n"
453 "feature\tmaximus\n"
454 "montecristo\tmaximus";
456 static const CHAR rof_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
457 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
458 "File\tFile\n"
459 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
461 static const CHAR rof_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
462 "i2\ti4\tL64\tS255\tS32\tS72\n"
463 "Media\tDiskId\n"
464 "1\t1\t\t\tDISK1\t\n";
466 static const CHAR rofc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
467 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
468 "File\tFile\n"
469 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1";
471 static const CHAR rofc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
472 "i2\ti4\tL64\tS255\tS32\tS72\n"
473 "Media\tDiskId\n"
474 "1\t1\t\ttest1.cab\tDISK1\t\n";
476 static const CHAR sdp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
477 "s72\tS255\tI2\n"
478 "InstallExecuteSequence\tAction\n"
479 "AllocateRegistrySpace\tNOT Installed\t1550\n"
480 "CostFinalize\t\t1000\n"
481 "CostInitialize\t\t800\n"
482 "FileCost\t\t900\n"
483 "InstallFiles\t\t4000\n"
484 "InstallFinalize\t\t6600\n"
485 "InstallInitialize\t\t1500\n"
486 "InstallValidate\t\t1400\n"
487 "LaunchConditions\t\t100\n"
488 "SetDirProperty\t\t950";
490 static const CHAR sdp_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
491 "s72\ti2\tS64\tS0\tS255\n"
492 "CustomAction\tAction\n"
493 "SetDirProperty\t51\tMSITESTDIR\t[CommonFilesFolder]msitest\\\t\n";
495 static const CHAR pv_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
496 "s72\tS255\tI2\n"
497 "InstallExecuteSequence\tAction\n"
498 "LaunchConditions\t\t100\n"
499 "CostInitialize\t\t800\n"
500 "FileCost\t\t900\n"
501 "CostFinalize\t\t1000\n"
502 "InstallValidate\t\t1400\n"
503 "InstallInitialize\t\t1500\n"
504 "InstallFiles\t\t4000\n"
505 "InstallFinalize\t\t6600\n";
507 static const CHAR cie_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
508 "s72\tS38\ts72\ti2\tS255\tS72\n"
509 "Component\tComponent\n"
510 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
511 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
512 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
513 "gaius\t\tMSITESTDIR\t0\t1\tgaius\n";
515 static const CHAR cie_feature_comp_dat[] = "Feature_\tComponent_\n"
516 "s38\ts72\n"
517 "FeatureComponents\tFeature_\tComponent_\n"
518 "feature\tmaximus\n"
519 "feature\taugustus\n"
520 "feature\tcaesar\n"
521 "feature\tgaius";
523 static const CHAR cie_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
524 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
525 "File\tFile\n"
526 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
527 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
528 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12\n"
529 "gaius\tgaius\tgaius\t500\t\t\t8192\t11";
531 static const CHAR cie_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
532 "i2\ti4\tL64\tS255\tS32\tS72\n"
533 "Media\tDiskId\n"
534 "1\t1\t\ttest1.cab\tDISK1\t\n"
535 "2\t2\t\ttest2.cab\tDISK2\t\n"
536 "3\t12\t\ttest3.cab\tDISK3\t\n";
538 static const CHAR ci_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
539 "s72\tS38\ts72\ti2\tS255\tS72\n"
540 "Component\tComponent\n"
541 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n";
543 static const CHAR ci2_feature_comp_dat[] = "Feature_\tComponent_\n"
544 "s38\ts72\n"
545 "FeatureComponents\tFeature_\tComponent_\n"
546 "feature\taugustus";
548 static const CHAR ci2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
549 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
550 "File\tFile\n"
551 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
553 static const CHAR pp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
554 "s72\tS255\tI2\n"
555 "InstallExecuteSequence\tAction\n"
556 "ValidateProductID\t\t700\n"
557 "CostInitialize\t\t800\n"
558 "FileCost\t\t900\n"
559 "CostFinalize\t\t1000\n"
560 "InstallValidate\t\t1400\n"
561 "InstallInitialize\t\t1500\n"
562 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
563 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
564 "RemoveFiles\t\t3500\n"
565 "InstallFiles\t\t4000\n"
566 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
567 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
568 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
569 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
570 "InstallFinalize\t\t6600";
572 static const CHAR tp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
573 "s72\tS38\ts72\ti2\tS255\tS72\n"
574 "Component\tComponent\n"
575 "augustus\t\tMSITESTDIR\t0\tprop=\"val\"\taugustus\n";
577 static const CHAR cwd_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
578 "s72\tS38\ts72\ti2\tS255\tS72\n"
579 "Component\tComponent\n"
580 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
582 static const CHAR adm_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
583 "s72\tS38\ts72\ti2\tS255\tS72\n"
584 "Component\tComponent\n"
585 "augustus\t\tMSITESTDIR\t0\tPOSTADMIN=1\taugustus";
587 static const CHAR adm_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
588 "s72\ti2\tS64\tS0\tS255\n"
589 "CustomAction\tAction\n"
590 "SetPOSTADMIN\t51\tPOSTADMIN\t1\t\n";
592 static const CHAR adm_admin_exec_seq_dat[] = "Action\tCondition\tSequence\n"
593 "s72\tS255\tI2\n"
594 "AdminExecuteSequence\tAction\n"
595 "CostFinalize\t\t1000\n"
596 "CostInitialize\t\t800\n"
597 "FileCost\t\t900\n"
598 "SetPOSTADMIN\t\t950\n"
599 "InstallFiles\t\t4000\n"
600 "InstallFinalize\t\t6600\n"
601 "InstallInitialize\t\t1500\n"
602 "InstallValidate\t\t1400\n"
603 "LaunchConditions\t\t100";
605 static const CHAR amp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
606 "s72\tS38\ts72\ti2\tS255\tS72\n"
607 "Component\tComponent\n"
608 "augustus\t\tMSITESTDIR\t0\tMYPROP=2718 and MyProp=42\taugustus\n";
610 static const CHAR rem_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
611 "s72\tS255\tI2\n"
612 "InstallExecuteSequence\tAction\n"
613 "ValidateProductID\t\t700\n"
614 "CostInitialize\t\t800\n"
615 "FileCost\t\t900\n"
616 "CostFinalize\t\t1000\n"
617 "InstallValidate\t\t1400\n"
618 "InstallInitialize\t\t1500\n"
619 "ProcessComponents\t\t1600\n"
620 "UnpublishFeatures\t\t1800\n"
621 "RemoveFiles\t\t3500\n"
622 "InstallFiles\t\t4000\n"
623 "RegisterProduct\t\t6100\n"
624 "PublishFeatures\t\t6300\n"
625 "PublishProduct\t\t6400\n"
626 "InstallFinalize\t\t6600";
628 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
629 "s72\tS38\ts72\ti2\tS255\tS72\n"
630 "Component\tComponent\n"
631 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
632 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
633 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
634 "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n"
635 "tiberius\t\tMSITESTDIR\t0\t\ttiberius\n";
637 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
638 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
639 "File\tFile\n"
640 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
641 "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
642 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
643 "gaius\tgaius\tgaius\t500\t\t\t16384\t4\n"
644 "tiberius\ttiberius\ttiberius\t500\t\t\t0\t5\n";
646 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
647 "i2\ti4\tL64\tS255\tS32\tS72\n"
648 "Media\tDiskId\n"
649 "1\t1\t\ttest1.cab\tDISK1\t\n"
650 "2\t2\t\ttest2.cab\tDISK2\t\n"
651 "3\t3\t\ttest3.cab\tDISK3\t\n"
652 "4\t4\t\ttest3.cab\tDISK3\t\n"
653 "5\t5\t\ttest4.cab\tDISK4\t\n";
655 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
656 "s72\ti2\ti4\ti4\ti4\ti4\n"
657 "MsiFileHash\tFile_\n"
658 "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
660 static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
661 "s72\tS38\ts72\ti2\tS255\tS72\n"
662 "Component\tComponent\n"
663 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
665 static const CHAR ca1_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
666 "s72\tS255\tI2\n"
667 "InstallExecuteSequence\tAction\n"
668 "CostInitialize\t\t100\n"
669 "FileCost\t\t200\n"
670 "CostFinalize\t\t300\n"
671 "InstallValidate\t\t400\n"
672 "InstallInitialize\t\t500\n"
673 "embednull\t\t600\n"
674 "maintest\tMAIN_TEST\t700\n"
675 "testretval\tTEST_RETVAL\t710\n"
676 "process1\tTEST_PROCESS\t720\n"
677 "process2\tTEST_PROCESS\t721\n"
678 "process_deferred\tTEST_PROCESS\t722\n"
679 "async1\tTEST_ASYNC\t730\n"
680 "async2\tTEST_ASYNC\t731\n"
681 "InstallFinalize\t\t800\n";
683 static const CHAR ca1_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
684 "s72\ti2\tS64\tS0\n"
685 "CustomAction\tAction\n"
686 "embednull\t51\tembednullprop\ta[~]b\n"
687 "nested51\t51\tnested\t1\n"
688 "nested1\t1\tcustom.dll\tnested\n"
689 "maintest\t1\tcustom.dll\tmain_test\n"
690 "process1\t1\tcustom.dll\tprocess1\n"
691 "process2\t1\tcustom.dll\tprocess2\n"
692 "process_deferred\t1025\tcustom.dll\tprocess2\n"
693 "async1\t129\tcustom.dll\tasync1\n"
694 "async2\t1\tcustom.dll\tasync2\n"
695 "testretval\t1\tcustom.dll\ttest_retval\n";
697 static const CHAR ca1_test_seq_dat[] = "Action\tCondition\tSequence\n"
698 "s72\tS255\tI2\n"
699 "TestSequence\tAction\n"
700 "nested1\t\t1\n"
701 "nested51\t\t2\n";
703 static const CHAR ca1_test2_dat[] =
704 "A\tB\n"
705 "i2\ti2\n"
706 "test2\tA\n"
707 "1\t2\n";
709 static const CHAR ca1__validation_dat[] =
710 "Table\tColumn\tNullable\tMinValue\tMaxValue\tKeyTable\tKeyColumn\tCategory\tSet\tDescription\n"
711 "s32\ts32\ts4\tI4\tI4\tS255\tI2\tS32\tS255\tS255\n"
712 "_Validation\tTable\tColumn\n"
713 "test2\tA\tN\t\t\t\t\t\t\t\n"
714 "test2\tB\tN\t\t\t\t\t\t\t\n";
716 static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
717 "s72\tS38\ts72\ti2\tS255\tS72\n"
718 "Component\tComponent\n"
719 "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
721 static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
722 "s72\tS255\tI2\n"
723 "InstallExecuteSequence\tAction\n"
724 "ValidateProductID\t\t700\n"
725 "GoodSetProperty\t\t725\n"
726 "BadSetProperty\t\t750\n"
727 "CostInitialize\t\t800\n"
728 "ResolveSource\t\t810\n"
729 "FileCost\t\t900\n"
730 "SetSourceDir\tSRCDIR\t910\n"
731 "CostFinalize\t\t1000\n"
732 "InstallValidate\t\t1400\n"
733 "InstallInitialize\t\t1500\n"
734 "InstallFiles\t\t4000\n"
735 "InstallFinalize\t\t6600";
737 static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
738 "s72\ti2\tS64\tS0\n"
739 "CustomAction\tAction\n"
740 "GoodSetProperty\t51\tMYPROP\t42\n"
741 "BadSetProperty\t51\t\tMYPROP\n"
742 "SetSourceDir\t51\tSourceDir\t[SRCDIR]\n";
744 static const CHAR is_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
745 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
746 "Feature\tFeature\n"
747 "one\t\t\t\t2\t1\t\t0\n" /* favorLocal */
748 "two\t\t\t\t2\t1\t\t1\n" /* favorSource */
749 "three\t\t\t\t2\t1\t\t4\n" /* favorAdvertise */
750 "four\t\t\t\t2\t0\t\t0"; /* disabled */
752 static const CHAR is_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
753 "s72\tS38\ts72\ti2\tS255\tS72\n"
754 "Component\tComponent\n"
755 "alpha\t\tMSITESTDIR\t0\t\talpha_file\n" /* favorLocal:Local */
756 "beta\t\tMSITESTDIR\t1\t\tbeta_file\n" /* favorLocal:Source */
757 "gamma\t\tMSITESTDIR\t2\t\tgamma_file\n" /* favorLocal:Optional */
758 "theta\t\tMSITESTDIR\t0\t\ttheta_file\n" /* favorSource:Local */
759 "delta\t\tMSITESTDIR\t1\t\tdelta_file\n" /* favorSource:Source */
760 "epsilon\t\tMSITESTDIR\t2\t\tepsilon_file\n" /* favorSource:Optional */
761 "zeta\t\tMSITESTDIR\t0\t\tzeta_file\n" /* favorAdvertise:Local */
762 "iota\t\tMSITESTDIR\t1\t\tiota_file\n" /* favorAdvertise:Source */
763 "eta\t\tMSITESTDIR\t2\t\teta_file\n" /* favorAdvertise:Optional */
764 "kappa\t\tMSITESTDIR\t0\t\tkappa_file\n" /* disabled:Local */
765 "lambda\t\tMSITESTDIR\t1\t\tlambda_file\n" /* disabled:Source */
766 "mu\t\tMSITESTDIR\t2\t\tmu_file\n"; /* disabled:Optional */
768 static const CHAR is_feature_comp_dat[] = "Feature_\tComponent_\n"
769 "s38\ts72\n"
770 "FeatureComponents\tFeature_\tComponent_\n"
771 "one\talpha\n"
772 "one\tbeta\n"
773 "one\tgamma\n"
774 "two\ttheta\n"
775 "two\tdelta\n"
776 "two\tepsilon\n"
777 "three\tzeta\n"
778 "three\tiota\n"
779 "three\teta\n"
780 "four\tkappa\n"
781 "four\tlambda\n"
782 "four\tmu";
784 static const CHAR is_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
785 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
786 "File\tFile\n"
787 "alpha_file\talpha\talpha\t500\t\t\t8192\t1\n"
788 "beta_file\tbeta\tbeta\t500\t\t\t8291\t2\n"
789 "gamma_file\tgamma\tgamma\t500\t\t\t8192\t3\n"
790 "theta_file\ttheta\ttheta\t500\t\t\t8192\t4\n"
791 "delta_file\tdelta\tdelta\t500\t\t\t8192\t5\n"
792 "epsilon_file\tepsilon\tepsilon\t500\t\t\t8192\t6\n"
793 "zeta_file\tzeta\tzeta\t500\t\t\t8192\t7\n"
794 "iota_file\tiota\tiota\t500\t\t\t8192\t8\n"
795 "eta_file\teta\teta\t500\t\t\t8192\t9\n"
796 "kappa_file\tkappa\tkappa\t500\t\t\t8192\t10\n"
797 "lambda_file\tlambda\tlambda\t500\t\t\t8192\t11\n"
798 "mu_file\tmu\tmu\t500\t\t\t8192\t12";
800 static const CHAR is_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
801 "i2\ti4\tL64\tS255\tS32\tS72\n"
802 "Media\tDiskId\n"
803 "1\t12\t\t\tDISK1\t\n";
805 static const CHAR sp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
806 "s72\tS38\ts72\ti2\tS255\tS72\n"
807 "Component\tComponent\n"
808 "augustus\t\tTWODIR\t0\t\taugustus\n";
810 static const CHAR sp_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
811 "s72\tS72\tl255\n"
812 "Directory\tDirectory\n"
813 "TARGETDIR\t\tSourceDir\n"
814 "ProgramFilesFolder\tTARGETDIR\t.\n"
815 "MSITESTDIR\tProgramFilesFolder\tmsitest:.\n"
816 "ONEDIR\tMSITESTDIR\t.:shortone|longone\n"
817 "TWODIR\tONEDIR\t.:shorttwo|longtwo";
819 static const CHAR mcp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
820 "s72\tS38\ts72\ti2\tS255\tS72\n"
821 "Component\tComponent\n"
822 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t2\t\thydrogen\n"
823 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t2\t\thelium\n"
824 "lithium\t{4AF28FFC-71C7-4307-BDE4-B77C5338F56F}\tMSITESTDIR\t2\tPROPVAR=42\tlithium\n";
826 static const CHAR mcp_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
827 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
828 "Feature\tFeature\n"
829 "hydroxyl\t\thydroxyl\thydroxyl\t2\t1\tTARGETDIR\t0\n"
830 "heliox\t\theliox\theliox\t2\t5\tTARGETDIR\t0\n"
831 "lithia\t\tlithia\tlithia\t2\t10\tTARGETDIR\t0";
833 static const CHAR mcp_feature_comp_dat[] = "Feature_\tComponent_\n"
834 "s38\ts72\n"
835 "FeatureComponents\tFeature_\tComponent_\n"
836 "hydroxyl\thydrogen\n"
837 "heliox\thelium\n"
838 "lithia\tlithium";
840 static const CHAR mcp_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
841 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
842 "File\tFile\n"
843 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
844 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
845 "lithium\tlithium\tlithium\t0\t\t\t8192\t1\n"
846 "beryllium\tmissingcomp\tberyllium\t0\t\t\t8192\t1";
848 static const CHAR ai_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
849 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
850 "File\tFile\n"
851 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
852 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
853 "one.txt\tOne\tone.txt\t1000\t\t\t16384\t1\n"
854 "three.txt\tThree\tthree.txt\t1000\t\t\t16384\t3\n"
855 "two.txt\tTwo\ttwo.txt\t1000\t\t\t16384\t2\n"
856 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n";
858 static const CHAR ip_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
859 "s72\tS255\tI2\n"
860 "InstallExecuteSequence\tAction\n"
861 "CostFinalize\t\t1000\n"
862 "ValidateProductID\t\t700\n"
863 "CostInitialize\t\t800\n"
864 "FileCost\t\t900\n"
865 "RemoveFiles\t\t3500\n"
866 "InstallFiles\t\t4000\n"
867 "RegisterUser\t\t6000\n"
868 "RegisterProduct\t\t6100\n"
869 "PublishFeatures\t\t6300\n"
870 "PublishProduct\t\t6400\n"
871 "InstallFinalize\t\t6600\n"
872 "InstallInitialize\t\t1500\n"
873 "ProcessComponents\t\t1600\n"
874 "UnpublishFeatures\t\t1800\n"
875 "InstallValidate\t\t1400\n"
876 "LaunchConditions\t\t100\n"
877 "TestInstalledProp\tInstalled AND NOT REMOVE\t950\n";
879 static const CHAR ip_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
880 "s72\ti2\tS64\tS0\tS255\n"
881 "CustomAction\tAction\n"
882 "TestInstalledProp\t19\t\tTest failed\t\n";
884 static const CHAR aup_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
885 "s72\tS255\tI2\n"
886 "InstallExecuteSequence\tAction\n"
887 "CostFinalize\t\t1000\n"
888 "ValidateProductID\t\t700\n"
889 "CostInitialize\t\t800\n"
890 "FileCost\t\t900\n"
891 "RemoveFiles\t\t3500\n"
892 "InstallFiles\t\t4000\n"
893 "RegisterUser\t\t6000\n"
894 "RegisterProduct\t\t6100\n"
895 "PublishFeatures\t\t6300\n"
896 "PublishProduct\t\t6400\n"
897 "InstallFinalize\t\t6600\n"
898 "InstallInitialize\t\t1500\n"
899 "ProcessComponents\t\t1600\n"
900 "UnpublishFeatures\t\t1800\n"
901 "InstallValidate\t\t1400\n"
902 "LaunchConditions\t\t100\n"
903 "TestAllUsersProp\tALLUSERS AND NOT REMOVE\t50\n";
905 static const CHAR aup2_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
906 "s72\tS255\tI2\n"
907 "InstallExecuteSequence\tAction\n"
908 "CostFinalize\t\t1000\n"
909 "ValidateProductID\t\t700\n"
910 "CostInitialize\t\t800\n"
911 "FileCost\t\t900\n"
912 "RemoveFiles\t\t3500\n"
913 "InstallFiles\t\t4000\n"
914 "RegisterUser\t\t6000\n"
915 "RegisterProduct\t\t6100\n"
916 "PublishFeatures\t\t6300\n"
917 "PublishProduct\t\t6400\n"
918 "InstallFinalize\t\t6600\n"
919 "InstallInitialize\t\t1500\n"
920 "ProcessComponents\t\t1600\n"
921 "UnpublishFeatures\t\t1800\n"
922 "InstallValidate\t\t1400\n"
923 "LaunchConditions\t\t100\n"
924 "TestAllUsersProp\tALLUSERS=2 AND NOT REMOVE\t50\n";
926 static const CHAR aup3_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
927 "s72\tS255\tI2\n"
928 "InstallExecuteSequence\tAction\n"
929 "CostFinalize\t\t1000\n"
930 "ValidateProductID\t\t700\n"
931 "CostInitialize\t\t800\n"
932 "FileCost\t\t900\n"
933 "RemoveFiles\t\t3500\n"
934 "InstallFiles\t\t4000\n"
935 "RegisterUser\t\t6000\n"
936 "RegisterProduct\t\t6100\n"
937 "PublishFeatures\t\t6300\n"
938 "PublishProduct\t\t6400\n"
939 "InstallFinalize\t\t6600\n"
940 "InstallInitialize\t\t1500\n"
941 "ProcessComponents\t\t1600\n"
942 "UnpublishFeatures\t\t1800\n"
943 "InstallValidate\t\t1400\n"
944 "LaunchConditions\t\t100\n"
945 "TestAllUsersProp\tALLUSERS=1 AND NOT REMOVE\t50\n";
947 static const CHAR aup_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
948 "s72\ti2\tS64\tS0\tS255\n"
949 "CustomAction\tAction\n"
950 "TestAllUsersProp\t19\t\tTest failed\t\n";
952 static const CHAR fo_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
953 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
954 "File\tFile\n"
955 "override.txt\toverride\toverride.txt\t1000\t\t\t8192\t1\n"
956 "preselected.txt\tpreselected\tpreselected.txt\t1000\t\t\t8192\t2\n"
957 "notpreselected.txt\tnotpreselected\tnotpreselected.txt\t1000\t\t\t8192\t3\n";
959 static const CHAR fo_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
960 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
961 "Feature\tFeature\n"
962 "override\t\t\toverride feature\t1\t1\tMSITESTDIR\t0\n"
963 "preselected\t\t\tpreselected feature\t1\t1\tMSITESTDIR\t0\n"
964 "notpreselected\t\t\tnotpreselected feature\t1\t1\tMSITESTDIR\t0\n";
966 static const CHAR fo_condition_dat[] = "Feature_\tLevel\tCondition\n"
967 "s38\ti2\tS255\n"
968 "Condition\tFeature_\tLevel\n"
969 "preselected\t0\tPreselected AND NOT REMOVE\n"
970 "notpreselected\t0\tNOT Preselected AND NOT REMOVE\n";
972 static const CHAR fo_feature_comp_dat[] = "Feature_\tComponent_\n"
973 "s38\ts72\n"
974 "FeatureComponents\tFeature_\tComponent_\n"
975 "override\toverride\n"
976 "preselected\tpreselected\n"
977 "notpreselected\tnotpreselected\n";
979 static const CHAR fo_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
980 "s72\tS38\ts72\ti2\tS255\tS72\n"
981 "Component\tComponent\n"
982 "override\t{0A00FB1D-97B0-4B42-ADF0-BB8913416623}\tMSITESTDIR\t0\t\toverride.txt\n"
983 "preselected\t{44E1DB75-605A-43DD-8CF5-CAB17F1BBD60}\tMSITESTDIR\t0\t\tpreselected.txt\n"
984 "notpreselected\t{E1647733-5E75-400A-A92E-5E60B4D4EF9F}\tMSITESTDIR\t0\t\tnotpreselected.txt\n";
986 static const CHAR fo_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
987 "s72\ti2\tS64\tS0\tS255\n"
988 "CustomAction\tAction\n"
989 "SetPreselected\t51\tPreselected\t1\t\n";
991 static const CHAR fo_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
992 "s72\tS255\tI2\n"
993 "InstallExecuteSequence\tAction\n"
994 "LaunchConditions\t\t100\n"
995 "SetPreselected\tpreselect=1\t200\n"
996 "CostInitialize\t\t800\n"
997 "FileCost\t\t900\n"
998 "CostFinalize\t\t1000\n"
999 "InstallValidate\t\t1400\n"
1000 "InstallInitialize\t\t1500\n"
1001 "ProcessComponents\t\t1600\n"
1002 "RemoveFiles\t\t1700\n"
1003 "InstallFiles\t\t2000\n"
1004 "RegisterProduct\t\t5000\n"
1005 "PublishFeatures\t\t5100\n"
1006 "PublishProduct\t\t5200\n"
1007 "UnpublishFeatures\t\t5300\n"
1008 "InstallFinalize\t\t6000\n";
1010 static const CHAR uc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1011 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1012 "File\tFile\n"
1013 "upgradecode.txt\tupgradecode\tupgradecode.txt\t1000\t\t\t8192\t1\n";
1015 static const CHAR uc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1016 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1017 "Feature\tFeature\n"
1018 "upgradecode\t\t\tupgradecode feature\t1\t2\tMSITESTDIR\t0\n";
1020 static const CHAR uc_feature_comp_dat[] = "Feature_\tComponent_\n"
1021 "s38\ts72\n"
1022 "FeatureComponents\tFeature_\tComponent_\n"
1023 "upgradecode\tupgradecode\n";
1025 static const CHAR uc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1026 "s72\tS38\ts72\ti2\tS255\tS72\n"
1027 "Component\tComponent\n"
1028 "upgradecode\t{6952B732-2FCB-4E47-976F-989FCBD7EDFB}\tMSITESTDIR\t0\t\tupgradecode.txt\n";
1030 static const CHAR uc_property_dat[] = "Property\tValue\n"
1031 "s72\tl0\n"
1032 "Property\tProperty\n"
1033 "INSTALLLEVEL\t3\n"
1034 "ProductCode\t{E5FB1241-F547-4BA7-A60E-8E75797268D4}\n"
1035 "ProductName\tMSITEST\n"
1036 "ProductVersion\t1.1.1\n"
1037 "UpgradeCode\t#UPGEADECODE#\n"
1038 "MSIFASTINSTALL\t1\n";
1040 static const CHAR uc_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1041 "s72\tS255\tI2\n"
1042 "InstallExecuteSequence\tAction\n"
1043 "LaunchConditions\t\t100\n"
1044 "CostInitialize\t\t200\n"
1045 "FileCost\t\t300\n"
1046 "CostFinalize\t\t400\n"
1047 "InstallInitialize\t\t500\n"
1048 "ProcessComponents\t\t600\n"
1049 "InstallValidate\t\t700\n"
1050 "RemoveFiles\t\t800\n"
1051 "InstallFiles\t\t900\n"
1052 "RegisterProduct\t\t1000\n"
1053 "PublishFeatures\t\t1100\n"
1054 "PublishProduct\t\t1200\n"
1055 "UnpublishFeatures\t\t1250\n"
1056 "InstallFinalize\t\t1300\n";
1058 static const char mixed_feature_dat[] =
1059 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1060 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1061 "Feature\tFeature\n"
1062 "feature1\t\t\t\t1\t2\tMSITESTDIR\t0\n"
1063 "feature2\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1065 static const char mixed_feature_comp_dat[] =
1066 "Feature_\tComponent_\n"
1067 "s38\ts72\n"
1068 "FeatureComponents\tFeature_\tComponent_\n"
1069 "feature1\tcomp1\n"
1070 "feature2\tcomp2\n";
1072 static const char mixed_component_dat[] =
1073 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1074 "s72\tS38\ts72\ti2\tS255\tS72\n"
1075 "Component\tComponent\n"
1076 "comp1\t{DE9F0EF4-0ED3-495A-8105-060C0EA457B8}\tTARGETDIR\t4\t\tregdata1\n"
1077 "comp2\t{4912DBE7-FC3A-4F91-BB5C-88F5C15C19A5}\tTARGETDIR\t260\t\tregdata2\n";
1079 static const char mixed_registry_dat[] =
1080 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
1081 "s72\ti2\tl255\tL255\tL0\ts72\n"
1082 "Registry\tRegistry\n"
1083 "regdata1\t2\tSOFTWARE\\Wine\\msitest\ttest1\t\tcomp1\n"
1084 "regdata2\t2\tSOFTWARE\\Wine\\msitest\ttest2\t\tcomp2\n"
1085 "regdata3\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\t\tCLSID_Winetest32\tcomp1\n"
1086 "regdata4\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32\t\twinetest32.dll\tcomp1\n"
1087 "regdata5\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\t\tCLSID_Winetest64\tcomp2\n"
1088 "regdata6\t0\tCLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32\t\twinetest64.dll\tcomp2\n";
1090 static const char mixed_install_exec_seq_dat[] =
1091 "Action\tCondition\tSequence\n"
1092 "s72\tS255\tI2\n"
1093 "InstallExecuteSequence\tAction\n"
1094 "LaunchConditions\t\t100\n"
1095 "CostInitialize\t\t200\n"
1096 "FileCost\t\t300\n"
1097 "CostFinalize\t\t400\n"
1098 "InstallValidate\t\t500\n"
1099 "InstallInitialize\t\t600\n"
1100 "ProcessComponents\t\t700\n"
1101 "UnpublishFeatures\t\t800\n"
1102 "RemoveRegistryValues\t\t900\n"
1103 "WriteRegistryValues\t\t1000\n"
1104 "RegisterProduct\t\t1100\n"
1105 "PublishFeatures\t\t1200\n"
1106 "PublishProduct\t\t1300\n"
1107 "InstallFinalize\t\t1400\n";
1109 static const char vp_file_dat[] =
1110 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1111 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1112 "File\tFile\n"
1113 "volumeprop\tcomp\tvolumeprop.txt\t1000\t\t\t8192\t1\n";
1115 static const char vp_feature_dat[] =
1116 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1117 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1118 "Feature\tFeature\n"
1119 "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1121 static const char vp_feature_comp_dat[] =
1122 "Feature_\tComponent_\n"
1123 "s38\ts72\n"
1124 "FeatureComponents\tFeature_\tComponent_\n"
1125 "feature\tcomp\n";
1127 static const char vp_component_dat[] =
1128 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1129 "s72\tS38\ts72\ti2\tS255\tS72\n"
1130 "Component\tComponent\n"
1131 "comp\t{24364AE7-5B7F-496C-AF5A-54893639C567}\tMSITESTDIR\t0\t\tvolumeprop\n";
1133 static const char vp_custom_action_dat[] =
1134 "Action\tType\tSource\tTarget\tISComments\n"
1135 "s72\ti2\tS64\tS0\tS255\n"
1136 "CustomAction\tAction\n"
1137 "TestPrimaryVolumePath0\t19\t\tPrimaryVolumePath set before CostFinalize\t\n"
1138 "TestPrimaryVolumeSpaceAvailable0\t19\t\tPrimaryVolumeSpaceAvailable set before CostFinalize\t\n"
1139 "TestPrimaryVolumeSpaceRequired0\t19\t\tPrimaryVolumeSpaceRequired set before CostFinalize\t\n"
1140 "TestPrimaryVolumeSpaceRemaining0\t19\t\tPrimaryVolumeSpaceRemaining set before CostFinalize\t\n"
1141 "TestPrimaryVolumePath1\t19\t\tPrimaryVolumePath set before InstallValidate\t\n"
1142 "TestPrimaryVolumeSpaceAvailable1\t19\t\tPrimaryVolumeSpaceAvailable not set before InstallValidate\t\n"
1143 "TestPrimaryVolumeSpaceRequired1\t19\t\tPrimaryVolumeSpaceRequired not set before InstallValidate\t\n"
1144 "TestPrimaryVolumeSpaceRemaining1\t19\t\tPrimaryVolumeSpaceRemaining not set before InstallValidate\t\n"
1145 "TestPrimaryVolumePath2\t19\t\tPrimaryVolumePath not set after InstallValidate\t\n"
1146 "TestPrimaryVolumeSpaceAvailable2\t19\t\tPrimaryVolumeSpaceAvailable not set after InstallValidate\t\n"
1147 "TestPrimaryVolumeSpaceRequired2\t19\t\tPrimaryVolumeSpaceRequired not set after InstallValidate\t\n"
1148 "TestPrimaryVolumeSpaceRemaining2\t19\t\tPrimaryVolumeSpaceRemaining not set after InstallValidate\t\n";
1150 static const char vp_install_exec_seq_dat[] =
1151 "Action\tCondition\tSequence\n"
1152 "s72\tS255\tI2\n"
1153 "InstallExecuteSequence\tAction\n"
1154 "LaunchConditions\t\t100\n"
1155 "CostInitialize\t\t200\n"
1156 "FileCost\t\t300\n"
1157 "TestPrimaryVolumePath0\tPrimaryVolumePath AND NOT REMOVE\t400\n"
1158 "TestPrimaryVolumeSpaceAvailable0\tPrimaryVolumeSpaceAvailable AND NOT REMOVE\t500\n"
1159 "TestPrimaryVolumeSpaceRequired0\tPrimaryVolumeSpaceRequired AND NOT REMOVE\t510\n"
1160 "TestPrimaryVolumeSpaceRemaining0\tPrimaryVolumeSpaceRemaining AND NOT REMOVE\t520\n"
1161 "CostFinalize\t\t600\n"
1162 "TestPrimaryVolumePath1\tPrimaryVolumePath AND NOT REMOVE\t600\n"
1163 "TestPrimaryVolumeSpaceAvailable1\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t800\n"
1164 "TestPrimaryVolumeSpaceRequired1\tNOT PrimaryVolumeSpaceRequired AND NOT REMOVE\t810\n"
1165 "TestPrimaryVolumeSpaceRemaining1\tNOT PrimaryVolumeSpaceRemaining AND NOT REMOVE\t820\n"
1166 "InstallValidate\t\t900\n"
1167 "TestPrimaryVolumePath2\tNOT PrimaryVolumePath AND NOT REMOVE\t1000\n"
1168 "TestPrimaryVolumeSpaceAvailable2\tNOT PrimaryVolumeSpaceAvailable AND NOT REMOVE\t1100\n"
1169 "TestPrimaryVolumeSpaceRequired2\tNOT PrimaryVolumeSpaceRequired AND NOT REMOVE\t1110\n"
1170 "TestPrimaryVolumeSpaceRemaining2\tNOT PrimaryVolumeSpaceRemaining AND NOT REMOVE\t1120\n"
1171 "InstallInitialize\t\t1200\n"
1172 "ProcessComponents\t\t1300\n"
1173 "RemoveFiles\t\t1400\n"
1174 "InstallFiles\t\t1500\n"
1175 "RegisterProduct\t\t1600\n"
1176 "PublishFeatures\t\t1700\n"
1177 "PublishProduct\t\t1800\n"
1178 "UnpublishFeatures\t\t1850\n"
1179 "InstallFinalize\t\t1900\n";
1181 static const char shc_property_dat[] =
1182 "Property\tValue\n"
1183 "s72\tl0\n"
1184 "Property\tProperty\n"
1185 "INSTALLLEVEL\t3\n"
1186 "ProductCode\t{5CD99CD0-69C7-409B-9905-82DD743CC840}\n"
1187 "ProductName\tMSITEST\n"
1188 "ProductVersion\t1.1.1\n"
1189 "MSIFASTINSTALL\t1\n";
1191 static const char shc2_property_dat[] =
1192 "Property\tValue\n"
1193 "s72\tl0\n"
1194 "Property\tProperty\n"
1195 "INSTALLLEVEL\t3\n"
1196 "ProductCode\t{4CEFADE5-DAFB-4C21-8EF2-4ED4F139F340}\n"
1197 "ProductName\tMSITEST2\n"
1198 "ProductVersion\t1.1.1\n"
1199 "MSIFASTINSTALL\t1\n";
1201 static const char shc_file_dat[] =
1202 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1203 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1204 "File\tFile\n"
1205 "sharedcomponent\tsharedcomponent\tsharedcomponent.txt\t1000\t\t\t8192\t1\n";
1207 static const char shc_feature_dat[] =
1208 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1209 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1210 "Feature\tFeature\n"
1211 "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n";
1213 static const char shc_feature_comp_dat[] =
1214 "Feature_\tComponent_\n"
1215 "s38\ts72\n"
1216 "FeatureComponents\tFeature_\tComponent_\n"
1217 "feature\tsharedcomponent\n";
1219 static const char shc_component_dat[] =
1220 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1221 "s72\tS38\ts72\ti2\tS255\tS72\n"
1222 "Component\tComponent\n"
1223 "sharedcomponent\t{900A4ACB-DC6F-4795-A04B-81B530183D41}\tMSITESTDIR\t0\t\tsharedcomponent\n";
1225 static const char shc_custom_action_dat[] =
1226 "Action\tType\tSource\tTarget\tISComments\n"
1227 "s72\ti2\tS64\tS0\tS255\n"
1228 "CustomAction\tAction\n"
1229 "TestComponentAction\t19\t\twrong component action on install\t\n"
1230 "TestDisallowedAction\t19\t\twrong component action on disallowed remove\t\n"
1231 "TestRemoveAction\t19\t\twrong component action on remove\t\n";
1233 static const char shc_install_exec_seq_dat[] =
1234 "Action\tCondition\tSequence\n"
1235 "s72\tS255\tI2\n"
1236 "InstallExecuteSequence\tAction\n"
1237 "LaunchConditions\t\t100\n"
1238 "CostInitialize\t\t200\n"
1239 "FileCost\t\t300\n"
1240 "CostFinalize\t\t600\n"
1241 "TestDisallowedAction\tREMOVE AND ($sharedcomponent <> -1)\t700\n"
1242 "InstallValidate\t\t900\n"
1243 "InstallInitialize\t\t1200\n"
1244 "ProcessComponents\t\t1300\n"
1245 "RemoveFiles\t\t1400\n"
1246 "InstallFiles\t\t1500\n"
1247 "TestComponentAction\tNOT REMOVE AND ($sharedcomponent <> 3)\t1600\n"
1248 "RegisterProduct\t\t1700\n"
1249 "PublishFeatures\t\t1800\n"
1250 "PublishProduct\t\t1900\n"
1251 "UnpublishFeatures\t\t1950\n"
1252 "InstallFinalize\t\t2000\n";
1254 static const char shc2_install_exec_seq_dat[] =
1255 "Action\tCondition\tSequence\n"
1256 "s72\tS255\tI2\n"
1257 "InstallExecuteSequence\tAction\n"
1258 "LaunchConditions\t\t100\n"
1259 "CostInitialize\t\t200\n"
1260 "FileCost\t\t300\n"
1261 "CostFinalize\t\t600\n"
1262 "TestRemoveAction\tREMOVE AND ($sharedcomponent <> 2)\t700\n"
1263 "InstallValidate\t\t900\n"
1264 "InstallInitialize\t\t1200\n"
1265 "ProcessComponents\t\t1300\n"
1266 "RemoveFiles\t\t1400\n"
1267 "InstallFiles\t\t1500\n"
1268 "TestComponentAction\tNOT REMOVE AND ($sharedcomponent <> 3)\t1600\n"
1269 "RegisterProduct\t\t1700\n"
1270 "PublishFeatures\t\t1800\n"
1271 "PublishProduct\t\t1900\n"
1272 "UnpublishFeatures\t\t1950\n"
1273 "InstallFinalize\t\t2000\n";
1275 static const char ft_file_dat[] =
1276 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1277 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1278 "File\tFile\n"
1279 "featuretree\tcomp\tfeaturetree.txt\t1000\t\t\t8192\t1\n";
1281 static const char ft_comp_dat[] =
1282 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1283 "s72\tS38\ts72\ti2\tS255\tS72\n"
1284 "Component\tComponent\n"
1285 "comp\t{12345678-1234-1234-1234-222222222222}\tTARGETDIR\t0\t\t\n"
1286 "comp2\t{12345678-1234-1234-1234-333333333333}\tTARGETDIR\t0\t\tfeaturetree\n";
1288 static const char ft_feature_dat[] =
1289 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1290 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1291 "Feature\tFeature\n"
1292 "A\t\t\t\t2\t1\t\t0\n"
1293 "C\tB\t\t\t2\t1\t\t0\n"
1294 "B\tA\t\t\t4\t1\t\t0\n"
1295 "D\t\t\t\t2\t1\t\t0\n";
1297 static const char ft_feature_comp_dat[] =
1298 "Feature_\tComponent_\n"
1299 "s38\ts72\n"
1300 "FeatureComponents\tFeature_\tComponent_\n"
1301 "C\tcomp\n"
1302 "D\tcomp2\n";
1304 static const char ft_condition_dat[] =
1305 "Feature_\tLevel\tCondition\n"
1306 "s38\ti2\tS255\n"
1307 "Condition\tFeature_\tLevel\n"
1308 "A\t0\t\"0\"<>INSTALLTYPE\n";
1310 static const char ft_custom_action_dat[] =
1311 "Action\tType\tSource\tTarget\tISComments\n"
1312 "s72\ti2\tS64\tS0\tS255\n"
1313 "CustomAction\tAction\n"
1314 "Run A\t19\t\tA\t\n"
1315 "Run B\t19\t\tB\t\n"
1316 "Run C\t19\t\tC\t\n";
1318 static const char ft_install_exec_seq_dat[] =
1319 "Action\tCondition\tSequence\n"
1320 "s72\tS255\tI2\n"
1321 "InstallExecuteSequence\tAction\n"
1322 "CostInitialize\t\t100\n"
1323 "FileCost\t\t200\n"
1324 "CostFinalize\t\t300\n"
1325 "InstallValidate\t\t400\n"
1326 "InstallInitialize\t\t500\n"
1327 "Run C\t3 = &C AND NOT Installed\t600\n"
1328 "Run B\t3 = &B AND NOT Installed\t700\n"
1329 "Run A\t3 = &A AND NOT Installed\t800\n"
1330 "ProcessComponents\t\t900\n"
1331 "RemoveFiles\t\t1000\n"
1332 "InstallFiles\t\t1100\n"
1333 "RegisterProduct\t\t1200\n"
1334 "PublishFeatures\t\t1300\n"
1335 "PublishProduct\t\t1400\n"
1336 "UnpublishFeatures\t\t1450\n"
1337 "InstallFinalize\t\t1500\n";
1339 static const char da_custom_action_dat[] =
1340 "Action\tType\tSource\tTarget\n"
1341 "s72\ti2\tS64\tS0\n"
1342 "CustomAction\tAction\n"
1343 "setprop\t51\tdeferred\t[TESTPATH]\n"
1344 "immediate\t1\tcustom.dll\tda_immediate\n"
1345 "deferred\t1025\tcustom.dll\tda_deferred\n";
1347 static const char da_install_exec_seq_dat[] =
1348 "Action\tCondition\tSequence\n"
1349 "s72\tS255\tI2\n"
1350 "InstallExecuteSequence\tAction\n"
1351 "CostInitialize\t\t200\n"
1352 "FileCost\t\t300\n"
1353 "CostFinalize\t\t400\n"
1354 "InstallInitialize\t\t500\n"
1355 "setprop\t\t600\n"
1356 "deferred\t\t700\n"
1357 "immediate\t\t800\n"
1358 "InstallFinalize\t\t1100\n";
1360 static const CHAR x64_directory_dat[] =
1361 "Directory\tDirectory_Parent\tDefaultDir\n"
1362 "s72\tS72\tl255\n"
1363 "Directory\tDirectory\n"
1364 "CABOUTDIR\tMSITESTDIR\tcabout\n"
1365 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
1366 "FIRSTDIR\tMSITESTDIR\tfirst\n"
1367 "MSITESTDIR\tProgramFiles64Folder\tmsitest\n"
1368 "NEWDIR\tCABOUTDIR\tnew\n"
1369 "ProgramFiles64Folder\tTARGETDIR\t.\n"
1370 "TARGETDIR\t\tSourceDir";
1372 static const CHAR sr_install_exec_seq_dat[] =
1373 "Action\tCondition\tSequence\n"
1374 "s72\tS255\tI2\n"
1375 "InstallExecuteSequence\tAction\n"
1376 "CostInitialize\t\t200\n"
1377 "FileCost\t\t300\n"
1378 "CostFinalize\t\t400\n"
1379 "InstallValidate\t\t500\n"
1380 "InstallInitialize\t\t600\n"
1381 "sourcedir_unset\tSourceDir\t700\n"
1382 "ResolveSource\tRESOLVE_SOURCE\t800\n"
1383 "ProcessComponents\tPROCESS_COMPONENTS\t800\n"
1384 "InstallFiles\tINSTALL_FILES\t800\n"
1385 "sourcedir_set\tNOT SourceDir\t900\n"
1386 "InstallFinalize\t\t1000\n";
1388 static const CHAR sr_custom_action_dat[] =
1389 "Action\tType\tSource\tTarget\n"
1390 "s72\ti2\tS64\tS0\n"
1391 "CustomAction\tAction\n"
1392 "sourcedir_unset\t19\t\tSourceDir should not be set\n"
1393 "sourcedir_set\t19\t\tSourceDir should be set\n";
1395 static const CHAR ai2_file_dat[] =
1396 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1397 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1398 "File\tFile\n"
1399 "five.txt\tFive\tfive.txt\t1000\t\t\t0\t5\n"
1400 "four.txt\tFour\tfour.txt\t1000\t\t\t0\t4\n";
1402 static const CHAR ai2_component_dat[] =
1403 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1404 "s72\tS38\ts72\ti2\tS255\tS72\n"
1405 "Component\tComponent\n"
1406 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
1407 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n";
1409 static const CHAR ai2_feature_dat[] =
1410 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1411 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1412 "Feature\tFeature\n"
1413 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
1414 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n";
1416 static const CHAR ai2_feature_comp_dat[] =
1417 "Feature_\tComponent_\n"
1418 "s38\ts72\n"
1419 "FeatureComponents\tFeature_\tComponent_\n"
1420 "Five\tFive\n"
1421 "Four\tFour\n";
1423 static const msi_table tables[] =
1425 ADD_TABLE(component),
1426 ADD_TABLE(directory),
1427 ADD_TABLE(feature),
1428 ADD_TABLE(feature_comp),
1429 ADD_TABLE(file),
1430 ADD_TABLE(install_exec_seq),
1431 ADD_TABLE(media),
1432 ADD_TABLE(property),
1433 ADD_TABLE(registry),
1436 static const msi_table sc_tables[] =
1438 ADD_TABLE(component),
1439 ADD_TABLE(directory),
1440 ADD_TABLE(feature),
1441 ADD_TABLE(feature_comp),
1442 ADD_TABLE(file),
1443 ADD_TABLE(install_exec_seq),
1444 ADD_TABLE(media),
1445 ADD_TABLE(property),
1446 ADD_TABLE(shortcut)
1449 static const msi_table ps_tables[] =
1451 ADD_TABLE(component),
1452 ADD_TABLE(directory),
1453 ADD_TABLE(feature),
1454 ADD_TABLE(feature_comp),
1455 ADD_TABLE(file),
1456 ADD_TABLE(install_exec_seq),
1457 ADD_TABLE(media),
1458 ADD_TABLE(property),
1459 ADD_TABLE(condition)
1462 static const msi_table up_tables[] =
1464 ADD_TABLE(component),
1465 ADD_TABLE(directory),
1466 ADD_TABLE(feature),
1467 ADD_TABLE(feature_comp),
1468 ADD_TABLE(file),
1469 ADD_TABLE(install_exec_seq),
1470 ADD_TABLE(media),
1471 ADD_TABLE(up_property),
1472 ADD_TABLE(registry),
1475 static const msi_table up2_tables[] =
1477 ADD_TABLE(component),
1478 ADD_TABLE(directory),
1479 ADD_TABLE(feature),
1480 ADD_TABLE(feature_comp),
1481 ADD_TABLE(file),
1482 ADD_TABLE(install_exec_seq),
1483 ADD_TABLE(media),
1484 ADD_TABLE(up2_property),
1485 ADD_TABLE(registry),
1488 static const msi_table up3_tables[] =
1490 ADD_TABLE(component),
1491 ADD_TABLE(directory),
1492 ADD_TABLE(feature),
1493 ADD_TABLE(feature_comp),
1494 ADD_TABLE(file),
1495 ADD_TABLE(install_exec_seq),
1496 ADD_TABLE(media),
1497 ADD_TABLE(up3_property),
1498 ADD_TABLE(registry),
1501 static const msi_table up4_tables[] =
1503 ADD_TABLE(component),
1504 ADD_TABLE(directory),
1505 ADD_TABLE(feature),
1506 ADD_TABLE(feature_comp),
1507 ADD_TABLE(file),
1508 ADD_TABLE(pp_install_exec_seq),
1509 ADD_TABLE(media),
1510 ADD_TABLE(property),
1511 ADD_TABLE(registry),
1514 static const msi_table up5_tables[] =
1516 ADD_TABLE(component),
1517 ADD_TABLE(directory),
1518 ADD_TABLE(feature),
1519 ADD_TABLE(feature_comp),
1520 ADD_TABLE(file),
1521 ADD_TABLE(pp_install_exec_seq),
1522 ADD_TABLE(media),
1523 ADD_TABLE(up_property),
1524 ADD_TABLE(registry),
1527 static const msi_table up6_tables[] =
1529 ADD_TABLE(component),
1530 ADD_TABLE(directory),
1531 ADD_TABLE(feature),
1532 ADD_TABLE(feature_comp),
1533 ADD_TABLE(file),
1534 ADD_TABLE(pp_install_exec_seq),
1535 ADD_TABLE(media),
1536 ADD_TABLE(up2_property),
1537 ADD_TABLE(registry),
1540 static const msi_table up7_tables[] =
1542 ADD_TABLE(component),
1543 ADD_TABLE(directory),
1544 ADD_TABLE(feature),
1545 ADD_TABLE(feature_comp),
1546 ADD_TABLE(file),
1547 ADD_TABLE(pp_install_exec_seq),
1548 ADD_TABLE(media),
1549 ADD_TABLE(up3_property),
1550 ADD_TABLE(registry),
1553 static const msi_table cc_tables[] =
1555 ADD_TABLE(cc_component),
1556 ADD_TABLE(directory),
1557 ADD_TABLE(cc_feature),
1558 ADD_TABLE(cc_feature_comp),
1559 ADD_TABLE(cc_file),
1560 ADD_TABLE(install_exec_seq),
1561 ADD_TABLE(cc_media),
1562 ADD_TABLE(property),
1565 static const msi_table cc2_tables[] =
1567 ADD_TABLE(cc2_component),
1568 ADD_TABLE(directory),
1569 ADD_TABLE(cc_feature),
1570 ADD_TABLE(cc_feature_comp),
1571 ADD_TABLE(cc2_file),
1572 ADD_TABLE(install_exec_seq),
1573 ADD_TABLE(cc_media),
1574 ADD_TABLE(property),
1577 static const msi_table cc3_tables[] =
1579 ADD_TABLE(cc_component),
1580 ADD_TABLE(directory),
1581 ADD_TABLE(cc_feature),
1582 ADD_TABLE(cc_feature_comp),
1583 ADD_TABLE(cc_file),
1584 ADD_TABLE(install_exec_seq),
1585 ADD_TABLE(cc3_media),
1586 ADD_TABLE(property),
1589 static const msi_table co_tables[] =
1591 ADD_TABLE(cc_component),
1592 ADD_TABLE(directory),
1593 ADD_TABLE(cc_feature),
1594 ADD_TABLE(cc_feature_comp),
1595 ADD_TABLE(co_file),
1596 ADD_TABLE(install_exec_seq),
1597 ADD_TABLE(co_media),
1598 ADD_TABLE(property),
1601 static const msi_table co2_tables[] =
1603 ADD_TABLE(cc_component),
1604 ADD_TABLE(directory),
1605 ADD_TABLE(cc_feature),
1606 ADD_TABLE(cc_feature_comp),
1607 ADD_TABLE(cc_file),
1608 ADD_TABLE(install_exec_seq),
1609 ADD_TABLE(co2_media),
1610 ADD_TABLE(property),
1613 static const msi_table mm_tables[] =
1615 ADD_TABLE(cc_component),
1616 ADD_TABLE(directory),
1617 ADD_TABLE(cc_feature),
1618 ADD_TABLE(cc_feature_comp),
1619 ADD_TABLE(mm_file),
1620 ADD_TABLE(install_exec_seq),
1621 ADD_TABLE(mm_media),
1622 ADD_TABLE(property),
1625 static const msi_table ss_tables[] =
1627 ADD_TABLE(cc_component),
1628 ADD_TABLE(directory),
1629 ADD_TABLE(cc_feature),
1630 ADD_TABLE(cc_feature_comp),
1631 ADD_TABLE(cc_file),
1632 ADD_TABLE(install_exec_seq),
1633 ADD_TABLE(ss_media),
1634 ADD_TABLE(property),
1637 static const msi_table ui_tables[] =
1639 ADD_TABLE(ui_component),
1640 ADD_TABLE(directory),
1641 ADD_TABLE(cc_feature),
1642 ADD_TABLE(cc_feature_comp),
1643 ADD_TABLE(cc_file),
1644 ADD_TABLE(install_exec_seq),
1645 ADD_TABLE(ui_install_ui_seq),
1646 ADD_TABLE(ui_custom_action),
1647 ADD_TABLE(cc_media),
1648 ADD_TABLE(property),
1651 static const msi_table rof_tables[] =
1653 ADD_TABLE(rof_component),
1654 ADD_TABLE(directory),
1655 ADD_TABLE(rof_feature),
1656 ADD_TABLE(rof_feature_comp),
1657 ADD_TABLE(rof_file),
1658 ADD_TABLE(install_exec_seq),
1659 ADD_TABLE(rof_media),
1660 ADD_TABLE(property),
1663 static const msi_table rofc_tables[] =
1665 ADD_TABLE(rof_component),
1666 ADD_TABLE(directory),
1667 ADD_TABLE(rof_feature),
1668 ADD_TABLE(rof_feature_comp),
1669 ADD_TABLE(rofc_file),
1670 ADD_TABLE(install_exec_seq),
1671 ADD_TABLE(rofc_media),
1672 ADD_TABLE(property),
1675 static const msi_table sdp_tables[] =
1677 ADD_TABLE(rof_component),
1678 ADD_TABLE(directory),
1679 ADD_TABLE(rof_feature),
1680 ADD_TABLE(rof_feature_comp),
1681 ADD_TABLE(rof_file),
1682 ADD_TABLE(sdp_install_exec_seq),
1683 ADD_TABLE(sdp_custom_action),
1684 ADD_TABLE(rof_media),
1685 ADD_TABLE(property),
1688 static const msi_table cie_tables[] =
1690 ADD_TABLE(cie_component),
1691 ADD_TABLE(directory),
1692 ADD_TABLE(cc_feature),
1693 ADD_TABLE(cie_feature_comp),
1694 ADD_TABLE(cie_file),
1695 ADD_TABLE(install_exec_seq),
1696 ADD_TABLE(cie_media),
1697 ADD_TABLE(property),
1700 static const msi_table tp_tables[] =
1702 ADD_TABLE(tp_component),
1703 ADD_TABLE(directory),
1704 ADD_TABLE(rof_feature),
1705 ADD_TABLE(ci2_feature_comp),
1706 ADD_TABLE(ci2_file),
1707 ADD_TABLE(install_exec_seq),
1708 ADD_TABLE(rof_media),
1709 ADD_TABLE(property),
1712 static const msi_table cwd_tables[] =
1714 ADD_TABLE(cwd_component),
1715 ADD_TABLE(directory),
1716 ADD_TABLE(rof_feature),
1717 ADD_TABLE(ci2_feature_comp),
1718 ADD_TABLE(ci2_file),
1719 ADD_TABLE(install_exec_seq),
1720 ADD_TABLE(rof_media),
1721 ADD_TABLE(property),
1724 static const msi_table adm_tables[] =
1726 ADD_TABLE(adm_component),
1727 ADD_TABLE(directory),
1728 ADD_TABLE(rof_feature),
1729 ADD_TABLE(ci2_feature_comp),
1730 ADD_TABLE(ci2_file),
1731 ADD_TABLE(install_exec_seq),
1732 ADD_TABLE(rof_media),
1733 ADD_TABLE(property),
1734 ADD_TABLE(adm_custom_action),
1735 ADD_TABLE(adm_admin_exec_seq),
1738 static const msi_table amp_tables[] =
1740 ADD_TABLE(amp_component),
1741 ADD_TABLE(directory),
1742 ADD_TABLE(rof_feature),
1743 ADD_TABLE(ci2_feature_comp),
1744 ADD_TABLE(ci2_file),
1745 ADD_TABLE(install_exec_seq),
1746 ADD_TABLE(rof_media),
1747 ADD_TABLE(property),
1750 static const msi_table mc_tables[] =
1752 ADD_TABLE(mc_component),
1753 ADD_TABLE(directory),
1754 ADD_TABLE(cc_feature),
1755 ADD_TABLE(cie_feature_comp),
1756 ADD_TABLE(mc_file),
1757 ADD_TABLE(install_exec_seq),
1758 ADD_TABLE(mc_media),
1759 ADD_TABLE(property),
1760 ADD_TABLE(mc_file_hash),
1763 static const msi_table sf_tables[] =
1765 ADD_TABLE(wrv_component),
1766 ADD_TABLE(directory),
1767 ADD_TABLE(rof_feature),
1768 ADD_TABLE(ci2_feature_comp),
1769 ADD_TABLE(ci2_file),
1770 ADD_TABLE(install_exec_seq),
1771 ADD_TABLE(rof_media),
1772 ADD_TABLE(property),
1775 static const msi_table ca1_tables[] =
1777 ADD_TABLE(component),
1778 ADD_TABLE(directory),
1779 ADD_TABLE(feature),
1780 ADD_TABLE(feature_comp),
1781 ADD_TABLE(file),
1782 ADD_TABLE(property),
1783 ADD_TABLE(directory),
1784 ADD_TABLE(ca1_install_exec_seq),
1785 ADD_TABLE(ca1_custom_action),
1786 ADD_TABLE(ca1_test_seq),
1787 ADD_TABLE(ca1_test2),
1788 ADD_TABLE(ca1__validation),
1791 static const msi_table ca51_tables[] =
1793 ADD_TABLE(ca51_component),
1794 ADD_TABLE(directory),
1795 ADD_TABLE(rof_feature),
1796 ADD_TABLE(ci2_feature_comp),
1797 ADD_TABLE(ci2_file),
1798 ADD_TABLE(ca51_install_exec_seq),
1799 ADD_TABLE(rof_media),
1800 ADD_TABLE(property),
1801 ADD_TABLE(ca51_custom_action),
1804 static const msi_table is_tables[] =
1806 ADD_TABLE(is_component),
1807 ADD_TABLE(directory),
1808 ADD_TABLE(is_feature),
1809 ADD_TABLE(is_feature_comp),
1810 ADD_TABLE(is_file),
1811 ADD_TABLE(install_exec_seq),
1812 ADD_TABLE(is_media),
1813 ADD_TABLE(property),
1816 static const msi_table sp_tables[] =
1818 ADD_TABLE(sp_component),
1819 ADD_TABLE(sp_directory),
1820 ADD_TABLE(rof_feature),
1821 ADD_TABLE(ci2_feature_comp),
1822 ADD_TABLE(ci2_file),
1823 ADD_TABLE(install_exec_seq),
1824 ADD_TABLE(rof_media),
1825 ADD_TABLE(property),
1828 static const msi_table mcp_tables[] =
1830 ADD_TABLE(mcp_component),
1831 ADD_TABLE(directory),
1832 ADD_TABLE(mcp_feature),
1833 ADD_TABLE(mcp_feature_comp),
1834 ADD_TABLE(mcp_file),
1835 ADD_TABLE(rem_install_exec_seq),
1836 ADD_TABLE(rof_media),
1837 ADD_TABLE(property),
1840 static const msi_table ai_tables[] =
1842 ADD_TABLE(component),
1843 ADD_TABLE(directory),
1844 ADD_TABLE(feature),
1845 ADD_TABLE(feature_comp),
1846 ADD_TABLE(ai_file),
1847 ADD_TABLE(install_exec_seq),
1848 ADD_TABLE(media),
1849 ADD_TABLE(property)
1852 static const msi_table ai2_tables[] =
1854 ADD_TABLE(ai2_component),
1855 ADD_TABLE(directory),
1856 ADD_TABLE(ai2_feature),
1857 ADD_TABLE(ai2_feature_comp),
1858 ADD_TABLE(ai2_file),
1859 ADD_TABLE(install_exec_seq),
1860 ADD_TABLE(media),
1861 ADD_TABLE(property)
1864 static const msi_table pc_tables[] =
1866 ADD_TABLE(ca51_component),
1867 ADD_TABLE(directory),
1868 ADD_TABLE(rof_feature),
1869 ADD_TABLE(ci2_feature_comp),
1870 ADD_TABLE(ci2_file),
1871 ADD_TABLE(install_exec_seq),
1872 ADD_TABLE(rof_media),
1873 ADD_TABLE(property)
1876 static const msi_table ip_tables[] =
1878 ADD_TABLE(component),
1879 ADD_TABLE(directory),
1880 ADD_TABLE(feature),
1881 ADD_TABLE(feature_comp),
1882 ADD_TABLE(file),
1883 ADD_TABLE(ip_install_exec_seq),
1884 ADD_TABLE(ip_custom_action),
1885 ADD_TABLE(media),
1886 ADD_TABLE(property)
1889 static const msi_table aup_tables[] =
1891 ADD_TABLE(component),
1892 ADD_TABLE(directory),
1893 ADD_TABLE(feature),
1894 ADD_TABLE(feature_comp),
1895 ADD_TABLE(file),
1896 ADD_TABLE(aup_install_exec_seq),
1897 ADD_TABLE(aup_custom_action),
1898 ADD_TABLE(media),
1899 ADD_TABLE(property)
1902 static const msi_table aup2_tables[] =
1904 ADD_TABLE(component),
1905 ADD_TABLE(directory),
1906 ADD_TABLE(feature),
1907 ADD_TABLE(feature_comp),
1908 ADD_TABLE(file),
1909 ADD_TABLE(aup2_install_exec_seq),
1910 ADD_TABLE(aup_custom_action),
1911 ADD_TABLE(media),
1912 ADD_TABLE(aup_property)
1915 static const msi_table aup3_tables[] =
1917 ADD_TABLE(component),
1918 ADD_TABLE(directory),
1919 ADD_TABLE(feature),
1920 ADD_TABLE(feature_comp),
1921 ADD_TABLE(file),
1922 ADD_TABLE(aup2_install_exec_seq),
1923 ADD_TABLE(aup_custom_action),
1924 ADD_TABLE(media),
1925 ADD_TABLE(aup2_property)
1928 static const msi_table aup4_tables[] =
1930 ADD_TABLE(component),
1931 ADD_TABLE(directory),
1932 ADD_TABLE(feature),
1933 ADD_TABLE(feature_comp),
1934 ADD_TABLE(file),
1935 ADD_TABLE(aup3_install_exec_seq),
1936 ADD_TABLE(aup_custom_action),
1937 ADD_TABLE(media),
1938 ADD_TABLE(aup2_property)
1941 static const msi_table fiu_tables[] =
1943 ADD_TABLE(rof_component),
1944 ADD_TABLE(directory),
1945 ADD_TABLE(rof_feature),
1946 ADD_TABLE(rof_feature_comp),
1947 ADD_TABLE(rof_file),
1948 ADD_TABLE(pp_install_exec_seq),
1949 ADD_TABLE(rof_media),
1950 ADD_TABLE(property),
1953 static const msi_table fiuc_tables[] =
1955 ADD_TABLE(rof_component),
1956 ADD_TABLE(directory),
1957 ADD_TABLE(rof_feature),
1958 ADD_TABLE(rof_feature_comp),
1959 ADD_TABLE(rofc_file),
1960 ADD_TABLE(pp_install_exec_seq),
1961 ADD_TABLE(rofc_media),
1962 ADD_TABLE(property),
1965 static const msi_table fo_tables[] =
1967 ADD_TABLE(directory),
1968 ADD_TABLE(fo_file),
1969 ADD_TABLE(fo_component),
1970 ADD_TABLE(fo_feature),
1971 ADD_TABLE(fo_condition),
1972 ADD_TABLE(fo_feature_comp),
1973 ADD_TABLE(fo_custom_action),
1974 ADD_TABLE(fo_install_exec_seq),
1975 ADD_TABLE(media),
1976 ADD_TABLE(property)
1979 static const msi_table icon_base_tables[] =
1981 ADD_TABLE(ci_component),
1982 ADD_TABLE(directory),
1983 ADD_TABLE(rof_feature),
1984 ADD_TABLE(rof_feature_comp),
1985 ADD_TABLE(rof_file),
1986 ADD_TABLE(pp_install_exec_seq),
1987 ADD_TABLE(rof_media),
1988 ADD_TABLE(icon_property),
1991 static const msi_table pv_tables[] =
1993 ADD_TABLE(rof_component),
1994 ADD_TABLE(directory),
1995 ADD_TABLE(rof_feature),
1996 ADD_TABLE(rof_feature_comp),
1997 ADD_TABLE(rof_file),
1998 ADD_TABLE(pv_install_exec_seq),
1999 ADD_TABLE(rof_media),
2000 ADD_TABLE(property)
2003 static const msi_table uc_tables[] =
2005 ADD_TABLE(directory),
2006 ADD_TABLE(uc_component),
2007 ADD_TABLE(uc_feature),
2008 ADD_TABLE(uc_feature_comp),
2009 ADD_TABLE(uc_file),
2010 ADD_TABLE(uc_install_exec_seq),
2011 ADD_TABLE(media),
2012 ADD_TABLE(uc_property)
2015 static const msi_table mixed_tables[] =
2017 ADD_TABLE(directory),
2018 ADD_TABLE(mixed_component),
2019 ADD_TABLE(mixed_feature),
2020 ADD_TABLE(mixed_feature_comp),
2021 ADD_TABLE(mixed_install_exec_seq),
2022 ADD_TABLE(mixed_registry),
2023 ADD_TABLE(media),
2024 ADD_TABLE(property)
2027 static const msi_table vp_tables[] =
2029 ADD_TABLE(directory),
2030 ADD_TABLE(vp_file),
2031 ADD_TABLE(vp_component),
2032 ADD_TABLE(vp_feature),
2033 ADD_TABLE(vp_feature_comp),
2034 ADD_TABLE(vp_custom_action),
2035 ADD_TABLE(vp_install_exec_seq),
2036 ADD_TABLE(media),
2037 ADD_TABLE(property)
2040 static const msi_table shc_tables[] =
2042 ADD_TABLE(media),
2043 ADD_TABLE(directory),
2044 ADD_TABLE(shc_file),
2045 ADD_TABLE(shc_component),
2046 ADD_TABLE(shc_feature),
2047 ADD_TABLE(shc_feature_comp),
2048 ADD_TABLE(shc_custom_action),
2049 ADD_TABLE(shc_install_exec_seq),
2050 ADD_TABLE(shc_property)
2053 static const msi_table shc2_tables[] =
2055 ADD_TABLE(media),
2056 ADD_TABLE(directory),
2057 ADD_TABLE(shc_file),
2058 ADD_TABLE(shc_component),
2059 ADD_TABLE(shc_feature),
2060 ADD_TABLE(shc_feature_comp),
2061 ADD_TABLE(shc_custom_action),
2062 ADD_TABLE(shc2_install_exec_seq),
2063 ADD_TABLE(shc2_property)
2066 static const msi_table ft_tables[] =
2068 ADD_TABLE(media),
2069 ADD_TABLE(directory),
2070 ADD_TABLE(ft_file),
2071 ADD_TABLE(ft_comp),
2072 ADD_TABLE(ft_feature),
2073 ADD_TABLE(ft_feature_comp),
2074 ADD_TABLE(ft_condition),
2075 ADD_TABLE(ft_custom_action),
2076 ADD_TABLE(ft_install_exec_seq),
2077 ADD_TABLE(property)
2080 static const msi_table da_tables[] =
2082 ADD_TABLE(media),
2083 ADD_TABLE(directory),
2084 ADD_TABLE(file),
2085 ADD_TABLE(component),
2086 ADD_TABLE(feature),
2087 ADD_TABLE(feature_comp),
2088 ADD_TABLE(property),
2089 ADD_TABLE(da_install_exec_seq),
2090 ADD_TABLE(da_custom_action),
2093 static const msi_table x64_tables[] =
2095 ADD_TABLE(media),
2096 ADD_TABLE(x64_directory),
2097 ADD_TABLE(file),
2098 ADD_TABLE(component),
2099 ADD_TABLE(feature),
2100 ADD_TABLE(feature_comp),
2101 ADD_TABLE(property),
2102 ADD_TABLE(install_exec_seq),
2105 static const msi_table sr_tables[] =
2107 ADD_TABLE(media),
2108 ADD_TABLE(directory),
2109 ADD_TABLE(file),
2110 ADD_TABLE(component),
2111 ADD_TABLE(feature),
2112 ADD_TABLE(feature_comp),
2113 ADD_TABLE(property),
2114 ADD_TABLE(sr_install_exec_seq),
2115 ADD_TABLE(sr_custom_action),
2118 /* cabinet definitions */
2120 /* make the max size large so there is only one cab file */
2121 #define MEDIA_SIZE 0x7FFFFFFF
2122 #define FOLDER_THRESHOLD 900000
2124 /* the FCI callbacks */
2126 static void * CDECL mem_alloc(ULONG cb)
2128 return HeapAlloc(GetProcessHeap(), 0, cb);
2131 static void CDECL mem_free(void *memory)
2133 HeapFree(GetProcessHeap(), 0, memory);
2136 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
2138 sprintf(pccab->szCab, pv, pccab->iCab);
2139 return TRUE;
2142 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
2144 return 0;
2147 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
2148 BOOL fContinuation, void *pv)
2150 return 0;
2153 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
2155 HANDLE handle;
2156 DWORD dwAccess = 0;
2157 DWORD dwShareMode = 0;
2158 DWORD dwCreateDisposition = OPEN_EXISTING;
2160 dwAccess = GENERIC_READ | GENERIC_WRITE;
2161 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
2163 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
2164 dwCreateDisposition = OPEN_EXISTING;
2165 else
2166 dwCreateDisposition = CREATE_NEW;
2168 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
2169 dwCreateDisposition, 0, NULL);
2171 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
2173 return (INT_PTR)handle;
2176 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2178 HANDLE handle = (HANDLE)hf;
2179 DWORD dwRead;
2180 BOOL res;
2182 res = ReadFile(handle, memory, cb, &dwRead, NULL);
2183 ok(res, "Failed to ReadFile\n");
2185 return dwRead;
2188 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2190 HANDLE handle = (HANDLE)hf;
2191 DWORD dwWritten;
2192 BOOL res;
2194 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2195 ok(res, "Failed to WriteFile\n");
2197 return dwWritten;
2200 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
2202 HANDLE handle = (HANDLE)hf;
2203 ok(CloseHandle(handle), "Failed to CloseHandle\n");
2205 return 0;
2208 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
2210 HANDLE handle = (HANDLE)hf;
2211 DWORD ret;
2213 ret = SetFilePointer(handle, dist, NULL, seektype);
2214 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2216 return ret;
2219 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
2221 BOOL ret = DeleteFileA(pszFile);
2222 ok(ret, "Failed to DeleteFile %s\n", pszFile);
2224 return 0;
2227 static void init_functionpointers(void)
2229 HMODULE hmsi = GetModuleHandleA("msi.dll");
2230 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2231 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2232 HMODULE hsrclient = LoadLibraryA("srclient.dll");
2234 #define GET_PROC(mod, func) \
2235 p ## func = (void*)GetProcAddress(mod, #func); \
2236 if(!p ## func) \
2237 trace("GetProcAddress(%s) failed\n", #func);
2239 GET_PROC(hmsi, MsiQueryComponentStateA);
2240 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
2241 GET_PROC(hmsi, MsiGetComponentPathExA);
2243 GET_PROC(hadvapi32, RegDeleteKeyExA)
2244 GET_PROC(hkernel32, IsWow64Process)
2245 GET_PROC(hkernel32, Wow64DisableWow64FsRedirection);
2246 GET_PROC(hkernel32, Wow64RevertWow64FsRedirection);
2248 GET_PROC(hsrclient, SRRemoveRestorePoint);
2249 GET_PROC(hsrclient, SRSetRestorePointA);
2251 #undef GET_PROC
2254 BOOL is_process_limited(void)
2256 SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
2257 PSID Group = NULL;
2258 BOOL IsInGroup;
2259 HANDLE token;
2261 if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
2262 DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
2263 !CheckTokenMembership(NULL, Group, &IsInGroup))
2265 trace("Could not check if the current user is an administrator\n");
2266 FreeSid(Group);
2267 return FALSE;
2269 FreeSid(Group);
2271 if (!IsInGroup)
2273 /* Only administrators have enough privileges for these tests */
2274 return TRUE;
2277 if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2279 BOOL ret;
2280 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
2281 DWORD size;
2283 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2284 CloseHandle(token);
2285 return (ret && type == TokenElevationTypeLimited);
2287 return FALSE;
2290 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
2292 CHAR buffer[0x20];
2293 UINT r;
2294 DWORD sz;
2296 sz = sizeof buffer;
2297 r = MsiRecordGetStringA(rec, field, buffer, &sz);
2298 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
2301 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2303 LPSTR tempname;
2305 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2306 GetTempFileNameA(".", "xx", 0, tempname);
2308 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2310 lstrcpyA(pszTempName, tempname);
2311 HeapFree(GetProcessHeap(), 0, tempname);
2312 return TRUE;
2315 HeapFree(GetProcessHeap(), 0, tempname);
2317 return FALSE;
2320 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2321 USHORT *pattribs, int *err, void *pv)
2323 BY_HANDLE_FILE_INFORMATION finfo;
2324 FILETIME filetime;
2325 HANDLE handle;
2326 DWORD attrs;
2327 BOOL res;
2329 handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2330 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2332 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2334 res = GetFileInformationByHandle(handle, &finfo);
2335 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2337 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2338 FileTimeToDosDateTime(&filetime, pdate, ptime);
2340 attrs = GetFileAttributesA(pszName);
2341 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2343 return (INT_PTR)handle;
2346 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2348 char path[MAX_PATH];
2349 char filename[MAX_PATH];
2351 lstrcpyA(path, CURR_DIR);
2352 lstrcatA(path, "\\");
2353 lstrcatA(path, file);
2355 lstrcpyA(filename, file);
2357 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2358 progress, get_open_info, compress);
2361 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2363 ZeroMemory(pCabParams, sizeof(CCAB));
2365 pCabParams->cb = max_size;
2366 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2367 pCabParams->setID = 0xbeef;
2368 pCabParams->iCab = 1;
2369 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2370 lstrcatA(pCabParams->szCabPath, "\\");
2371 lstrcpyA(pCabParams->szCab, name);
2374 void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2376 CCAB cabParams;
2377 LPCSTR ptr;
2378 HFCI hfci;
2379 ERF erf;
2380 BOOL res;
2382 set_cab_parameters(&cabParams, name, max_size);
2384 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2385 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2386 get_temp_file, &cabParams, NULL);
2388 ok(hfci != NULL, "Failed to create an FCI context\n");
2390 ptr = files;
2391 while (*ptr)
2393 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2394 ok(res, "Failed to add file: %s\n", ptr);
2395 ptr += lstrlenA(ptr) + 1;
2398 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2399 ok(res, "Failed to flush the cabinet\n");
2401 res = FCIDestroy(hfci);
2402 ok(res, "Failed to destroy the cabinet\n");
2405 BOOL get_user_dirs(void)
2407 HKEY hkey;
2408 DWORD type, size;
2410 if (RegOpenKeyA(HKEY_CURRENT_USER,
2411 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2412 return FALSE;
2414 size = MAX_PATH;
2415 if(RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size)){
2416 RegCloseKey(hkey);
2417 return FALSE;
2420 RegCloseKey(hkey);
2421 return TRUE;
2424 BOOL get_system_dirs(void)
2426 HKEY hkey;
2427 DWORD type, size;
2429 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion",
2430 0, KEY_QUERY_VALUE | KEY_WOW64_64KEY, &hkey))
2431 return FALSE;
2433 size = MAX_PATH;
2434 if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2435 RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size)) {
2436 RegCloseKey(hkey);
2437 return FALSE;
2440 size = MAX_PATH;
2441 if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2442 RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size)) {
2443 RegCloseKey(hkey);
2444 return FALSE;
2447 size = MAX_PATH;
2448 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR_NATIVE, &size)) {
2449 RegCloseKey(hkey);
2450 return FALSE;
2453 RegCloseKey(hkey);
2455 if(!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH))
2456 return FALSE;
2458 return TRUE;
2461 void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2463 HANDLE file;
2464 DWORD written;
2466 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2467 if (file == INVALID_HANDLE_VALUE)
2468 return;
2470 WriteFile(file, data, strlen(data), &written, NULL);
2472 if (size)
2474 SetFilePointer(file, size, NULL, FILE_BEGIN);
2475 SetEndOfFile(file);
2478 CloseHandle(file);
2481 static void create_test_files(void)
2483 CreateDirectoryA("msitest", NULL);
2484 create_file("msitest\\one.txt", 100);
2485 CreateDirectoryA("msitest\\first", NULL);
2486 create_file("msitest\\first\\two.txt", 100);
2487 CreateDirectoryA("msitest\\second", NULL);
2488 create_file("msitest\\second\\three.txt", 100);
2490 create_file("four.txt", 100);
2491 create_file("five.txt", 100);
2492 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2494 create_file("msitest\\filename", 100);
2496 DeleteFileA("four.txt");
2497 DeleteFileA("five.txt");
2500 BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2502 CHAR path[MAX_PATH];
2504 lstrcpyA(path, PROG_FILES_DIR);
2505 lstrcatA(path, "\\");
2506 lstrcatA(path, rel_path);
2508 if (is_file)
2509 return DeleteFileA(path);
2510 else
2511 return RemoveDirectoryA(path);
2514 static BOOL delete_pf_native(const CHAR *rel_path, BOOL is_file)
2516 CHAR path[MAX_PATH];
2518 lstrcpyA(path, PROG_FILES_DIR_NATIVE);
2519 lstrcatA(path, "\\");
2520 lstrcatA(path, rel_path);
2522 if (is_file)
2523 return DeleteFileA(path);
2524 else
2525 return RemoveDirectoryA(path);
2528 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
2530 CHAR path[MAX_PATH];
2532 lstrcpyA(path, COMMON_FILES_DIR);
2533 lstrcatA(path, "\\");
2534 lstrcatA(path, rel_path);
2536 if (is_file)
2537 return DeleteFileA(path);
2538 else
2539 return RemoveDirectoryA(path);
2542 static BOOL compare_pf_data(const char *filename, const char *data, DWORD size)
2544 DWORD read;
2545 HANDLE handle;
2546 BOOL ret = FALSE;
2547 char *buffer, path[MAX_PATH];
2549 lstrcpyA(path, PROG_FILES_DIR);
2550 lstrcatA(path, "\\");
2551 lstrcatA(path, filename);
2553 handle = CreateFileA(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2554 buffer = HeapAlloc(GetProcessHeap(), 0, size);
2555 if (buffer)
2557 ReadFile(handle, buffer, size, &read, NULL);
2558 if (read == size && !memcmp(data, buffer, size)) ret = TRUE;
2559 HeapFree(GetProcessHeap(), 0, buffer);
2561 CloseHandle(handle);
2562 return ret;
2565 static void delete_test_files(void)
2567 DeleteFileA("msitest.msi");
2568 DeleteFileA("msitest.cab");
2569 DeleteFileA("msitest\\second\\three.txt");
2570 DeleteFileA("msitest\\first\\two.txt");
2571 DeleteFileA("msitest\\one.txt");
2572 DeleteFileA("msitest\\filename");
2573 RemoveDirectoryA("msitest\\second");
2574 RemoveDirectoryA("msitest\\first");
2575 RemoveDirectoryA("msitest");
2578 static void delete_pf_files(void)
2580 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2581 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
2582 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2583 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
2584 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2585 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
2586 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2587 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
2588 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2589 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2590 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2593 static void write_file(const CHAR *filename, const char *data, int data_size)
2595 DWORD size;
2597 HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
2598 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2599 WriteFile(hf, data, data_size, &size, NULL);
2600 CloseHandle(hf);
2603 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount,
2604 const char *template, const char *packagecode)
2606 MSIHANDLE summary;
2607 UINT r;
2609 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2610 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2612 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2613 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2615 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL, packagecode);
2616 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2618 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL);
2619 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2621 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2622 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2624 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2625 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2627 /* write the summary changes back to the stream */
2628 r = MsiSummaryInfoPersist(summary);
2629 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2631 MsiCloseHandle(summary);
2634 static char *load_resource(const char *name)
2636 static char path[MAX_PATH];
2637 DWORD written;
2638 HANDLE file;
2639 HRSRC res;
2640 void *ptr;
2642 GetTempFileNameA(".", name, 0, path);
2644 file = CreateFileA(path, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
2645 ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", path, GetLastError());
2647 res = FindResourceA(NULL, name, "TESTDLL");
2648 ok( res != 0, "couldn't find resource\n" );
2649 ptr = LockResource( LoadResource( GetModuleHandleA(NULL), res ));
2650 WriteFile( file, ptr, SizeofResource( GetModuleHandleA(NULL), res ), &written, NULL );
2651 ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" );
2652 CloseHandle( file );
2654 return path;
2657 static INT CALLBACK ok_callback(void *context, UINT message_type, MSIHANDLE record)
2659 if (message_type == INSTALLMESSAGE_USER)
2661 char file[200];
2662 char msg[2000];
2663 DWORD len;
2665 len = sizeof(file);
2666 MsiRecordGetStringA(record, 2, file, &len);
2667 len = sizeof(msg);
2668 MsiRecordGetStringA(record, 5, msg, &len);
2670 todo_wine_if(MsiRecordGetInteger(record, 1))
2671 ok_(file, MsiRecordGetInteger(record, 3)) (MsiRecordGetInteger(record, 4), "%s", msg);
2673 return 1;
2675 return 0;
2678 static void add_custom_dll(MSIHANDLE hdb)
2680 MSIHANDLE record;
2681 UINT res;
2683 if (!customdll)
2684 customdll = load_resource("custom.dll");
2686 MsiSetExternalUIRecord(ok_callback, INSTALLLOGMODE_USER, NULL, NULL);
2688 res = run_query(hdb, 0, "CREATE TABLE `Binary` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)");
2689 ok(res == ERROR_SUCCESS, "failed to create Binary table: %u\n", res);
2691 record = MsiCreateRecord(1);
2692 res = MsiRecordSetStreamA(record, 1, customdll);
2693 ok(res == ERROR_SUCCESS, "failed to add %s to stream: %u\n", customdll, res);
2695 res = run_query(hdb, record, "INSERT INTO `Binary` (`Name`, `Data`) VALUES ('custom.dll', ?)");
2696 ok(res == ERROR_SUCCESS, "failed to insert into Binary table: %u\n", res);
2698 MsiCloseHandle(record);
2701 void create_database_wordcount(const CHAR *name, const msi_table *tables, int num_tables,
2702 INT version, INT wordcount, const char *template, const char *packagecode)
2704 MSIHANDLE db;
2705 UINT r;
2706 WCHAR *nameW;
2707 int j, len;
2709 len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2710 if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
2711 MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2713 r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
2714 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2716 /* import the tables into the database */
2717 for (j = 0; j < num_tables; j++)
2719 const msi_table *table = &tables[j];
2721 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2723 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2724 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2726 DeleteFileA(table->filename);
2729 write_msi_summary_info(db, version, wordcount, template, packagecode);
2730 add_custom_dll(db);
2732 r = MsiDatabaseCommit(db);
2733 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2735 MsiCloseHandle(db);
2736 HeapFree( GetProcessHeap(), 0, nameW );
2739 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2741 RESTOREPOINTINFOA spec;
2743 spec.dwEventType = event_type;
2744 spec.dwRestorePtType = APPLICATION_INSTALL;
2745 spec.llSequenceNumber = status->llSequenceNumber;
2746 lstrcpyA(spec.szDescription, "msitest restore point");
2748 return pSRSetRestorePointA(&spec, status);
2751 static void remove_restore_point(DWORD seq_number)
2753 DWORD res;
2755 res = pSRRemoveRestorePoint(seq_number);
2756 if (res != ERROR_SUCCESS)
2757 trace("Failed to remove the restore point : %08x\n", res);
2760 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
2762 if (pRegDeleteKeyExA)
2763 return pRegDeleteKeyExA( key, subkey, access, 0 );
2764 return RegDeleteKeyA( key, subkey );
2767 static void test_MsiInstallProduct(void)
2769 UINT r;
2770 CHAR path[MAX_PATH];
2771 LONG res;
2772 HKEY hkey;
2773 DWORD num, size, type;
2774 REGSAM access = KEY_ALL_ACCESS;
2776 if (is_process_limited())
2778 skip("process is limited\n");
2779 return;
2782 if (is_wow64)
2783 access |= KEY_WOW64_64KEY;
2785 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2787 if (0) /* crashes on Win10 1709 */
2789 r = MsiInstallProductA(NULL, "INSTALL=ALL");
2790 ok(r == ERROR_INVALID_PARAMETER, "got %u\n", r);
2792 r = MsiInstallProductA(NULL, NULL);
2793 ok(r == ERROR_INVALID_PARAMETER, "got %u\n", r);
2796 /* szPackagePath is empty */
2797 r = MsiInstallProductA("", "INSTALL=ALL");
2798 ok(r == ERROR_PATH_NOT_FOUND,
2799 "Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
2801 create_test_files();
2802 create_database(msifile, tables, ARRAY_SIZE(tables));
2804 /* install, don't publish */
2805 r = MsiInstallProductA(msifile, NULL);
2806 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2808 skip("Not enough rights to perform tests\n");
2809 goto error;
2811 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2813 delete_pf_files();
2815 res = RegOpenKeyExA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", 0, access, &hkey);
2816 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2818 size = MAX_PATH;
2819 type = REG_SZ;
2820 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
2821 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2822 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
2824 size = MAX_PATH;
2825 type = REG_SZ;
2826 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
2827 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2829 size = sizeof(num);
2830 type = REG_DWORD;
2831 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
2832 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2833 ok(num == 314, "Expected 314, got %d\n", num);
2835 size = MAX_PATH;
2836 type = REG_SZ;
2837 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
2838 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2839 ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
2841 delete_key(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", access);
2843 /* not published, reinstall */
2844 r = MsiInstallProductA(msifile, NULL);
2845 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2847 delete_pf_files();
2849 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2850 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2851 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2853 create_database(msifile, up_tables, ARRAY_SIZE(up_tables));
2855 /* not published, RemovePreviousVersions set */
2856 r = MsiInstallProductA(msifile, NULL);
2857 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2859 delete_pf_files();
2861 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2862 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2863 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2865 create_database(msifile, up2_tables, ARRAY_SIZE(up2_tables));
2867 /* not published, version number bumped */
2868 r = MsiInstallProductA(msifile, NULL);
2869 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2871 delete_pf_files();
2873 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2874 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2875 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2877 create_database(msifile, up3_tables, ARRAY_SIZE(up3_tables));
2879 /* not published, RemovePreviousVersions set and version number bumped */
2880 r = MsiInstallProductA(msifile, NULL);
2881 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2883 delete_pf_files();
2885 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2886 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2887 RegDeleteKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest");
2889 create_database(msifile, up4_tables, ARRAY_SIZE(up4_tables));
2891 /* install, publish product */
2892 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2893 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2895 delete_pf_files();
2897 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2898 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2900 create_database(msifile, up4_tables, ARRAY_SIZE(up4_tables));
2902 /* published, reinstall */
2903 r = MsiInstallProductA(msifile, NULL);
2904 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2906 delete_pf_files();
2908 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2909 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2911 create_database(msifile, up5_tables, ARRAY_SIZE(up5_tables));
2913 /* published product, RemovePreviousVersions set */
2914 r = MsiInstallProductA(msifile, NULL);
2915 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2917 delete_pf_files();
2919 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2920 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2922 create_database(msifile, up6_tables, ARRAY_SIZE(up6_tables));
2924 /* published product, version number bumped */
2925 r = MsiInstallProductA(msifile, NULL);
2926 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2928 delete_pf_files();
2930 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2931 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2933 create_database(msifile, up7_tables, ARRAY_SIZE(up7_tables));
2935 /* published product, RemovePreviousVersions set and version number bumped */
2936 r = MsiInstallProductA(msifile, NULL);
2937 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2939 delete_pf_files();
2941 res = RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Wine\\msitest", &hkey);
2942 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2944 r = MsiInstallProductA(msifile, "REMOVE=ALL FULL=1");
2945 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2947 error:
2948 delete_test_files();
2949 DeleteFileA(msifile);
2952 static void test_MsiSetComponentState(void)
2954 INSTALLSTATE installed, action;
2955 MSIHANDLE package;
2956 char path[MAX_PATH];
2957 UINT r;
2959 create_database(msifile, tables, ARRAY_SIZE(tables));
2961 CoInitialize(NULL);
2963 lstrcpyA(path, CURR_DIR);
2964 lstrcatA(path, "\\");
2965 lstrcatA(path, msifile);
2967 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2969 r = MsiOpenPackageA(path, &package);
2970 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2972 skip("Not enough rights to perform tests\n");
2973 goto error;
2975 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2977 r = MsiDoActionA(package, "CostInitialize");
2978 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2980 r = MsiDoActionA(package, "FileCost");
2981 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2983 r = MsiDoActionA(package, "CostFinalize");
2984 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2986 r = MsiGetComponentStateA(package, "dangler", &installed, &action);
2987 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2988 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
2989 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2991 r = MsiSetComponentStateA(package, "dangler", INSTALLSTATE_SOURCE);
2992 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2994 MsiCloseHandle(package);
2996 error:
2997 CoUninitialize();
2998 DeleteFileA(msifile);
3001 static void test_packagecoltypes(void)
3003 MSIHANDLE hdb, view, rec;
3004 char path[MAX_PATH];
3005 WCHAR pathW[MAX_PATH];
3006 LPCSTR query;
3007 UINT r, count;
3009 create_database(msifile, tables, ARRAY_SIZE(tables));
3011 CoInitialize(NULL);
3013 lstrcpyA(path, CURR_DIR);
3014 lstrcatA(path, "\\");
3015 lstrcatA(path, msifile);
3016 MultiByteToWideChar( CP_ACP, 0, path, -1, pathW, MAX_PATH );
3018 r = MsiOpenDatabaseW(pathW, MSIDBOPEN_READONLY, &hdb);
3019 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3021 query = "SELECT * FROM `Media`";
3022 r = MsiDatabaseOpenViewA( hdb, query, &view );
3023 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
3025 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
3026 count = MsiRecordGetFieldCount( rec );
3027 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
3028 ok(count == 6, "Expected 6, got %d\n", count);
3029 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
3030 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
3031 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
3032 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
3033 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
3034 ok(check_record(rec, 6, "Source"), "wrong column label\n");
3035 MsiCloseHandle(rec);
3037 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
3038 count = MsiRecordGetFieldCount( rec );
3039 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
3040 ok(count == 6, "Expected 6, got %d\n", count);
3041 ok(check_record(rec, 1, "i2"), "wrong column label\n");
3042 ok(check_record(rec, 2, "i4"), "wrong column label\n");
3043 ok(check_record(rec, 3, "L64"), "wrong column label\n");
3044 ok(check_record(rec, 4, "S255"), "wrong column label\n");
3045 ok(check_record(rec, 5, "S32"), "wrong column label\n");
3046 ok(check_record(rec, 6, "S72"), "wrong column label\n");
3048 MsiCloseHandle(rec);
3049 MsiCloseHandle(view);
3050 MsiCloseHandle(hdb);
3051 CoUninitialize();
3053 DeleteFileA(msifile);
3056 static void create_cc_test_files(void)
3058 CCAB cabParams;
3059 HFCI hfci;
3060 ERF erf;
3061 static CHAR cab_context[] = "test%d.cab";
3062 BOOL res;
3064 create_file("maximus", 500);
3065 create_file("augustus", 50000);
3066 create_file("tiberius", 500);
3067 create_file("caesar", 500);
3069 set_cab_parameters(&cabParams, "test1.cab", 40000);
3071 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
3072 fci_read, fci_write, fci_close, fci_seek, fci_delete,
3073 get_temp_file, &cabParams, cab_context);
3074 ok(hfci != NULL, "Failed to create an FCI context\n");
3076 res = add_file(hfci, "maximus", tcompTYPE_NONE);
3077 ok(res, "Failed to add file maximus\n");
3079 res = add_file(hfci, "augustus", tcompTYPE_NONE);
3080 ok(res, "Failed to add file augustus\n");
3082 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
3083 ok(res, "Failed to add file tiberius\n");
3085 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
3086 ok(res, "Failed to flush the cabinet\n");
3088 res = FCIDestroy(hfci);
3089 ok(res, "Failed to destroy the cabinet\n");
3091 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3093 DeleteFileA("maximus");
3094 DeleteFileA("augustus");
3095 DeleteFileA("tiberius");
3096 DeleteFileA("caesar");
3099 void delete_cab_files(void)
3101 SHFILEOPSTRUCTA shfl;
3102 CHAR path[MAX_PATH+10];
3104 lstrcpyA(path, CURR_DIR);
3105 lstrcatA(path, "\\*.cab");
3106 path[strlen(path) + 1] = '\0';
3108 shfl.hwnd = NULL;
3109 shfl.wFunc = FO_DELETE;
3110 shfl.pFrom = path;
3111 shfl.pTo = NULL;
3112 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
3114 SHFileOperationA(&shfl);
3117 static void test_continuouscabs(void)
3119 UINT r;
3121 if (is_process_limited())
3123 skip("process is limited\n");
3124 return;
3127 create_cc_test_files();
3128 create_database(msifile, cc_tables, ARRAY_SIZE(cc_tables));
3130 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3132 r = MsiInstallProductA(msifile, NULL);
3133 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3135 skip("Not enough rights to perform tests\n");
3136 goto error;
3138 else
3140 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3141 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3142 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3143 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3144 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3147 delete_cab_files();
3148 DeleteFileA(msifile);
3150 create_cc_test_files();
3151 create_database(msifile, cc2_tables, ARRAY_SIZE(cc2_tables));
3153 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3155 r = MsiInstallProductA(msifile, NULL);
3156 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3158 skip("Not enough rights to perform tests\n");
3160 else
3162 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3163 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3164 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3165 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
3166 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3167 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3170 delete_cab_files();
3171 DeleteFileA(msifile);
3173 /* Tests to show that only msi cab filename is taken in case of mismatch with the one given by previous cab */
3175 /* Filename from cab is right and the one from msi is wrong */
3176 create_cc_test_files();
3177 create_database(msifile, cc3_tables, ARRAY_SIZE(cc3_tables));
3179 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3181 r = MsiInstallProductA(msifile, NULL);
3182 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3184 skip("Not enough rights to perform tests\n");
3186 else
3188 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3189 todo_wine ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3190 ok(!delete_pf("msitest\\caesar", TRUE), "File installed\n");
3191 todo_wine ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
3192 todo_wine ok(!delete_pf("msitest", FALSE), "Directory created\n");
3195 delete_cab_files();
3196 DeleteFileA(msifile);
3198 /* Filename from msi is right and the one from cab is wrong */
3199 create_cc_test_files();
3200 ok(MoveFileA("test2.cab", "test2_.cab"), "Cannot rename test2.cab to test2_.cab\n");
3201 create_database(msifile, cc3_tables, ARRAY_SIZE(cc3_tables));
3203 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3205 r = MsiInstallProductA(msifile, NULL);
3206 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3208 skip("Not enough rights to perform tests\n");
3210 else
3212 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3213 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3214 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3215 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3216 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3219 error:
3220 delete_cab_files();
3221 DeleteFileA(msifile);
3224 static void test_caborder(void)
3226 UINT r;
3228 create_file("imperator", 100);
3229 create_file("maximus", 500);
3230 create_file("augustus", 50000);
3231 create_file("caesar", 500);
3233 create_database(msifile, cc_tables, ARRAY_SIZE(cc_tables));
3235 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3237 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3238 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3239 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3241 r = MsiInstallProductA(msifile, NULL);
3242 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3244 skip("Not enough rights to perform tests\n");
3245 goto error;
3247 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3248 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3249 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3250 todo_wine
3252 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3253 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3256 delete_cab_files();
3258 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
3259 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
3260 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3262 r = MsiInstallProductA(msifile, NULL);
3263 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3264 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3265 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3266 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3267 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3269 delete_cab_files();
3270 DeleteFileA(msifile);
3272 create_cc_test_files();
3273 create_database(msifile, co_tables, ARRAY_SIZE(co_tables));
3275 r = MsiInstallProductA(msifile, NULL);
3276 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3277 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3278 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3279 todo_wine
3281 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3282 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3285 delete_cab_files();
3286 DeleteFileA(msifile);
3288 create_cc_test_files();
3289 create_database(msifile, co2_tables, ARRAY_SIZE(co2_tables));
3291 r = MsiInstallProductA(msifile, NULL);
3292 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3293 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3294 todo_wine
3296 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3297 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3298 ok(!delete_pf("msitest", FALSE), "Directory is created\n");
3301 error:
3302 delete_cab_files();
3303 DeleteFileA("imperator");
3304 DeleteFileA("maximus");
3305 DeleteFileA("augustus");
3306 DeleteFileA("caesar");
3307 DeleteFileA(msifile);
3310 static void test_mixedmedia(void)
3312 UINT r;
3314 if (is_process_limited())
3316 skip("process is limited\n");
3317 return;
3320 CreateDirectoryA("msitest", NULL);
3321 create_file("msitest\\maximus", 500);
3322 create_file("msitest\\augustus", 500);
3323 create_file("caesar", 500);
3325 create_database(msifile, mm_tables, ARRAY_SIZE(mm_tables));
3327 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3329 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
3331 r = MsiInstallProductA(msifile, NULL);
3332 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3334 skip("Not enough rights to perform tests\n");
3335 goto error;
3337 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3338 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3339 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3340 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3341 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3343 error:
3344 /* Delete the files in the temp (current) folder */
3345 DeleteFileA("msitest\\maximus");
3346 DeleteFileA("msitest\\augustus");
3347 RemoveDirectoryA("msitest");
3348 DeleteFileA("caesar");
3349 DeleteFileA("test1.cab");
3350 DeleteFileA(msifile);
3353 static void test_samesequence(void)
3355 UINT r;
3357 create_cc_test_files();
3358 create_database(msifile, ss_tables, ARRAY_SIZE(ss_tables));
3360 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3362 r = MsiInstallProductA(msifile, NULL);
3363 if (r == ERROR_INSTALL_FAILURE)
3365 win_skip("unprivileged user?\n");
3366 goto error;
3368 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3369 if (r == ERROR_SUCCESS)
3371 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3372 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3373 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3374 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3377 error:
3378 delete_cab_files();
3379 DeleteFileA(msifile);
3382 static void test_uiLevelFlags(void)
3384 UINT r;
3386 create_cc_test_files();
3387 create_database(msifile, ui_tables, ARRAY_SIZE(ui_tables));
3389 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
3391 r = MsiInstallProductA(msifile, NULL);
3392 if (r == ERROR_INSTALL_FAILURE)
3394 win_skip("unprivileged user?\n");
3395 goto error;
3398 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3399 if (r == ERROR_SUCCESS)
3401 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
3402 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3403 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3404 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3407 error:
3408 delete_cab_files();
3409 DeleteFileA(msifile);
3412 static BOOL file_matches(LPSTR path)
3414 CHAR buf[MAX_PATH];
3415 HANDLE file;
3416 DWORD size;
3418 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3419 NULL, OPEN_EXISTING, 0, NULL);
3420 ZeroMemory(buf, MAX_PATH);
3421 ReadFile(file, buf, 15, &size, NULL);
3422 CloseHandle(file);
3424 return !lstrcmpA(buf, "msitest\\maximus");
3427 static void test_readonlyfile(void)
3429 UINT r;
3430 DWORD size;
3431 HANDLE file;
3432 CHAR path[MAX_PATH];
3434 if (is_process_limited())
3436 skip("process is limited\n");
3437 return;
3440 CreateDirectoryA("msitest", NULL);
3441 create_file("msitest\\maximus", 500);
3442 create_database(msifile, rof_tables, ARRAY_SIZE(rof_tables));
3444 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3446 lstrcpyA(path, PROG_FILES_DIR);
3447 lstrcatA(path, "\\msitest");
3448 CreateDirectoryA(path, NULL);
3450 lstrcatA(path, "\\maximus");
3451 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3452 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3454 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3455 CloseHandle(file);
3457 r = MsiInstallProductA(msifile, NULL);
3458 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3460 skip("Not enough rights to perform tests\n");
3461 goto error;
3463 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3464 ok(file_matches(path), "Expected file to be overwritten\n");
3465 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3466 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3468 error:
3469 /* Delete the files in the temp (current) folder */
3470 DeleteFileA("msitest\\maximus");
3471 RemoveDirectoryA("msitest");
3472 DeleteFileA(msifile);
3475 static void test_readonlyfile_cab(void)
3477 UINT r;
3478 DWORD size;
3479 HANDLE file;
3480 CHAR path[MAX_PATH];
3481 CHAR buf[16];
3483 if (is_process_limited())
3485 skip("process is limited\n");
3486 return;
3489 CreateDirectoryA("msitest", NULL);
3490 create_file("maximus", 500);
3491 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3492 DeleteFileA("maximus");
3494 create_database(msifile, rofc_tables, ARRAY_SIZE(rofc_tables));
3496 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3498 lstrcpyA(path, PROG_FILES_DIR);
3499 lstrcatA(path, "\\msitest");
3500 CreateDirectoryA(path, NULL);
3502 lstrcatA(path, "\\maximus");
3503 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3504 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3506 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3507 CloseHandle(file);
3509 r = MsiInstallProductA(msifile, NULL);
3510 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3512 skip("Not enough rights to perform tests\n");
3513 goto error;
3515 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3517 memset( buf, 0, sizeof(buf) );
3518 if ((file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3519 NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
3521 ReadFile(file, buf, sizeof(buf) - 1, &size, NULL);
3522 CloseHandle(file);
3524 ok(!memcmp( buf, "maximus", sizeof("maximus")-1 ), "Expected file to be overwritten, got '%s'\n", buf);
3525 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3526 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3528 error:
3529 /* Delete the files in the temp (current) folder */
3530 delete_cab_files();
3531 DeleteFileA("msitest\\maximus");
3532 RemoveDirectoryA("msitest");
3533 DeleteFileA(msifile);
3536 static void test_setdirproperty(void)
3538 UINT r;
3540 if (is_process_limited())
3542 skip("process is limited\n");
3543 return;
3546 CreateDirectoryA("msitest", NULL);
3547 create_file("msitest\\maximus", 500);
3548 create_database(msifile, sdp_tables, ARRAY_SIZE(sdp_tables));
3550 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3552 r = MsiInstallProductA(msifile, NULL);
3553 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3555 skip("Not enough rights to perform tests\n");
3556 goto error;
3558 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3559 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
3560 ok(delete_cf("msitest", FALSE), "Directory not created\n");
3562 error:
3563 /* Delete the files in the temp (current) folder */
3564 DeleteFileA(msifile);
3565 DeleteFileA("msitest\\maximus");
3566 RemoveDirectoryA("msitest");
3569 static void test_cabisextracted(void)
3571 UINT r;
3573 if (is_process_limited())
3575 skip("process is limited\n");
3576 return;
3579 CreateDirectoryA("msitest", NULL);
3580 create_file("msitest\\gaius", 500);
3581 create_file("maximus", 500);
3582 create_file("augustus", 500);
3583 create_file("caesar", 500);
3585 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3586 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3587 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3589 create_database(msifile, cie_tables, ARRAY_SIZE(cie_tables));
3591 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3593 r = MsiInstallProductA(msifile, NULL);
3594 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3596 skip("Not enough rights to perform tests\n");
3597 goto error;
3599 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3600 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3601 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3602 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3603 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
3604 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3606 error:
3607 /* Delete the files in the temp (current) folder */
3608 delete_cab_files();
3609 DeleteFileA(msifile);
3610 DeleteFileA("maximus");
3611 DeleteFileA("augustus");
3612 DeleteFileA("caesar");
3613 DeleteFileA("msitest\\gaius");
3614 RemoveDirectoryA("msitest");
3617 BOOL file_exists(const char *file)
3619 return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES;
3622 BOOL pf_exists(const char *file)
3624 CHAR path[MAX_PATH];
3626 lstrcpyA(path, PROG_FILES_DIR);
3627 lstrcatA(path, "\\");
3628 lstrcatA(path, file);
3630 return file_exists(path);
3633 static void delete_pfmsitest_files(void)
3635 SHFILEOPSTRUCTA shfl;
3636 CHAR path[MAX_PATH+11];
3638 lstrcpyA(path, PROG_FILES_DIR);
3639 lstrcatA(path, "\\msitest\\*");
3640 path[strlen(path) + 1] = '\0';
3642 shfl.hwnd = NULL;
3643 shfl.wFunc = FO_DELETE;
3644 shfl.pFrom = path;
3645 shfl.pTo = NULL;
3646 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT | FOF_NOERRORUI;
3648 SHFileOperationA(&shfl);
3650 lstrcpyA(path, PROG_FILES_DIR);
3651 lstrcatA(path, "\\msitest");
3652 RemoveDirectoryA(path);
3655 UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
3657 MSIHANDLE hview = 0;
3658 UINT r;
3660 r = MsiDatabaseOpenViewA(hdb, query, &hview);
3661 if(r != ERROR_SUCCESS)
3662 return r;
3664 r = MsiViewExecute(hview, hrec);
3665 if(r == ERROR_SUCCESS)
3666 r = MsiViewClose(hview);
3667 MsiCloseHandle(hview);
3668 return r;
3671 static void set_transform_summary_info(void)
3673 UINT r;
3674 MSIHANDLE suminfo = 0;
3676 /* build summary info */
3677 r = MsiGetSummaryInformationA(0, mstfile, 3, &suminfo);
3678 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
3680 r = MsiSummaryInfoSetPropertyA(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
3681 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3683 r = MsiSummaryInfoSetPropertyA(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
3684 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3685 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3686 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
3687 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
3689 r = MsiSummaryInfoSetPropertyA(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
3690 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3692 r = MsiSummaryInfoPersist(suminfo);
3693 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
3695 r = MsiCloseHandle(suminfo);
3696 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
3699 static void generate_transform(void)
3701 MSIHANDLE hdb1, hdb2;
3702 LPCSTR query;
3703 UINT r;
3705 /* start with two identical databases */
3706 CopyFileA(msifile, msifile2, FALSE);
3708 r = MsiOpenDatabaseW(msifile2W, MSIDBOPEN_TRANSACT, &hdb1);
3709 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3711 r = MsiDatabaseCommit(hdb1);
3712 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
3714 r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_READONLY, &hdb2);
3715 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3717 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
3718 r = run_query(hdb1, 0, query);
3719 ok(r == ERROR_SUCCESS, "failed to add property\n");
3721 /* database needs to be committed */
3722 MsiDatabaseCommit(hdb1);
3724 r = MsiDatabaseGenerateTransformA(hdb1, hdb2, mstfile, 0, 0);
3725 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3727 r = MsiCreateTransformSummaryInfoA(hdb2, hdb2, mstfile, 0, 0);
3728 todo_wine ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3730 MsiCloseHandle(hdb1);
3731 MsiCloseHandle(hdb2);
3734 /* data for generating a transform */
3736 /* tables transform names - encoded as they would be in an msi database file */
3737 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
3738 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
3739 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
3741 /* data in each table */
3742 static const char data1[] = /* _StringData */
3743 "propval"; /* all the strings squashed together */
3745 static const WCHAR data2[] = { /* _StringPool */
3746 /* len, refs */
3747 0, 0, /* string 0 '' */
3748 4, 1, /* string 1 'prop' */
3749 3, 1, /* string 2 'val' */
3752 static const WCHAR data3[] = { /* Property */
3753 0x0201, 0x0001, 0x0002,
3756 static const struct {
3757 LPCWSTR name;
3758 const void *data;
3759 DWORD size;
3760 } table_transform_data[] =
3762 { name1, data1, sizeof data1 - 1 },
3763 { name2, data2, sizeof data2 },
3764 { name3, data3, sizeof data3 },
3767 static void generate_transform_manual(void)
3769 IStorage *stg = NULL;
3770 IStream *stm;
3771 WCHAR name[0x20];
3772 HRESULT r;
3773 DWORD i, count;
3774 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
3776 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
3778 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
3780 r = StgCreateDocfile(name, mode, 0, &stg);
3781 ok(r == S_OK, "failed to create storage\n");
3782 if (!stg)
3783 return;
3785 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
3786 ok(r == S_OK, "failed to set storage type\n");
3788 for (i=0; i<ARRAY_SIZE(table_transform_data); i++)
3790 r = IStorage_CreateStream(stg, table_transform_data[i].name,
3791 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3792 if (FAILED(r))
3794 ok(0, "failed to create stream %08x\n", r);
3795 continue;
3798 r = IStream_Write(stm, table_transform_data[i].data,
3799 table_transform_data[i].size, &count);
3800 if (FAILED(r) || count != table_transform_data[i].size)
3801 ok(0, "failed to write stream\n");
3802 IStream_Release(stm);
3805 IStorage_Release(stg);
3807 set_transform_summary_info();
3810 static void test_transformprop(void)
3812 UINT r;
3814 if (is_process_limited())
3816 skip("process is limited\n");
3817 return;
3820 CreateDirectoryA("msitest", NULL);
3821 create_file("msitest\\augustus", 500);
3823 create_database(msifile, tp_tables, ARRAY_SIZE(tp_tables));
3825 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3827 r = MsiInstallProductA(msifile, NULL);
3828 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3830 skip("Not enough rights to perform tests\n");
3831 goto error;
3833 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3834 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3835 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3837 if (0)
3838 generate_transform();
3839 else
3840 generate_transform_manual();
3842 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
3843 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3844 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3845 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3847 error:
3848 /* Delete the files in the temp (current) folder */
3849 DeleteFileA(msifile);
3850 DeleteFileA(msifile2);
3851 DeleteFileA(mstfile);
3852 DeleteFileA("msitest\\augustus");
3853 RemoveDirectoryA("msitest");
3856 static void test_currentworkingdir(void)
3858 UINT r;
3859 CHAR drive[MAX_PATH], path[MAX_PATH + 12];
3860 LPSTR ptr;
3862 if (is_process_limited())
3864 skip("process is limited\n");
3865 return;
3868 CreateDirectoryA("msitest", NULL);
3869 create_file("msitest\\augustus", 500);
3871 create_database(msifile, cwd_tables, ARRAY_SIZE(cwd_tables));
3873 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3875 CreateDirectoryA("diffdir", NULL);
3876 SetCurrentDirectoryA("diffdir");
3878 sprintf(path, "..\\%s", msifile);
3879 r = MsiInstallProductA(path, NULL);
3880 todo_wine
3882 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
3883 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3884 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3887 sprintf(path, "%s\\%s", CURR_DIR, msifile);
3888 r = MsiInstallProductA(path, NULL);
3889 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3891 skip("Not enough rights to perform tests\n");
3892 goto error;
3894 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3895 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3896 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3898 lstrcpyA(drive, CURR_DIR);
3899 drive[2] = '\\';
3900 drive[3] = '\0';
3901 SetCurrentDirectoryA(drive);
3903 lstrcpyA(path, CURR_DIR);
3904 if (path[lstrlenA(path) - 1] != '\\') lstrcatA(path, "\\");
3905 lstrcatA(path, msifile);
3906 ptr = strchr(path, ':');
3907 ptr +=2;
3909 r = MsiInstallProductA(ptr, NULL);
3910 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3911 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3912 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3914 error:
3915 SetCurrentDirectoryA(CURR_DIR);
3916 DeleteFileA(msifile);
3917 DeleteFileA("msitest\\augustus");
3918 RemoveDirectoryA("msitest");
3919 RemoveDirectoryA("diffdir");
3922 static void set_admin_summary_info(const WCHAR *name)
3924 MSIHANDLE db, summary;
3925 UINT r;
3927 r = MsiOpenDatabaseW(name, MSIDBOPEN_DIRECT, &db);
3928 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3930 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
3931 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3933 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
3934 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3936 /* write the summary changes back to the stream */
3937 r = MsiSummaryInfoPersist(summary);
3938 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3940 MsiCloseHandle(summary);
3942 r = MsiDatabaseCommit(db);
3943 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3945 MsiCloseHandle(db);
3948 static void test_admin(void)
3950 UINT r;
3952 CreateDirectoryA("msitest", NULL);
3953 create_file("msitest\\augustus", 500);
3955 create_database(msifile, adm_tables, ARRAY_SIZE(adm_tables));
3956 set_admin_summary_info(msifileW);
3958 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3960 r = MsiInstallProductA(msifile, NULL);
3961 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3963 skip("Not enough rights to perform tests\n");
3964 goto error;
3966 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3967 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3968 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3969 ok(!DeleteFileA("c:\\msitest\\augustus"), "File installed\n");
3970 ok(!RemoveDirectoryA("c:\\msitest"), "File installed\n");
3972 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
3973 todo_wine
3974 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3975 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3976 ok(!delete_pf("msitest", FALSE), "Directory created\n");
3977 todo_wine
3979 ok(DeleteFileA("c:\\msitest\\augustus"), "File not installed\n");
3980 ok(RemoveDirectoryA("c:\\msitest"), "File not installed\n");
3983 error:
3984 DeleteFileA(msifile);
3985 DeleteFileA("msitest\\augustus");
3986 RemoveDirectoryA("msitest");
3989 static void set_admin_property_stream(LPCSTR file)
3991 IStorage *stg;
3992 IStream *stm;
3993 WCHAR fileW[MAX_PATH];
3994 HRESULT hr;
3995 DWORD count;
3996 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
3998 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
4000 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
4001 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4002 if (!stg)
4003 return;
4005 hr = IStorage_CreateStream(stg, L"\x41ca\x4330\x3e71\x44b5\x4233\x45f5\x422c\x4836",
4006 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
4007 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4009 hr = IStream_Write(stm, L"MYPROP=2718 MyProp=42", sizeof(L"MYPROP=2718 MyProp=42"), &count);
4010 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4012 IStream_Release(stm);
4013 IStorage_Release(stg);
4016 static void test_adminprops(void)
4018 UINT r;
4020 if (is_process_limited())
4022 skip("process is limited\n");
4023 return;
4026 CreateDirectoryA("msitest", NULL);
4027 create_file("msitest\\augustus", 500);
4029 create_database(msifile, amp_tables, ARRAY_SIZE(amp_tables));
4030 set_admin_summary_info(msifileW);
4031 set_admin_property_stream(msifile);
4033 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4035 r = MsiInstallProductA(msifile, NULL);
4036 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4038 skip("Not enough rights to perform tests\n");
4039 goto error;
4041 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4042 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4043 ok(delete_pf("msitest", FALSE), "Directory created\n");
4045 error:
4046 DeleteFileA(msifile);
4047 DeleteFileA("msitest\\augustus");
4048 RemoveDirectoryA("msitest");
4051 void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
4053 CHAR path[MAX_PATH];
4055 lstrcpyA(path, PROG_FILES_DIR);
4056 lstrcatA(path, "\\");
4057 lstrcatA(path, file);
4059 if (is_file)
4060 create_file_data(path, data, 500);
4061 else
4062 CreateDirectoryA(path, NULL);
4065 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
4067 static void test_missingcab(void)
4069 UINT r;
4071 if (is_process_limited())
4073 skip("process is limited\n");
4074 return;
4077 CreateDirectoryA("msitest", NULL);
4078 create_file("msitest\\augustus", 500);
4079 create_file("maximus", 500);
4080 create_file("tiberius", 500);
4082 create_database(msifile, mc_tables, ARRAY_SIZE(mc_tables));
4084 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4086 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
4087 create_cab_file("test4.cab", MEDIA_SIZE, "tiberius\0");
4089 create_pf("msitest", FALSE);
4090 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
4091 create_pf_data("msitest\\tiberius", "abcdefgh", TRUE);
4093 r = MsiInstallProductA(msifile, NULL);
4094 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4096 skip("Not enough rights to perform tests\n");
4097 goto error;
4099 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4100 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4101 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4102 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
4103 ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
4104 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
4105 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
4106 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4108 create_pf("msitest", FALSE);
4109 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
4110 create_pf_data("msitest\\tiberius", "abcdefgh", TRUE);
4111 create_pf("msitest\\gaius", TRUE);
4113 r = MsiInstallProductA(msifile, "GAIUS=1");
4114 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4115 todo_wine
4117 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
4118 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4120 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
4121 ok(compare_pf_data("msitest\\tiberius", "abcdefgh", sizeof("abcdefgh")), "Wrong file contents\n");
4122 ok(delete_pf("msitest\\tiberius", TRUE), "File removed\n");
4123 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
4124 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4126 error:
4127 delete_pf("msitest", FALSE);
4128 DeleteFileA("msitest\\augustus");
4129 RemoveDirectoryA("msitest");
4130 DeleteFileA("maximus");
4131 DeleteFileA("tiberius");
4132 DeleteFileA("test1.cab");
4133 DeleteFileA("test4.cab");
4134 DeleteFileA(msifile);
4137 static void test_sourcefolder(void)
4139 UINT r;
4141 if (is_process_limited())
4143 skip("process is limited\n");
4144 return;
4147 CreateDirectoryA("msitest", NULL);
4148 create_file("augustus", 500);
4150 create_database(msifile, sf_tables, ARRAY_SIZE(sf_tables));
4152 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4154 r = MsiInstallProductA(msifile, NULL);
4155 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4157 skip("Not enough rights to perform tests\n");
4158 goto error;
4160 ok(r == ERROR_INSTALL_FAILURE,
4161 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4162 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4163 todo_wine
4165 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4167 RemoveDirectoryA("msitest");
4169 r = MsiInstallProductA(msifile, NULL);
4170 ok(r == ERROR_INSTALL_FAILURE,
4171 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4172 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4173 todo_wine
4175 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4178 error:
4179 DeleteFileA(msifile);
4180 DeleteFileA("augustus");
4183 static void test_customaction1(void)
4185 MSIHANDLE hdb, record;
4186 UINT r;
4188 create_test_files();
4189 create_database(msifile, ca1_tables, ARRAY_SIZE(ca1_tables));
4191 /* create a test table */
4192 MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb);
4193 run_query(hdb, 0, "CREATE TABLE `Test` (`Name` CHAR(10), `Number` INTEGER, `Data` OBJECT PRIMARY KEY `Name`)");
4194 create_file("unus", 10);
4195 create_file("duo", 10);
4196 record = MsiCreateRecord(1);
4197 MsiRecordSetStreamA(record, 1, "unus");
4198 run_query(hdb, record, "INSERT INTO `Test` (`Name`, `Number`, `Data`) VALUES ('one', 1, ?)");
4199 MsiRecordSetStreamA(record, 1, "duo");
4200 run_query(hdb, record, "INSERT INTO `Test` (`Name`, `Number`, `Data`) VALUES ('two', 2, ?)");
4201 MsiDatabaseCommit(hdb);
4202 MsiCloseHandle(hdb);
4204 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4206 r = MsiInstallProductA(msifile, "MAIN_TEST=1");
4207 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4209 /* Test return values */
4210 r = MsiInstallProductA(msifile, "TEST_RETVAL=0");
4211 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4213 r = MsiInstallProductA(msifile, "TEST_RETVAL=1626"); /* ERROR_FUNCTION_NOT_CALLED */
4214 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4216 r = MsiInstallProductA(msifile, "TEST_RETVAL=1602");
4217 ok(r == ERROR_INSTALL_USEREXIT, "Expected ERROR_INSTALL_USEREXIT, got %u\n", r);
4219 r = MsiInstallProductA(msifile, "TEST_RETVAL=259"); /* ERROR_NO_MORE_ITEMS */
4220 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4222 /* any other error maps to ERROR_INSTALL_FAILURE */
4223 r = MsiInstallProductA(msifile, "TEST_RETVAL=1");
4224 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4226 /* Custom actions execute in the same process, but they don't retain state */
4227 r = MsiInstallProductA(msifile, "TEST_PROCESS=1");
4228 ok(!r, "got %u\n", r);
4230 /* test asynchronous actions (msidbCustomActionTypeAsync) */
4231 r = MsiInstallProductA(msifile, "TEST_ASYNC=1");
4232 ok(!r, "got %u\n", r);
4234 delete_test_files();
4235 DeleteFileA(msifile);
4236 DeleteFileA("unus");
4237 DeleteFileA("duo");
4240 static void test_customaction51(void)
4242 UINT r;
4244 if (is_process_limited())
4246 skip("process is limited\n");
4247 return;
4250 CreateDirectoryA("msitest", NULL);
4251 create_file("msitest\\augustus", 500);
4253 create_database(msifile, ca51_tables, ARRAY_SIZE(ca51_tables));
4255 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4257 r = MsiInstallProductA(msifile, NULL);
4258 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4260 skip("Not enough rights to perform tests\n");
4261 goto error;
4263 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4264 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4265 ok(delete_pf("msitest", FALSE), "Directory created\n");
4267 error:
4268 DeleteFileA(msifile);
4269 DeleteFileA("msitest\\augustus");
4270 RemoveDirectoryA("msitest");
4273 static void test_installstate(void)
4275 UINT r;
4277 if (is_process_limited())
4279 skip("process is limited\n");
4280 return;
4283 CreateDirectoryA("msitest", NULL);
4284 create_file("msitest\\alpha", 500);
4285 create_file("msitest\\beta", 500);
4286 create_file("msitest\\gamma", 500);
4287 create_file("msitest\\theta", 500);
4288 create_file("msitest\\delta", 500);
4289 create_file("msitest\\epsilon", 500);
4290 create_file("msitest\\zeta", 500);
4291 create_file("msitest\\iota", 500);
4292 create_file("msitest\\eta", 500);
4293 create_file("msitest\\kappa", 500);
4294 create_file("msitest\\lambda", 500);
4295 create_file("msitest\\mu", 500);
4297 create_database(msifile, is_tables, ARRAY_SIZE(is_tables));
4299 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4301 r = MsiInstallProductA(msifile, NULL);
4302 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4304 skip("Not enough rights to perform tests\n");
4305 goto error;
4307 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4308 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4309 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4310 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4311 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4312 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4313 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4314 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4315 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4316 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4317 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4318 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4319 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4320 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4322 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
4323 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4324 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4325 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4326 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4327 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4328 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4329 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
4330 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4331 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4332 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
4333 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4334 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4335 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4336 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4338 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
4339 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4340 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4341 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4342 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4343 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4344 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4345 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4346 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4347 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4348 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4349 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4350 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4351 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4352 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4354 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
4355 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4356 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
4357 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4358 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4359 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
4360 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4361 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4362 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4363 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4364 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4365 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4366 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4367 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4368 ok(!delete_pf("msitest", FALSE), "Directory created\n");
4370 error:
4371 DeleteFileA(msifile);
4372 DeleteFileA("msitest\\alpha");
4373 DeleteFileA("msitest\\beta");
4374 DeleteFileA("msitest\\gamma");
4375 DeleteFileA("msitest\\theta");
4376 DeleteFileA("msitest\\delta");
4377 DeleteFileA("msitest\\epsilon");
4378 DeleteFileA("msitest\\zeta");
4379 DeleteFileA("msitest\\iota");
4380 DeleteFileA("msitest\\eta");
4381 DeleteFileA("msitest\\kappa");
4382 DeleteFileA("msitest\\lambda");
4383 DeleteFileA("msitest\\mu");
4384 RemoveDirectoryA("msitest");
4387 static const struct sourcepathmap
4389 BOOL sost; /* shortone\shorttwo */
4390 BOOL solt; /* shortone\longtwo */
4391 BOOL lost; /* longone\shorttwo */
4392 BOOL lolt; /* longone\longtwo */
4393 BOOL soste; /* shortone\shorttwo source exists */
4394 BOOL solte; /* shortone\longtwo source exists */
4395 BOOL loste; /* longone\shorttwo source exists */
4396 BOOL lolte; /* longone\longtwo source exists */
4397 UINT err;
4398 DWORD size;
4399 } spmap[256] =
4401 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4402 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4403 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4404 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4405 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4406 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4407 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4408 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4409 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4410 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4411 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4412 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4413 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4414 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4415 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4416 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4417 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4418 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4419 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4420 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4421 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4422 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4423 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4424 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4425 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4426 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4427 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4428 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4429 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4430 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4431 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4432 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4433 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4434 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4435 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4436 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4437 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4438 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4439 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4440 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4441 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4442 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4443 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4444 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4445 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4446 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4447 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4448 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4449 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4450 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4451 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4452 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4453 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4454 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4455 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4456 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4457 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4458 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4459 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4460 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4461 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4462 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4463 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4464 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4465 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4466 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4467 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4468 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4469 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4470 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4471 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4472 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4473 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4474 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4475 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4476 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4477 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4478 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4479 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4480 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4481 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4482 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4483 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4484 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4485 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4486 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4487 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4488 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4489 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4490 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4491 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4492 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4493 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4494 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4495 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4496 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4497 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4498 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4499 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4500 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4501 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4502 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4503 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4504 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4505 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4506 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4507 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4508 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4509 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4510 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4511 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4512 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4513 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4514 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4515 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4516 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4517 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4518 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4519 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4520 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4521 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4522 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4523 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4524 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4525 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4526 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4527 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4528 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4529 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4530 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4531 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4532 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4533 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4534 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4535 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4536 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4537 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4538 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4539 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4540 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4541 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4542 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4543 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4544 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4545 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4546 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4547 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4548 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4549 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4550 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4551 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4552 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4553 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4554 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4555 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4556 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4557 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4558 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4559 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4560 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4561 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4562 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4563 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4564 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4565 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4566 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4567 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4568 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4569 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4570 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4571 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4572 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4573 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4574 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4575 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4576 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4577 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4578 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4579 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4580 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4581 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4582 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4583 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4584 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4585 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4586 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4587 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4588 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4589 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4590 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4591 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4592 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4593 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4594 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4595 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4596 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4597 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4598 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4599 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4600 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4601 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4602 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4603 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4604 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4605 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4606 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4607 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4608 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4609 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4610 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4611 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4612 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4613 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4614 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4615 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4616 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4617 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4618 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4619 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4620 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4621 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4622 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4623 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4624 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4625 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4626 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4627 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4628 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4629 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4630 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4631 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4632 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4633 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4634 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4635 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4636 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4637 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4638 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4639 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4640 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4641 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4642 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4643 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4644 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4645 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4646 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4647 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4648 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4649 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4650 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4651 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4652 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4653 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4654 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4655 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4656 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4659 static DWORD get_pf_file_size(LPCSTR file)
4661 CHAR path[MAX_PATH];
4662 HANDLE hfile;
4663 DWORD size;
4665 lstrcpyA(path, PROG_FILES_DIR);
4666 lstrcatA(path, "\\");
4667 lstrcatA(path, file);
4669 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
4670 if (hfile == INVALID_HANDLE_VALUE)
4671 return INVALID_FILE_SIZE;
4673 size = GetFileSize(hfile, NULL);
4674 CloseHandle(hfile);
4675 return size;
4678 static void test_sourcepath(void)
4680 UINT r, i;
4682 if (!winetest_interactive)
4684 skip("Run in interactive mode to run source path tests.\n");
4685 return;
4688 create_database(msifile, sp_tables, ARRAY_SIZE(sp_tables));
4690 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4692 for (i = 0; i < ARRAY_SIZE(spmap); i++)
4694 if (spmap[i].sost)
4696 CreateDirectoryA("shortone", NULL);
4697 CreateDirectoryA("shortone\\shorttwo", NULL);
4700 if (spmap[i].solt)
4702 CreateDirectoryA("shortone", NULL);
4703 CreateDirectoryA("shortone\\longtwo", NULL);
4706 if (spmap[i].lost)
4708 CreateDirectoryA("longone", NULL);
4709 CreateDirectoryA("longone\\shorttwo", NULL);
4712 if (spmap[i].lolt)
4714 CreateDirectoryA("longone", NULL);
4715 CreateDirectoryA("longone\\longtwo", NULL);
4718 if (spmap[i].soste)
4719 create_file("shortone\\shorttwo\\augustus", 50);
4720 if (spmap[i].solte)
4721 create_file("shortone\\longtwo\\augustus", 100);
4722 if (spmap[i].loste)
4723 create_file("longone\\shorttwo\\augustus", 150);
4724 if (spmap[i].lolte)
4725 create_file("longone\\longtwo\\augustus", 200);
4727 r = MsiInstallProductA(msifile, NULL);
4728 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
4729 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
4730 "%d: Expected %d, got %d\n", i, spmap[i].size,
4731 get_pf_file_size("msitest\\augustus"));
4733 if (r == ERROR_SUCCESS)
4735 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
4736 ok(delete_pf("msitest", FALSE), "%d: Directory not created\n", i);
4738 else
4740 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
4741 todo_wine ok(!delete_pf("msitest", FALSE), "%d: Directory installed\n", i);
4744 DeleteFileA("shortone\\shorttwo\\augustus");
4745 DeleteFileA("shortone\\longtwo\\augustus");
4746 DeleteFileA("longone\\shorttwo\\augustus");
4747 DeleteFileA("longone\\longtwo\\augustus");
4748 RemoveDirectoryA("shortone\\shorttwo");
4749 RemoveDirectoryA("shortone\\longtwo");
4750 RemoveDirectoryA("longone\\shorttwo");
4751 RemoveDirectoryA("longone\\longtwo");
4752 RemoveDirectoryA("shortone");
4753 RemoveDirectoryA("longone");
4756 DeleteFileA(msifile);
4759 static void test_missingcomponent(void)
4761 UINT r;
4763 if (is_process_limited())
4765 skip("process is limited\n");
4766 return;
4769 CreateDirectoryA("msitest", NULL);
4770 create_file("msitest\\hydrogen", 500);
4771 create_file("msitest\\helium", 500);
4772 create_file("msitest\\lithium", 500);
4773 create_file("beryllium", 500);
4775 create_database(msifile, mcp_tables, ARRAY_SIZE(mcp_tables));
4777 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4779 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
4780 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4782 skip("Not enough rights to perform tests\n");
4783 goto error;
4785 else if (r == ERROR_INSTALL_FAILURE)
4787 win_skip("broken result\n");
4788 goto error;
4790 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4791 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4792 ok(pf_exists("msitest\\helium"), "File not installed\n");
4793 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4794 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
4795 ok(pf_exists("msitest"), "File not installed\n");
4797 r = MsiInstallProductA(msifile, "REMOVE=ALL INSTALLLEVEL=10 PROPVAR=42");
4798 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4799 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
4800 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
4801 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
4802 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
4803 ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
4805 error:
4806 DeleteFileA(msifile);
4807 DeleteFileA("msitest\\hydrogen");
4808 DeleteFileA("msitest\\helium");
4809 DeleteFileA("msitest\\lithium");
4810 DeleteFileA("beryllium");
4811 RemoveDirectoryA("msitest");
4814 static void test_sourcedirprop(void)
4816 UINT r;
4817 CHAR props[MAX_PATH + 18];
4819 if (is_process_limited())
4821 skip("process is limited\n");
4822 return;
4825 CreateDirectoryA("msitest", NULL);
4826 create_file("msitest\\augustus", 500);
4828 create_database(msifile, ca51_tables, ARRAY_SIZE(ca51_tables));
4830 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4832 r = MsiInstallProductA(msifile, NULL);
4833 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4835 skip("Not enough rights to perform tests\n");
4836 goto error;
4838 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4839 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4840 ok(delete_pf("msitest", FALSE), "Directory created\n");
4842 DeleteFileA("msitest\\augustus");
4843 RemoveDirectoryA("msitest");
4845 CreateDirectoryA("altsource", NULL);
4846 CreateDirectoryA("altsource\\msitest", NULL);
4847 create_file("altsource\\msitest\\augustus", 500);
4849 sprintf(props, "SRCDIR=%s\\altsource\\", CURR_DIR);
4851 r = MsiInstallProductA(msifile, props);
4852 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4853 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4854 ok(delete_pf("msitest", FALSE), "Directory created\n");
4856 DeleteFileA("altsource\\msitest\\augustus");
4857 RemoveDirectoryA("altsource\\msitest");
4858 RemoveDirectoryA("altsource");
4860 error:
4861 DeleteFileA("msitest\\augustus");
4862 RemoveDirectoryA("msitest");
4863 DeleteFileA(msifile);
4866 static void test_adminimage(void)
4868 UINT r;
4870 if (is_process_limited())
4872 skip("process is limited\n");
4873 return;
4876 CreateDirectoryA("msitest", NULL);
4877 CreateDirectoryA("msitest\\first", NULL);
4878 CreateDirectoryA("msitest\\second", NULL);
4879 CreateDirectoryA("msitest\\cabout", NULL);
4880 CreateDirectoryA("msitest\\cabout\\new", NULL);
4881 create_file("msitest\\one.txt", 100);
4882 create_file("msitest\\first\\two.txt", 100);
4883 create_file("msitest\\second\\three.txt", 100);
4884 create_file("msitest\\cabout\\four.txt", 100);
4885 create_file("msitest\\cabout\\new\\five.txt", 100);
4886 create_file("msitest\\filename", 100);
4888 create_database_wordcount(msifile, ai_tables, ARRAY_SIZE(ai_tables),
4889 100, msidbSumInfoSourceTypeAdminImage, ";1033",
4890 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
4892 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4894 r = MsiInstallProductA(msifile, NULL);
4895 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4897 skip("Not enough rights to perform tests\n");
4898 goto error;
4900 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4902 delete_pf_files();
4904 create_file("four.txt", 100);
4905 create_file("five.txt", 100);
4906 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
4907 create_database_wordcount(msifile, ai2_tables, ARRAY_SIZE(ai2_tables),
4908 100, msidbSumInfoSourceTypeAdminImage|msidbSumInfoSourceTypeCompressed,
4909 ";1033", "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
4911 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4913 r = MsiInstallProductA(msifile, NULL);
4914 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4916 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4917 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4918 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4919 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4920 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4922 error:
4923 DeleteFileA("msifile");
4924 DeleteFileA("msitest\\cabout\\new\\five.txt");
4925 DeleteFileA("msitest\\cabout\\four.txt");
4926 DeleteFileA("msitest\\second\\three.txt");
4927 DeleteFileA("msitest\\first\\two.txt");
4928 DeleteFileA("msitest\\one.txt");
4929 DeleteFileA("msitest\\filename");
4930 RemoveDirectoryA("msitest\\cabout\\new");
4931 RemoveDirectoryA("msitest\\cabout");
4932 RemoveDirectoryA("msitest\\second");
4933 RemoveDirectoryA("msitest\\first");
4934 RemoveDirectoryA("msitest");
4937 static void test_propcase(void)
4939 UINT r;
4941 if (is_process_limited())
4943 skip("process is limited\n");
4944 return;
4947 CreateDirectoryA("msitest", NULL);
4948 create_file("msitest\\augustus", 500);
4950 create_database(msifile, pc_tables, ARRAY_SIZE(pc_tables));
4952 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4954 r = MsiInstallProductA(msifile, "MyProp=42");
4955 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4957 skip("Not enough rights to perform tests\n");
4958 goto error;
4960 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4961 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4962 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4964 r = MsiInstallProductA(msifile, "Prop1=\"Copyright \"\"My Company\"\" 2015\" MyProp=42");
4965 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4966 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4967 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4969 r = MsiInstallProductA(msifile, "Prop1=\"\"\"install.exe\"\" /Install\" MyProp=\"42\"");
4970 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4971 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4972 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4974 error:
4975 DeleteFileA(msifile);
4976 DeleteFileA("msitest\\augustus");
4977 RemoveDirectoryA("msitest");
4980 static void test_int_widths( void )
4982 static const char int0[] = "int0\ni0\nint0\tint0\n1";
4983 static const char int1[] = "int1\ni1\nint1\tint1\n1";
4984 static const char int2[] = "int2\ni2\nint2\tint2\n1";
4985 static const char int3[] = "int3\ni3\nint3\tint3\n1";
4986 static const char int4[] = "int4\ni4\nint4\tint4\n1";
4987 static const char int5[] = "int5\ni5\nint5\tint5\n1";
4988 static const char int8[] = "int8\ni8\nint8\tint8\n1";
4989 static const struct
4991 const char *data;
4992 unsigned int size;
4993 UINT ret;
4995 tests[] =
4997 { int0, sizeof(int0) - 1, ERROR_SUCCESS },
4998 { int1, sizeof(int1) - 1, ERROR_SUCCESS },
4999 { int2, sizeof(int2) - 1, ERROR_SUCCESS },
5000 { int3, sizeof(int3) - 1, ERROR_FUNCTION_FAILED },
5001 { int4, sizeof(int4) - 1, ERROR_SUCCESS },
5002 { int5, sizeof(int5) - 1, ERROR_FUNCTION_FAILED },
5003 { int8, sizeof(int8) - 1, ERROR_FUNCTION_FAILED }
5005 WCHAR tmpdir[MAX_PATH], msitable[MAX_PATH], msidb[MAX_PATH];
5006 MSIHANDLE db;
5007 UINT r, i;
5009 GetTempPathW(MAX_PATH, tmpdir);
5010 CreateDirectoryW(tmpdir, NULL);
5012 lstrcpyW(msitable, tmpdir);
5013 lstrcatW(msitable, L"\\msitable.idt");
5015 lstrcpyW(msidb, tmpdir);
5016 lstrcatW(msidb, L"\\msitest.msi");
5018 r = MsiOpenDatabaseW(msidb, MSIDBOPEN_CREATE, &db);
5019 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5021 for (i = 0; i < ARRAY_SIZE(tests); i++)
5023 DWORD count;
5024 HANDLE handle = CreateFileW(msitable, GENERIC_WRITE, 0, NULL,
5025 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
5026 WriteFile(handle, tests[i].data, tests[i].size, &count, NULL);
5027 CloseHandle(handle);
5029 r = MsiDatabaseImportW(db, tmpdir, L"msitable.idt");
5030 ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r);
5032 r = MsiDatabaseCommit(db);
5033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5034 DeleteFileW(msitable);
5037 MsiCloseHandle(db);
5038 DeleteFileW(msidb);
5039 RemoveDirectoryW(tmpdir);
5042 static void test_shortcut(void)
5044 UINT r;
5045 HRESULT hr;
5047 if (is_process_limited())
5049 skip("process is limited\n");
5050 return;
5053 create_test_files();
5054 create_database(msifile, sc_tables, ARRAY_SIZE(sc_tables));
5056 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5058 r = MsiInstallProductA(msifile, NULL);
5059 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5061 skip("Not enough rights to perform tests\n");
5062 goto error;
5064 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5066 hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
5067 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
5069 r = MsiInstallProductA(msifile, NULL);
5070 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5072 CoUninitialize();
5074 hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
5075 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
5077 r = MsiInstallProductA(msifile, NULL);
5078 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5080 CoUninitialize();
5082 while (!delete_pf("msitest\\Shortcut.lnk", TRUE) && GetLastError() == ERROR_SHARING_VIOLATION) Sleep(1000);
5083 delete_pf_files();
5085 error:
5086 delete_test_files();
5087 DeleteFileA(msifile);
5090 static void test_preselected(void)
5092 UINT r;
5094 if (is_process_limited())
5096 skip("process is limited\n");
5097 return;
5100 create_test_files();
5101 create_database(msifile, ps_tables, ARRAY_SIZE(ps_tables));
5103 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5105 r = MsiInstallProductA(msifile, "ADDLOCAL=One");
5106 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5108 skip("Not enough rights to perform tests\n");
5109 goto error;
5111 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5113 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
5114 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
5115 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
5116 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
5117 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
5118 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
5119 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
5120 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
5121 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
5122 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5123 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5125 r = MsiInstallProductA(msifile, NULL);
5126 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5128 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5129 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5130 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5131 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5132 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5133 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5134 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5135 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5136 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5137 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
5138 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5140 error:
5141 delete_test_files();
5142 DeleteFileA(msifile);
5145 static void test_installed_prop(void)
5147 static const char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}";
5148 UINT r;
5150 if (is_process_limited())
5152 skip("process is limited\n");
5153 return;
5156 create_test_files();
5157 create_database(msifile, ip_tables, ARRAY_SIZE(ip_tables));
5159 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5161 r = MsiInstallProductA(msifile, "FULL=1");
5162 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5164 skip("Not enough rights to perform tests\n");
5165 goto error;
5167 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5169 r = MsiInstallProductA(msifile, "FULL=1");
5170 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5172 r = MsiConfigureProductExA(prodcode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, "FULL=1");
5173 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5175 delete_pf_files();
5177 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5178 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5180 error:
5181 delete_test_files();
5182 DeleteFileA(msifile);
5185 static void test_allusers_prop(void)
5187 UINT r;
5189 if (is_process_limited())
5191 skip("process is limited\n");
5192 return;
5195 create_test_files();
5196 create_database(msifile, aup_tables, ARRAY_SIZE(aup_tables));
5198 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5200 /* ALLUSERS property unset */
5201 r = MsiInstallProductA(msifile, "FULL=1");
5202 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5204 skip("Not enough rights to perform tests\n");
5205 goto error;
5207 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5209 delete_pf_files();
5211 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5212 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5214 delete_test_files();
5216 create_test_files();
5217 create_database(msifile, aup2_tables, ARRAY_SIZE(aup2_tables));
5219 /* ALLUSERS property set to 1 */
5220 r = MsiInstallProductA(msifile, "FULL=1");
5221 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5223 delete_pf_files();
5225 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5226 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5228 delete_test_files();
5230 create_test_files();
5231 create_database(msifile, aup3_tables, ARRAY_SIZE(aup3_tables));
5233 /* ALLUSERS property set to 2 */
5234 r = MsiInstallProductA(msifile, "FULL=1");
5235 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5237 delete_pf_files();
5239 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5240 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5242 delete_test_files();
5244 create_test_files();
5245 create_database(msifile, aup4_tables, ARRAY_SIZE(aup4_tables));
5247 /* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */
5248 r = MsiInstallProductA(msifile, "FULL=1");
5249 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5251 error:
5252 delete_test_files();
5253 DeleteFileA(msifile);
5256 static const char session_manager[] = "System\\CurrentControlSet\\Control\\Session Manager";
5257 static const char rename_ops[] = "PendingFileRenameOperations";
5259 static void process_pending_renames(HKEY hkey)
5261 char *buf, *src, *dst, *buf2, *buf2ptr;
5262 DWORD size;
5263 LONG ret;
5264 BOOL found = FALSE;
5266 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size);
5267 ok(!ret, "RegQueryValueExA failed %d\n", ret);
5269 buf = HeapAlloc(GetProcessHeap(), 0, size + 1);
5270 buf2ptr = buf2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 1);
5272 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size);
5273 buf[size] = 0;
5274 ok(!ret, "RegQueryValueExA failed %d\n", ret);
5275 if (ret) return;
5277 for (src = buf; *src; src = dst + strlen(dst) + 1)
5279 DWORD flags = MOVEFILE_COPY_ALLOWED;
5280 BOOL fileret;
5282 dst = src + strlen(src) + 1;
5284 if (!strstr(src, "msitest"))
5286 lstrcpyA(buf2ptr, src);
5287 buf2ptr += strlen(src) + 1;
5288 lstrcpyA(buf2ptr, dst);
5289 buf2ptr += strlen(dst) + 1;
5290 continue;
5293 found = TRUE;
5295 if (*dst == '!')
5297 flags |= MOVEFILE_REPLACE_EXISTING;
5298 dst++;
5300 if (src[0] == '\\' && src[1] == '?' && src[2] == '?' && src[3] == '\\') src += 4;
5301 if (*dst)
5303 if (dst[0] == '\\' && dst[1] == '?' && dst[2] == '?' && dst[3] == '\\') dst += 4;
5304 fileret = MoveFileExA(src, dst, flags);
5305 ok(fileret, "Failed to move file %s -> %s (%u)\n", src, dst, GetLastError());
5307 else
5309 fileret = DeleteFileA(src);
5310 ok(fileret || broken(!fileret) /* win2k3 */, "Failed to delete file %s (%u)\n", src, GetLastError());
5314 ok(found, "Expected a 'msitest' entry\n");
5316 if (*buf2)
5317 RegSetValueExA(hkey, rename_ops, 0, REG_MULTI_SZ, (LPBYTE)buf2, buf2ptr + 1 - buf2);
5318 else
5319 RegDeleteValueA(hkey, rename_ops);
5321 HeapFree(GetProcessHeap(), 0, buf);
5322 HeapFree(GetProcessHeap(), 0, buf2);
5325 static BOOL file_matches_data(LPCSTR file, LPCSTR data)
5327 DWORD len, data_len = strlen(data);
5328 HANDLE handle;
5329 char buf[128];
5331 handle = CreateFileA(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
5332 ok(handle != INVALID_HANDLE_VALUE, "failed to open %s (%u)\n", file, GetLastError());
5334 if (ReadFile(handle, buf, sizeof(buf), &len, NULL) && len >= data_len)
5336 CloseHandle(handle);
5337 return !memcmp(buf, data, data_len);
5339 CloseHandle(handle);
5340 return FALSE;
5343 static void test_file_in_use(void)
5345 UINT r;
5346 HANDLE file;
5347 HKEY hkey;
5348 char path[MAX_PATH];
5350 if (is_process_limited())
5352 skip("process is limited\n");
5353 return;
5356 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
5358 CreateDirectoryA("msitest", NULL);
5359 create_file("msitest\\maximus", 500);
5360 create_database(msifile, fiu_tables, ARRAY_SIZE(fiu_tables));
5362 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5364 lstrcpyA(path, PROG_FILES_DIR);
5365 lstrcatA(path, "\\msitest");
5366 CreateDirectoryA(path, NULL);
5368 lstrcatA(path, "\\maximus");
5369 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
5371 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
5372 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5374 skip("Not enough rights to perform tests\n");
5375 goto error;
5377 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
5378 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
5379 CloseHandle(file);
5380 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
5382 process_pending_renames(hkey);
5383 RegCloseKey(hkey);
5385 ok(file_matches_data(path, "msitest\\maximus"), "Expected file to match\n");
5386 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
5387 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
5389 r = MsiInstallProductA(msifile, "REMOVE=ALL FULL=1");
5390 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5392 error:
5393 RegCloseKey(hkey);
5395 delete_pf("msitest\\maximus", TRUE);
5396 delete_pf("msitest", FALSE);
5397 DeleteFileA("msitest\\maximus");
5398 delete_test_files();
5399 DeleteFileA(msifile);
5402 static void test_file_in_use_cab(void)
5404 UINT r;
5405 HANDLE file;
5406 HKEY hkey;
5407 char path[MAX_PATH];
5409 if (is_process_limited())
5411 skip("process is limited\n");
5412 return;
5415 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
5417 CreateDirectoryA("msitest", NULL);
5418 create_file("maximus", 500);
5419 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
5420 DeleteFileA("maximus");
5422 create_database(msifile, fiuc_tables, ARRAY_SIZE(fiuc_tables));
5424 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5426 lstrcpyA(path, PROG_FILES_DIR);
5427 lstrcatA(path, "\\msitest");
5428 CreateDirectoryA(path, NULL);
5430 lstrcatA(path, "\\maximus");
5431 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
5433 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
5434 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5436 skip("Not enough rights to perform tests\n");
5437 goto error;
5439 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
5440 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
5441 CloseHandle(file);
5442 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
5444 process_pending_renames(hkey);
5445 RegCloseKey(hkey);
5447 ok(file_matches_data(path, "maximus"), "Expected file to match\n");
5448 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
5449 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
5451 r = MsiInstallProductA(msifile, "REMOVE=ALL FULL=1");
5452 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5454 error:
5455 RegCloseKey(hkey);
5457 delete_pf("msitest\\maximus", TRUE);
5458 delete_pf("msitest", FALSE);
5459 DeleteFileA("msitest\\maximus");
5460 delete_cab_files();
5461 delete_test_files();
5462 DeleteFileA(msifile);
5465 static void test_feature_override(void)
5467 UINT r;
5468 REGSAM access = KEY_ALL_ACCESS;
5470 if (is_process_limited())
5472 skip("process is limited\n");
5473 return;
5476 create_test_files();
5477 create_file("msitest\\override.txt", 1000);
5478 create_file("msitest\\preselected.txt", 1000);
5479 create_file("msitest\\notpreselected.txt", 1000);
5480 create_database(msifile, fo_tables, ARRAY_SIZE(fo_tables));
5482 if (is_wow64)
5483 access |= KEY_WOW64_64KEY;
5485 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5487 r = MsiInstallProductA(msifile, "ADDLOCAL=override");
5488 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5490 skip("Not enough rights to perform tests\n");
5491 goto error;
5493 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5495 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5496 ok(!pf_exists("msitest\\preselected.txt"), "file installed\n");
5497 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5499 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5500 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5502 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5504 r = MsiInstallProductA(msifile, "preselect=1");
5505 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5507 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5508 ok(pf_exists("msitest\\preselected.txt"), "file not installed\n");
5509 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5511 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5512 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5514 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5515 ok(!delete_pf("msitest\\preselected.txt", TRUE), "file not removed\n");
5516 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5518 r = MsiInstallProductA(msifile, NULL);
5519 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5521 ok(pf_exists("msitest\\override.txt"), "file not installed\n");
5522 ok(pf_exists("msitest\\preselected.txt"), "file not installed\n");
5523 ok(!pf_exists("msitest\\notpreselected.txt"), "file installed\n");
5525 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5526 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5528 ok(!delete_pf("msitest\\override.txt", TRUE), "file not removed\n");
5529 ok(!delete_pf("msitest\\preselected.txt", TRUE), "file not removed\n");
5530 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5532 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", access);
5534 error:
5535 DeleteFileA("msitest\\override.txt");
5536 DeleteFileA("msitest\\preselected.txt");
5537 DeleteFileA("msitest\\notpreselected.txt");
5538 delete_test_files();
5539 DeleteFileA(msifile);
5542 static void test_icon_table(void)
5544 MSIHANDLE hdb = 0, record;
5545 LPCSTR query;
5546 UINT res;
5547 CHAR path[MAX_PATH];
5548 static const char prodcode[] = "{7DF88A49-996F-4EC8-A022-BF956F9B2CBB}";
5550 if (is_process_limited())
5552 skip("process is limited\n");
5553 return;
5556 create_database(msifile, icon_base_tables, ARRAY_SIZE(icon_base_tables));
5558 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5560 res = MsiOpenDatabaseW(msifileW, MSIDBOPEN_TRANSACT, &hdb);
5561 ok(res == ERROR_SUCCESS, "failed to open db: %d\n", res);
5563 query = "CREATE TABLE `Icon` (`Name` CHAR(72) NOT NULL, `Data` OBJECT NOT NULL PRIMARY KEY `Name`)";
5564 res = run_query( hdb, 0, query );
5565 ok(res == ERROR_SUCCESS, "Can't create Icon table: %d\n", res);
5567 create_file("icon.ico", 100);
5568 record = MsiCreateRecord(1);
5569 res = MsiRecordSetStreamA(record, 1, "icon.ico");
5570 ok(res == ERROR_SUCCESS, "Failed to add stream data to record: %d\n", res);
5572 query = "INSERT INTO `Icon` (`Name`, `Data`) VALUES ('testicon', ?)";
5573 res = run_query(hdb, record, query);
5574 ok(res == ERROR_SUCCESS, "Insert into Icon table failed: %d\n", res);
5576 res = MsiCloseHandle(record);
5577 ok(res == ERROR_SUCCESS, "Failed to close record handle: %d\n", res);
5578 DeleteFileA("icon.ico");
5579 res = MsiDatabaseCommit(hdb);
5580 ok(res == ERROR_SUCCESS, "Failed to commit database: %d\n", res);
5581 res = MsiCloseHandle(hdb);
5582 ok(res == ERROR_SUCCESS, "Failed to close database: %d\n", res);
5584 /* per-user */
5585 res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
5586 if (res == ERROR_INSTALL_PACKAGE_REJECTED)
5588 skip("Not enough rights to perform tests\n");
5589 DeleteFileA(msifile);
5590 return;
5592 ok(res == ERROR_SUCCESS, "Failed to do per-user install: %d\n", res);
5594 lstrcpyA(path, APP_DATA_DIR);
5595 lstrcatA(path, "\\");
5596 lstrcatA(path, "Microsoft\\Installer\\");
5597 lstrcatA(path, prodcode);
5598 lstrcatA(path, "\\testicon");
5599 ok(file_exists(path), "Per-user icon file isn't where it's expected (%s)\n", path);
5601 res = MsiInstallProductA(msifile, "REMOVE=ALL FULL=1");
5602 ok(res == ERROR_SUCCESS, "Failed to uninstall per-user\n");
5603 ok(!file_exists(path), "Per-user icon file not removed (%s)\n", path);
5605 /* system-wide */
5606 res = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
5607 ok(res == ERROR_SUCCESS, "Failed to system-wide install: %d\n", res);
5609 lstrcpyA(path, WINDOWS_DIR);
5610 lstrcatA(path, "\\");
5611 lstrcatA(path, "Installer\\");
5612 lstrcatA(path, prodcode);
5613 lstrcatA(path, "\\testicon");
5614 ok(file_exists(path), "System-wide icon file isn't where it's expected (%s)\n", path);
5616 res = MsiInstallProductA(msifile, "REMOVE=ALL FULL=1");
5617 ok(res == ERROR_SUCCESS, "Failed to uninstall system-wide\n");
5618 ok(!file_exists(path), "System-wide icon file not removed (%s)\n", path);
5620 delete_pfmsitest_files();
5621 DeleteFileA(msifile);
5624 static void test_package_validation(void)
5626 UINT r;
5628 if (is_process_limited())
5630 skip("process is limited\n");
5631 return;
5634 CreateDirectoryA("msitest", NULL);
5635 create_file("msitest\\maximus", 500);
5636 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;1033");
5638 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5640 r = MsiInstallProductA(msifile, NULL);
5641 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5643 skip("Not enough rights to perform tests\n");
5644 goto error;
5646 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5647 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5648 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5650 DeleteFileA(msifile);
5651 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel,9999;9999");
5653 r = MsiInstallProductA(msifile, NULL);
5654 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5656 DeleteFileA(msifile);
5657 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel,1033;9999");
5659 r = MsiInstallProductA(msifile, NULL);
5660 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5662 DeleteFileA(msifile);
5663 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel,9999;1033");
5665 r = MsiInstallProductA(msifile, NULL);
5666 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5667 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5668 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5670 DeleteFileA(msifile);
5671 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel64,9999;1033");
5673 r = MsiInstallProductA(msifile, NULL);
5674 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5676 DeleteFileA(msifile);
5677 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel32,1033;1033");
5679 r = MsiInstallProductA(msifile, NULL);
5680 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5682 DeleteFileA(msifile);
5683 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "Intel32,9999;1033");
5685 r = MsiInstallProductA(msifile, NULL);
5686 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5688 DeleteFileA(msifile);
5689 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;9999");
5691 r = MsiInstallProductA(msifile, NULL);
5692 ok(r == ERROR_INSTALL_LANGUAGE_UNSUPPORTED, "Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u\n", r);
5693 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5694 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5696 if (GetSystemDefaultLangID() == MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US ))
5698 DeleteFileA(msifile);
5699 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;9");
5700 r = MsiInstallProductA(msifile, NULL);
5701 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5702 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5703 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5705 DeleteFileA(msifile);
5706 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;1024");
5707 r = MsiInstallProductA(msifile, NULL);
5708 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5709 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5710 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5713 DeleteFileA(msifile);
5714 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel32;0");
5716 r = MsiInstallProductA(msifile, NULL);
5717 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5718 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5719 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5721 if (is_64bit && !is_wow64)
5723 DeleteFileA(msifile);
5724 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;0");
5726 r = MsiInstallProductA(msifile, NULL);
5727 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5728 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5729 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5731 DeleteFileA(msifile);
5732 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "x64;0");
5734 r = MsiInstallProductA(msifile, NULL);
5735 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
5736 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5737 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5739 DeleteFileA(msifile);
5740 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "x64;0");
5742 r = MsiInstallProductA(msifile, NULL);
5743 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5744 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5745 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5747 else if (is_wow64)
5749 DeleteFileA(msifile);
5750 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;0");
5752 r = MsiInstallProductA(msifile, NULL);
5753 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5754 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5755 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5757 DeleteFileA(msifile);
5758 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "x64;0");
5760 r = MsiInstallProductA(msifile, NULL);
5761 ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r);
5762 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5763 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5765 DeleteFileA(msifile);
5766 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "x64;0");
5768 r = MsiInstallProductA(msifile, NULL);
5769 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5770 ok(delete_pf("msitest\\maximus", TRUE), "file exists\n");
5771 ok(delete_pf("msitest", FALSE), "directory exists\n");
5773 else
5775 DeleteFileA(msifile);
5776 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Intel;0");
5778 r = MsiInstallProductA(msifile, NULL);
5779 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5780 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5781 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5783 DeleteFileA(msifile);
5784 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "Alpha,Beta,Intel;0");
5786 r = MsiInstallProductA(msifile, NULL);
5787 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5788 ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
5789 ok(delete_pf("msitest", FALSE), "directory does not exist\n");
5791 DeleteFileA(msifile);
5792 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 100, "x64;0");
5794 r = MsiInstallProductA(msifile, NULL);
5795 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5796 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5797 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5799 DeleteFileA(msifile);
5800 create_database_template(msifile, pv_tables, ARRAY_SIZE(pv_tables), 200, "x64;0");
5802 r = MsiInstallProductA(msifile, NULL);
5803 ok(r == ERROR_INSTALL_PLATFORM_UNSUPPORTED, "Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u\n", r);
5804 ok(!delete_pf("msitest\\maximus", TRUE), "file exists\n");
5805 ok(!delete_pf("msitest", FALSE), "directory exists\n");
5808 error:
5809 /* Delete the files in the temp (current) folder */
5810 DeleteFileA(msifile);
5811 DeleteFileA("msitest\\maximus");
5812 RemoveDirectoryA("msitest");
5815 static void test_upgrade_code(void)
5817 UINT r;
5819 if (is_process_limited())
5821 skip("process is limited\n");
5822 return;
5825 CreateDirectoryA("msitest", NULL);
5826 create_file("msitest\\upgradecode.txt", 1000);
5827 create_database(msifile, uc_tables, ARRAY_SIZE(uc_tables));
5829 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5831 r = MsiInstallProductA(msifile, NULL);
5832 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5834 ok(pf_exists("msitest\\upgradecode.txt"), "file not installed\n");
5836 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5837 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5839 ok(!delete_pf("msitest\\upgradecode.txt", TRUE), "file not removed\n");
5840 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5842 DeleteFileA("msitest\\upgradecode.txt");
5843 RemoveDirectoryA("msitest");
5844 DeleteFileA(msifile);
5847 static void test_mixed_package(void)
5849 UINT r;
5850 LONG res;
5851 HKEY hkey;
5852 char value[MAX_PATH];
5853 DWORD size;
5855 if (is_process_limited())
5857 skip("process is limited\n");
5858 return;
5860 if (!is_wow64 && !is_64bit)
5862 skip("this test must be run on 64-bit\n");
5863 return;
5865 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5866 create_database_template(msifile, mixed_tables, ARRAY_SIZE(mixed_tables), 200, "x64;1033");
5868 r = MsiInstallProductA(msifile, NULL);
5869 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5871 skip("Not enough rights to perform tests\n");
5872 goto error;
5874 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5876 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5877 ok(!res, "can't open 32-bit component key, got %d\n", res);
5878 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5879 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5880 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5881 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5882 RegCloseKey(hkey);
5884 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5885 ok(!res, "can't open 64-bit component key, got %d\n", res);
5886 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5887 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5888 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5889 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5890 RegCloseKey(hkey);
5892 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5893 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5894 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5895 ok(res == ERROR_SUCCESS, "can't open 32-bit CLSID key, got %d\n", res);
5896 if (res == ERROR_SUCCESS) {
5897 size = sizeof(value);
5898 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5899 ok(!strcmp(value, "winetest32.dll"), "got %s\n", value);
5900 RegCloseKey(hkey);
5903 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5904 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5905 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5906 ok(res == ERROR_SUCCESS, "can't open 64-bit CLSID key, got %d\n", res);
5907 if (res == ERROR_SUCCESS) {
5908 size = sizeof(value);
5909 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5910 ok(!strcmp(value, "winetest64.dll"), "got %s\n", value);
5911 RegCloseKey(hkey);
5914 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5915 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5917 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5918 ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
5920 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5921 ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
5923 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5924 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5925 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5926 ok(res == ERROR_FILE_NOT_FOUND, "32-bit CLSID key not removed\n");
5928 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5929 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5930 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5931 ok(res == ERROR_FILE_NOT_FOUND, "64-bit CLSID key not removed\n");
5933 DeleteFileA( msifile );
5934 create_database_template(msifile, mixed_tables, ARRAY_SIZE(mixed_tables), 200, "Intel;1033");
5936 r = MsiInstallProductA(msifile, NULL);
5937 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5939 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5940 ok(!res, "can't open 32-bit component key, got %d\n", res);
5941 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5942 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5943 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5944 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5945 RegCloseKey(hkey);
5947 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5948 ok(!res, "can't open 64-bit component key, got %d\n", res);
5949 res = RegQueryValueExA(hkey, "test1", NULL, NULL, NULL, NULL);
5950 ok(res, "expected RegQueryValueEx to fail, got %d\n", res);
5951 res = RegQueryValueExA(hkey, "test2", NULL, NULL, NULL, NULL);
5952 ok(!res, "expected RegQueryValueEx to succeed, got %d\n", res);
5953 RegCloseKey(hkey);
5955 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5956 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5957 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5958 ok(res == ERROR_SUCCESS, "can't open 32-bit CLSID key, got %d\n", res);
5959 if (res == ERROR_SUCCESS) {
5960 size = sizeof(value);
5961 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5962 ok(!strcmp(value, "winetest32.dll"), "got %s\n", value);
5963 RegCloseKey(hkey);
5966 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5967 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}\\InProcServer32",
5968 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5969 ok(res == ERROR_SUCCESS, "can't open 64-bit CLSID key, got %d\n", res);
5970 if (res == ERROR_SUCCESS) {
5971 size = sizeof(value);
5972 res = RegQueryValueExA(hkey, "", NULL, NULL, (LPBYTE)value, &size);
5973 ok(!strcmp(value, "winetest64.dll"), "got %s\n", value);
5974 RegCloseKey(hkey);
5977 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5978 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5980 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5981 ok(res == ERROR_FILE_NOT_FOUND || broken(!res), "32-bit component key not removed\n");
5983 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\msitest", 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5984 ok(res == ERROR_FILE_NOT_FOUND, "64-bit component key not removed\n");
5986 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5987 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5988 0, KEY_ALL_ACCESS|KEY_WOW64_32KEY, &hkey);
5989 ok(res == ERROR_FILE_NOT_FOUND, "32-bit CLSID key not removed\n");
5991 res = RegOpenKeyExA(HKEY_CLASSES_ROOT,
5992 "CLSID\\{8dfef911-6885-41eb-b280-8f0304728e8b}",
5993 0, KEY_ALL_ACCESS|KEY_WOW64_64KEY, &hkey);
5994 ok(res == ERROR_FILE_NOT_FOUND, "64-bit CLSID key not removed\n");
5996 error:
5997 DeleteFileA( msifile );
6000 static void test_volume_props(void)
6002 UINT r;
6004 if (is_process_limited())
6006 skip("process is limited\n");
6007 return;
6009 CreateDirectoryA("msitest", NULL);
6010 create_file("msitest\\volumeprop.txt", 1000);
6011 create_database(msifile, vp_tables, ARRAY_SIZE(vp_tables));
6013 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6015 r = MsiInstallProductA(msifile, NULL);
6016 ok(r == ERROR_SUCCESS, "got %u\n", r);
6018 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6019 ok(r == ERROR_SUCCESS, "got %u\n", r);
6021 DeleteFileA("msitest\\volumeprop.txt");
6022 RemoveDirectoryA("msitest");
6023 DeleteFileA(msifile);
6026 static void test_shared_component(void)
6028 UINT r;
6030 if (is_process_limited())
6032 skip("process is limited\n");
6033 return;
6035 CreateDirectoryA("msitest", NULL);
6036 create_file("msitest\\sharedcomponent.txt", 1000);
6037 create_database_wordcount(msifile, shc_tables, ARRAY_SIZE(shc_tables),
6038 100, 0, ";", "{A8826420-FD72-4E61-9E15-C1944CF4CBE1}");
6039 create_database_wordcount(msifile2, shc2_tables, ARRAY_SIZE(shc2_tables),
6040 100, 0, ";", "{A8B50B30-0E8A-4ACD-B3CF-1A5DC58B2739}");
6042 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6044 r = MsiInstallProductA(msifile, NULL);
6045 ok(r == ERROR_SUCCESS, "got %u\n", r);
6047 ok(pf_exists("msitest\\sharedcomponent.txt"), "file not installed\n");
6049 r = MsiInstallProductA(msifile2, NULL);
6050 ok(r == ERROR_SUCCESS, "got %u\n", r);
6052 ok(pf_exists("msitest\\sharedcomponent.txt"), "file not installed\n");
6054 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6055 ok(r == ERROR_SUCCESS, "got %u\n", r);
6057 ok(pf_exists("msitest\\sharedcomponent.txt"), "file removed\n");
6059 r = MsiInstallProductA(msifile2, "REMOVE=ALL");
6060 ok(r == ERROR_SUCCESS, "got %u\n", r);
6062 ok(!pf_exists("msitest\\sharedcomponent.txt"), "file not removed\n");
6064 DeleteFileA("msitest\\sharedcomponent.txt");
6065 RemoveDirectoryA("msitest");
6066 DeleteFileA(msifile);
6067 DeleteFileA(msifile2);
6070 static void test_remove_upgrade_code(void)
6072 UINT r;
6073 LONG res;
6074 HKEY hkey;
6075 REGSAM access = KEY_ALL_ACCESS;
6076 DWORD type, size;
6077 char buf[1];
6079 if (is_process_limited())
6081 skip( "process is limited\n" );
6082 return;
6084 if (is_wow64) access |= KEY_WOW64_64KEY;
6086 create_test_files();
6087 create_database( msifile, icon_base_tables, ARRAY_SIZE( icon_base_tables ));
6089 MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
6091 r = MsiInstallProductA( msifile, "FULL=1" );
6092 ok(r == ERROR_SUCCESS, "got %u\n", r);
6094 res = RegOpenKeyExA( HKEY_LOCAL_MACHINE,
6095 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2",
6096 0, access, &hkey );
6097 ok( res == ERROR_SUCCESS, "got %d\n", res );
6099 type = 0xdeadbeef;
6100 buf[0] = 0x55;
6101 size = sizeof(buf);
6102 res = RegQueryValueExA( hkey, "94A88FD7F6998CE40A22FB59F6B9C2BB", NULL, &type, (BYTE *)buf, &size );
6103 ok( res == ERROR_SUCCESS, "got %d\n", res );
6104 ok( type == REG_SZ, "got %u\n", type );
6105 ok( size == 1, "got %u\n", size );
6106 ok( !buf[0], "wrong data\n" );
6107 RegCloseKey( hkey );
6109 r = MsiInstallProductA( msifile, "REMOVE=ALL" );
6110 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6112 res = RegOpenKeyExA( HKEY_LOCAL_MACHINE,
6113 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2",
6114 0, access, &hkey );
6115 ok( res == ERROR_FILE_NOT_FOUND, "got %d\n", res );
6117 RemoveDirectoryA( "msitest" );
6118 DeleteFileA( msifile );
6121 static void test_feature_tree(void)
6123 UINT r;
6125 if (is_process_limited())
6127 skip( "process is limited\n" );
6128 return;
6131 create_file( "msitest\\featuretree.txt", 1000 );
6132 create_database( msifile, ft_tables, ARRAY_SIZE( ft_tables ));
6134 MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
6136 r = MsiInstallProductA( msifile, "INSTALLTYPE=\"0\"" );
6137 ok( r == ERROR_INSTALL_FAILURE, "got %u\n", r );
6139 r = MsiInstallProductA( msifile, "INSTALLTYPE=\"1\"" );
6140 ok( r == ERROR_SUCCESS, "got %u\n", r );
6142 r = MsiInstallProductA( msifile, "REMOVE=ALL" );
6143 ok( r == ERROR_SUCCESS, "got %u\n", r );
6145 DeleteFileA( "msitest\\featuretree.txt" );
6146 RemoveDirectoryA( "msitest" );
6147 DeleteFileA( msifile );
6150 static void check_file_matches(const char *filename, const char *text)
6152 char buffer[200];
6153 HANDLE file;
6154 DWORD size;
6156 file = CreateFileA(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
6157 ReadFile(file, buffer, sizeof(buffer), &size, NULL);
6158 ok(size == strlen(text) && !memcmp(buffer, text, size), "got %.*s\n", size, buffer);
6159 CloseHandle(file);
6162 static void test_deferred_action(void)
6164 char path[200], file[200], buffer[211];
6165 UINT r;
6167 GetTempPathA(sizeof(path), path);
6168 GetTempFileNameA(path, "da", 0, file);
6169 sprintf(buffer, "TESTPATH=\"%s\"", file);
6171 create_database(msifile, da_tables, ARRAY_SIZE(da_tables));
6173 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6175 r = MsiInstallProductA(msifile, buffer);
6176 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6178 skip("Not enough rights to perform tests\n");
6179 goto error;
6181 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6183 check_file_matches(file, "onetwo");
6185 ok(DeleteFileA(file), "Directory not created\n");
6187 error:
6188 DeleteFileA(msifile);
6191 static void test_wow64(void)
6193 void *cookie;
6194 UINT r;
6196 if (!is_wow64)
6198 skip("test must be run on WoW64\n");
6199 return;
6202 if (is_process_limited())
6204 skip("process is limited\n");
6205 return;
6208 create_test_files();
6209 create_database_template(msifile, x64_tables, ARRAY_SIZE(x64_tables), 200, "x64;0");
6210 r = MsiInstallProductA(msifile, NULL);
6211 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6213 skip("Not enough rights to perform tests\n");
6214 goto error;
6217 pWow64DisableWow64FsRedirection(&cookie);
6219 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
6220 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
6221 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
6222 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
6223 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
6224 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
6225 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
6226 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
6227 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
6228 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
6229 ok(!delete_pf("msitest", FALSE), "Directory created\n");
6231 ok(delete_pf_native("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
6232 ok(delete_pf_native("msitest\\cabout\\new", FALSE), "Directory not created\n");
6233 ok(delete_pf_native("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
6234 ok(delete_pf_native("msitest\\cabout", FALSE), "Directory not created\n");
6235 ok(delete_pf_native("msitest\\changed\\three.txt", TRUE), "File not installed\n");
6236 ok(delete_pf_native("msitest\\changed", FALSE), "Directory not created\n");
6237 ok(delete_pf_native("msitest\\first\\two.txt", TRUE), "File not installed\n");
6238 ok(delete_pf_native("msitest\\first", FALSE), "Directory not created\n");
6239 ok(delete_pf_native("msitest\\one.txt", TRUE), "File not installed\n");
6240 ok(delete_pf_native("msitest\\filename", TRUE), "File not installed\n");
6241 ok(delete_pf_native("msitest", FALSE), "Directory not created\n");
6243 pWow64RevertWow64FsRedirection(cookie);
6245 error:
6246 delete_test_files();
6247 DeleteFileA(msifile);
6250 /* Test what actions cause resolution of SourceDir when executed. */
6251 static void test_source_resolution(void)
6253 UINT r;
6255 if (is_process_limited())
6257 skip( "process is limited\n" );
6258 return;
6261 create_test_files();
6262 create_database(msifile, sr_tables, ARRAY_SIZE(sr_tables));
6264 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6266 r = MsiInstallProductA(msifile, "RESOLVE_SOURCE=1");
6267 ok(r == ERROR_SUCCESS, "got %u\n", r);
6269 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
6270 ok(r == ERROR_SUCCESS, "got %u\n", r);
6272 r = MsiInstallProductA(msifile, "INSTALL_FILES=1");
6273 ok(r == ERROR_SUCCESS, "got %u\n", r);
6275 delete_pf_files();
6276 delete_test_files();
6277 DeleteFileA(msifile);
6280 START_TEST(install)
6282 DWORD len;
6283 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6284 STATEMGRSTATUS status;
6285 BOOL ret = FALSE;
6287 init_functionpointers();
6288 subtest("custom");
6290 if (pIsWow64Process)
6291 pIsWow64Process(GetCurrentProcess(), &is_wow64);
6293 GetCurrentDirectoryA(MAX_PATH, prev_path);
6294 GetTempPathA(MAX_PATH, temp_path);
6295 SetCurrentDirectoryA(temp_path);
6297 lstrcpyA(CURR_DIR, temp_path);
6298 len = lstrlenA(CURR_DIR);
6300 if(len && (CURR_DIR[len - 1] == '\\'))
6301 CURR_DIR[len - 1] = 0;
6303 ok(get_system_dirs(), "failed to retrieve system dirs\n");
6304 ok(get_user_dirs(), "failed to retrieve user dirs\n");
6306 /* Create a restore point ourselves so we circumvent the multitude of restore points
6307 * that would have been created by all the installation and removal tests.
6309 * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
6310 * creation of restore points.
6312 if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
6314 memset(&status, 0, sizeof(status));
6315 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
6318 /* Create only one log file and don't append. We have to pass something
6319 * for the log mode for this to work. The logfile needs to have an absolute
6320 * path otherwise we still end up with some extra logfiles as some tests
6321 * change the current directory.
6323 lstrcpyA(log_file, temp_path);
6324 lstrcatA(log_file, "\\msitest.log");
6325 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
6327 if (pSRSetRestorePointA) /* test has side-effects on win2k3 that cause failures in following tests */
6328 test_MsiInstallProduct();
6329 test_MsiSetComponentState();
6330 test_packagecoltypes();
6331 test_continuouscabs();
6332 test_caborder();
6333 test_mixedmedia();
6334 test_samesequence();
6335 test_uiLevelFlags();
6336 test_readonlyfile();
6337 test_readonlyfile_cab();
6338 test_setdirproperty();
6339 test_cabisextracted();
6340 test_transformprop();
6341 test_currentworkingdir();
6342 test_admin();
6343 test_adminprops();
6344 test_missingcab();
6345 test_sourcefolder();
6346 test_customaction1();
6347 test_customaction51();
6348 test_installstate();
6349 test_sourcepath();
6350 test_missingcomponent();
6351 test_sourcedirprop();
6352 test_adminimage();
6353 test_propcase();
6354 test_int_widths();
6355 test_shortcut();
6356 test_preselected();
6357 test_installed_prop();
6358 test_file_in_use();
6359 test_file_in_use_cab();
6360 test_allusers_prop();
6361 test_feature_override();
6362 test_icon_table();
6363 test_package_validation();
6364 test_upgrade_code();
6365 test_mixed_package();
6366 test_volume_props();
6367 test_shared_component();
6368 test_remove_upgrade_code();
6369 test_feature_tree();
6370 test_deferred_action();
6371 test_wow64();
6372 test_source_resolution();
6374 DeleteFileA(customdll);
6376 DeleteFileA(log_file);
6378 if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
6380 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
6381 if (ret)
6382 remove_restore_point(status.llSequenceNumber);
6385 SetCurrentDirectoryA(prev_path);