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
32 #include <srrestoreptapi.h>
34 #include "wine/test.h"
36 static UINT (WINAPI *pMsiQueryComponentStateA)
37 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*);
38 static UINT (WINAPI *pMsiSetExternalUIRecord)
39 (INSTALLUI_HANDLER_RECORD, DWORD, LPVOID, PINSTALLUI_HANDLER_RECORD);
40 static UINT (WINAPI *pMsiSourceListEnumSourcesA)
41 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
42 static UINT (WINAPI *pMsiSourceListGetInfoA)
43 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD);
45 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
47 static HMODULE hsrclient = 0;
48 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
49 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
51 static BOOL on_win9x = FALSE;
53 static const char *msifile = "msitest.msi";
54 static const char *msifile2 = "winetest2.msi";
55 static const char *mstfile = "winetest.mst";
56 static CHAR CURR_DIR[MAX_PATH];
57 static CHAR PROG_FILES_DIR[MAX_PATH];
58 static CHAR COMMON_FILES_DIR[MAX_PATH];
60 /* msi database data */
62 static const CHAR component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
63 "s72\tS38\ts72\ti2\tS255\tS72\n"
64 "Component\tComponent\n"
65 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
66 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
67 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n"
68 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
69 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
70 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
71 "component\t\tMSITESTDIR\t0\t1\tfile\n"
72 "service_comp\t\tMSITESTDIR\t0\t1\tservice_file";
74 static const CHAR directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
76 "Directory\tDirectory\n"
77 "CABOUTDIR\tMSITESTDIR\tcabout\n"
78 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
79 "FIRSTDIR\tMSITESTDIR\tfirst\n"
80 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
81 "NEWDIR\tCABOUTDIR\tnew\n"
82 "ProgramFilesFolder\tTARGETDIR\t.\n"
83 "TARGETDIR\t\tSourceDir";
85 static const CHAR feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
86 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
88 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
89 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
90 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
91 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
92 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
93 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
94 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
96 static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
98 "FeatureComponents\tFeature_\tComponent_\n"
104 "feature\tcomponent\n"
105 "service_feature\tservice_comp\n";
107 static const CHAR file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
108 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
110 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
111 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
112 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
113 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
114 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
115 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
116 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
118 static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
120 "InstallExecuteSequence\tAction\n"
121 "AllocateRegistrySpace\tNOT Installed\t1550\n"
122 "CostFinalize\t\t1000\n"
123 "CostInitialize\t\t800\n"
125 "ResolveSource\t\t950\n"
126 "MoveFiles\t\t1700\n"
127 "InstallFiles\t\t4000\n"
128 "DuplicateFiles\t\t4500\n"
129 "WriteEnvironmentStrings\t\t4550\n"
130 "CreateShortcuts\t\t4600\n"
131 "InstallServices\t\t5000\n"
132 "InstallFinalize\t\t6600\n"
133 "InstallInitialize\t\t1500\n"
134 "InstallValidate\t\t1400\n"
135 "LaunchConditions\t\t100\n"
136 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
138 static const CHAR media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
139 "i2\ti4\tL64\tS255\tS32\tS72\n"
141 "1\t3\t\t\tDISK1\t\n"
142 "2\t5\t\tmsitest.cab\tDISK2\t\n";
144 static const CHAR property_dat[] = "Property\tValue\n"
146 "Property\tProperty\n"
147 "DefaultUIFont\tDlgFont8\n"
150 "InstallMode\tTypical\n"
151 "Manufacturer\tWine\n"
152 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
153 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
155 "ProductLanguage\t1033\n"
156 "ProductName\tMSITEST\n"
157 "ProductVersion\t1.1.1\n"
158 "PROMPTROLLBACKCOST\tP\n"
160 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
161 "AdminProperties\tPOSTADMIN\n"
163 "SERVNAME\tTestService\n"
164 "SERVDISP\tTestServiceDisp\n";
166 static const CHAR shortcut_dat[] = "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
167 "s72\ts72\tl128\ts72\ts72\tS255\tL255\tI2\tS72\tI2\tI2\tS72\n"
168 "Shortcut\tShortcut\n"
169 "Shortcut\tMSITESTDIR\tShortcut\tcomponent\tShortcut\t\tShortcut\t\t\t\t\t\n";
171 static const CHAR environment_dat[] = "Environment\tName\tValue\tComponent_\n"
172 "s72\tl255\tL255\ts72\n"
173 "Environment\tEnvironment\n"
174 "Var1\t=-MSITESTVAR1\t1\tOne\n"
175 "Var2\tMSITESTVAR2\t1\tOne\n"
176 "Var3\t=-MSITESTVAR3\t1\tOne\n"
177 "Var4\tMSITESTVAR4\t1\tOne\n";
179 static const CHAR condition_dat[] = "Feature_\tLevel\tCondition\n"
181 "Condition\tFeature_\tLevel\n"
184 static const CHAR up_property_dat[] = "Property\tValue\n"
186 "Property\tProperty\n"
187 "DefaultUIFont\tDlgFont8\n"
190 "InstallMode\tTypical\n"
191 "Manufacturer\tWine\n"
192 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
193 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
195 "ProductLanguage\t1033\n"
196 "ProductName\tMSITEST\n"
197 "ProductVersion\t1.1.1\n"
198 "PROMPTROLLBACKCOST\tP\n"
200 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
201 "AdminProperties\tPOSTADMIN\n"
203 "SERVNAME\tTestService\n"
204 "SERVDISP\tTestServiceDisp\n"
205 "RemovePreviousVersions\t1\n";
207 static const CHAR up2_property_dat[] = "Property\tValue\n"
209 "Property\tProperty\n"
210 "DefaultUIFont\tDlgFont8\n"
213 "InstallMode\tTypical\n"
214 "Manufacturer\tWine\n"
215 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
216 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
218 "ProductLanguage\t1033\n"
219 "ProductName\tMSITEST\n"
220 "ProductVersion\t1.1.2\n"
221 "PROMPTROLLBACKCOST\tP\n"
223 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
224 "AdminProperties\tPOSTADMIN\n"
226 "SERVNAME\tTestService\n"
227 "SERVDISP\tTestServiceDisp\n";
229 static const CHAR up3_property_dat[] = "Property\tValue\n"
231 "Property\tProperty\n"
232 "DefaultUIFont\tDlgFont8\n"
235 "InstallMode\tTypical\n"
236 "Manufacturer\tWine\n"
237 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
238 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
240 "ProductLanguage\t1033\n"
241 "ProductName\tMSITEST\n"
242 "ProductVersion\t1.1.2\n"
243 "PROMPTROLLBACKCOST\tP\n"
245 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
246 "AdminProperties\tPOSTADMIN\n"
248 "SERVNAME\tTestService\n"
249 "SERVDISP\tTestServiceDisp\n"
250 "RemovePreviousVersions\t1\n";
252 static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
253 "s72\ti2\tl255\tL255\tL0\ts72\n"
254 "Registry\tRegistry\n"
255 "Apples\t2\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
256 "Oranges\t2\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
257 "regdata\t2\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
258 "OrderTest\t2\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
260 static const CHAR service_install_dat[] = "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
261 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
262 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
263 "ServiceInstall\tServiceInstall\n"
264 "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\t";
266 static const CHAR service_control_dat[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
267 "s72\tl255\ti2\tL255\tI2\ts72\n"
268 "ServiceControl\tServiceControl\n"
269 "ServiceControl\tTestService\t8\t\t0\tservice_comp";
271 /* tables for test_continuouscabs */
272 static const CHAR cc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
273 "s72\tS38\ts72\ti2\tS255\tS72\n"
274 "Component\tComponent\n"
275 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
276 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
277 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
279 static const CHAR cc2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
280 "s72\tS38\ts72\ti2\tS255\tS72\n"
281 "Component\tComponent\n"
282 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
283 "augustus\t\tMSITESTDIR\t0\t0\taugustus\n"
284 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
286 static const CHAR cc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
287 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
289 "feature\t\t\t\t2\t1\tTARGETDIR\t0";
291 static const CHAR cc_feature_comp_dat[] = "Feature_\tComponent_\n"
293 "FeatureComponents\tFeature_\tComponent_\n"
295 "feature\taugustus\n"
298 static const CHAR cc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
299 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
301 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
302 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
303 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
305 static const CHAR cc2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
306 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
308 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
309 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
310 "tiberius\tmaximus\ttiberius\t500\t\t\t16384\t3\n"
311 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
313 static const CHAR cc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
314 "i2\ti4\tL64\tS255\tS32\tS72\n"
316 "1\t10\t\ttest1.cab\tDISK1\t\n"
317 "2\t2\t\ttest2.cab\tDISK2\t\n"
318 "3\t12\t\ttest3.cab\tDISK3\t\n";
320 static const CHAR co_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
321 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
323 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
324 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
325 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
327 static const CHAR co_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
328 "i2\ti4\tL64\tS255\tS32\tS72\n"
330 "1\t10\t\ttest1.cab\tDISK1\t\n"
331 "2\t2\t\ttest2.cab\tDISK2\t\n"
332 "3\t3\t\ttest3.cab\tDISK3\t\n";
334 static const CHAR co2_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
335 "i2\ti4\tL64\tS255\tS32\tS72\n"
337 "1\t10\t\ttest1.cab\tDISK1\t\n"
338 "2\t12\t\ttest3.cab\tDISK3\t\n"
339 "3\t2\t\ttest2.cab\tDISK2\t\n";
341 static const CHAR mm_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
342 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
344 "maximus\tmaximus\tmaximus\t500\t\t\t512\t1\n"
345 "augustus\taugustus\taugustus\t500\t\t\t512\t2\n"
346 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
348 static const CHAR mm_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
349 "i2\ti4\tL64\tS255\tS32\tS72\n"
351 "1\t3\t\ttest1.cab\tDISK1\t\n";
353 static const CHAR ss_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
354 "i2\ti4\tL64\tS255\tS32\tS72\n"
356 "1\t2\t\ttest1.cab\tDISK1\t\n"
357 "2\t2\t\ttest2.cab\tDISK2\t\n"
358 "3\t12\t\ttest3.cab\tDISK3\t\n";
360 /* tables for test_uiLevelFlags */
361 static const CHAR ui_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
362 "s72\tS38\ts72\ti2\tS255\tS72\n"
363 "Component\tComponent\n"
364 "maximus\t\tMSITESTDIR\t0\tHASUIRUN=1\tmaximus\n"
365 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
366 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
368 static const CHAR ui_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
370 "InstallUISequence\tAction\n"
371 "SetUIProperty\t\t5\n"
372 "ExecuteAction\t\t1100\n";
374 static const CHAR ui_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
375 "s72\ti2\tS64\tS0\tS255\n"
376 "CustomAction\tAction\n"
377 "SetUIProperty\t51\tHASUIRUN\t1\t\n";
379 static const CHAR rof_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
380 "s72\tS38\ts72\ti2\tS255\tS72\n"
381 "Component\tComponent\n"
382 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
384 static const CHAR rof_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
385 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
387 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
388 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
390 static const CHAR rof_feature_comp_dat[] = "Feature_\tComponent_\n"
392 "FeatureComponents\tFeature_\tComponent_\n"
394 "montecristo\tmaximus";
396 static const CHAR rof_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
397 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
399 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
401 static const CHAR rof_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
402 "i2\ti4\tL64\tS255\tS32\tS72\n"
404 "1\t1\t\t\tDISK1\t\n";
406 static const CHAR rofc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
407 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
409 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1";
411 static const CHAR rofc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
412 "i2\ti4\tL64\tS255\tS32\tS72\n"
414 "1\t1\t\ttest1.cab\tDISK1\t\n";
416 static const CHAR lus2_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
417 "i2\ti4\tL64\tS255\tS32\tS72\n"
419 "1\t1\t\t#test1.cab\tDISK1\t\n";
421 static const CHAR sdp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
423 "InstallExecuteSequence\tAction\n"
424 "AllocateRegistrySpace\tNOT Installed\t1550\n"
425 "CostFinalize\t\t1000\n"
426 "CostInitialize\t\t800\n"
428 "InstallFiles\t\t4000\n"
429 "InstallFinalize\t\t6600\n"
430 "InstallInitialize\t\t1500\n"
431 "InstallValidate\t\t1400\n"
432 "LaunchConditions\t\t100\n"
433 "SetDirProperty\t\t950";
435 static const CHAR sdp_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
436 "s72\ti2\tS64\tS0\tS255\n"
437 "CustomAction\tAction\n"
438 "SetDirProperty\t51\tMSITESTDIR\t[CommonFilesFolder]msitest\\\t\n";
440 static const CHAR cie_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
441 "s72\tS38\ts72\ti2\tS255\tS72\n"
442 "Component\tComponent\n"
443 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
444 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
445 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
446 "gaius\t\tMSITESTDIR\t0\t1\tgaius\n";
448 static const CHAR cie_feature_comp_dat[] = "Feature_\tComponent_\n"
450 "FeatureComponents\tFeature_\tComponent_\n"
452 "feature\taugustus\n"
456 static const CHAR cie_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
457 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
459 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
460 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
461 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12\n"
462 "gaius\tgaius\tgaius\t500\t\t\t8192\t11";
464 static const CHAR cie_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
465 "i2\ti4\tL64\tS255\tS32\tS72\n"
467 "1\t1\t\ttest1.cab\tDISK1\t\n"
468 "2\t2\t\ttest2.cab\tDISK2\t\n"
469 "3\t12\t\ttest3.cab\tDISK3\t\n";
471 static const CHAR ci_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
473 "InstallExecuteSequence\tAction\n"
474 "CostFinalize\t\t1000\n"
475 "CostInitialize\t\t800\n"
477 "InstallFiles\t\t4000\n"
478 "InstallServices\t\t5000\n"
479 "InstallFinalize\t\t6600\n"
480 "InstallInitialize\t\t1500\n"
481 "RunInstall\t\t1600\n"
482 "InstallValidate\t\t1400\n"
483 "LaunchConditions\t\t100";
485 static const CHAR ci_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
486 "s72\ti2\tS64\tS0\tS255\n"
487 "CustomAction\tAction\n"
488 "RunInstall\t87\tmsitest\\concurrent.msi\tMYPROP=[UILevel]\t\n";
490 static const CHAR ci_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
491 "s72\tS38\ts72\ti2\tS255\tS72\n"
492 "Component\tComponent\n"
493 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n";
495 static const CHAR ci2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
496 "s72\tS38\ts72\ti2\tS255\tS72\n"
497 "Component\tComponent\n"
498 "augustus\t\tMSITESTDIR\t0\tUILevel=3 AND MYPROP=5\taugustus\n";
500 static const CHAR ci2_feature_comp_dat[] = "Feature_\tComponent_\n"
502 "FeatureComponents\tFeature_\tComponent_\n"
505 static const CHAR ci2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
506 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
508 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
510 static const CHAR spf_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
511 "s72\ti2\tS64\tS0\tS255\n"
512 "CustomAction\tAction\n"
513 "SetFolderProp\t51\tMSITESTDIR\t[ProgramFilesFolder]\\msitest\\added\t\n";
515 static const CHAR spf_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
517 "InstallExecuteSequence\tAction\n"
518 "CostFinalize\t\t1000\n"
519 "CostInitialize\t\t800\n"
521 "SetFolderProp\t\t950\n"
522 "InstallFiles\t\t4000\n"
523 "InstallServices\t\t5000\n"
524 "InstallFinalize\t\t6600\n"
525 "InstallInitialize\t\t1500\n"
526 "InstallValidate\t\t1400\n"
527 "LaunchConditions\t\t100";
529 static const CHAR spf_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
531 "InstallUISequence\tAction\n"
532 "CostInitialize\t\t800\n"
534 "CostFinalize\t\t1000\n"
535 "ExecuteAction\t\t1100\n";
537 static const CHAR pp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
539 "InstallExecuteSequence\tAction\n"
540 "ValidateProductID\t\t700\n"
541 "CostInitialize\t\t800\n"
543 "CostFinalize\t\t1000\n"
544 "InstallValidate\t\t1400\n"
545 "InstallInitialize\t\t1500\n"
546 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
547 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
548 "RemoveFiles\t\t3500\n"
549 "InstallFiles\t\t4000\n"
550 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
551 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
552 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
553 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
554 "InstallFinalize\t\t6600";
556 static const CHAR ppc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
557 "s72\tS38\ts72\ti2\tS255\tS72\n"
558 "Component\tComponent\n"
559 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n"
560 "augustus\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\taugustus\n";
562 static const CHAR ppc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
563 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
565 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1\n"
566 "augustus\taugustus\taugustus\t500\t\t\t8192\t2";
568 static const CHAR ppc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
569 "i2\ti4\tL64\tS255\tS32\tS72\n"
571 "1\t2\t\t\tDISK1\t\n";
573 static const CHAR ppc_feature_comp_dat[] = "Feature_\tComponent_\n"
575 "FeatureComponents\tFeature_\tComponent_\n"
577 "feature\taugustus\n"
578 "montecristo\tmaximus";
580 static const CHAR tp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
581 "s72\tS38\ts72\ti2\tS255\tS72\n"
582 "Component\tComponent\n"
583 "augustus\t\tMSITESTDIR\t0\tprop=\"val\"\taugustus\n";
585 static const CHAR cwd_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
586 "s72\tS38\ts72\ti2\tS255\tS72\n"
587 "Component\tComponent\n"
588 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
590 static const CHAR adm_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
591 "s72\tS38\ts72\ti2\tS255\tS72\n"
592 "Component\tComponent\n"
593 "augustus\t\tMSITESTDIR\t0\tPOSTADMIN=1\taugustus";
595 static const CHAR adm_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
596 "s72\ti2\tS64\tS0\tS255\n"
597 "CustomAction\tAction\n"
598 "SetPOSTADMIN\t51\tPOSTADMIN\t1\t\n";
600 static const CHAR adm_admin_exec_seq_dat[] = "Action\tCondition\tSequence\n"
602 "AdminExecuteSequence\tAction\n"
603 "CostFinalize\t\t1000\n"
604 "CostInitialize\t\t800\n"
606 "SetPOSTADMIN\t\t950\n"
607 "InstallFiles\t\t4000\n"
608 "InstallFinalize\t\t6600\n"
609 "InstallInitialize\t\t1500\n"
610 "InstallValidate\t\t1400\n"
611 "LaunchConditions\t\t100";
613 static const CHAR amp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
614 "s72\tS38\ts72\ti2\tS255\tS72\n"
615 "Component\tComponent\n"
616 "augustus\t\tMSITESTDIR\t0\tMYPROP=2718 and MyProp=42\taugustus\n";
618 static const CHAR rem_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
619 "s72\tS38\ts72\ti2\tS255\tS72\n"
620 "Component\tComponent\n"
621 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t0\t\thydrogen\n"
622 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\thelium\n"
623 "lithium\t\tMSITESTDIR\t2\t\tlithium\n";
625 static const CHAR rem_feature_comp_dat[] = "Feature_\tComponent_\n"
627 "FeatureComponents\tFeature_\tComponent_\n"
628 "feature\thydrogen\n"
632 static const CHAR rem_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
633 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
635 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
636 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
637 "lithium\tlithium\tlithium\t0\t\t\t8192\t1";
639 static const CHAR rem_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
641 "InstallExecuteSequence\tAction\n"
642 "ValidateProductID\t\t700\n"
643 "CostInitialize\t\t800\n"
645 "CostFinalize\t\t1000\n"
646 "InstallValidate\t\t1400\n"
647 "InstallInitialize\t\t1500\n"
648 "ProcessComponents\t\t1600\n"
649 "UnpublishFeatures\t\t1800\n"
650 "RemoveFiles\t\t3500\n"
651 "InstallFiles\t\t4000\n"
652 "RegisterProduct\t\t6100\n"
653 "PublishFeatures\t\t6300\n"
654 "PublishProduct\t\t6400\n"
655 "InstallFinalize\t\t6600";
657 static const CHAR rem_remove_files_dat[] = "FileKey\tComponent_\tFileName\tDirProperty\tInstallMode\n"
658 "s72\ts72\tS255\ts72\tI2\n"
659 "RemoveFile\tFileKey\n"
660 "furlong\thydrogen\tfurlong\tMSITESTDIR\t1\n"
661 "firkin\thelium\tfirkin\tMSITESTDIR\t1\n"
662 "fortnight\tlithium\tfortnight\tMSITESTDIR\t1\n"
663 "becquerel\thydrogen\tbecquerel\tMSITESTDIR\t2\n"
664 "dioptre\thelium\tdioptre\tMSITESTDIR\t2\n"
665 "attoparsec\tlithium\tattoparsec\tMSITESTDIR\t2\n"
666 "storeys\thydrogen\tstoreys\tMSITESTDIR\t3\n"
667 "block\thelium\tblock\tMSITESTDIR\t3\n"
668 "siriometer\tlithium\tsiriometer\tMSITESTDIR\t3\n"
669 "nanoacre\thydrogen\t\tCABOUTDIR\t3\n";
671 static const CHAR mov_move_file_dat[] = "FileKey\tComponent_\tSourceName\tDestName\tSourceFolder\tDestFolder\tOptions\n"
672 "s72\ts72\tS255\tS255\tS72\ts72\ti2\n"
673 "MoveFile\tFileKey\n"
674 "abkhazia\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t0\n"
675 "bahamas\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t1\n"
676 "cambodia\taugustus\tcameroon\tcanada\tSourceDir\tMSITESTDIR\t0\n"
677 "denmark\taugustus\tdjibouti\tdominica\tSourceDir\tMSITESTDIR\t1\n"
678 "ecuador\taugustus\tegypt\telsalvador\tNotAProp\tMSITESTDIR\t1\n"
679 "fiji\taugustus\tfinland\tfrance\tSourceDir\tNotAProp\t1\n"
680 "gabon\taugustus\tgambia\tgeorgia\tSOURCEFULL\tMSITESTDIR\t1\n"
681 "haiti\taugustus\thonduras\thungary\tSourceDir\tDESTFULL\t1\n"
682 "iceland\taugustus\tindia\tindonesia\tMSITESTDIR\tMSITESTDIR\t1\n"
683 "jamaica\taugustus\tjapan\tjordan\tFILEPATHBAD\tMSITESTDIR\t1\n"
684 "kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n"
685 "laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n"
686 "namibia\taugustus\tnauru\tkiribati\tSourceDir\tMSITESTDIR\t1\n"
687 "pakistan\taugustus\tperu\tsfn|poland\tSourceDir\tMSITESTDIR\t1\n"
688 "wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
689 "single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
690 "wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
691 "singlenodest\taugustus\tb?r\t\tSourceDir\tMSITESTDIR\t1\n";
693 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
694 "s72\tS38\ts72\ti2\tS255\tS72\n"
695 "Component\tComponent\n"
696 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
697 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
698 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
699 "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n";
701 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
702 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
704 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
705 "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
706 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
707 "gaius\tgaius\tgaius\t500\t\t\t16384\t4";
709 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
710 "i2\ti4\tL64\tS255\tS32\tS72\n"
712 "1\t1\t\ttest1.cab\tDISK1\t\n"
713 "2\t2\t\ttest2.cab\tDISK2\t\n"
714 "3\t3\t\ttest3.cab\tDISK3\t\n"
715 "4\t4\t\ttest3.cab\tDISK3\t\n";
717 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
718 "s72\ti2\ti4\ti4\ti4\ti4\n"
719 "MsiFileHash\tFile_\n"
720 "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
722 static const CHAR df_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
724 "Directory\tDirectory\n"
725 "THIS\tMSITESTDIR\tthis\n"
726 "DOESNOT\tTHIS\tdoesnot\n"
727 "NONEXISTENT\tDOESNOT\texist\n"
728 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
729 "ProgramFilesFolder\tTARGETDIR\t.\n"
730 "TARGETDIR\t\tSourceDir";
732 static const CHAR df_duplicate_file_dat[] = "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
733 "s72\ts72\ts72\tS255\tS72\n"
734 "DuplicateFile\tFileKey\n"
735 "maximus\tmaximus\tmaximus\taugustus\t\n"
736 "caesar\tmaximus\tmaximus\t\tNONEXISTENT\n";
738 static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
739 "s72\tS38\ts72\ti2\tS255\tS72\n"
740 "Component\tComponent\n"
741 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
743 static const CHAR wrv_registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
744 "s72\ti2\tl255\tL255\tL0\ts72\n"
745 "Registry\tRegistry\n"
746 "regdata\t2\tSOFTWARE\\Wine\\msitest\tValue\t[~]one[~]two[~]three\taugustus";
748 static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
749 "s72\tS38\ts72\ti2\tS255\tS72\n"
750 "Component\tComponent\n"
751 "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
753 static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
755 "InstallExecuteSequence\tAction\n"
756 "ValidateProductID\t\t700\n"
757 "GoodSetProperty\t\t725\n"
758 "BadSetProperty\t\t750\n"
759 "CostInitialize\t\t800\n"
760 "ResolveSource\t\t810\n"
762 "SetSourceDir\tSRCDIR\t910\n"
763 "CostFinalize\t\t1000\n"
764 "InstallValidate\t\t1400\n"
765 "InstallInitialize\t\t1500\n"
766 "InstallFiles\t\t4000\n"
767 "InstallFinalize\t\t6600";
769 static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
771 "CustomAction\tAction\n"
772 "GoodSetProperty\t51\tMYPROP\t42\n"
773 "BadSetProperty\t51\t\tMYPROP\n"
774 "SetSourceDir\t51\tSourceDir\t[SRCDIR]\n";
776 static const CHAR is_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
777 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
779 "one\t\t\t\t2\t1\t\t0\n" /* favorLocal */
780 "two\t\t\t\t2\t1\t\t1\n" /* favorSource */
781 "three\t\t\t\t2\t1\t\t4\n" /* favorAdvertise */
782 "four\t\t\t\t2\t0\t\t0"; /* disabled */
784 static const CHAR is_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
785 "s72\tS38\ts72\ti2\tS255\tS72\n"
786 "Component\tComponent\n"
787 "alpha\t\tMSITESTDIR\t0\t\talpha_file\n" /* favorLocal:Local */
788 "beta\t\tMSITESTDIR\t1\t\tbeta_file\n" /* favorLocal:Source */
789 "gamma\t\tMSITESTDIR\t2\t\tgamma_file\n" /* favorLocal:Optional */
790 "theta\t\tMSITESTDIR\t0\t\ttheta_file\n" /* favorSource:Local */
791 "delta\t\tMSITESTDIR\t1\t\tdelta_file\n" /* favorSource:Source */
792 "epsilon\t\tMSITESTDIR\t2\t\tepsilon_file\n" /* favorSource:Optional */
793 "zeta\t\tMSITESTDIR\t0\t\tzeta_file\n" /* favorAdvertise:Local */
794 "iota\t\tMSITESTDIR\t1\t\tiota_file\n" /* favorAdvertise:Source */
795 "eta\t\tMSITESTDIR\t2\t\teta_file\n" /* favorAdvertise:Optional */
796 "kappa\t\tMSITESTDIR\t0\t\tkappa_file\n" /* disabled:Local */
797 "lambda\t\tMSITESTDIR\t1\t\tlambda_file\n" /* disabled:Source */
798 "mu\t\tMSITESTDIR\t2\t\tmu_file\n"; /* disabled:Optional */
800 static const CHAR is_feature_comp_dat[] = "Feature_\tComponent_\n"
802 "FeatureComponents\tFeature_\tComponent_\n"
816 static const CHAR is_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
817 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
819 "alpha_file\talpha\talpha\t500\t\t\t8192\t1\n"
820 "beta_file\tbeta\tbeta\t500\t\t\t8291\t2\n"
821 "gamma_file\tgamma\tgamma\t500\t\t\t8192\t3\n"
822 "theta_file\ttheta\ttheta\t500\t\t\t8192\t4\n"
823 "delta_file\tdelta\tdelta\t500\t\t\t8192\t5\n"
824 "epsilon_file\tepsilon\tepsilon\t500\t\t\t8192\t6\n"
825 "zeta_file\tzeta\tzeta\t500\t\t\t8192\t7\n"
826 "iota_file\tiota\tiota\t500\t\t\t8192\t8\n"
827 "eta_file\teta\teta\t500\t\t\t8192\t9\n"
828 "kappa_file\tkappa\tkappa\t500\t\t\t8192\t10\n"
829 "lambda_file\tlambda\tlambda\t500\t\t\t8192\t11\n"
830 "mu_file\tmu\tmu\t500\t\t\t8192\t12";
832 static const CHAR is_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
833 "i2\ti4\tL64\tS255\tS32\tS72\n"
835 "1\t12\t\t\tDISK1\t\n";
837 static const CHAR sp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
838 "s72\tS38\ts72\ti2\tS255\tS72\n"
839 "Component\tComponent\n"
840 "augustus\t\tTWODIR\t0\t\taugustus\n";
842 static const CHAR sp_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
844 "Directory\tDirectory\n"
845 "TARGETDIR\t\tSourceDir\n"
846 "ProgramFilesFolder\tTARGETDIR\t.\n"
847 "MSITESTDIR\tProgramFilesFolder\tmsitest:.\n"
848 "ONEDIR\tMSITESTDIR\t.:shortone|longone\n"
849 "TWODIR\tONEDIR\t.:shorttwo|longtwo";
851 static const CHAR mcp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
852 "s72\tS38\ts72\ti2\tS255\tS72\n"
853 "Component\tComponent\n"
854 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t2\t\thydrogen\n"
855 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t2\t\thelium\n"
856 "lithium\t{4AF28FFC-71C7-4307-BDE4-B77C5338F56F}\tMSITESTDIR\t2\tPROPVAR=42\tlithium\n";
858 static const CHAR mcp_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
859 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
861 "hydroxyl\t\thydroxyl\thydroxyl\t2\t1\tTARGETDIR\t0\n"
862 "heliox\t\theliox\theliox\t2\t5\tTARGETDIR\t0\n"
863 "lithia\t\tlithia\tlithia\t2\t10\tTARGETDIR\t0";
865 static const CHAR mcp_feature_comp_dat[] = "Feature_\tComponent_\n"
867 "FeatureComponents\tFeature_\tComponent_\n"
868 "hydroxyl\thydrogen\n"
872 static const CHAR mcomp_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
873 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
875 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
876 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
877 "lithium\tlithium\tlithium\t0\t\t\t8192\t1\n"
878 "beryllium\tmissingcomp\tberyllium\t0\t\t\t8192\t1";
880 static const CHAR ai_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
881 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
883 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
884 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
885 "one.txt\tOne\tone.txt\t1000\t\t\t16384\t1\n"
886 "three.txt\tThree\tthree.txt\t1000\t\t\t16384\t3\n"
887 "two.txt\tTwo\ttwo.txt\t1000\t\t\t16384\t2\n"
888 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
889 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
891 static const CHAR ip_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
893 "InstallExecuteSequence\tAction\n"
894 "CostFinalize\t\t1000\n"
895 "ValidateProductID\t\t700\n"
896 "CostInitialize\t\t800\n"
898 "RemoveFiles\t\t3500\n"
899 "InstallFiles\t\t4000\n"
900 "RegisterUser\t\t6000\n"
901 "RegisterProduct\t\t6100\n"
902 "PublishFeatures\t\t6300\n"
903 "PublishProduct\t\t6400\n"
904 "InstallFinalize\t\t6600\n"
905 "InstallInitialize\t\t1500\n"
906 "ProcessComponents\t\t1600\n"
907 "UnpublishFeatures\t\t1800\n"
908 "InstallValidate\t\t1400\n"
909 "LaunchConditions\t\t100\n"
910 "TestInstalledProp\tInstalled AND NOT REMOVE\t950\n";
912 static const CHAR ip_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
913 "s72\ti2\tS64\tS0\tS255\n"
914 "CustomAction\tAction\n"
915 "TestInstalledProp\t19\t\tTest failed\t\n";
917 typedef struct _msi_table
919 const CHAR *filename;
924 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
926 static const msi_table tables[] =
928 ADD_TABLE(component),
929 ADD_TABLE(directory),
931 ADD_TABLE(feature_comp),
933 ADD_TABLE(install_exec_seq),
937 ADD_TABLE(service_install),
938 ADD_TABLE(service_control)
941 static const msi_table sc_tables[] =
943 ADD_TABLE(component),
944 ADD_TABLE(directory),
946 ADD_TABLE(feature_comp),
948 ADD_TABLE(install_exec_seq),
954 static const msi_table ps_tables[] =
956 ADD_TABLE(component),
957 ADD_TABLE(directory),
959 ADD_TABLE(feature_comp),
961 ADD_TABLE(install_exec_seq),
967 static const msi_table env_tables[] =
969 ADD_TABLE(component),
970 ADD_TABLE(directory),
972 ADD_TABLE(feature_comp),
974 ADD_TABLE(install_exec_seq),
977 ADD_TABLE(environment)
980 static const msi_table up_tables[] =
982 ADD_TABLE(component),
983 ADD_TABLE(directory),
985 ADD_TABLE(feature_comp),
987 ADD_TABLE(install_exec_seq),
989 ADD_TABLE(up_property),
991 ADD_TABLE(service_install),
992 ADD_TABLE(service_control)
995 static const msi_table up2_tables[] =
997 ADD_TABLE(component),
998 ADD_TABLE(directory),
1000 ADD_TABLE(feature_comp),
1002 ADD_TABLE(install_exec_seq),
1004 ADD_TABLE(up2_property),
1005 ADD_TABLE(registry),
1006 ADD_TABLE(service_install),
1007 ADD_TABLE(service_control)
1010 static const msi_table up3_tables[] =
1012 ADD_TABLE(component),
1013 ADD_TABLE(directory),
1015 ADD_TABLE(feature_comp),
1017 ADD_TABLE(install_exec_seq),
1019 ADD_TABLE(up3_property),
1020 ADD_TABLE(registry),
1021 ADD_TABLE(service_install),
1022 ADD_TABLE(service_control)
1025 static const msi_table up4_tables[] =
1027 ADD_TABLE(component),
1028 ADD_TABLE(directory),
1030 ADD_TABLE(feature_comp),
1032 ADD_TABLE(pp_install_exec_seq),
1034 ADD_TABLE(property),
1035 ADD_TABLE(registry),
1036 ADD_TABLE(service_install),
1037 ADD_TABLE(service_control)
1040 static const msi_table up5_tables[] =
1042 ADD_TABLE(component),
1043 ADD_TABLE(directory),
1045 ADD_TABLE(feature_comp),
1047 ADD_TABLE(pp_install_exec_seq),
1049 ADD_TABLE(up_property),
1050 ADD_TABLE(registry),
1051 ADD_TABLE(service_install),
1052 ADD_TABLE(service_control)
1055 static const msi_table up6_tables[] =
1057 ADD_TABLE(component),
1058 ADD_TABLE(directory),
1060 ADD_TABLE(feature_comp),
1062 ADD_TABLE(pp_install_exec_seq),
1064 ADD_TABLE(up2_property),
1065 ADD_TABLE(registry),
1066 ADD_TABLE(service_install),
1067 ADD_TABLE(service_control)
1070 static const msi_table up7_tables[] =
1072 ADD_TABLE(component),
1073 ADD_TABLE(directory),
1075 ADD_TABLE(feature_comp),
1077 ADD_TABLE(pp_install_exec_seq),
1079 ADD_TABLE(up3_property),
1080 ADD_TABLE(registry),
1081 ADD_TABLE(service_install),
1082 ADD_TABLE(service_control)
1085 static const msi_table cc_tables[] =
1087 ADD_TABLE(cc_component),
1088 ADD_TABLE(directory),
1089 ADD_TABLE(cc_feature),
1090 ADD_TABLE(cc_feature_comp),
1092 ADD_TABLE(install_exec_seq),
1093 ADD_TABLE(cc_media),
1094 ADD_TABLE(property),
1097 static const msi_table cc2_tables[] =
1099 ADD_TABLE(cc2_component),
1100 ADD_TABLE(directory),
1101 ADD_TABLE(cc_feature),
1102 ADD_TABLE(cc_feature_comp),
1103 ADD_TABLE(cc2_file),
1104 ADD_TABLE(install_exec_seq),
1105 ADD_TABLE(cc_media),
1106 ADD_TABLE(property),
1109 static const msi_table co_tables[] =
1111 ADD_TABLE(cc_component),
1112 ADD_TABLE(directory),
1113 ADD_TABLE(cc_feature),
1114 ADD_TABLE(cc_feature_comp),
1116 ADD_TABLE(install_exec_seq),
1117 ADD_TABLE(co_media),
1118 ADD_TABLE(property),
1121 static const msi_table co2_tables[] =
1123 ADD_TABLE(cc_component),
1124 ADD_TABLE(directory),
1125 ADD_TABLE(cc_feature),
1126 ADD_TABLE(cc_feature_comp),
1128 ADD_TABLE(install_exec_seq),
1129 ADD_TABLE(co2_media),
1130 ADD_TABLE(property),
1133 static const msi_table mm_tables[] =
1135 ADD_TABLE(cc_component),
1136 ADD_TABLE(directory),
1137 ADD_TABLE(cc_feature),
1138 ADD_TABLE(cc_feature_comp),
1140 ADD_TABLE(install_exec_seq),
1141 ADD_TABLE(mm_media),
1142 ADD_TABLE(property),
1145 static const msi_table ss_tables[] =
1147 ADD_TABLE(cc_component),
1148 ADD_TABLE(directory),
1149 ADD_TABLE(cc_feature),
1150 ADD_TABLE(cc_feature_comp),
1152 ADD_TABLE(install_exec_seq),
1153 ADD_TABLE(ss_media),
1154 ADD_TABLE(property),
1157 static const msi_table ui_tables[] =
1159 ADD_TABLE(ui_component),
1160 ADD_TABLE(directory),
1161 ADD_TABLE(cc_feature),
1162 ADD_TABLE(cc_feature_comp),
1164 ADD_TABLE(install_exec_seq),
1165 ADD_TABLE(ui_install_ui_seq),
1166 ADD_TABLE(ui_custom_action),
1167 ADD_TABLE(cc_media),
1168 ADD_TABLE(property),
1171 static const msi_table rof_tables[] =
1173 ADD_TABLE(rof_component),
1174 ADD_TABLE(directory),
1175 ADD_TABLE(rof_feature),
1176 ADD_TABLE(rof_feature_comp),
1177 ADD_TABLE(rof_file),
1178 ADD_TABLE(install_exec_seq),
1179 ADD_TABLE(rof_media),
1180 ADD_TABLE(property),
1183 static const msi_table rofc_tables[] =
1185 ADD_TABLE(rof_component),
1186 ADD_TABLE(directory),
1187 ADD_TABLE(rof_feature),
1188 ADD_TABLE(rof_feature_comp),
1189 ADD_TABLE(rofc_file),
1190 ADD_TABLE(install_exec_seq),
1191 ADD_TABLE(rofc_media),
1192 ADD_TABLE(property),
1195 static const msi_table sdp_tables[] =
1197 ADD_TABLE(rof_component),
1198 ADD_TABLE(directory),
1199 ADD_TABLE(rof_feature),
1200 ADD_TABLE(rof_feature_comp),
1201 ADD_TABLE(rof_file),
1202 ADD_TABLE(sdp_install_exec_seq),
1203 ADD_TABLE(sdp_custom_action),
1204 ADD_TABLE(rof_media),
1205 ADD_TABLE(property),
1208 static const msi_table cie_tables[] =
1210 ADD_TABLE(cie_component),
1211 ADD_TABLE(directory),
1212 ADD_TABLE(cc_feature),
1213 ADD_TABLE(cie_feature_comp),
1214 ADD_TABLE(cie_file),
1215 ADD_TABLE(install_exec_seq),
1216 ADD_TABLE(cie_media),
1217 ADD_TABLE(property),
1220 static const msi_table ci_tables[] =
1222 ADD_TABLE(ci_component),
1223 ADD_TABLE(directory),
1224 ADD_TABLE(rof_feature),
1225 ADD_TABLE(rof_feature_comp),
1226 ADD_TABLE(rof_file),
1227 ADD_TABLE(ci_install_exec_seq),
1228 ADD_TABLE(rof_media),
1229 ADD_TABLE(property),
1230 ADD_TABLE(ci_custom_action),
1233 static const msi_table ci2_tables[] =
1235 ADD_TABLE(ci2_component),
1236 ADD_TABLE(directory),
1237 ADD_TABLE(rof_feature),
1238 ADD_TABLE(ci2_feature_comp),
1239 ADD_TABLE(ci2_file),
1240 ADD_TABLE(install_exec_seq),
1241 ADD_TABLE(rof_media),
1242 ADD_TABLE(property),
1245 static const msi_table spf_tables[] =
1247 ADD_TABLE(ci_component),
1248 ADD_TABLE(directory),
1249 ADD_TABLE(rof_feature),
1250 ADD_TABLE(rof_feature_comp),
1251 ADD_TABLE(rof_file),
1252 ADD_TABLE(spf_install_exec_seq),
1253 ADD_TABLE(rof_media),
1254 ADD_TABLE(property),
1255 ADD_TABLE(spf_custom_action),
1256 ADD_TABLE(spf_install_ui_seq),
1259 static const msi_table pp_tables[] =
1261 ADD_TABLE(ci_component),
1262 ADD_TABLE(directory),
1263 ADD_TABLE(rof_feature),
1264 ADD_TABLE(rof_feature_comp),
1265 ADD_TABLE(rof_file),
1266 ADD_TABLE(pp_install_exec_seq),
1267 ADD_TABLE(rof_media),
1268 ADD_TABLE(property),
1271 static const msi_table ppc_tables[] =
1273 ADD_TABLE(ppc_component),
1274 ADD_TABLE(directory),
1275 ADD_TABLE(rof_feature),
1276 ADD_TABLE(ppc_feature_comp),
1277 ADD_TABLE(ppc_file),
1278 ADD_TABLE(pp_install_exec_seq),
1279 ADD_TABLE(ppc_media),
1280 ADD_TABLE(property),
1283 static const msi_table lus0_tables[] =
1285 ADD_TABLE(ci_component),
1286 ADD_TABLE(directory),
1287 ADD_TABLE(rof_feature),
1288 ADD_TABLE(rof_feature_comp),
1289 ADD_TABLE(rof_file),
1290 ADD_TABLE(pp_install_exec_seq),
1291 ADD_TABLE(rof_media),
1292 ADD_TABLE(property),
1295 static const msi_table lus1_tables[] =
1297 ADD_TABLE(ci_component),
1298 ADD_TABLE(directory),
1299 ADD_TABLE(rof_feature),
1300 ADD_TABLE(rof_feature_comp),
1301 ADD_TABLE(rof_file),
1302 ADD_TABLE(pp_install_exec_seq),
1303 ADD_TABLE(rofc_media),
1304 ADD_TABLE(property),
1307 static const msi_table lus2_tables[] =
1309 ADD_TABLE(ci_component),
1310 ADD_TABLE(directory),
1311 ADD_TABLE(rof_feature),
1312 ADD_TABLE(rof_feature_comp),
1313 ADD_TABLE(rof_file),
1314 ADD_TABLE(pp_install_exec_seq),
1315 ADD_TABLE(lus2_media),
1316 ADD_TABLE(property),
1319 static const msi_table tp_tables[] =
1321 ADD_TABLE(tp_component),
1322 ADD_TABLE(directory),
1323 ADD_TABLE(rof_feature),
1324 ADD_TABLE(ci2_feature_comp),
1325 ADD_TABLE(ci2_file),
1326 ADD_TABLE(install_exec_seq),
1327 ADD_TABLE(rof_media),
1328 ADD_TABLE(property),
1331 static const msi_table cwd_tables[] =
1333 ADD_TABLE(cwd_component),
1334 ADD_TABLE(directory),
1335 ADD_TABLE(rof_feature),
1336 ADD_TABLE(ci2_feature_comp),
1337 ADD_TABLE(ci2_file),
1338 ADD_TABLE(install_exec_seq),
1339 ADD_TABLE(rof_media),
1340 ADD_TABLE(property),
1343 static const msi_table adm_tables[] =
1345 ADD_TABLE(adm_component),
1346 ADD_TABLE(directory),
1347 ADD_TABLE(rof_feature),
1348 ADD_TABLE(ci2_feature_comp),
1349 ADD_TABLE(ci2_file),
1350 ADD_TABLE(install_exec_seq),
1351 ADD_TABLE(rof_media),
1352 ADD_TABLE(property),
1353 ADD_TABLE(adm_custom_action),
1354 ADD_TABLE(adm_admin_exec_seq),
1357 static const msi_table amp_tables[] =
1359 ADD_TABLE(amp_component),
1360 ADD_TABLE(directory),
1361 ADD_TABLE(rof_feature),
1362 ADD_TABLE(ci2_feature_comp),
1363 ADD_TABLE(ci2_file),
1364 ADD_TABLE(install_exec_seq),
1365 ADD_TABLE(rof_media),
1366 ADD_TABLE(property),
1369 static const msi_table rem_tables[] =
1371 ADD_TABLE(rem_component),
1372 ADD_TABLE(directory),
1373 ADD_TABLE(rof_feature),
1374 ADD_TABLE(rem_feature_comp),
1375 ADD_TABLE(rem_file),
1376 ADD_TABLE(rem_install_exec_seq),
1377 ADD_TABLE(rof_media),
1378 ADD_TABLE(property),
1379 ADD_TABLE(rem_remove_files),
1382 static const msi_table mov_tables[] =
1384 ADD_TABLE(cwd_component),
1385 ADD_TABLE(directory),
1386 ADD_TABLE(rof_feature),
1387 ADD_TABLE(ci2_feature_comp),
1388 ADD_TABLE(ci2_file),
1389 ADD_TABLE(install_exec_seq),
1390 ADD_TABLE(rof_media),
1391 ADD_TABLE(property),
1392 ADD_TABLE(mov_move_file),
1395 static const msi_table mc_tables[] =
1397 ADD_TABLE(mc_component),
1398 ADD_TABLE(directory),
1399 ADD_TABLE(cc_feature),
1400 ADD_TABLE(cie_feature_comp),
1402 ADD_TABLE(install_exec_seq),
1403 ADD_TABLE(mc_media),
1404 ADD_TABLE(property),
1405 ADD_TABLE(mc_file_hash),
1408 static const msi_table df_tables[] =
1410 ADD_TABLE(rof_component),
1411 ADD_TABLE(df_directory),
1412 ADD_TABLE(rof_feature),
1413 ADD_TABLE(rof_feature_comp),
1414 ADD_TABLE(rof_file),
1415 ADD_TABLE(install_exec_seq),
1416 ADD_TABLE(rof_media),
1417 ADD_TABLE(property),
1418 ADD_TABLE(df_duplicate_file),
1421 static const msi_table wrv_tables[] =
1423 ADD_TABLE(wrv_component),
1424 ADD_TABLE(directory),
1425 ADD_TABLE(rof_feature),
1426 ADD_TABLE(ci2_feature_comp),
1427 ADD_TABLE(ci2_file),
1428 ADD_TABLE(install_exec_seq),
1429 ADD_TABLE(rof_media),
1430 ADD_TABLE(property),
1431 ADD_TABLE(wrv_registry),
1434 static const msi_table sf_tables[] =
1436 ADD_TABLE(wrv_component),
1437 ADD_TABLE(directory),
1438 ADD_TABLE(rof_feature),
1439 ADD_TABLE(ci2_feature_comp),
1440 ADD_TABLE(ci2_file),
1441 ADD_TABLE(install_exec_seq),
1442 ADD_TABLE(rof_media),
1443 ADD_TABLE(property),
1446 static const msi_table ca51_tables[] =
1448 ADD_TABLE(ca51_component),
1449 ADD_TABLE(directory),
1450 ADD_TABLE(rof_feature),
1451 ADD_TABLE(ci2_feature_comp),
1452 ADD_TABLE(ci2_file),
1453 ADD_TABLE(ca51_install_exec_seq),
1454 ADD_TABLE(rof_media),
1455 ADD_TABLE(property),
1456 ADD_TABLE(ca51_custom_action),
1459 static const msi_table is_tables[] =
1461 ADD_TABLE(is_component),
1462 ADD_TABLE(directory),
1463 ADD_TABLE(is_feature),
1464 ADD_TABLE(is_feature_comp),
1466 ADD_TABLE(install_exec_seq),
1467 ADD_TABLE(is_media),
1468 ADD_TABLE(property),
1471 static const msi_table sp_tables[] =
1473 ADD_TABLE(sp_component),
1474 ADD_TABLE(sp_directory),
1475 ADD_TABLE(rof_feature),
1476 ADD_TABLE(ci2_feature_comp),
1477 ADD_TABLE(ci2_file),
1478 ADD_TABLE(install_exec_seq),
1479 ADD_TABLE(rof_media),
1480 ADD_TABLE(property),
1483 static const msi_table mcp_tables[] =
1485 ADD_TABLE(mcp_component),
1486 ADD_TABLE(directory),
1487 ADD_TABLE(mcp_feature),
1488 ADD_TABLE(mcp_feature_comp),
1489 ADD_TABLE(rem_file),
1490 ADD_TABLE(rem_install_exec_seq),
1491 ADD_TABLE(rof_media),
1492 ADD_TABLE(property),
1495 static const msi_table mcomp_tables[] =
1497 ADD_TABLE(mcp_component),
1498 ADD_TABLE(directory),
1499 ADD_TABLE(mcp_feature),
1500 ADD_TABLE(mcp_feature_comp),
1501 ADD_TABLE(mcomp_file),
1502 ADD_TABLE(rem_install_exec_seq),
1503 ADD_TABLE(rof_media),
1504 ADD_TABLE(property),
1507 static const msi_table ai_tables[] =
1509 ADD_TABLE(component),
1510 ADD_TABLE(directory),
1512 ADD_TABLE(feature_comp),
1514 ADD_TABLE(install_exec_seq),
1519 static const msi_table pc_tables[] =
1521 ADD_TABLE(ca51_component),
1522 ADD_TABLE(directory),
1523 ADD_TABLE(rof_feature),
1524 ADD_TABLE(ci2_feature_comp),
1525 ADD_TABLE(ci2_file),
1526 ADD_TABLE(install_exec_seq),
1527 ADD_TABLE(rof_media),
1531 static const msi_table ip_tables[] =
1533 ADD_TABLE(component),
1534 ADD_TABLE(directory),
1536 ADD_TABLE(feature_comp),
1538 ADD_TABLE(ip_install_exec_seq),
1539 ADD_TABLE(ip_custom_action),
1544 static const msi_table fiu_tables[] =
1546 ADD_TABLE(rof_component),
1547 ADD_TABLE(directory),
1548 ADD_TABLE(rof_feature),
1549 ADD_TABLE(rof_feature_comp),
1550 ADD_TABLE(rof_file),
1551 ADD_TABLE(pp_install_exec_seq),
1552 ADD_TABLE(rof_media),
1553 ADD_TABLE(property),
1556 static const msi_table fiuc_tables[] =
1558 ADD_TABLE(rof_component),
1559 ADD_TABLE(directory),
1560 ADD_TABLE(rof_feature),
1561 ADD_TABLE(rof_feature_comp),
1562 ADD_TABLE(rofc_file),
1563 ADD_TABLE(pp_install_exec_seq),
1564 ADD_TABLE(rofc_media),
1565 ADD_TABLE(property),
1568 /* cabinet definitions */
1570 /* make the max size large so there is only one cab file */
1571 #define MEDIA_SIZE 0x7FFFFFFF
1572 #define FOLDER_THRESHOLD 900000
1574 /* the FCI callbacks */
1576 static void * CDECL mem_alloc(ULONG cb)
1578 return HeapAlloc(GetProcessHeap(), 0, cb);
1581 static void CDECL mem_free(void *memory)
1583 HeapFree(GetProcessHeap(), 0, memory);
1586 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
1588 sprintf(pccab->szCab, pv, pccab->iCab);
1592 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
1597 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
1598 BOOL fContinuation, void *pv)
1603 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
1607 DWORD dwShareMode = 0;
1608 DWORD dwCreateDisposition = OPEN_EXISTING;
1610 dwAccess = GENERIC_READ | GENERIC_WRITE;
1611 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
1612 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
1614 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
1615 dwCreateDisposition = OPEN_EXISTING;
1617 dwCreateDisposition = CREATE_NEW;
1619 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
1620 dwCreateDisposition, 0, NULL);
1622 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
1624 return (INT_PTR)handle;
1627 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1629 HANDLE handle = (HANDLE)hf;
1633 res = ReadFile(handle, memory, cb, &dwRead, NULL);
1634 ok(res, "Failed to ReadFile\n");
1639 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1641 HANDLE handle = (HANDLE)hf;
1645 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
1646 ok(res, "Failed to WriteFile\n");
1651 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
1653 HANDLE handle = (HANDLE)hf;
1654 ok(CloseHandle(handle), "Failed to CloseHandle\n");
1659 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
1661 HANDLE handle = (HANDLE)hf;
1664 ret = SetFilePointer(handle, dist, NULL, seektype);
1665 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
1670 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
1672 BOOL ret = DeleteFileA(pszFile);
1673 ok(ret, "Failed to DeleteFile %s\n", pszFile);
1678 static void init_functionpointers(void)
1680 HMODULE hmsi = GetModuleHandleA("msi.dll");
1681 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
1683 #define GET_PROC(mod, func) \
1684 p ## func = (void*)GetProcAddress(mod, #func); \
1686 trace("GetProcAddress(%s) failed\n", #func);
1688 GET_PROC(hmsi, MsiQueryComponentStateA);
1689 GET_PROC(hmsi, MsiSetExternalUIRecord);
1690 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
1691 GET_PROC(hmsi, MsiSourceListGetInfoA);
1693 GET_PROC(hadvapi32, ConvertSidToStringSidA);
1695 hsrclient = LoadLibraryA("srclient.dll");
1696 GET_PROC(hsrclient, SRRemoveRestorePoint);
1697 GET_PROC(hsrclient, SRSetRestorePointA);
1702 static BOOL check_win9x(void)
1706 scm = OpenSCManager(NULL, NULL, GENERIC_ALL);
1707 if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
1710 CloseServiceHandle(scm);
1715 static LPSTR get_user_sid(LPSTR *usersid)
1722 if (!pConvertSidToStringSidA)
1724 win_skip("ConvertSidToStringSidA is not available\n");
1729 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
1731 GetTokenInformation(token, TokenUser, buf, size, &size);
1732 user = (PTOKEN_USER)buf;
1733 pConvertSidToStringSidA(user->User.Sid, usersid);
1734 ok(*usersid != NULL, "pConvertSidToStringSidA failed lre=%d\n", GetLastError());
1739 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
1746 r = MsiRecordGetString(rec, field, buffer, &sz);
1747 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
1750 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
1754 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
1755 GetTempFileNameA(".", "xx", 0, tempname);
1757 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
1759 lstrcpyA(pszTempName, tempname);
1760 HeapFree(GetProcessHeap(), 0, tempname);
1764 HeapFree(GetProcessHeap(), 0, tempname);
1769 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
1770 USHORT *pattribs, int *err, void *pv)
1772 BY_HANDLE_FILE_INFORMATION finfo;
1778 handle = CreateFile(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
1779 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
1781 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
1783 res = GetFileInformationByHandle(handle, &finfo);
1784 ok(res, "Expected GetFileInformationByHandle to succeed\n");
1786 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
1787 FileTimeToDosDateTime(&filetime, pdate, ptime);
1789 attrs = GetFileAttributes(pszName);
1790 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
1792 return (INT_PTR)handle;
1795 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
1797 char path[MAX_PATH];
1798 char filename[MAX_PATH];
1800 lstrcpyA(path, CURR_DIR);
1801 lstrcatA(path, "\\");
1802 lstrcatA(path, file);
1804 lstrcpyA(filename, file);
1806 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
1807 progress, get_open_info, compress);
1810 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
1812 ZeroMemory(pCabParams, sizeof(CCAB));
1814 pCabParams->cb = max_size;
1815 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
1816 pCabParams->setID = 0xbeef;
1817 pCabParams->iCab = 1;
1818 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
1819 lstrcatA(pCabParams->szCabPath, "\\");
1820 lstrcpyA(pCabParams->szCab, name);
1823 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
1831 set_cab_parameters(&cabParams, name, max_size);
1833 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
1834 fci_read, fci_write, fci_close, fci_seek, fci_delete,
1835 get_temp_file, &cabParams, NULL);
1837 ok(hfci != NULL, "Failed to create an FCI context\n");
1842 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
1843 ok(res, "Failed to add file: %s\n", ptr);
1844 ptr += lstrlen(ptr) + 1;
1847 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
1848 ok(res, "Failed to flush the cabinet\n");
1850 res = FCIDestroy(hfci);
1851 ok(res, "Failed to destroy the cabinet\n");
1854 static BOOL get_program_files_dir(LPSTR buf, LPSTR buf2)
1859 if (RegOpenKey(HKEY_LOCAL_MACHINE,
1860 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
1864 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) {
1870 if (RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size)) {
1879 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
1884 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
1885 if (file == INVALID_HANDLE_VALUE)
1888 WriteFile(file, data, strlen(data), &written, NULL);
1892 SetFilePointer(file, size, NULL, FILE_BEGIN);
1899 #define create_file(name, size) create_file_data(name, name, size)
1901 static void create_test_files(void)
1903 CreateDirectoryA("msitest", NULL);
1904 create_file("msitest\\one.txt", 100);
1905 CreateDirectoryA("msitest\\first", NULL);
1906 create_file("msitest\\first\\two.txt", 100);
1907 CreateDirectoryA("msitest\\second", NULL);
1908 create_file("msitest\\second\\three.txt", 100);
1910 create_file("four.txt", 100);
1911 create_file("five.txt", 100);
1912 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
1914 create_file("msitest\\filename", 100);
1915 create_file("msitest\\service.exe", 100);
1917 DeleteFileA("four.txt");
1918 DeleteFileA("five.txt");
1921 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
1923 CHAR path[MAX_PATH];
1925 lstrcpyA(path, PROG_FILES_DIR);
1926 lstrcatA(path, "\\");
1927 lstrcatA(path, rel_path);
1930 return DeleteFileA(path);
1932 return RemoveDirectoryA(path);
1935 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
1937 CHAR path[MAX_PATH];
1939 lstrcpyA(path, COMMON_FILES_DIR);
1940 lstrcatA(path, "\\");
1941 lstrcatA(path, rel_path);
1944 return DeleteFileA(path);
1946 return RemoveDirectoryA(path);
1949 static void delete_test_files(void)
1951 DeleteFileA("msitest.msi");
1952 DeleteFileA("msitest.cab");
1953 DeleteFileA("msitest\\second\\three.txt");
1954 DeleteFileA("msitest\\first\\two.txt");
1955 DeleteFileA("msitest\\one.txt");
1956 DeleteFileA("msitest\\service.exe");
1957 DeleteFileA("msitest\\filename");
1958 RemoveDirectoryA("msitest\\second");
1959 RemoveDirectoryA("msitest\\first");
1960 RemoveDirectoryA("msitest");
1963 static void write_file(const CHAR *filename, const char *data, int data_size)
1967 HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
1968 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
1970 WriteFile(hf, data, data_size, &size, NULL);
1974 static void write_msi_summary_info(MSIHANDLE db, INT wordcount)
1979 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
1980 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1982 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, ";1033");
1983 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1985 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
1986 "{004757CA-5092-49c2-AD20-28E1CE0DF5F2}");
1987 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1989 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
1990 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1992 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
1993 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1995 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
1996 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1998 /* write the summary changes back to the stream */
1999 r = MsiSummaryInfoPersist(summary);
2000 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2002 MsiCloseHandle(summary);
2005 #define create_database(name, tables, num_tables) \
2006 create_database_wordcount(name, tables, num_tables, 0);
2008 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2009 int num_tables, INT wordcount)
2015 r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db);
2016 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2018 /* import the tables into the database */
2019 for (j = 0; j < num_tables; j++)
2021 const msi_table *table = &tables[j];
2023 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2025 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2026 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2028 DeleteFileA(table->filename);
2031 write_msi_summary_info(db, wordcount);
2033 r = MsiDatabaseCommit(db);
2034 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2039 static void check_service_is_installed(void)
2041 SC_HANDLE scm, service;
2044 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
2045 ok(scm != NULL, "Failed to open the SC Manager\n");
2047 service = OpenService(scm, "TestService", SC_MANAGER_ALL_ACCESS);
2048 ok(service != NULL, "Failed to open TestService\n");
2050 res = DeleteService(service);
2051 ok(res, "Failed to delete TestService\n");
2053 CloseServiceHandle(service);
2054 CloseServiceHandle(scm);
2057 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2059 RESTOREPOINTINFOA spec;
2061 spec.dwEventType = event_type;
2062 spec.dwRestorePtType = APPLICATION_INSTALL;
2063 spec.llSequenceNumber = status->llSequenceNumber;
2064 lstrcpyA(spec.szDescription, "msitest restore point");
2066 return pSRSetRestorePointA(&spec, status);
2069 static void remove_restore_point(DWORD seq_number)
2073 res = pSRRemoveRestorePoint(seq_number);
2074 if (res != ERROR_SUCCESS)
2075 trace("Failed to remove the restore point : %08x\n", res);
2078 static void test_MsiInstallProduct(void)
2081 CHAR path[MAX_PATH];
2084 DWORD num, size, type;
2088 win_skip("Services are not implemented on Win9x and WinMe\n");
2092 /* szPackagePath is NULL */
2093 r = MsiInstallProductA(NULL, "INSTALL=ALL");
2094 ok(r == ERROR_INVALID_PARAMETER,
2095 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2097 /* both szPackagePath and szCommandLine are NULL */
2098 r = MsiInstallProductA(NULL, NULL);
2099 ok(r == ERROR_INVALID_PARAMETER,
2100 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2102 /* szPackagePath is empty */
2103 r = MsiInstallProductA("", "INSTALL=ALL");
2104 ok(r == ERROR_PATH_NOT_FOUND,
2105 "Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
2107 create_test_files();
2108 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2110 /* install, don't publish */
2111 r = MsiInstallProductA(msifile, NULL);
2112 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2114 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2115 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2116 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2117 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2118 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2119 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2120 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2121 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2122 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2123 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2124 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2125 ok(delete_pf("msitest", FALSE), "File not installed\n");
2127 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2128 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2132 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
2133 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2134 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
2138 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
2139 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2143 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
2144 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2145 ok(num == 314, "Expected 314, got %d\n", num);
2149 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
2150 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2151 ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
2153 check_service_is_installed();
2155 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2157 /* not published, reinstall */
2158 r = MsiInstallProductA(msifile, NULL);
2159 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2161 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2162 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2163 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2164 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2165 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2166 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2167 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2168 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2169 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2170 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2171 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2172 ok(delete_pf("msitest", FALSE), "File not installed\n");
2174 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2175 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2176 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2178 create_database(msifile, up_tables, sizeof(up_tables) / sizeof(msi_table));
2180 /* not published, RemovePreviousVersions set */
2181 r = MsiInstallProductA(msifile, NULL);
2182 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2184 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2185 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2186 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2187 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2188 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2189 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2190 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2191 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2192 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2193 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2194 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2195 ok(delete_pf("msitest", FALSE), "File not installed\n");
2197 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2198 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2199 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2201 create_database(msifile, up2_tables, sizeof(up2_tables) / sizeof(msi_table));
2203 /* not published, version number bumped */
2204 r = MsiInstallProductA(msifile, NULL);
2205 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2207 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2208 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2209 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2210 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2211 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2212 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2213 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2214 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2215 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2216 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2217 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2218 ok(delete_pf("msitest", FALSE), "File not installed\n");
2220 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2221 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2222 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2224 create_database(msifile, up3_tables, sizeof(up3_tables) / sizeof(msi_table));
2226 /* not published, RemovePreviousVersions set and version number bumped */
2227 r = MsiInstallProductA(msifile, NULL);
2228 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2230 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2231 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2232 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2233 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2234 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2235 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2236 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2237 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2238 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2239 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2240 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2241 ok(delete_pf("msitest", FALSE), "File not installed\n");
2243 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2244 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2245 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2247 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2249 /* install, publish product */
2250 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2251 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2253 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2254 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2255 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2256 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2257 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2258 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2259 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2260 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2261 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2262 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2263 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2264 ok(delete_pf("msitest", FALSE), "File not installed\n");
2266 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2267 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2269 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2271 /* published, reinstall */
2272 r = MsiInstallProductA(msifile, NULL);
2273 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2275 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2276 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2277 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2278 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2279 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2280 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2281 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2282 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2283 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2284 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2285 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2286 ok(delete_pf("msitest", FALSE), "File not installed\n");
2288 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2289 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2291 create_database(msifile, up5_tables, sizeof(up5_tables) / sizeof(msi_table));
2293 /* published product, RemovePreviousVersions set */
2294 r = MsiInstallProductA(msifile, NULL);
2295 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2297 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2298 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2299 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2300 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2301 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2302 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2303 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2304 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2305 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2306 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2307 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2308 ok(delete_pf("msitest", FALSE), "File not installed\n");
2310 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2311 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2313 create_database(msifile, up6_tables, sizeof(up6_tables) / sizeof(msi_table));
2315 /* published product, version number bumped */
2316 r = MsiInstallProductA(msifile, NULL);
2317 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2319 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2320 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2321 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2322 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2323 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2324 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2325 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2326 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2327 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2328 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2329 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2330 ok(delete_pf("msitest", FALSE), "File not installed\n");
2332 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2333 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2335 create_database(msifile, up7_tables, sizeof(up7_tables) / sizeof(msi_table));
2337 /* published product, RemovePreviousVersions set and version number bumped */
2338 r = MsiInstallProductA(msifile, NULL);
2339 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2341 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2342 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2343 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2344 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2345 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2346 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2347 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2348 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2349 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2350 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2351 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2352 ok(delete_pf("msitest", FALSE), "File not installed\n");
2354 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2355 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2357 r = MsiInstallProductA(msifile, "REMOVE=ALL");
2358 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2360 delete_test_files();
2363 static void test_MsiSetComponentState(void)
2365 INSTALLSTATE installed, action;
2367 char path[MAX_PATH];
2370 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2374 lstrcpy(path, CURR_DIR);
2375 lstrcat(path, "\\");
2376 lstrcat(path, msifile);
2378 r = MsiOpenPackage(path, &package);
2379 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2381 r = MsiDoAction(package, "CostInitialize");
2382 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2384 r = MsiDoAction(package, "FileCost");
2385 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2387 r = MsiDoAction(package, "CostFinalize");
2388 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2390 r = MsiGetComponentState(package, "dangler", &installed, &action);
2391 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2392 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
2393 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2395 r = MsiSetComponentState(package, "dangler", INSTALLSTATE_SOURCE);
2396 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2398 MsiCloseHandle(package);
2401 DeleteFileA(msifile);
2404 static void test_packagecoltypes(void)
2406 MSIHANDLE hdb, view, rec;
2407 char path[MAX_PATH];
2411 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2415 lstrcpy(path, CURR_DIR);
2416 lstrcat(path, "\\");
2417 lstrcat(path, msifile);
2419 r = MsiOpenDatabase(path, MSIDBOPEN_READONLY, &hdb);
2420 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2422 query = "SELECT * FROM `Media`";
2423 r = MsiDatabaseOpenView( hdb, query, &view );
2424 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2426 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
2427 count = MsiRecordGetFieldCount( rec );
2428 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2429 ok(count == 6, "Expected 6, got %d\n", count);
2430 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
2431 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
2432 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
2433 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
2434 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
2435 ok(check_record(rec, 6, "Source"), "wrong column label\n");
2436 MsiCloseHandle(rec);
2438 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
2439 count = MsiRecordGetFieldCount( rec );
2440 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2441 ok(count == 6, "Expected 6, got %d\n", count);
2442 ok(check_record(rec, 1, "i2"), "wrong column label\n");
2443 ok(check_record(rec, 2, "i4"), "wrong column label\n");
2444 ok(check_record(rec, 3, "L64"), "wrong column label\n");
2445 ok(check_record(rec, 4, "S255"), "wrong column label\n");
2446 ok(check_record(rec, 5, "S32"), "wrong column label\n");
2447 ok(check_record(rec, 6, "S72"), "wrong column label\n");
2449 MsiCloseHandle(rec);
2450 MsiCloseHandle(view);
2451 MsiCloseHandle(hdb);
2454 DeleteFile(msifile);
2457 static void create_cc_test_files(void)
2462 static CHAR cab_context[] = "test%d.cab";
2465 create_file("maximus", 500);
2466 create_file("augustus", 50000);
2467 create_file("tiberius", 500);
2468 create_file("caesar", 500);
2470 set_cab_parameters(&cabParams, "test1.cab", 40000);
2472 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2473 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2474 get_temp_file, &cabParams, cab_context);
2475 ok(hfci != NULL, "Failed to create an FCI context\n");
2477 res = add_file(hfci, "maximus", tcompTYPE_NONE);
2478 ok(res, "Failed to add file maximus\n");
2480 res = add_file(hfci, "augustus", tcompTYPE_NONE);
2481 ok(res, "Failed to add file augustus\n");
2483 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
2484 ok(res, "Failed to add file tiberius\n");
2486 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2487 ok(res, "Failed to flush the cabinet\n");
2489 res = FCIDestroy(hfci);
2490 ok(res, "Failed to destroy the cabinet\n");
2492 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2494 DeleteFile("maximus");
2495 DeleteFile("augustus");
2496 DeleteFile("tiberius");
2497 DeleteFile("caesar");
2500 static void delete_cab_files(void)
2502 SHFILEOPSTRUCT shfl;
2503 CHAR path[MAX_PATH+10];
2505 lstrcpyA(path, CURR_DIR);
2506 lstrcatA(path, "\\*.cab");
2507 path[strlen(path) + 1] = '\0';
2510 shfl.wFunc = FO_DELETE;
2513 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
2515 SHFileOperation(&shfl);
2518 static void test_continuouscabs(void)
2522 create_cc_test_files();
2523 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
2525 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2527 r = MsiInstallProductA(msifile, NULL);
2528 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
2530 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2531 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2532 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2533 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2534 ok(delete_pf("msitest", FALSE), "File not installed\n");
2538 DeleteFile(msifile);
2540 create_cc_test_files();
2541 create_database(msifile, cc2_tables, sizeof(cc2_tables) / sizeof(msi_table));
2543 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2545 r = MsiInstallProductA(msifile, NULL);
2546 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2547 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2548 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
2549 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
2550 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2551 ok(delete_pf("msitest", FALSE), "File not installed\n");
2554 DeleteFile(msifile);
2557 static void test_caborder(void)
2561 create_file("imperator", 100);
2562 create_file("maximus", 500);
2563 create_file("augustus", 50000);
2564 create_file("caesar", 500);
2566 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
2568 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2570 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
2571 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
2572 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2574 r = MsiInstallProductA(msifile, NULL);
2575 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
2576 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
2577 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
2580 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
2581 ok(!delete_pf("msitest", FALSE), "File is installed\n");
2586 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
2587 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
2588 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2590 r = MsiInstallProductA(msifile, NULL);
2591 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
2592 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
2593 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
2594 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
2597 ok(!delete_pf("msitest", FALSE), "File is installed\n");
2601 DeleteFile(msifile);
2603 create_cc_test_files();
2604 create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
2606 r = MsiInstallProductA(msifile, NULL);
2607 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
2608 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
2609 ok(!delete_pf("msitest", FALSE), "File is installed\n");
2612 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
2613 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
2617 DeleteFile(msifile);
2619 create_cc_test_files();
2620 create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
2622 r = MsiInstallProductA(msifile, NULL);
2623 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
2626 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
2627 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
2628 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
2629 ok(!delete_pf("msitest", FALSE), "File is installed\n");
2633 DeleteFile("imperator");
2634 DeleteFile("maximus");
2635 DeleteFile("augustus");
2636 DeleteFile("caesar");
2637 DeleteFile(msifile);
2640 static void test_mixedmedia(void)
2644 CreateDirectoryA("msitest", NULL);
2645 create_file("msitest\\maximus", 500);
2646 create_file("msitest\\augustus", 500);
2647 create_file("caesar", 500);
2649 create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
2651 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2653 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
2655 r = MsiInstallProductA(msifile, NULL);
2656 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2657 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2658 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2659 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2660 ok(delete_pf("msitest", FALSE), "File not installed\n");
2662 /* Delete the files in the temp (current) folder */
2663 DeleteFile("msitest\\maximus");
2664 DeleteFile("msitest\\augustus");
2665 RemoveDirectory("msitest");
2666 DeleteFile("caesar");
2667 DeleteFile("test1.cab");
2668 DeleteFile(msifile);
2671 static void test_samesequence(void)
2675 create_cc_test_files();
2676 create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
2678 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2680 r = MsiInstallProductA(msifile, NULL);
2681 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
2683 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2684 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2685 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2686 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2687 ok(delete_pf("msitest", FALSE), "File not installed\n");
2691 DeleteFile(msifile);
2694 static void test_uiLevelFlags(void)
2698 create_cc_test_files();
2699 create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
2701 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
2703 r = MsiInstallProductA(msifile, NULL);
2704 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
2706 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2707 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
2708 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2709 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2710 ok(delete_pf("msitest", FALSE), "File not installed\n");
2714 DeleteFile(msifile);
2717 static BOOL file_matches(LPSTR path)
2723 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
2724 NULL, OPEN_EXISTING, 0, NULL);
2726 ZeroMemory(buf, MAX_PATH);
2727 ReadFile(file, buf, 15, &size, NULL);
2730 return !lstrcmp(buf, "msitest\\maximus");
2733 static void test_readonlyfile(void)
2738 CHAR path[MAX_PATH];
2740 CreateDirectoryA("msitest", NULL);
2741 create_file("msitest\\maximus", 500);
2742 create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
2744 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2746 lstrcpy(path, PROG_FILES_DIR);
2747 lstrcat(path, "\\msitest");
2748 CreateDirectory(path, NULL);
2750 lstrcat(path, "\\maximus");
2751 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
2752 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
2754 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
2757 r = MsiInstallProductA(msifile, NULL);
2758 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2759 ok(file_matches(path), "Expected file to be overwritten\n");
2760 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2761 ok(delete_pf("msitest", FALSE), "File not installed\n");
2763 /* Delete the files in the temp (current) folder */
2764 DeleteFile("msitest\\maximus");
2765 RemoveDirectory("msitest");
2766 DeleteFile(msifile);
2769 static void test_readonlyfile_cab(void)
2774 CHAR path[MAX_PATH];
2777 CreateDirectoryA("msitest", NULL);
2778 create_file("maximus", 500);
2779 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
2780 DeleteFile("maximus");
2782 create_database(msifile, rofc_tables, sizeof(rofc_tables) / sizeof(msi_table));
2784 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2786 lstrcpy(path, PROG_FILES_DIR);
2787 lstrcat(path, "\\msitest");
2788 CreateDirectory(path, NULL);
2790 lstrcat(path, "\\maximus");
2791 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
2792 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
2794 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
2797 r = MsiInstallProductA(msifile, NULL);
2798 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2800 memset( buf, 0, sizeof(buf) );
2801 if ((file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
2802 NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
2804 ReadFile(file, buf, sizeof(buf) - 1, &size, NULL);
2807 ok( !lstrcmp( buf, "maximus" ), "Expected file to be overwritten, got '%s'\n", buf );
2808 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2809 ok(delete_pf("msitest", FALSE), "File not installed\n");
2811 /* Delete the files in the temp (current) folder */
2813 DeleteFile("msitest\\maximus");
2814 RemoveDirectory("msitest");
2815 DeleteFile(msifile);
2818 static BOOL add_cabinet_storage(LPCSTR db, LPCSTR cabinet)
2820 WCHAR dbW[MAX_PATH], cabinetW[MAX_PATH];
2826 MultiByteToWideChar(CP_ACP, 0, db, -1, dbW, MAX_PATH);
2827 hr = StgOpenStorage(dbW, NULL, STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, 0, &stg);
2831 MultiByteToWideChar(CP_ACP, 0, cabinet, -1, cabinetW, MAX_PATH);
2832 hr = IStorage_CreateStream(stg, cabinetW, STGM_WRITE|STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
2835 IStorage_Release(stg);
2839 handle = CreateFileW(cabinetW, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
2840 if (handle != INVALID_HANDLE_VALUE)
2844 if (ReadFile(handle, buffer, sizeof(buffer), &count, NULL))
2845 IStream_Write(stm, buffer, count, &count);
2846 CloseHandle(handle);
2849 IStream_Release(stm);
2850 IStorage_Release(stg);
2855 static void test_lastusedsource(void)
2857 static char prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2860 char value[MAX_PATH], path[MAX_PATH];
2863 if (!pMsiSourceListGetInfoA)
2865 win_skip("MsiSourceListGetInfoA is not available\n");
2869 CreateDirectoryA("msitest", NULL);
2870 create_file("maximus", 500);
2871 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
2872 DeleteFile("maximus");
2874 create_database("msifile0.msi", lus0_tables, sizeof(lus0_tables) / sizeof(msi_table));
2875 create_database("msifile1.msi", lus1_tables, sizeof(lus1_tables) / sizeof(msi_table));
2876 create_database("msifile2.msi", lus2_tables, sizeof(lus2_tables) / sizeof(msi_table));
2878 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2880 /* no cabinet file */
2883 lstrcpyA(value, "aaa");
2884 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2885 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
2886 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
2887 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
2889 r = MsiInstallProductA("msifile0.msi", "PUBLISH_PRODUCT=1");
2890 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2892 lstrcpyA(path, CURR_DIR);
2893 lstrcatA(path, "\\");
2896 lstrcpyA(value, "aaa");
2897 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2898 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
2899 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2902 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
2903 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
2906 r = MsiInstallProductA("msifile0.msi", "REMOVE=ALL");
2907 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2909 /* separate cabinet file */
2912 lstrcpyA(value, "aaa");
2913 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2914 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
2915 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
2916 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
2918 r = MsiInstallProductA("msifile1.msi", "PUBLISH_PRODUCT=1");
2919 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2921 lstrcpyA(path, CURR_DIR);
2922 lstrcatA(path, "\\");
2925 lstrcpyA(value, "aaa");
2926 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2927 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
2928 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2931 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
2932 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
2935 r = MsiInstallProductA("msifile1.msi", "REMOVE=ALL");
2936 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2939 lstrcpyA(value, "aaa");
2940 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2941 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
2942 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
2943 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
2945 /* embedded cabinet stream */
2947 add_cabinet_storage("msifile2.msi", "test1.cab");
2949 r = MsiInstallProductA("msifile2.msi", "PUBLISH_PRODUCT=1");
2950 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2953 lstrcpyA(value, "aaa");
2954 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2955 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
2956 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2959 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
2960 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
2963 r = MsiInstallProductA("msifile2.msi", "REMOVE=ALL");
2964 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2967 lstrcpyA(value, "aaa");
2968 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2969 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
2970 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
2971 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
2973 /* Delete the files in the temp (current) folder */
2975 DeleteFile("msitest\\maximus");
2976 RemoveDirectory("msitest");
2977 DeleteFile("msifile0.msi");
2978 DeleteFile("msifile1.msi");
2979 DeleteFile("msifile2.msi");
2982 static void test_setdirproperty(void)
2986 CreateDirectoryA("msitest", NULL);
2987 create_file("msitest\\maximus", 500);
2988 create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
2990 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2992 r = MsiInstallProductA(msifile, NULL);
2993 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2994 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
2995 ok(delete_cf("msitest", FALSE), "File not installed\n");
2997 /* Delete the files in the temp (current) folder */
2998 DeleteFile(msifile);
2999 DeleteFile("msitest\\maximus");
3000 RemoveDirectory("msitest");
3003 static void test_cabisextracted(void)
3007 CreateDirectoryA("msitest", NULL);
3008 create_file("msitest\\gaius", 500);
3009 create_file("maximus", 500);
3010 create_file("augustus", 500);
3011 create_file("caesar", 500);
3013 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3014 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3015 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3017 create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
3019 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3021 r = MsiInstallProductA(msifile, NULL);
3022 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3023 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3024 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3025 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3026 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
3027 ok(delete_pf("msitest", FALSE), "File not installed\n");
3029 /* Delete the files in the temp (current) folder */
3031 DeleteFile(msifile);
3032 DeleteFile("maximus");
3033 DeleteFile("augustus");
3034 DeleteFile("caesar");
3035 DeleteFile("msitest\\gaius");
3036 RemoveDirectory("msitest");
3039 static void test_concurrentinstall(void)
3042 CHAR path[MAX_PATH];
3044 CreateDirectoryA("msitest", NULL);
3045 CreateDirectoryA("msitest\\msitest", NULL);
3046 create_file("msitest\\maximus", 500);
3047 create_file("msitest\\msitest\\augustus", 500);
3049 create_database(msifile, ci_tables, sizeof(ci_tables) / sizeof(msi_table));
3051 lstrcpyA(path, CURR_DIR);
3052 lstrcatA(path, "\\msitest\\concurrent.msi");
3053 create_database(path, ci2_tables, sizeof(ci2_tables) / sizeof(msi_table));
3055 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3057 r = MsiInstallProductA(msifile, NULL);
3058 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3059 if (!delete_pf("msitest\\augustus", TRUE))
3060 trace("concurrent installs not supported\n");
3061 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3062 ok(delete_pf("msitest", FALSE), "File not installed\n");
3066 r = MsiInstallProductA(msifile, NULL);
3067 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3068 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3069 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3070 ok(delete_pf("msitest", FALSE), "File not installed\n");
3072 DeleteFile(msifile);
3073 DeleteFile("msitest\\msitest\\augustus");
3074 DeleteFile("msitest\\maximus");
3075 RemoveDirectory("msitest\\msitest");
3076 RemoveDirectory("msitest");
3079 static void test_setpropertyfolder(void)
3082 CHAR path[MAX_PATH];
3085 lstrcpyA(path, PROG_FILES_DIR);
3086 lstrcatA(path, "\\msitest\\added");
3088 CreateDirectoryA("msitest", NULL);
3089 create_file("msitest\\maximus", 500);
3091 create_database(msifile, spf_tables, sizeof(spf_tables) / sizeof(msi_table));
3093 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3095 r = MsiInstallProductA(msifile, NULL);
3096 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3097 attr = GetFileAttributesA(path);
3098 if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY))
3100 ok(delete_pf("msitest\\added\\maximus", TRUE), "File not installed\n");
3101 ok(delete_pf("msitest\\added", FALSE), "File not installed\n");
3102 ok(delete_pf("msitest", FALSE), "File not installed\n");
3106 trace("changing folder property not supported\n");
3107 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3108 ok(delete_pf("msitest", FALSE), "File not installed\n");
3111 /* Delete the files in the temp (current) folder */
3112 DeleteFile(msifile);
3113 DeleteFile("msitest\\maximus");
3114 RemoveDirectory("msitest");
3117 static BOOL file_exists(LPCSTR file)
3119 return GetFileAttributes(file) != INVALID_FILE_ATTRIBUTES;
3122 static BOOL pf_exists(LPCSTR file)
3124 CHAR path[MAX_PATH];
3126 lstrcpyA(path, PROG_FILES_DIR);
3127 lstrcatA(path, "\\");
3128 lstrcatA(path, file);
3130 return file_exists(path);
3133 static void delete_pfmsitest_files(void)
3135 SHFILEOPSTRUCT shfl;
3136 CHAR path[MAX_PATH+11];
3138 lstrcpyA(path, PROG_FILES_DIR);
3139 lstrcatA(path, "\\msitest\\*");
3140 path[strlen(path) + 1] = '\0';
3143 shfl.wFunc = FO_DELETE;
3146 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
3148 SHFileOperation(&shfl);
3150 lstrcpyA(path, PROG_FILES_DIR);
3151 lstrcatA(path, "\\msitest");
3152 RemoveDirectoryA(path);
3155 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
3163 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
3165 if (res != ERROR_SUCCESS ||
3166 (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
3168 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3173 ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val);
3177 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
3179 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
3183 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
3185 DWORD val, size, type;
3188 size = sizeof(DWORD);
3189 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
3191 if (res != ERROR_SUCCESS || type != REG_DWORD)
3193 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3197 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
3200 static void check_reg_dword2(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD line)
3202 DWORD val, size, type;
3205 size = sizeof(DWORD);
3206 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
3208 if (res != ERROR_SUCCESS || type != REG_DWORD)
3210 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3214 ok_(__FILE__, line)(val == expected1 || val == expected2, "Expected %d or %d, got %d\n", expected1, expected2, val);
3217 static void check_reg_dword3(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3, DWORD line)
3219 DWORD val, size, type;
3222 size = sizeof(DWORD);
3223 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
3225 if (res != ERROR_SUCCESS || type != REG_DWORD)
3227 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3231 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3,
3232 "Expected %d, %d or %d, got %d\n", expected1, expected2, expected3, val);
3235 #define CHECK_REG_STR(prodkey, name, expected) \
3236 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
3238 #define CHECK_DEL_REG_STR(prodkey, name, expected) \
3239 check_reg_str(prodkey, name, expected, TRUE, __LINE__); \
3240 RegDeleteValueA(prodkey, name);
3242 #define CHECK_REG_ISTR(prodkey, name, expected) \
3243 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
3245 #define CHECK_DEL_REG_ISTR(prodkey, name, expected) \
3246 check_reg_str(prodkey, name, expected, FALSE, __LINE__); \
3247 RegDeleteValueA(prodkey, name);
3249 #define CHECK_REG_DWORD(prodkey, name, expected) \
3250 check_reg_dword(prodkey, name, expected, __LINE__);
3252 #define CHECK_DEL_REG_DWORD(prodkey, name, expected) \
3253 check_reg_dword(prodkey, name, expected, __LINE__); \
3254 RegDeleteValueA(prodkey, name);
3256 #define CHECK_REG_DWORD2(prodkey, name, expected1, expected2) \
3257 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__);
3259 #define CHECK_DEL_REG_DWORD2(prodkey, name, expected1, expected2) \
3260 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__); \
3261 RegDeleteValueA(prodkey, name);
3263 #define CHECK_REG_DWORD3(prodkey, name, expected1, expected2, expected3) \
3264 check_reg_dword3(prodkey, name, expected1, expected2, expected3, __LINE__);
3266 #define CHECK_DEL_REG_DWORD3(prodkey, name, expected1, expected2, expected3) \
3267 check_reg_dword3(prodkey, name, expected1, expected2, expected3, __LINE__); \
3268 RegDeleteValueA(prodkey, name);
3270 static void get_date_str(LPSTR date)
3274 static const char date_fmt[] = "%d%02d%02d";
3275 GetLocalTime(&systime);
3276 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
3279 static void test_publish_registerproduct(void)
3286 char date[MAX_PATH];
3287 char temp[MAX_PATH];
3288 char keypath[MAX_PATH];
3290 static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3291 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3292 static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
3293 "\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3294 static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
3295 "\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
3296 static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
3297 "\\51AAE0C44620A5E4788506E91F249BD2";
3299 if (!get_user_sid(&usersid))
3303 GetTempPath(MAX_PATH, temp);
3305 CreateDirectoryA("msitest", NULL);
3306 create_file("msitest\\maximus", 500);
3308 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3310 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3312 /* RegisterProduct */
3313 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
3314 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3315 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3316 ok(delete_pf("msitest", FALSE), "File not installed\n");
3318 res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
3319 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3321 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
3322 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3324 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
3325 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
3326 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
3327 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
3328 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3329 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
3330 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3331 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
3332 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
3333 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
3334 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
3335 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
3336 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
3337 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
3338 CHECK_DEL_REG_STR(hkey, "Size", NULL);
3339 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
3340 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
3341 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3342 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3343 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
3344 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
3345 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
3348 CHECK_DEL_REG_DWORD3(hkey, "EstimatedSize", 12, -12, 4);
3351 RegDeleteKeyA(hkey, "");
3354 sprintf(keypath, userdata, usersid);
3355 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
3356 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3358 res = RegOpenKeyA(hkey, "InstallProperties", &props);
3359 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3361 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
3362 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
3363 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
3364 CHECK_DEL_REG_STR(props, "InstallDate", date);
3365 CHECK_DEL_REG_STR(props, "InstallSource", temp);
3366 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3367 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
3368 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3369 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
3370 CHECK_DEL_REG_STR(props, "Comments", NULL);
3371 CHECK_DEL_REG_STR(props, "Contact", NULL);
3372 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
3373 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
3374 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
3375 CHECK_DEL_REG_STR(props, "Readme", NULL);
3376 CHECK_DEL_REG_STR(props, "Size", NULL);
3377 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
3378 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
3379 CHECK_DEL_REG_DWORD(props, "Language", 1033);
3380 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
3381 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
3382 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
3383 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
3386 CHECK_DEL_REG_DWORD3(props, "EstimatedSize", 12, -12, 4);
3389 RegDeleteKeyA(props, "");
3392 res = RegOpenKeyA(hkey, "Usage", &usage);
3395 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3398 RegDeleteKeyA(usage, "");
3400 RegDeleteKeyA(hkey, "");
3403 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
3404 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3406 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3408 RegDeleteKeyA(hkey, "");
3411 /* RegisterProduct, machine */
3412 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 ALLUSERS=1");
3413 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3414 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3415 ok(delete_pf("msitest", FALSE), "File not installed\n");
3417 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, userugkey, &hkey);
3418 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3420 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
3421 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3423 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
3424 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
3425 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
3426 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
3427 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3428 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
3429 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3430 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
3431 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
3432 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
3433 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
3434 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
3435 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
3436 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
3437 CHECK_DEL_REG_STR(hkey, "Size", NULL);
3438 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
3439 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
3440 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3441 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3442 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
3443 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
3444 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
3447 CHECK_DEL_REG_DWORD3(hkey, "EstimatedSize", 12, -12, 4);
3450 RegDeleteKeyA(hkey, "");
3453 sprintf(keypath, userdata, "S-1-5-18");
3454 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
3455 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3457 res = RegOpenKeyA(hkey, "InstallProperties", &props);
3458 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3460 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
3461 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
3462 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
3463 CHECK_DEL_REG_STR(props, "InstallDate", date);
3464 CHECK_DEL_REG_STR(props, "InstallSource", temp);
3465 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3466 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
3467 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3468 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
3469 CHECK_DEL_REG_STR(props, "Comments", NULL);
3470 CHECK_DEL_REG_STR(props, "Contact", NULL);
3471 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
3472 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
3473 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
3474 CHECK_DEL_REG_STR(props, "Readme", NULL);
3475 CHECK_DEL_REG_STR(props, "Size", NULL);
3476 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
3477 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
3478 CHECK_DEL_REG_DWORD(props, "Language", 1033);
3479 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
3480 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
3481 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
3482 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
3485 CHECK_DEL_REG_DWORD3(props, "EstimatedSize", 12, -12, 4);
3488 RegDeleteKeyA(props, "");
3491 res = RegOpenKeyA(hkey, "Usage", &usage);
3494 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3497 RegDeleteKeyA(usage, "");
3499 RegDeleteKeyA(hkey, "");
3502 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
3503 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3505 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3507 RegDeleteKeyA(hkey, "");
3510 DeleteFile(msifile);
3511 DeleteFile("msitest\\maximus");
3512 RemoveDirectory("msitest");
3513 HeapFree(GetProcessHeap(), 0, usersid);
3516 static void test_publish_publishproduct(void)
3521 HKEY sourcelist, net, props;
3522 HKEY hkey, patches, media;
3523 CHAR keypath[MAX_PATH];
3524 CHAR temp[MAX_PATH];
3525 CHAR path[MAX_PATH];
3527 static const CHAR prodpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3528 "\\Installer\\UserData\\%s\\Products"
3529 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3530 static const CHAR cuprodpath[] = "Software\\Microsoft\\Installer\\Products"
3531 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3532 static const CHAR cuupgrades[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
3533 "\\51AAE0C44620A5E4788506E91F249BD2";
3534 static const CHAR badprod[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3535 "\\Installer\\Products"
3536 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3537 static const CHAR machprod[] = "Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3538 static const CHAR machup[] = "Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
3540 if (!get_user_sid(&usersid))
3543 GetTempPath(MAX_PATH, temp);
3545 CreateDirectoryA("msitest", NULL);
3546 create_file("msitest\\maximus", 500);
3548 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3550 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3552 /* PublishProduct, current user */
3553 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
3554 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3555 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3556 ok(delete_pf("msitest", FALSE), "File not installed\n");
3558 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
3559 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3561 sprintf(keypath, prodpath, usersid);
3562 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
3563 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3565 res = RegOpenKeyA(hkey, "InstallProperties", &props);
3566 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3568 res = RegOpenKeyA(hkey, "Patches", &patches);
3571 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3573 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3576 RegDeleteKeyA(patches, "");
3577 RegCloseKey(patches);
3578 RegDeleteKeyA(hkey, "");
3581 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
3582 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3584 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3585 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
3586 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3587 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3588 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3589 CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
3590 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3591 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3592 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3594 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
3595 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3597 lstrcpyA(path, "n;1;");
3598 lstrcatA(path, temp);
3599 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3600 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3602 res = RegOpenKeyA(sourcelist, "Net", &net);
3603 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3605 CHECK_DEL_REG_STR(net, "1", temp);
3607 RegDeleteKeyA(net, "");
3610 res = RegOpenKeyA(sourcelist, "Media", &media);
3611 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3613 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3615 RegDeleteKeyA(media, "");
3617 RegDeleteKeyA(sourcelist, "");
3618 RegCloseKey(sourcelist);
3619 RegDeleteKeyA(hkey, "");
3622 res = RegOpenKeyA(HKEY_CURRENT_USER, cuupgrades, &hkey);
3623 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3625 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3627 RegDeleteKeyA(hkey, "");
3630 /* PublishProduct, machine */
3631 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
3632 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3633 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3634 ok(delete_pf("msitest", FALSE), "File not installed\n");
3636 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
3637 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3639 sprintf(keypath, prodpath, "S-1-5-18");
3640 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
3641 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3643 res = RegOpenKeyA(hkey, "InstallProperties", &props);
3644 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3646 res = RegOpenKeyA(hkey, "Patches", &patches);
3649 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3651 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3654 RegDeleteKeyA(patches, "");
3655 RegCloseKey(patches);
3656 RegDeleteKeyA(hkey, "");
3659 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machprod, &hkey);
3660 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3662 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3663 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
3664 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3665 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3666 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3667 todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
3668 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3669 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3670 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3672 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
3673 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3675 lstrcpyA(path, "n;1;");
3676 lstrcatA(path, temp);
3677 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3678 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3680 res = RegOpenKeyA(sourcelist, "Net", &net);
3681 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3683 CHECK_DEL_REG_STR(net, "1", temp);
3685 RegDeleteKeyA(net, "");
3688 res = RegOpenKeyA(sourcelist, "Media", &media);
3689 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3691 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3693 RegDeleteKeyA(media, "");
3695 RegDeleteKeyA(sourcelist, "");
3696 RegCloseKey(sourcelist);
3697 RegDeleteKeyA(hkey, "");
3700 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machup, &hkey);
3701 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3703 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3705 RegDeleteKeyA(hkey, "");
3708 DeleteFile(msifile);
3709 DeleteFile("msitest\\maximus");
3710 RemoveDirectory("msitest");
3711 HeapFree(GetProcessHeap(), 0, usersid);
3714 static void test_publish_publishfeatures(void)
3720 CHAR keypath[MAX_PATH];
3722 static const CHAR cupath[] = "Software\\Microsoft\\Installer\\Features"
3723 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3724 static const CHAR udpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3725 "\\Installer\\UserData\\%s\\Products"
3726 "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
3727 static const CHAR featkey[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3728 "\\Installer\\Features";
3729 static const CHAR classfeat[] = "Software\\Classes\\Installer\\Features"
3730 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3732 if (!get_user_sid(&usersid))
3735 CreateDirectoryA("msitest", NULL);
3736 create_file("msitest\\maximus", 500);
3738 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3740 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3742 /* PublishFeatures, current user */
3743 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
3744 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3745 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3746 ok(delete_pf("msitest", FALSE), "File not installed\n");
3748 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
3749 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3751 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
3752 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3754 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
3755 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3757 CHECK_REG_STR(hkey, "feature", "");
3758 CHECK_REG_STR(hkey, "montecristo", "");
3760 RegDeleteValueA(hkey, "feature");
3761 RegDeleteValueA(hkey, "montecristo");
3762 RegDeleteKeyA(hkey, "");
3765 sprintf(keypath, udpath, usersid);
3766 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
3767 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3769 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
3770 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
3772 RegDeleteValueA(hkey, "feature");
3773 RegDeleteValueA(hkey, "montecristo");
3774 RegDeleteKeyA(hkey, "");
3777 /* PublishFeatures, machine */
3778 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
3779 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3780 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3781 ok(delete_pf("msitest", FALSE), "File not installed\n");
3783 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
3784 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3786 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
3787 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3789 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
3790 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3792 CHECK_REG_STR(hkey, "feature", "");
3793 CHECK_REG_STR(hkey, "montecristo", "");
3795 RegDeleteValueA(hkey, "feature");
3796 RegDeleteValueA(hkey, "montecristo");
3797 RegDeleteKeyA(hkey, "");
3800 sprintf(keypath, udpath, "S-1-5-18");
3801 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
3802 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3804 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
3805 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
3807 RegDeleteValueA(hkey, "feature");
3808 RegDeleteValueA(hkey, "montecristo");
3809 RegDeleteKeyA(hkey, "");
3812 DeleteFile(msifile);
3813 DeleteFile("msitest\\maximus");
3814 RemoveDirectory("msitest");
3815 HeapFree(GetProcessHeap(), 0, usersid);
3818 static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
3824 r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
3825 if (r != ERROR_SUCCESS)
3828 len += sizeof (WCHAR);
3829 val = HeapAlloc(GetProcessHeap(), 0, len);
3830 if (!val) return NULL;
3832 RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
3836 static void get_owner_company(LPSTR *owner, LPSTR *company)
3841 *owner = *company = NULL;
3843 res = RegOpenKeyA(HKEY_CURRENT_USER,
3844 "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
3845 if (res == ERROR_SUCCESS)
3847 *owner = reg_get_val_str(hkey, "DefName");
3848 *company = reg_get_val_str(hkey, "DefCompany");
3852 if (!*owner || !*company)
3854 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
3855 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey);
3856 if (res == ERROR_SUCCESS)
3858 *owner = reg_get_val_str(hkey, "RegisteredOwner");
3859 *company = reg_get_val_str(hkey, "RegisteredOrganization");
3864 if (!*owner || !*company)
3866 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
3867 "Software\\Microsoft\\Windows NT\\CurrentVersion", &hkey);
3868 if (res == ERROR_SUCCESS)
3870 *owner = reg_get_val_str(hkey, "RegisteredOwner");
3871 *company = reg_get_val_str(hkey, "RegisteredOrganization");
3877 static void test_publish_registeruser(void)
3883 LPSTR owner, company;
3884 CHAR keypath[MAX_PATH];
3886 static const CHAR keyfmt[] =
3887 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3888 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
3890 if (!get_user_sid(&usersid))
3893 get_owner_company(&owner, &company);
3895 CreateDirectoryA("msitest", NULL);
3896 create_file("msitest\\maximus", 500);
3898 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3900 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3902 /* RegisterUser, per-user */
3903 r = MsiInstallProductA(msifile, "REGISTER_USER=1");
3904 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3905 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3906 ok(delete_pf("msitest", FALSE), "File not installed\n");
3908 sprintf(keypath, keyfmt, usersid);
3910 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
3911 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3913 CHECK_REG_STR(props, "ProductID", "none");
3914 CHECK_REG_STR(props, "RegCompany", company);
3915 CHECK_REG_STR(props, "RegOwner", owner);
3917 RegDeleteValueA(props, "ProductID");
3918 RegDeleteValueA(props, "RegCompany");
3919 RegDeleteValueA(props, "RegOwner");
3920 RegDeleteKeyA(props, "");
3923 /* RegisterUser, machine */
3924 r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
3925 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3926 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3927 ok(delete_pf("msitest", FALSE), "File not installed\n");
3929 sprintf(keypath, keyfmt, "S-1-5-18");
3931 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
3932 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3934 CHECK_REG_STR(props, "ProductID", "none");
3935 CHECK_REG_STR(props, "RegCompany", company);
3936 CHECK_REG_STR(props, "RegOwner", owner);
3938 RegDeleteValueA(props, "ProductID");
3939 RegDeleteValueA(props, "RegCompany");
3940 RegDeleteValueA(props, "RegOwner");
3941 RegDeleteKeyA(props, "");
3944 HeapFree(GetProcessHeap(), 0, company);
3945 HeapFree(GetProcessHeap(), 0, owner);
3947 DeleteFile(msifile);
3948 DeleteFile("msitest\\maximus");
3949 RemoveDirectory("msitest");
3953 static void test_publish_processcomponents(void)
3961 CHAR keypath[MAX_PATH];
3962 CHAR program_files_maximus[MAX_PATH];
3964 static const CHAR keyfmt[] =
3965 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3966 "UserData\\%s\\Components\\%s";
3967 static const CHAR compkey[] =
3968 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
3970 if (!get_user_sid(&usersid))
3973 CreateDirectoryA("msitest", NULL);
3974 create_file("msitest\\maximus", 500);
3976 create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table));
3978 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3980 /* ProcessComponents, per-user */
3981 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3982 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3983 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3984 ok(delete_pf("msitest", FALSE), "File not installed\n");
3986 sprintf(keypath, keyfmt, usersid, "CBABC2FDCCB35E749A8944D8C1C098B5");
3988 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
3989 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3992 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3993 NULL, NULL, (LPBYTE)val, &size);
3994 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3996 lstrcpyA(program_files_maximus,PROG_FILES_DIR);
3997 lstrcatA(program_files_maximus,"\\msitest\\maximus");
3999 ok(!lstrcmpiA(val, program_files_maximus),
4000 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
4002 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4003 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4005 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4006 RegDeleteKeyA(comp, "");
4009 sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
4011 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4012 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4015 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4016 NULL, NULL, (LPBYTE)val, &size);
4017 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4018 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
4019 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
4021 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4022 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4024 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4025 RegDeleteKeyA(comp, "");
4028 /* ProcessComponents, machine */
4029 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
4030 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4031 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4032 ok(delete_pf("msitest", FALSE), "File not installed\n");
4034 sprintf(keypath, keyfmt, "S-1-5-18", "CBABC2FDCCB35E749A8944D8C1C098B5");
4036 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4037 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4040 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4041 NULL, NULL, (LPBYTE)val, &size);
4042 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4043 ok(!lstrcmpiA(val, program_files_maximus),
4044 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
4046 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4047 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4049 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4050 RegDeleteKeyA(comp, "");
4053 sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
4055 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4056 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4059 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4060 NULL, NULL, (LPBYTE)val, &size);
4061 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4062 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
4063 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
4065 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4066 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4068 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4069 RegDeleteKeyA(comp, "");
4072 DeleteFile(msifile);
4073 DeleteFile("msitest\\maximus");
4074 RemoveDirectory("msitest");
4078 static void test_publish(void)
4082 HKEY uninstall, prodkey;
4084 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
4085 char date[MAX_PATH];
4086 char temp[MAX_PATH];
4088 static const CHAR subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
4090 if (!pMsiQueryComponentStateA)
4092 win_skip("MsiQueryComponentStateA is not available\n");
4097 GetTempPath(MAX_PATH, temp);
4099 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, subkey, &uninstall);
4100 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4102 CreateDirectoryA("msitest", NULL);
4103 create_file("msitest\\maximus", 500);
4105 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4107 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4109 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4110 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4112 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4113 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4115 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4116 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4118 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4119 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4120 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4121 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4123 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4124 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4126 /* nothing published */
4127 r = MsiInstallProductA(msifile, NULL);
4128 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4129 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4130 ok(pf_exists("msitest"), "File not installed\n");
4132 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4133 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4135 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4136 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4138 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4139 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4141 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4142 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4143 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4144 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4146 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4147 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4149 /* PublishProduct and RegisterProduct */
4150 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
4151 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4152 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4153 ok(pf_exists("msitest"), "File not installed\n");
4155 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4156 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4158 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4159 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4161 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4162 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4164 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4165 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4166 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
4167 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4169 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4170 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4172 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4173 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4174 CHECK_REG_STR(prodkey, "InstallDate", date);
4175 CHECK_REG_STR(prodkey, "InstallSource", temp);
4176 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4177 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4178 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4179 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4180 CHECK_REG_STR(prodkey, "Comments", NULL);
4181 CHECK_REG_STR(prodkey, "Contact", NULL);
4182 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4183 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4184 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4185 CHECK_REG_STR(prodkey, "Readme", NULL);
4186 CHECK_REG_STR(prodkey, "Size", NULL);
4187 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4188 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4189 CHECK_REG_DWORD(prodkey, "Language", 1033);
4190 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4191 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4192 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4193 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4196 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4199 RegCloseKey(prodkey);
4201 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4203 ok(pf_exists("msitest\\maximus"), "File deleted\n");
4204 ok(pf_exists("msitest"), "File deleted\n");
4206 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4207 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4209 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4210 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4212 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4213 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4215 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4216 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4217 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4218 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4220 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4221 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4223 /* complete install */
4224 r = MsiInstallProductA(msifile, "FULL=1");
4225 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4226 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4227 ok(pf_exists("msitest"), "File not installed\n");
4229 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4230 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4232 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4233 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4235 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4236 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4238 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4239 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4240 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4241 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4243 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4244 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4246 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4247 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4248 CHECK_REG_STR(prodkey, "InstallDate", date);
4249 CHECK_REG_STR(prodkey, "InstallSource", temp);
4250 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4251 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4252 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4253 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4254 CHECK_REG_STR(prodkey, "Comments", NULL);
4255 CHECK_REG_STR(prodkey, "Contact", NULL);
4256 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4257 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4258 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4259 CHECK_REG_STR(prodkey, "Readme", NULL);
4260 CHECK_REG_STR(prodkey, "Size", NULL);
4261 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4262 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4263 CHECK_REG_DWORD(prodkey, "Language", 1033);
4264 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4265 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4266 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4267 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4270 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4273 RegCloseKey(prodkey);
4275 /* no UnpublishFeatures */
4276 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4277 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4278 ok(!pf_exists("msitest\\maximus"), "File deleted\n");
4281 ok(!pf_exists("msitest"), "File deleted\n");
4284 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4285 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4287 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4288 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4290 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4291 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4293 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4294 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4295 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4296 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4298 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4299 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4301 /* complete install */
4302 r = MsiInstallProductA(msifile, "FULL=1");
4303 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4304 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4305 ok(pf_exists("msitest"), "File not installed\n");
4307 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4308 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4310 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4311 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4313 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4314 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4316 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4317 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4318 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4319 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4321 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4322 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4324 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4325 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4326 CHECK_REG_STR(prodkey, "InstallDate", date);
4327 CHECK_REG_STR(prodkey, "InstallSource", temp);
4328 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4329 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4330 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4331 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4332 CHECK_REG_STR(prodkey, "Comments", NULL);
4333 CHECK_REG_STR(prodkey, "Contact", NULL);
4334 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4335 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4336 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4337 CHECK_REG_STR(prodkey, "Readme", NULL);
4338 CHECK_REG_STR(prodkey, "Size", NULL);
4339 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4340 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4341 CHECK_REG_DWORD(prodkey, "Language", 1033);
4342 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4343 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4344 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4345 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4348 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4351 RegCloseKey(prodkey);
4353 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
4354 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
4355 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4356 todo_wine ok(pf_exists("msitest\\maximus"), "File deleted\n");
4357 ok(pf_exists("msitest"), "File deleted\n");
4359 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4360 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4362 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4363 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4365 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4366 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4368 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4369 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4370 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4371 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4373 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4374 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4376 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4377 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4378 CHECK_REG_STR(prodkey, "InstallDate", date);
4379 CHECK_REG_STR(prodkey, "InstallSource", temp);
4380 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4381 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4382 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4383 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4384 CHECK_REG_STR(prodkey, "Comments", NULL);
4385 CHECK_REG_STR(prodkey, "Contact", NULL);
4386 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4387 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4388 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4389 CHECK_REG_STR(prodkey, "Readme", NULL);
4390 CHECK_REG_STR(prodkey, "Size", NULL);
4391 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4392 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4393 CHECK_REG_DWORD(prodkey, "Language", 1033);
4394 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4395 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4396 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4397 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4400 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4403 RegCloseKey(prodkey);
4405 /* complete install */
4406 r = MsiInstallProductA(msifile, "FULL=1");
4407 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4408 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4409 ok(pf_exists("msitest"), "File not installed\n");
4411 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4412 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4414 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4415 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4417 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4418 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4420 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4421 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4422 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4423 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4425 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4426 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4428 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4429 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4430 CHECK_REG_STR(prodkey, "InstallDate", date);
4431 CHECK_REG_STR(prodkey, "InstallSource", temp);
4432 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4433 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4434 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4435 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4436 CHECK_REG_STR(prodkey, "Comments", NULL);
4437 CHECK_REG_STR(prodkey, "Contact", NULL);
4438 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4439 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4440 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4441 CHECK_REG_STR(prodkey, "Readme", NULL);
4442 CHECK_REG_STR(prodkey, "Size", NULL);
4443 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4444 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4445 CHECK_REG_DWORD(prodkey, "Language", 1033);
4446 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4447 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4448 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4449 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4452 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -20);
4455 RegCloseKey(prodkey);
4457 /* UnpublishFeatures, both features removed */
4458 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
4459 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4460 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4463 ok(!pf_exists("msitest"), "File not deleted\n");
4466 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4467 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4469 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4470 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4472 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4473 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4475 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4476 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4477 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4478 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4480 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4481 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4483 /* complete install */
4484 r = MsiInstallProductA(msifile, "FULL=1");
4485 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4486 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4487 ok(pf_exists("msitest"), "File not installed\n");
4489 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4490 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4492 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4493 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4495 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4496 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4498 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4499 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4500 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4501 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4503 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4504 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4506 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4507 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4508 CHECK_REG_STR(prodkey, "InstallDate", date);
4509 CHECK_REG_STR(prodkey, "InstallSource", temp);
4510 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4511 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4512 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4513 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4514 CHECK_REG_STR(prodkey, "Comments", NULL);
4515 CHECK_REG_STR(prodkey, "Contact", NULL);
4516 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4517 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4518 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4519 CHECK_REG_STR(prodkey, "Readme", NULL);
4520 CHECK_REG_STR(prodkey, "Size", NULL);
4521 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4522 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4523 CHECK_REG_DWORD(prodkey, "Language", 1033);
4524 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4525 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4526 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4527 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4530 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4533 RegCloseKey(prodkey);
4535 /* complete uninstall */
4536 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4537 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4538 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4541 ok(!pf_exists("msitest"), "File not deleted\n");
4544 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4545 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4547 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4548 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4550 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4551 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4553 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4554 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4555 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4556 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4558 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4559 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4561 /* make sure 'Program Files\msitest' is removed */
4562 delete_pfmsitest_files();
4564 RegCloseKey(uninstall);
4565 DeleteFile(msifile);
4566 DeleteFile("msitest\\maximus");
4567 RemoveDirectory("msitest");
4570 static void test_publishsourcelist(void)
4574 CHAR value[MAX_PATH];
4575 CHAR path[MAX_PATH];
4576 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
4578 if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
4580 win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
4584 CreateDirectoryA("msitest", NULL);
4585 create_file("msitest\\maximus", 500);
4587 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4589 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4591 r = MsiInstallProductA(msifile, NULL);
4592 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4593 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4594 ok(pf_exists("msitest"), "File not installed\n");
4596 /* nothing published */
4598 lstrcpyA(value, "aaa");
4599 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4600 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4601 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4602 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4603 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4606 lstrcpyA(value, "aaa");
4607 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4608 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4609 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4610 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4611 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4613 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
4614 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4615 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4616 ok(pf_exists("msitest"), "File not installed\n");
4618 /* after RegisterProduct */
4620 lstrcpyA(value, "aaa");
4621 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4622 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4623 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4624 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4625 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4628 lstrcpyA(value, "aaa");
4629 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4630 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4631 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4632 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4633 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4635 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
4636 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4637 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4638 ok(pf_exists("msitest"), "File not installed\n");
4640 /* after ProcessComponents */
4642 lstrcpyA(value, "aaa");
4643 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4644 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4645 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4646 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4647 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4650 lstrcpyA(value, "aaa");
4651 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4652 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4653 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4654 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4655 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4657 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
4658 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4659 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4660 ok(pf_exists("msitest"), "File not installed\n");
4662 /* after PublishFeatures */
4664 lstrcpyA(value, "aaa");
4665 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4666 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4667 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4668 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4669 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4672 lstrcpyA(value, "aaa");
4673 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4674 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4675 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4676 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4677 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4679 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
4680 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4681 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4682 ok(pf_exists("msitest"), "File not installed\n");
4684 /* after PublishProduct */
4686 lstrcpyA(value, "aaa");
4687 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4688 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4689 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4690 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
4691 ok(size == 11, "Expected 11, got %d\n", size);
4694 lstrcpyA(value, "aaa");
4695 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4696 MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATH, value, &size);
4697 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4698 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
4699 ok(size == 0, "Expected 0, got %d\n", size);
4702 lstrcpyA(value, "aaa");
4703 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4704 MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPT, value, &size);
4705 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4706 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
4707 ok(size == 0, "Expected 0, got %d\n", size);
4709 lstrcpyA(path, CURR_DIR);
4710 lstrcatA(path, "\\");
4713 lstrcpyA(value, "aaa");
4714 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4715 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
4716 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4717 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
4718 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
4721 lstrcpyA(value, "aaa");
4722 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4723 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE, value, &size);
4724 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4725 ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
4726 ok(size == 1, "Expected 1, got %d\n", size);
4729 lstrcpyA(value, "aaa");
4730 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4731 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4732 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4733 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
4734 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
4737 lstrcpyA(value, "aaa");
4738 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4739 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
4740 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4741 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
4742 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
4745 lstrcpyA(value, "aaa");
4746 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4747 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
4748 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4749 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
4750 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
4752 /* complete uninstall */
4753 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4754 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4755 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4758 ok(!pf_exists("msitest"), "File not deleted\n");
4761 /* make sure 'Program Files\msitest' is removed */
4762 delete_pfmsitest_files();
4764 DeleteFile(msifile);
4765 DeleteFile("msitest\\maximus");
4766 RemoveDirectory("msitest");
4769 static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
4771 MSIHANDLE hview = 0;
4774 r = MsiDatabaseOpenView(hdb, query, &hview);
4775 if(r != ERROR_SUCCESS)
4778 r = MsiViewExecute(hview, hrec);
4779 if(r == ERROR_SUCCESS)
4780 r = MsiViewClose(hview);
4781 MsiCloseHandle(hview);
4785 static void set_transform_summary_info(void)
4788 MSIHANDLE suminfo = 0;
4790 /* build summary info */
4791 r = MsiGetSummaryInformation(0, mstfile, 3, &suminfo);
4792 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
4794 r = MsiSummaryInfoSetProperty(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
4795 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
4797 r = MsiSummaryInfoSetProperty(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
4798 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
4799 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
4800 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
4801 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
4803 r = MsiSummaryInfoSetProperty(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
4804 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
4806 r = MsiSummaryInfoPersist(suminfo);
4807 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
4809 r = MsiCloseHandle(suminfo);
4810 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
4813 static void generate_transform(void)
4815 MSIHANDLE hdb1, hdb2;
4819 /* start with two identical databases */
4820 CopyFile(msifile, msifile2, FALSE);
4822 r = MsiOpenDatabase(msifile2, MSIDBOPEN_TRANSACT, &hdb1);
4823 ok(r == ERROR_SUCCESS , "Failed to create database\n");
4825 r = MsiDatabaseCommit(hdb1);
4826 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
4828 r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb2);
4829 ok(r == ERROR_SUCCESS , "Failed to create database\n");
4831 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
4832 r = run_query(hdb1, 0, query);
4833 ok(r == ERROR_SUCCESS, "failed to add property\n");
4835 /* database needs to be committed */
4836 MsiDatabaseCommit(hdb1);
4838 r = MsiDatabaseGenerateTransform(hdb1, hdb2, mstfile, 0, 0);
4839 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
4841 #if 0 /* not implemented in wine yet */
4842 r = MsiCreateTransformSummaryInfo(hdb2, hdb2, mstfile, 0, 0);
4843 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4846 MsiCloseHandle(hdb1);
4847 MsiCloseHandle(hdb2);
4850 /* data for generating a transform */
4852 /* tables transform names - encoded as they would be in an msi database file */
4853 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
4854 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
4855 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
4857 /* data in each table */
4858 static const char data1[] = /* _StringData */
4859 "propval"; /* all the strings squashed together */
4861 static const WCHAR data2[] = { /* _StringPool */
4863 0, 0, /* string 0 '' */
4864 4, 1, /* string 1 'prop' */
4865 3, 1, /* string 2 'val' */
4868 static const WCHAR data3[] = { /* Property */
4869 0x0201, 0x0001, 0x0002,
4872 static const struct {
4876 } table_transform_data[] =
4878 { name1, data1, sizeof data1 - 1 },
4879 { name2, data2, sizeof data2 },
4880 { name3, data3, sizeof data3 },
4883 #define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
4885 static void generate_transform_manual(void)
4887 IStorage *stg = NULL;
4892 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
4894 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
4896 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
4898 r = StgCreateDocfile(name, mode, 0, &stg);
4899 ok(r == S_OK, "failed to create storage\n");
4903 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
4904 ok(r == S_OK, "failed to set storage type\n");
4906 for (i=0; i<NUM_TRANSFORM_TABLES; i++)
4908 r = IStorage_CreateStream(stg, table_transform_data[i].name,
4909 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
4912 ok(0, "failed to create stream %08x\n", r);
4916 r = IStream_Write(stm, table_transform_data[i].data,
4917 table_transform_data[i].size, &count);
4918 if (FAILED(r) || count != table_transform_data[i].size)
4919 ok(0, "failed to write stream\n");
4920 IStream_Release(stm);
4923 IStorage_Release(stg);
4925 set_transform_summary_info();
4928 static void test_transformprop(void)
4932 CreateDirectoryA("msitest", NULL);
4933 create_file("msitest\\augustus", 500);
4935 create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
4937 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4939 r = MsiInstallProductA(msifile, NULL);
4940 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4941 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4942 ok(!delete_pf("msitest", FALSE), "File installed\n");
4945 generate_transform();
4947 generate_transform_manual();
4949 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
4950 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4951 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4952 ok(delete_pf("msitest", FALSE), "File not installed\n");
4954 /* Delete the files in the temp (current) folder */
4955 DeleteFile(msifile);
4956 DeleteFile(msifile2);
4957 DeleteFile(mstfile);
4958 DeleteFile("msitest\\augustus");
4959 RemoveDirectory("msitest");
4962 static void test_currentworkingdir(void)
4965 CHAR drive[MAX_PATH], path[MAX_PATH];
4968 CreateDirectoryA("msitest", NULL);
4969 create_file("msitest\\augustus", 500);
4971 create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
4973 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4975 CreateDirectoryA("diffdir", NULL);
4976 SetCurrentDirectoryA("diffdir");
4978 sprintf(path, "..\\%s", msifile);
4979 r = MsiInstallProductA(path, NULL);
4982 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
4983 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4984 ok(!delete_pf("msitest", FALSE), "File installed\n");
4987 sprintf(path, "%s\\%s", CURR_DIR, msifile);
4988 r = MsiInstallProductA(path, NULL);
4989 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4990 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4991 ok(delete_pf("msitest", FALSE), "File not installed\n");
4993 lstrcpyA(drive, CURR_DIR);
4996 SetCurrentDirectoryA(drive);
4998 lstrcpy(path, CURR_DIR);
4999 if (path[lstrlenA(path) - 1] != '\\')
5000 lstrcatA(path, "\\");
5001 lstrcatA(path, msifile);
5002 ptr = strchr(path, ':');
5005 r = MsiInstallProductA(ptr, NULL);
5006 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5007 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5008 ok(delete_pf("msitest", FALSE), "File not installed\n");
5010 SetCurrentDirectoryA(CURR_DIR);
5012 DeleteFile(msifile);
5013 DeleteFile("msitest\\augustus");
5014 RemoveDirectory("msitest");
5015 RemoveDirectory("diffdir");
5018 static void set_admin_summary_info(const CHAR *name)
5020 MSIHANDLE db, summary;
5023 r = MsiOpenDatabaseA(name, MSIDBOPEN_DIRECT, &db);
5024 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5026 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
5027 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5029 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
5030 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5032 /* write the summary changes back to the stream */
5033 r = MsiSummaryInfoPersist(summary);
5034 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5036 MsiCloseHandle(summary);
5038 r = MsiDatabaseCommit(db);
5039 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5044 static void test_admin(void)
5048 CreateDirectoryA("msitest", NULL);
5049 create_file("msitest\\augustus", 500);
5051 create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
5052 set_admin_summary_info(msifile);
5054 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5056 r = MsiInstallProductA(msifile, NULL);
5057 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5058 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5059 ok(!delete_pf("msitest", FALSE), "File installed\n");
5060 ok(!DeleteFile("c:\\msitest\\augustus"), "File installed\n");
5061 ok(!RemoveDirectory("c:\\msitest"), "File installed\n");
5063 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
5064 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5065 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5066 ok(!delete_pf("msitest", FALSE), "File installed\n");
5069 ok(DeleteFile("c:\\msitest\\augustus"), "File not installed\n");
5070 ok(RemoveDirectory("c:\\msitest"), "File not installed\n");
5073 DeleteFile(msifile);
5074 DeleteFile("msitest\\augustus");
5075 RemoveDirectory("msitest");
5078 static void set_admin_property_stream(LPCSTR file)
5082 WCHAR fileW[MAX_PATH];
5085 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
5087 /* AdminProperties */
5088 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
5089 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',' ',
5090 'M','y','P','r','o','p','=','4','2',0};
5092 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
5094 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
5095 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
5099 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
5100 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
5102 hr = IStream_Write(stm, data, sizeof(data), &count);
5103 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
5105 IStream_Release(stm);
5106 IStorage_Release(stg);
5109 static void test_adminprops(void)
5113 CreateDirectoryA("msitest", NULL);
5114 create_file("msitest\\augustus", 500);
5116 create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
5117 set_admin_summary_info(msifile);
5118 set_admin_property_stream(msifile);
5120 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5122 r = MsiInstallProductA(msifile, NULL);
5123 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5124 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
5125 ok(delete_pf("msitest", FALSE), "File installed\n");
5127 DeleteFile(msifile);
5128 DeleteFile("msitest\\augustus");
5129 RemoveDirectory("msitest");
5132 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
5134 CHAR path[MAX_PATH];
5136 lstrcpyA(path, PROG_FILES_DIR);
5137 lstrcatA(path, "\\");
5138 lstrcatA(path, file);
5141 create_file_data(path, data, 500);
5143 CreateDirectoryA(path, NULL);
5146 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
5148 static void test_removefiles(void)
5152 CreateDirectoryA("msitest", NULL);
5153 create_file("msitest\\hydrogen", 500);
5154 create_file("msitest\\helium", 500);
5155 create_file("msitest\\lithium", 500);
5157 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
5159 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
5161 r = MsiInstallProductA(msifile, NULL);
5162 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5163 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5164 ok(!pf_exists("msitest\\helium"), "File installed\n");
5165 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5166 ok(pf_exists("msitest"), "File not installed\n");
5168 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5169 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5170 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
5171 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
5172 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
5173 ok(delete_pf("msitest", FALSE), "File deleted\n");
5175 create_pf("msitest", FALSE);
5176 create_pf("msitest\\hydrogen", TRUE);
5177 create_pf("msitest\\helium", TRUE);
5178 create_pf("msitest\\lithium", TRUE);
5180 r = MsiInstallProductA(msifile, NULL);
5181 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5182 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5183 ok(pf_exists("msitest\\helium"), "File not installed\n");
5184 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5185 ok(pf_exists("msitest"), "File not installed\n");
5187 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5188 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5189 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
5190 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
5191 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
5192 ok(delete_pf("msitest", FALSE), "File deleted\n");
5194 create_pf("msitest", FALSE);
5195 create_pf("msitest\\furlong", TRUE);
5196 create_pf("msitest\\firkin", TRUE);
5197 create_pf("msitest\\fortnight", TRUE);
5198 create_pf("msitest\\becquerel", TRUE);
5199 create_pf("msitest\\dioptre", TRUE);
5200 create_pf("msitest\\attoparsec", TRUE);
5201 create_pf("msitest\\storeys", TRUE);
5202 create_pf("msitest\\block", TRUE);
5203 create_pf("msitest\\siriometer", TRUE);
5204 create_pf("msitest\\cabout", FALSE);
5205 create_pf("msitest\\cabout\\blocker", TRUE);
5207 r = MsiInstallProductA(msifile, NULL);
5208 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5209 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5210 ok(!pf_exists("msitest\\helium"), "File installed\n");
5211 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5212 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
5213 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
5214 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
5215 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
5216 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
5217 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
5218 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
5219 ok(!pf_exists("msitest\\block"), "File not deleted\n");
5220 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
5221 ok(pf_exists("msitest\\cabout"), "Directory removed\n");
5222 ok(pf_exists("msitest"), "File not installed\n");
5224 create_pf("msitest\\furlong", TRUE);
5225 create_pf("msitest\\firkin", TRUE);
5226 create_pf("msitest\\fortnight", TRUE);
5227 create_pf("msitest\\storeys", TRUE);
5228 create_pf("msitest\\block", TRUE);
5229 create_pf("msitest\\siriometer", TRUE);
5231 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5232 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5233 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
5234 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
5235 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
5236 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
5237 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
5238 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
5239 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
5240 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
5241 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
5242 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
5243 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
5244 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
5245 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
5246 ok(pf_exists("msitest"), "Directory deleted\n");
5248 r = MsiInstallProductA(msifile, NULL);
5249 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5250 ok(delete_pf("msitest\\hydrogen", TRUE), "File not installed\n");
5251 ok(!delete_pf("msitest\\helium", TRUE), "File installed\n");
5252 ok(delete_pf("msitest\\lithium", TRUE), "File not installed\n");
5253 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
5254 ok(pf_exists("msitest"), "Directory deleted\n");
5256 delete_pf("msitest\\cabout\\blocker", TRUE);
5258 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5259 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5260 ok(!delete_pf("msitest\\cabout", FALSE), "Directory not deleted\n");
5261 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
5263 DeleteFile(msifile);
5264 DeleteFile("msitest\\hydrogen");
5265 DeleteFile("msitest\\helium");
5266 DeleteFile("msitest\\lithium");
5267 RemoveDirectory("msitest");
5270 static void test_movefiles(void)
5273 char props[MAX_PATH];
5275 CreateDirectoryA("msitest", NULL);
5276 create_file("msitest\\augustus", 100);
5277 create_file("cameroon", 100);
5278 create_file("djibouti", 100);
5279 create_file("egypt", 100);
5280 create_file("finland", 100);
5281 create_file("gambai", 100);
5282 create_file("honduras", 100);
5283 create_file("msitest\\india", 100);
5284 create_file("japan", 100);
5285 create_file("kenya", 100);
5286 CreateDirectoryA("latvia", NULL);
5287 create_file("nauru", 100);
5288 create_file("peru", 100);
5289 create_file("apple", 100);
5290 create_file("application", 100);
5291 create_file("ape", 100);
5292 create_file("foo", 100);
5293 create_file("fao", 100);
5294 create_file("fbod", 100);
5295 create_file("budding", 100);
5296 create_file("buddy", 100);
5297 create_file("bud", 100);
5298 create_file("bar", 100);
5299 create_file("bur", 100);
5300 create_file("bird", 100);
5302 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
5304 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
5306 /* if the source or dest property is not a full path,
5307 * windows tries to access it as a network resource
5310 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
5311 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
5312 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
5314 r = MsiInstallProductA(msifile, props);
5315 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5316 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5317 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
5318 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
5319 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
5320 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
5321 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
5322 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
5323 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
5324 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
5325 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
5326 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
5327 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
5328 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
5329 ok(delete_pf("msitest\\poland", TRUE), "File not moved\n");
5330 /* either apple or application will be moved depending on directory order */
5331 if (!delete_pf("msitest\\apple", TRUE))
5332 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
5334 ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
5335 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
5336 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
5337 /* either fao or foo will be moved depending on directory order */
5338 if (delete_pf("msitest\\foo", TRUE))
5339 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
5341 ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
5342 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
5343 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
5344 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
5345 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
5346 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
5347 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
5348 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
5349 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
5350 ok(delete_pf("msitest", FALSE), "File not installed\n");
5351 ok(DeleteFileA("cameroon"), "File moved\n");
5352 ok(!DeleteFileA("djibouti"), "File not moved\n");
5353 ok(DeleteFileA("egypt"), "File moved\n");
5354 ok(DeleteFileA("finland"), "File moved\n");
5355 ok(DeleteFileA("gambai"), "File moved\n");
5356 ok(!DeleteFileA("honduras"), "File not moved\n");
5357 ok(DeleteFileA("msitest\\india"), "File moved\n");
5358 ok(DeleteFileA("japan"), "File moved\n");
5359 ok(!DeleteFileA("kenya"), "File not moved\n");
5360 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
5361 ok(!DeleteFileA("nauru"), "File not moved\n");
5362 ok(!DeleteFileA("peru"), "File not moved\n");
5363 ok(!DeleteFileA("apple"), "File not moved\n");
5364 ok(!DeleteFileA("application"), "File not moved\n");
5365 ok(DeleteFileA("ape"), "File moved\n");
5366 ok(!DeleteFileA("foo"), "File not moved\n");
5367 ok(!DeleteFileA("fao"), "File not moved\n");
5368 ok(DeleteFileA("fbod"), "File moved\n");
5369 ok(!DeleteFileA("budding"), "File not moved\n");
5370 ok(!DeleteFileA("buddy"), "File not moved\n");
5371 ok(DeleteFileA("bud"), "File moved\n");
5372 ok(!DeleteFileA("bar"), "File not moved\n");
5373 ok(!DeleteFileA("bur"), "File not moved\n");
5374 ok(DeleteFileA("bird"), "File moved\n");
5376 DeleteFile("msitest\\augustus");
5377 RemoveDirectory("msitest");
5378 DeleteFile(msifile);
5381 static void test_missingcab(void)
5385 CreateDirectoryA("msitest", NULL);
5386 create_file("msitest\\augustus", 500);
5387 create_file("maximus", 500);
5389 create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
5391 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5393 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
5395 create_pf("msitest", FALSE);
5396 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
5398 r = MsiInstallProductA(msifile, NULL);
5399 ok(r == ERROR_SUCCESS ||
5400 broken(r == ERROR_INSTALL_FAILURE), /* win9x */
5401 "Expected ERROR_SUCCESS, got %u\n", r);
5402 if (r == ERROR_SUCCESS)
5404 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5405 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
5407 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
5408 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
5409 ok(delete_pf("msitest", FALSE), "File not installed\n");
5411 create_pf("msitest", FALSE);
5412 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
5413 create_pf("msitest\\gaius", TRUE);
5415 r = MsiInstallProductA(msifile, "GAIUS=1");
5416 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5419 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
5420 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5422 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
5423 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
5424 ok(delete_pf("msitest", FALSE), "File not installed\n");
5426 DeleteFile("msitest\\augustus");
5427 RemoveDirectory("msitest");
5428 DeleteFile("maximus");
5429 DeleteFile("test1.cab");
5430 DeleteFile(msifile);
5433 static void test_duplicatefiles(void)
5437 CreateDirectoryA("msitest", NULL);
5438 create_file("msitest\\maximus", 500);
5439 create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
5441 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5443 /* fails if the destination folder is not a valid property */
5445 r = MsiInstallProductA(msifile, NULL);
5446 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5447 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
5448 ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
5449 ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
5450 ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "File not duplicated\n");
5451 ok(delete_pf("msitest\\this\\doesnot", FALSE), "File not duplicated\n");
5452 ok(delete_pf("msitest\\this", FALSE), "File not duplicated\n");
5453 ok(delete_pf("msitest", FALSE), "File not installed\n");
5455 DeleteFile("msitest\\maximus");
5456 RemoveDirectory("msitest");
5457 DeleteFile(msifile);
5460 static void test_writeregistryvalues(void)
5466 CHAR path[MAX_PATH];
5468 CreateDirectoryA("msitest", NULL);
5469 create_file("msitest\\augustus", 500);
5471 create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
5473 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5475 r = MsiInstallProductA(msifile, NULL);
5476 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5477 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
5478 ok(delete_pf("msitest", FALSE), "File installed\n");
5480 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
5481 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5484 type = REG_MULTI_SZ;
5485 memset(path, 'a', MAX_PATH);
5486 res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size);
5487 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5488 ok(!memcmp(path, "one\0two\0three\0\0", size), "Wrong multi-sz data\n");
5489 ok(size == 15, "Expected 15, got %d\n", size);
5490 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5492 DeleteFile(msifile);
5493 DeleteFile("msitest\\augustus");
5494 RemoveDirectory("msitest");
5496 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
5497 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine");
5500 static void test_sourcefolder(void)
5504 CreateDirectoryA("msitest", NULL);
5505 create_file("augustus", 500);
5507 create_database(msifile, sf_tables, sizeof(sf_tables) / sizeof(msi_table));
5509 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5511 r = MsiInstallProductA(msifile, NULL);
5512 ok(r == ERROR_INSTALL_FAILURE,
5513 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5514 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5517 ok(!delete_pf("msitest", FALSE), "File installed\n");
5520 RemoveDirectoryA("msitest");
5522 r = MsiInstallProductA(msifile, NULL);
5523 ok(r == ERROR_INSTALL_FAILURE,
5524 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5525 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5528 ok(!delete_pf("msitest", FALSE), "File installed\n");
5531 DeleteFile(msifile);
5532 DeleteFile("augustus");
5535 static void test_customaction51(void)
5539 CreateDirectoryA("msitest", NULL);
5540 create_file("msitest\\augustus", 500);
5542 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
5544 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5546 r = MsiInstallProductA(msifile, NULL);
5547 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5548 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
5549 ok(delete_pf("msitest", FALSE), "File installed\n");
5551 DeleteFile(msifile);
5552 DeleteFile("msitest\\augustus");
5553 RemoveDirectory("msitest");
5556 static void test_installstate(void)
5560 CreateDirectoryA("msitest", NULL);
5561 create_file("msitest\\alpha", 500);
5562 create_file("msitest\\beta", 500);
5563 create_file("msitest\\gamma", 500);
5564 create_file("msitest\\theta", 500);
5565 create_file("msitest\\delta", 500);
5566 create_file("msitest\\epsilon", 500);
5567 create_file("msitest\\zeta", 500);
5568 create_file("msitest\\iota", 500);
5569 create_file("msitest\\eta", 500);
5570 create_file("msitest\\kappa", 500);
5571 create_file("msitest\\lambda", 500);
5572 create_file("msitest\\mu", 500);
5574 create_database(msifile, is_tables, sizeof(is_tables) / sizeof(msi_table));
5576 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5578 r = MsiInstallProductA(msifile, NULL);
5579 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5580 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
5581 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
5582 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
5583 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
5584 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
5585 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
5586 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
5587 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
5588 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
5589 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
5590 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
5591 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
5592 ok(delete_pf("msitest", FALSE), "File not installed\n");
5594 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
5595 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5596 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
5597 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
5598 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
5599 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
5600 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
5601 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
5602 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
5603 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
5604 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
5605 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
5606 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
5607 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
5608 ok(delete_pf("msitest", FALSE), "File not installed\n");
5610 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
5611 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5612 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
5613 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
5614 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
5615 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
5616 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
5617 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
5618 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
5619 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
5620 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
5621 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
5622 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
5623 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
5624 ok(delete_pf("msitest", FALSE), "File not installed\n");
5626 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
5627 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5628 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
5629 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
5630 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
5631 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
5632 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
5633 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
5634 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
5635 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
5636 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
5637 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
5638 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
5639 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
5640 ok(!delete_pf("msitest", FALSE), "File installed\n");
5642 DeleteFile(msifile);
5643 DeleteFile("msitest\\alpha");
5644 DeleteFile("msitest\\beta");
5645 DeleteFile("msitest\\gamma");
5646 DeleteFile("msitest\\theta");
5647 DeleteFile("msitest\\delta");
5648 DeleteFile("msitest\\epsilon");
5649 DeleteFile("msitest\\zeta");
5650 DeleteFile("msitest\\iota");
5651 DeleteFile("msitest\\eta");
5652 DeleteFile("msitest\\kappa");
5653 DeleteFile("msitest\\lambda");
5654 DeleteFile("msitest\\mu");
5655 RemoveDirectory("msitest");
5658 struct sourcepathmap
5660 BOOL sost; /* shortone\shorttwo */
5661 BOOL solt; /* shortone\longtwo */
5662 BOOL lost; /* longone\shorttwo */
5663 BOOL lolt; /* longone\longtwo */
5664 BOOL soste; /* shortone\shorttwo source exists */
5665 BOOL solte; /* shortone\longtwo source exists */
5666 BOOL loste; /* longone\shorttwo source exists */
5667 BOOL lolte; /* longone\longtwo source exists */
5672 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5673 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5674 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5675 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5676 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5677 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5678 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5679 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5680 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5681 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5682 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5683 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5684 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5685 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5686 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5687 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5688 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5689 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5690 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5691 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5692 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5693 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5694 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5695 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5696 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5697 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5698 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5699 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5700 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5701 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5702 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5703 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5704 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5705 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5706 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5707 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5708 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5709 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5710 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5711 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5712 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5713 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5714 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5715 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5716 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5717 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5718 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5719 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5720 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5721 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5722 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5723 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5724 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5725 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5726 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5727 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5728 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5729 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5730 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5731 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5732 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5733 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5734 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5735 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5736 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5737 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5738 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5739 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5740 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5741 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5742 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5743 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5744 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5745 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5746 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5747 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5748 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5749 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5750 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5751 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5752 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5753 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5754 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5755 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5756 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5757 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5758 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5759 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5760 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5761 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5762 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5763 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5764 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5765 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5766 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5767 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5768 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5769 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5770 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5771 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5772 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5773 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5774 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5775 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5776 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5777 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5778 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5779 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5780 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5781 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5782 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5783 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5784 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5785 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5786 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5787 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5788 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5789 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5790 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5791 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5792 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5793 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5794 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5795 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5796 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5797 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5798 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5799 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5800 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5801 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5802 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5803 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5804 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5805 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5806 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5807 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5808 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5809 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5810 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5811 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5812 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5813 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5814 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5815 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5816 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5817 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5818 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5819 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5820 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5821 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5822 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5823 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5824 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5825 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5826 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5827 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5828 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5829 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5830 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5831 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5832 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5833 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5834 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5835 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5836 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5837 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5838 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5839 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5840 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5841 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5842 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5843 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5844 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5845 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5846 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5847 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5848 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5849 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5850 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5851 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5852 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5853 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5854 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5855 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5856 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5857 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5858 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5859 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5860 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5861 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5862 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5863 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5864 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5865 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5866 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5867 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5868 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5869 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5870 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5871 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5872 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5873 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5874 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5875 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5876 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5877 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5878 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5879 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5880 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5881 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5882 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5883 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5884 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5885 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5886 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5887 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5888 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5889 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5890 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5891 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5892 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5893 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5894 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5895 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5896 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5897 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5898 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5899 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5900 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5901 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5902 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5903 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5904 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5905 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5906 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5907 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5908 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5909 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5910 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5911 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5912 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5913 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5914 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5915 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5916 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5917 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5918 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5919 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5920 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5921 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5922 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5923 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5924 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5925 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5926 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5927 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5930 static DWORD get_pf_file_size(LPCSTR file)
5932 CHAR path[MAX_PATH];
5936 lstrcpyA(path, PROG_FILES_DIR);
5937 lstrcatA(path, "\\");
5938 lstrcatA(path, file);
5940 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
5941 if (hfile == INVALID_HANDLE_VALUE)
5944 size = GetFileSize(hfile, NULL);
5949 static void test_sourcepath(void)
5953 if (!winetest_interactive)
5955 skip("Run in interactive mode to run source path tests.\n");
5959 create_database(msifile, sp_tables, sizeof(sp_tables) / sizeof(msi_table));
5961 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5963 for (i = 0; i < sizeof(spmap) / sizeof(spmap[0]); i++)
5967 CreateDirectoryA("shortone", NULL);
5968 CreateDirectoryA("shortone\\shorttwo", NULL);
5973 CreateDirectoryA("shortone", NULL);
5974 CreateDirectoryA("shortone\\longtwo", NULL);
5979 CreateDirectoryA("longone", NULL);
5980 CreateDirectoryA("longone\\shorttwo", NULL);
5985 CreateDirectoryA("longone", NULL);
5986 CreateDirectoryA("longone\\longtwo", NULL);
5990 create_file("shortone\\shorttwo\\augustus", 50);
5992 create_file("shortone\\longtwo\\augustus", 100);
5994 create_file("longone\\shorttwo\\augustus", 150);
5996 create_file("longone\\longtwo\\augustus", 200);
5998 r = MsiInstallProductA(msifile, NULL);
5999 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
6000 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
6001 "%d: Expected %d, got %d\n", i, spmap[i].size,
6002 get_pf_file_size("msitest\\augustus"));
6004 if (r == ERROR_SUCCESS)
6006 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
6007 ok(delete_pf("msitest", FALSE), "%d: File not installed\n", i);
6011 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
6012 todo_wine ok(!delete_pf("msitest", FALSE), "%d: File installed\n", i);
6015 DeleteFileA("shortone\\shorttwo\\augustus");
6016 DeleteFileA("shortone\\longtwo\\augustus");
6017 DeleteFileA("longone\\shorttwo\\augustus");
6018 DeleteFileA("longone\\longtwo\\augustus");
6019 RemoveDirectoryA("shortone\\shorttwo");
6020 RemoveDirectoryA("shortone\\longtwo");
6021 RemoveDirectoryA("longone\\shorttwo");
6022 RemoveDirectoryA("longone\\longtwo");
6023 RemoveDirectoryA("shortone");
6024 RemoveDirectoryA("longone");
6027 DeleteFileA(msifile);
6030 static void test_MsiConfigureProductEx(void)
6036 CHAR keypath[MAX_PATH * 2];
6037 CHAR localpack[MAX_PATH];
6041 win_skip("Different registry keys on Win9x and WinMe\n");
6045 CreateDirectoryA("msitest", NULL);
6046 create_file("msitest\\hydrogen", 500);
6047 create_file("msitest\\helium", 500);
6048 create_file("msitest\\lithium", 500);
6050 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
6052 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6054 /* NULL szProduct */
6055 r = MsiConfigureProductExA(NULL, INSTALLLEVEL_DEFAULT,
6056 INSTALLSTATE_DEFAULT, "PROPVAR=42");
6057 ok(r == ERROR_INVALID_PARAMETER,
6058 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6060 /* empty szProduct */
6061 r = MsiConfigureProductExA("", INSTALLLEVEL_DEFAULT,
6062 INSTALLSTATE_DEFAULT, "PROPVAR=42");
6063 ok(r == ERROR_INVALID_PARAMETER,
6064 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6066 /* garbage szProduct */
6067 r = MsiConfigureProductExA("garbage", INSTALLLEVEL_DEFAULT,
6068 INSTALLSTATE_DEFAULT, "PROPVAR=42");
6069 ok(r == ERROR_INVALID_PARAMETER,
6070 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6072 /* guid without brackets */
6073 r = MsiConfigureProductExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
6074 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6076 ok(r == ERROR_INVALID_PARAMETER,
6077 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6079 /* guid with brackets */
6080 r = MsiConfigureProductExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
6081 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6083 ok(r == ERROR_UNKNOWN_PRODUCT,
6084 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
6086 /* same length as guid, but random */
6087 r = MsiConfigureProductExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93",
6088 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6090 ok(r == ERROR_UNKNOWN_PRODUCT,
6091 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
6093 /* product not installed yet */
6094 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6095 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6097 ok(r == ERROR_UNKNOWN_PRODUCT,
6098 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
6100 /* install the product, per-user unmanaged */
6101 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
6102 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6103 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6104 ok(pf_exists("msitest\\helium"), "File not installed\n");
6105 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6106 ok(pf_exists("msitest"), "File not installed\n");
6108 /* product is installed per-user managed, remove it */
6109 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6110 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6112 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6113 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6114 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6115 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6118 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6121 /* product has been removed */
6122 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6123 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6125 ok(r == ERROR_UNKNOWN_PRODUCT,
6126 "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
6128 /* install the product, machine */
6129 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6130 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6131 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6132 ok(pf_exists("msitest\\helium"), "File not installed\n");
6133 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6134 ok(pf_exists("msitest"), "File not installed\n");
6136 /* product is installed machine, remove it */
6137 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6138 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6140 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6141 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6142 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6143 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6146 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6149 /* product has been removed */
6150 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6151 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6153 ok(r == ERROR_UNKNOWN_PRODUCT,
6154 "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
6156 /* install the product, machine */
6157 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6158 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6159 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6160 ok(pf_exists("msitest\\helium"), "File not installed\n");
6161 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6162 ok(pf_exists("msitest"), "File not installed\n");
6164 DeleteFileA(msifile);
6166 /* local msifile is removed */
6167 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6168 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6170 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6171 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6172 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6173 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6176 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6179 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
6181 /* install the product, machine */
6182 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6183 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6184 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6185 ok(pf_exists("msitest\\helium"), "File not installed\n");
6186 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6187 ok(pf_exists("msitest"), "File not installed\n");
6189 DeleteFileA(msifile);
6191 lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
6192 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
6193 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties");
6195 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
6196 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6198 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
6199 (const BYTE *)"C:\\idontexist.msi", 18);
6200 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6202 /* LocalPackage is used to find the cached msi package */
6203 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6204 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6206 ok(r == ERROR_INSTALL_SOURCE_ABSENT,
6207 "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
6208 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6209 ok(pf_exists("msitest\\helium"), "File not installed\n");
6210 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6211 ok(pf_exists("msitest"), "File not installed\n");
6214 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
6216 /* LastUsedSource (local msi package) can be used as a last resort */
6217 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6218 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6220 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6221 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6222 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6223 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6226 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6229 /* install the product, machine */
6230 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6231 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6232 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6233 ok(pf_exists("msitest\\helium"), "File not installed\n");
6234 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6235 ok(pf_exists("msitest"), "File not installed\n");
6237 lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
6238 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
6239 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties");
6241 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
6242 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6244 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
6245 (const BYTE *)"C:\\idontexist.msi", 18);
6246 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6248 lstrcpyA(keypath, "SOFTWARE\\Classes\\Installer\\Products\\");
6249 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\SourceList");
6251 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &source);
6252 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6256 res = RegQueryValueExA(source, "PackageName", NULL, &type,
6257 (LPBYTE)localpack, &size);
6258 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6260 res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
6261 (const BYTE *)"idontexist.msi", 15);
6262 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6264 /* SourceList is altered */
6265 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6266 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6268 ok(r == ERROR_INSTALL_SOURCE_ABSENT,
6269 "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
6270 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6271 ok(pf_exists("msitest\\helium"), "File not installed\n");
6272 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6273 ok(pf_exists("msitest"), "File not installed\n");
6275 /* restore the SourceList */
6276 res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
6277 (const BYTE *)localpack, lstrlenA(localpack) + 1);
6278 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6280 /* finally remove the product */
6281 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6282 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6284 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6285 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6286 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6287 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6290 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6293 DeleteFileA(msifile);
6294 RegCloseKey(source);
6296 DeleteFileA("msitest\\hydrogen");
6297 DeleteFileA("msitest\\helium");
6298 DeleteFileA("msitest\\lithium");
6299 RemoveDirectoryA("msitest");
6302 static void test_missingcomponent(void)
6306 CreateDirectoryA("msitest", NULL);
6307 create_file("msitest\\hydrogen", 500);
6308 create_file("msitest\\helium", 500);
6309 create_file("msitest\\lithium", 500);
6310 create_file("beryllium", 500);
6312 create_database(msifile, mcomp_tables, sizeof(mcomp_tables) / sizeof(msi_table));
6314 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6316 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
6317 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6318 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6319 ok(pf_exists("msitest\\helium"), "File not installed\n");
6320 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6321 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
6322 ok(pf_exists("msitest"), "File not installed\n");
6324 r = MsiInstallProductA(msifile, "REMOVE=ALL INSTALLLEVEL=10 PROPVAR=42");
6325 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6326 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6327 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6328 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6329 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
6332 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6335 DeleteFileA(msifile);
6336 DeleteFileA("msitest\\hydrogen");
6337 DeleteFileA("msitest\\helium");
6338 DeleteFileA("msitest\\lithium");
6339 DeleteFileA("beryllium");
6340 RemoveDirectoryA("msitest");
6343 static void test_sourcedirprop(void)
6346 CHAR props[MAX_PATH];
6348 CreateDirectoryA("msitest", NULL);
6349 create_file("msitest\\augustus", 500);
6351 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
6353 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6355 r = MsiInstallProductA(msifile, NULL);
6356 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6357 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
6358 ok(delete_pf("msitest", FALSE), "File installed\n");
6360 DeleteFile("msitest\\augustus");
6361 RemoveDirectory("msitest");
6363 CreateDirectoryA("altsource", NULL);
6364 CreateDirectoryA("altsource\\msitest", NULL);
6365 create_file("altsource\\msitest\\augustus", 500);
6367 sprintf(props, "SRCDIR=%s\\altsource\\", CURR_DIR);
6369 r = MsiInstallProductA(msifile, props);
6370 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6371 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
6372 ok(delete_pf("msitest", FALSE), "File installed\n");
6374 DeleteFile(msifile);
6375 DeleteFile("altsource\\msitest\\augustus");
6376 RemoveDirectory("altsource\\msitest");
6377 RemoveDirectory("altsource");
6380 static void test_adminimage(void)
6384 CreateDirectoryA("msitest", NULL);
6385 CreateDirectoryA("msitest\\first", NULL);
6386 CreateDirectoryA("msitest\\second", NULL);
6387 CreateDirectoryA("msitest\\cabout", NULL);
6388 CreateDirectoryA("msitest\\cabout\\new", NULL);
6389 create_file("msitest\\one.txt", 100);
6390 create_file("msitest\\first\\two.txt", 100);
6391 create_file("msitest\\second\\three.txt", 100);
6392 create_file("msitest\\cabout\\four.txt", 100);
6393 create_file("msitest\\cabout\\new\\five.txt", 100);
6394 create_file("msitest\\filename", 100);
6395 create_file("msitest\\service.exe", 100);
6397 create_database_wordcount(msifile, ai_tables,
6398 sizeof(ai_tables) / sizeof(msi_table),
6399 msidbSumInfoSourceTypeAdminImage);
6401 r = MsiInstallProductA(msifile, NULL);
6402 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6404 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
6405 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
6406 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
6407 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
6408 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
6409 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
6410 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
6411 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
6412 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
6413 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
6414 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
6415 ok(delete_pf("msitest", FALSE), "File not installed\n");
6417 DeleteFileA("msitest.msi");
6418 DeleteFileA("msitest\\cabout\\new\\five.txt");
6419 DeleteFileA("msitest\\cabout\\four.txt");
6420 DeleteFileA("msitest\\second\\three.txt");
6421 DeleteFileA("msitest\\first\\two.txt");
6422 DeleteFileA("msitest\\one.txt");
6423 DeleteFileA("msitest\\service.exe");
6424 DeleteFileA("msitest\\filename");
6425 RemoveDirectoryA("msitest\\cabout\\new");
6426 RemoveDirectoryA("msitest\\cabout");
6427 RemoveDirectoryA("msitest\\second");
6428 RemoveDirectoryA("msitest\\first");
6429 RemoveDirectoryA("msitest");
6432 static void test_propcase(void)
6436 CreateDirectoryA("msitest", NULL);
6437 create_file("msitest\\augustus", 500);
6439 create_database(msifile, pc_tables, sizeof(pc_tables) / sizeof(msi_table));
6441 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6443 r = MsiInstallProductA(msifile, "MyProp=42");
6444 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6445 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
6446 ok(delete_pf("msitest", FALSE), "File not installed\n");
6448 DeleteFile(msifile);
6449 DeleteFile("msitest\\augustus");
6450 RemoveDirectory("msitest");
6453 static void test_int_widths( void )
6455 static const char int0[] = "int0\ni0\nint0\tint0\n1";
6456 static const char int1[] = "int1\ni1\nint1\tint1\n1";
6457 static const char int2[] = "int2\ni2\nint2\tint2\n1";
6458 static const char int3[] = "int3\ni3\nint3\tint3\n1";
6459 static const char int4[] = "int4\ni4\nint4\tint4\n1";
6460 static const char int5[] = "int5\ni5\nint5\tint5\n1";
6461 static const char int8[] = "int8\ni8\nint8\tint8\n1";
6471 { int0, sizeof(int0) - 1, ERROR_SUCCESS },
6472 { int1, sizeof(int1) - 1, ERROR_SUCCESS },
6473 { int2, sizeof(int2) - 1, ERROR_SUCCESS },
6474 { int3, sizeof(int3) - 1, ERROR_FUNCTION_FAILED },
6475 { int4, sizeof(int4) - 1, ERROR_SUCCESS },
6476 { int5, sizeof(int5) - 1, ERROR_FUNCTION_FAILED },
6477 { int8, sizeof(int8) - 1, ERROR_FUNCTION_FAILED }
6480 char tmpdir[MAX_PATH], msitable[MAX_PATH], msidb[MAX_PATH];
6484 GetTempPathA(MAX_PATH, tmpdir);
6485 CreateDirectoryA(tmpdir, NULL);
6487 strcpy(msitable, tmpdir);
6488 strcat(msitable, "\\msitable.idt");
6490 strcpy(msidb, tmpdir);
6491 strcat(msidb, "\\msitest.msi");
6493 r = MsiOpenDatabaseA(msidb, MSIDBOPEN_CREATE, &db);
6494 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6496 for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
6498 write_file(msitable, tests[i].data, tests[i].size);
6500 r = MsiDatabaseImportA(db, tmpdir, "msitable.idt");
6501 ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r);
6503 r = MsiDatabaseCommit(db);
6504 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6505 DeleteFileA(msitable);
6510 RemoveDirectoryA(tmpdir);
6513 static void test_shortcut(void)
6518 create_test_files();
6519 create_database(msifile, sc_tables, sizeof(sc_tables) / sizeof(msi_table));
6521 r = MsiInstallProductA(msifile, NULL);
6522 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6524 hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
6525 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
6527 r = MsiInstallProductA(msifile, NULL);
6528 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6532 hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
6533 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
6535 r = MsiInstallProductA(msifile, NULL);
6536 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6540 delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
6541 delete_pf("msitest\\cabout\\new", FALSE);
6542 delete_pf("msitest\\cabout\\four.txt", TRUE);
6543 delete_pf("msitest\\cabout", FALSE);
6544 delete_pf("msitest\\changed\\three.txt", TRUE);
6545 delete_pf("msitest\\changed", FALSE);
6546 delete_pf("msitest\\first\\two.txt", TRUE);
6547 delete_pf("msitest\\first", FALSE);
6548 delete_pf("msitest\\filename", TRUE);
6549 delete_pf("msitest\\one.txt", TRUE);
6550 delete_pf("msitest\\service.exe", TRUE);
6551 delete_pf("msitest\\Shortcut.lnk", TRUE);
6552 delete_pf("msitest", FALSE);
6553 delete_test_files();
6556 static void test_envvar(void)
6566 win_skip("Environment variables are handled differently on Win9x and WinMe\n");
6570 create_test_files();
6571 create_database(msifile, env_tables, sizeof(env_tables) / sizeof(msi_table));
6573 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Environment", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &env, NULL);
6574 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6576 res = RegSetValueExA(env, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"0", 2);
6577 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6579 res = RegSetValueExA(env, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"0", 2);
6580 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6582 r = MsiInstallProductA(msifile, NULL);
6583 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6586 size = sizeof(buffer);
6588 res = RegQueryValueExA(env, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
6589 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6590 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
6591 ok(!lstrcmp(buffer, "1"), "Expected \"1\", got %s\n", buffer);
6593 res = RegDeleteValueA(env, "MSITESTVAR1");
6594 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6597 size = sizeof(buffer);
6599 res = RegQueryValueExA(env, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
6600 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6601 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
6602 ok(!lstrcmp(buffer, "1"), "Expected \"1\", got %s\n", buffer);
6604 res = RegDeleteValueA(env, "MSITESTVAR2");
6605 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6607 res = RegDeleteValueA(env, "MSITESTVAR3");
6608 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6610 res = RegDeleteValueA(env, "MSITESTVAR4");
6611 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6615 delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
6616 delete_pf("msitest\\cabout\\new", FALSE);
6617 delete_pf("msitest\\cabout\\four.txt", TRUE);
6618 delete_pf("msitest\\cabout", FALSE);
6619 delete_pf("msitest\\changed\\three.txt", TRUE);
6620 delete_pf("msitest\\changed", FALSE);
6621 delete_pf("msitest\\first\\two.txt", TRUE);
6622 delete_pf("msitest\\first", FALSE);
6623 delete_pf("msitest\\filename", TRUE);
6624 delete_pf("msitest\\one.txt", TRUE);
6625 delete_pf("msitest\\service.exe", TRUE);
6626 delete_pf("msitest", FALSE);
6627 delete_test_files();
6630 static void test_preselected(void)
6634 create_test_files();
6635 create_database(msifile, ps_tables, sizeof(ps_tables) / sizeof(msi_table));
6637 r = MsiInstallProductA(msifile, "ADDLOCAL=One");
6638 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6640 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
6641 ok(!delete_pf("msitest\\cabout\\new", FALSE), "File installed\n");
6642 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
6643 ok(!delete_pf("msitest\\cabout", FALSE), "File installed\n");
6644 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
6645 ok(!delete_pf("msitest\\changed", FALSE), "File installed\n");
6646 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
6647 ok(!delete_pf("msitest\\first", FALSE), "File installed\n");
6648 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
6649 todo_wine ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
6650 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
6651 todo_wine ok(delete_pf("msitest", FALSE), "File not installed\n");
6653 r = MsiInstallProductA(msifile, NULL);
6654 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6656 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
6657 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
6658 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
6659 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
6660 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
6661 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
6662 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
6663 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
6664 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
6665 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
6666 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
6667 ok(delete_pf("msitest", FALSE), "File not installed\n");
6668 delete_test_files();
6671 static void test_installed_prop(void)
6673 static char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}";
6676 create_test_files();
6677 create_database(msifile, ip_tables, sizeof(ip_tables) / sizeof(msi_table));
6679 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6681 r = MsiInstallProductA(msifile, "FULL=1");
6682 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6684 r = MsiInstallProductA(msifile, "FULL=1");
6685 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
6687 r = MsiConfigureProductExA(prodcode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, "FULL=1");
6688 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
6690 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
6691 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
6692 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
6693 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
6694 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
6695 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
6696 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
6697 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
6698 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
6699 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
6700 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
6701 ok(delete_pf("msitest", FALSE), "File not installed\n");
6703 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6704 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6706 delete_test_files();
6709 static char session_manager[] = "System\\CurrentControlSet\\Control\\Session Manager";
6710 static char rename_ops[] = "PendingFileRenameOperations";
6712 static void process_pending_renames(HKEY hkey)
6714 char *buf, *src, *dst;
6718 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size);
6719 buf = HeapAlloc(GetProcessHeap(), 0, size);
6722 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size);
6723 ok(!ret, "RegQueryValueExA failed %d (%u)\n", ret, GetLastError());
6724 ok(strstr(buf, "msitest\\maximus") != NULL, "Unexpected value \"%s\"\n", buf);
6726 for (src = buf; *src; src = dst + strlen(dst) + 1)
6728 DWORD flags = MOVEFILE_COPY_ALLOWED;
6730 dst = src + strlen(src) + 1;
6733 flags |= MOVEFILE_REPLACE_EXISTING;
6736 if (src[0] == '\\' && src[1] == '?' && src[2] == '?' && src[3] == '\\') src += 4;
6739 if (dst[0] == '\\' && dst[1] == '?' && dst[2] == '?' && dst[3] == '\\') dst += 4;
6740 ok(MoveFileExA(src, dst, flags), "Failed to move file %s -> %s (%u)\n", src, dst, GetLastError());
6743 ok(DeleteFileA(src), "Failed to delete file %s (%u)\n", src, GetLastError());
6745 HeapFree(GetProcessHeap(), 0, buf);
6746 RegDeleteValueA(hkey, rename_ops);
6749 static BOOL file_matches_data(LPCSTR file, LPCSTR data)
6751 DWORD len, data_len = strlen(data);
6755 handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
6756 ok(handle != INVALID_HANDLE_VALUE, "failed to open %s (%u)\n", file, GetLastError());
6758 if (ReadFile(handle, buf, sizeof(buf), &len, NULL) && len >= data_len)
6760 CloseHandle(handle);
6761 return !memcmp(buf, data, data_len);
6763 CloseHandle(handle);
6767 static void test_file_in_use(void)
6773 char path[MAX_PATH];
6777 win_skip("Pending file renaming is implemented differently on Win9x and WinMe\n");
6781 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
6782 if (!RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size))
6784 skip("Pending file rename operations, skipping test\n");
6788 CreateDirectoryA("msitest", NULL);
6789 create_file("msitest\\maximus", 500);
6790 create_database(msifile, fiu_tables, sizeof(fiu_tables) / sizeof(msi_table));
6792 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6794 lstrcpy(path, PROG_FILES_DIR);
6795 lstrcat(path, "\\msitest");
6796 CreateDirectoryA(path, NULL);
6798 lstrcat(path, "\\maximus");
6799 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
6801 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
6802 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
6803 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
6805 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
6807 process_pending_renames(hkey);
6810 ok(file_matches_data(path, "msitest\\maximus"), "Expected file to match\n");
6811 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
6812 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
6814 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6815 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6817 delete_test_files();
6820 static void test_file_in_use_cab(void)
6826 char path[MAX_PATH];
6830 win_skip("Pending file renaming is implemented differently on Win9x and WinMe\n");
6834 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
6835 if (!RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size))
6837 skip("Pending file rename operations, skipping test\n");
6841 CreateDirectoryA("msitest", NULL);
6842 create_file("maximus", 500);
6843 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
6844 DeleteFile("maximus");
6846 create_database(msifile, fiuc_tables, sizeof(fiuc_tables) / sizeof(msi_table));
6848 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6850 lstrcpy(path, PROG_FILES_DIR);
6851 lstrcat(path, "\\msitest");
6852 CreateDirectoryA(path, NULL);
6854 lstrcat(path, "\\maximus");
6855 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
6857 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
6858 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
6859 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
6861 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
6863 process_pending_renames(hkey);
6866 ok(file_matches_data(path, "maximus"), "Expected file to match\n");
6867 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
6868 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
6870 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6871 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6874 delete_test_files();
6877 static INT CALLBACK handler_a(LPVOID context, UINT type, LPCSTR msg)
6882 static INT CALLBACK handler_w(LPVOID context, UINT type, LPCWSTR msg)
6887 static INT CALLBACK handler_record(LPVOID context, UINT type, MSIHANDLE record)
6892 static void test_MsiSetExternalUI(void)
6894 INSTALLUI_HANDLERA ret_a;
6895 INSTALLUI_HANDLERW ret_w;
6896 INSTALLUI_HANDLER_RECORD prev;
6899 ret_a = MsiSetExternalUIA(handler_a, INSTALLLOGMODE_ERROR, NULL);
6900 ok(ret_a == NULL, "expected NULL, got %p\n", ret_a);
6902 ret_a = MsiSetExternalUIA(NULL, 0, NULL);
6903 ok(ret_a == handler_a, "expected %p, got %p\n", handler_a, ret_a);
6905 /* Not present before Installer 3.1 */
6906 if (!pMsiSetExternalUIRecord) {
6907 win_skip("MsiSetExternalUIRecord is not available\n");
6911 error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev);
6912 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
6913 ok(prev == NULL, "expected NULL, got %p\n", prev);
6915 prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
6916 error = pMsiSetExternalUIRecord(NULL, INSTALLLOGMODE_ERROR, NULL, &prev);
6917 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
6918 ok(prev == handler_record, "expected %p, got %p\n", handler_record, prev);
6920 ret_w = MsiSetExternalUIW(handler_w, INSTALLLOGMODE_ERROR, NULL);
6921 ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
6923 ret_w = MsiSetExternalUIW(NULL, 0, NULL);
6924 ok(ret_w == handler_w, "expected %p, got %p\n", handler_w, ret_w);
6926 ret_a = MsiSetExternalUIA(handler_a, INSTALLLOGMODE_ERROR, NULL);
6927 ok(ret_a == NULL, "expected NULL, got %p\n", ret_a);
6929 ret_w = MsiSetExternalUIW(handler_w, INSTALLLOGMODE_ERROR, NULL);
6930 ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
6932 prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
6933 error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev);
6934 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
6935 ok(prev == NULL, "expected NULL, got %p\n", prev);
6937 ret_a = MsiSetExternalUIA(NULL, 0, NULL);
6938 ok(ret_a == NULL, "expected NULL, got %p\n", ret_a);
6940 ret_w = MsiSetExternalUIW(NULL, 0, NULL);
6941 ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
6943 prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
6944 error = pMsiSetExternalUIRecord(NULL, 0, NULL, &prev);
6945 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
6946 ok(prev == handler_record, "expected %p, got %p\n", handler_record, prev);
6948 error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, NULL);
6949 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
6951 error = pMsiSetExternalUIRecord(NULL, 0, NULL, NULL);
6952 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
6958 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6959 STATEMGRSTATUS status;
6962 init_functionpointers();
6964 on_win9x = check_win9x();
6966 GetCurrentDirectoryA(MAX_PATH, prev_path);
6967 GetTempPath(MAX_PATH, temp_path);
6968 SetCurrentDirectoryA(temp_path);
6970 lstrcpyA(CURR_DIR, temp_path);
6971 len = lstrlenA(CURR_DIR);
6973 if(len && (CURR_DIR[len - 1] == '\\'))
6974 CURR_DIR[len - 1] = 0;
6976 get_program_files_dir(PROG_FILES_DIR, COMMON_FILES_DIR);
6978 /* Create a restore point ourselves so we circumvent the multitude of restore points
6979 * that would have been created by all the installation and removal tests.
6981 if (pSRSetRestorePointA)
6983 memset(&status, 0, sizeof(status));
6984 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
6987 /* Create only one log file and don't append. We have to pass something
6988 * for the log mode for this to work. The logfile needs to have an absolute
6989 * path otherwise we still end up with some extra logfiles as some tests
6990 * change the current directory.
6992 lstrcpyA(log_file, temp_path);
6993 lstrcatA(log_file, "\\msitest.log");
6994 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
6996 test_MsiInstallProduct();
6997 test_MsiSetComponentState();
6998 test_packagecoltypes();
6999 test_continuouscabs();
7002 test_samesequence();
7003 test_uiLevelFlags();
7004 test_readonlyfile();
7005 test_readonlyfile_cab();
7006 test_setdirproperty();
7007 test_cabisextracted();
7008 test_concurrentinstall();
7009 test_setpropertyfolder();
7010 test_publish_registerproduct();
7011 test_publish_publishproduct();
7012 test_publish_publishfeatures();
7013 test_publish_registeruser();
7014 test_publish_processcomponents();
7016 test_publishsourcelist();
7017 test_transformprop();
7018 test_currentworkingdir();
7024 test_duplicatefiles();
7025 test_writeregistryvalues();
7026 test_sourcefolder();
7027 test_customaction51();
7028 test_installstate();
7030 test_MsiConfigureProductEx();
7031 test_missingcomponent();
7032 test_sourcedirprop();
7038 test_lastusedsource();
7040 test_installed_prop();
7042 test_file_in_use_cab();
7043 test_MsiSetExternalUI();
7045 DeleteFileA(log_file);
7047 if (pSRSetRestorePointA && ret)
7049 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
7051 remove_restore_point(status.llSequenceNumber);
7053 FreeLibrary(hsrclient);
7055 SetCurrentDirectoryA(prev_path);