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
31 #include "wine/test.h"
33 static const char *msifile
= "msitest.msi";
34 CHAR CURR_DIR
[MAX_PATH
];
35 CHAR PROG_FILES_DIR
[MAX_PATH
];
37 /* msi database data */
39 static const CHAR component_dat
[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
40 "s72\tS38\ts72\ti2\tS255\tS72\n"
41 "Component\tComponent\n"
42 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
43 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
44 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\t\tone.txt\n"
45 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
46 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
47 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
48 "component\t\tMSITESTDIR\t0\t1\tfile\n"
49 "service_comp\t\tMSITESTDIR\t0\t1\tservice_file";
51 static const CHAR directory_dat
[] = "Directory\tDirectory_Parent\tDefaultDir\n"
53 "Directory\tDirectory\n"
54 "CABOUTDIR\tMSITESTDIR\tcabout\n"
55 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
56 "FIRSTDIR\tMSITESTDIR\tfirst\n"
57 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
58 "NEWDIR\tCABOUTDIR\tnew\n"
59 "ProgramFilesFolder\tTARGETDIR\t.\n"
60 "TARGETDIR\t\tSourceDir";
62 static const CHAR feature_dat
[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
63 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
65 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
66 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
67 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
68 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
69 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
70 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
71 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
73 static const CHAR feature_comp_dat
[] = "Feature_\tComponent_\n"
75 "FeatureComponents\tFeature_\tComponent_\n"
81 "feature\tcomponent\n"
82 "service_feature\tservice_comp\n";
84 static const CHAR file_dat
[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
85 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
87 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
88 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
89 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
90 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
91 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
92 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
93 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
95 static const CHAR install_exec_seq_dat
[] = "Action\tCondition\tSequence\n"
97 "InstallExecuteSequence\tAction\n"
98 "AllocateRegistrySpace\tNOT Installed\t1550\n"
99 "CostFinalize\t\t1000\n"
100 "CostInitialize\t\t800\n"
102 "InstallFiles\t\t4000\n"
103 "InstallServices\t\t5000\n"
104 "InstallFinalize\t\t6600\n"
105 "InstallInitialize\t\t1500\n"
106 "InstallValidate\t\t1400\n"
107 "LaunchConditions\t\t100\n"
108 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
110 static const CHAR media_dat
[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
111 "i2\ti4\tL64\tS255\tS32\tS72\n"
113 "1\t3\t\t\tDISK1\t\n"
114 "2\t5\t\tmsitest.cab\tDISK2\t\n";
116 static const CHAR property_dat
[] = "Property\tValue\n"
118 "Property\tProperty\n"
119 "DefaultUIFont\tDlgFont8\n"
122 "InstallMode\tTypical\n"
123 "Manufacturer\tWine\n"
124 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
125 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
127 "ProductLanguage\t1033\n"
128 "ProductName\tMSITEST\n"
129 "ProductVersion\t1.1.1\n"
130 "PROMPTROLLBACKCOST\tP\n"
132 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}";
134 static const CHAR registry_dat
[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
135 "s72\ti2\tl255\tL255\tL0\ts72\n"
136 "Registry\tRegistry\n"
137 "Apples\t2\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
138 "Oranges\t2\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
139 "regdata\t2\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
140 "OrderTest\t2\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
142 static const CHAR service_install_dat
[] = "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
143 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
144 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
145 "ServiceInstall\tServiceInstall\n"
146 "TestService\tTestService\tTestService\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\t";
148 static const CHAR service_control_dat
[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
149 "s72\tl255\ti2\tL255\tI2\ts72\n"
150 "ServiceControl\tServiceControl\n"
151 "ServiceControl\tTestService\t8\t\t0\tservice_comp";
153 /* tables for test_continuouscabs */
154 static const CHAR cc_component_dat
[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
155 "s72\tS38\ts72\ti2\tS255\tS72\n"
156 "Component\tComponent\n"
157 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
158 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
159 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
161 static const CHAR cc_feature_dat
[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
162 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
164 "feature\t\t\t\t2\t1\tTARGETDIR\t0";
166 static const CHAR cc_feature_comp_dat
[] = "Feature_\tComponent_\n"
168 "FeatureComponents\tFeature_\tComponent_\n"
170 "feature\taugustus\n"
173 static const CHAR cc_file_dat
[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
174 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
176 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
177 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
178 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
180 static const CHAR cc_media_dat
[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
181 "i2\ti4\tL64\tS255\tS32\tS72\n"
183 "1\t10\t\ttest1.cab\tDISK1\t\n"
184 "2\t2\t\ttest2.cab\tDISK2\t\n"
185 "3\t12\t\ttest3.cab\tDISK3\t\n";
187 static const CHAR co_file_dat
[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
188 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
190 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
191 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
192 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
194 static const CHAR co_media_dat
[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
195 "i2\ti4\tL64\tS255\tS32\tS72\n"
197 "1\t10\t\ttest1.cab\tDISK1\t\n"
198 "2\t2\t\ttest2.cab\tDISK2\t\n"
199 "3\t3\t\ttest3.cab\tDISK3\t\n";
201 static const CHAR co2_media_dat
[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
202 "i2\ti4\tL64\tS255\tS32\tS72\n"
204 "1\t10\t\ttest1.cab\tDISK1\t\n"
205 "2\t12\t\ttest3.cab\tDISK3\t\n"
206 "3\t2\t\ttest2.cab\tDISK2\t\n";
208 static const CHAR mm_file_dat
[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
209 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
211 "maximus\tmaximus\tmaximus\t500\t\t\t512\t1\n"
212 "augustus\taugustus\taugustus\t500\t\t\t512\t2\n"
213 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
215 static const CHAR mm_media_dat
[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
216 "i2\ti4\tL64\tS255\tS32\tS72\n"
218 "1\t3\t\ttest1.cab\tDISK1\t\n";
220 static const CHAR ss_media_dat
[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
221 "i2\ti4\tL64\tS255\tS32\tS72\n"
223 "1\t2\t\ttest1.cab\tDISK1\t\n"
224 "2\t2\t\ttest2.cab\tDISK2\t\n"
225 "3\t12\t\ttest3.cab\tDISK3\t\n";
227 /* tables for test_uiLevelFlags */
228 static const CHAR ui_component_dat
[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
229 "s72\tS38\ts72\ti2\tS255\tS72\n"
230 "Component\tComponent\n"
231 "maximus\t\tMSITESTDIR\t0\tHASUIRUN=1\tmaximus\n"
232 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
233 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
235 static const CHAR ui_install_ui_seq_dat
[] = "Action\tCondition\tSequence\n"
237 "InstallUISequence\tAction\n"
238 "SetUIProperty\t\t5\n"
239 "ExecuteAction\t\t1100\n";
241 static const CHAR ui_custom_action_dat
[] = "Action\tType\tSource\tTarget\tISComments\n"
242 "s72\ti2\tS64\tS0\tS255\n"
243 "CustomAction\tAction\n"
244 "SetUIProperty\t51\tHASUIRUN\t1\t\n";
246 static const CHAR rof_component_dat
[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
247 "s72\tS38\ts72\ti2\tS255\tS72\n"
248 "Component\tComponent\n"
249 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
251 static const CHAR rof_feature_dat
[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
252 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
254 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
255 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
257 static const CHAR rof_feature_comp_dat
[] = "Feature_\tComponent_\n"
259 "FeatureComponents\tFeature_\tComponent_\n"
261 "montecristo\tmaximus";
263 static const CHAR rof_file_dat
[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
264 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
266 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
268 static const CHAR rof_media_dat
[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
269 "i2\ti4\tL64\tS255\tS32\tS72\n"
271 "1\t1\t\t\tDISK1\t\n";
273 static const CHAR sdp_install_exec_seq_dat
[] = "Action\tCondition\tSequence\n"
275 "InstallExecuteSequence\tAction\n"
276 "AllocateRegistrySpace\tNOT Installed\t1550\n"
277 "CostFinalize\t\t1000\n"
278 "CostInitialize\t\t800\n"
280 "InstallFiles\t\t4000\n"
281 "InstallFinalize\t\t6600\n"
282 "InstallInitialize\t\t1500\n"
283 "InstallValidate\t\t1400\n"
284 "LaunchConditions\t\t100\n"
285 "SetDirProperty\t\t950";
287 static const CHAR sdp_custom_action_dat
[] = "Action\tType\tSource\tTarget\tISComments\n"
288 "s72\ti2\tS64\tS0\tS255\n"
289 "CustomAction\tAction\n"
290 "SetDirProperty\t51\tMSITESTDIR\t[CommonFilesFolder]msitest\\\t\n";
292 static const CHAR cie_component_dat
[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
293 "s72\tS38\ts72\ti2\tS255\tS72\n"
294 "Component\tComponent\n"
295 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
296 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
297 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
298 "gaius\t\tMSITESTDIR\t0\t1\tgaius\n";
300 static const CHAR cie_feature_comp_dat
[] = "Feature_\tComponent_\n"
302 "FeatureComponents\tFeature_\tComponent_\n"
304 "feature\taugustus\n"
308 static const CHAR cie_file_dat
[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
309 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
311 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
312 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
313 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12\n"
314 "gaius\tgaius\tgaius\t500\t\t\t8192\t11";
316 static const CHAR cie_media_dat
[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
317 "i2\ti4\tL64\tS255\tS32\tS72\n"
319 "1\t1\t\ttest1.cab\tDISK1\t\n"
320 "2\t2\t\ttest2.cab\tDISK2\t\n"
321 "3\t12\t\ttest3.cab\tDISK3\t\n";
323 static const CHAR ci_install_exec_seq_dat
[] = "Action\tCondition\tSequence\n"
325 "InstallExecuteSequence\tAction\n"
326 "CostFinalize\t\t1000\n"
327 "CostInitialize\t\t800\n"
329 "InstallFiles\t\t4000\n"
330 "InstallServices\t\t5000\n"
331 "InstallFinalize\t\t6600\n"
332 "InstallInitialize\t\t1500\n"
333 "RunInstall\t\t1600\n"
334 "InstallValidate\t\t1400\n"
335 "LaunchConditions\t\t100";
337 static const CHAR ci_custom_action_dat
[] = "Action\tType\tSource\tTarget\tISComments\n"
338 "s72\ti2\tS64\tS0\tS255\n"
339 "CustomAction\tAction\n"
340 "RunInstall\t23\tmsitest\\concurrent.msi\tMYPROP=[UILevel]\t\n";
342 static const CHAR ci_component_dat
[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
343 "s72\tS38\ts72\ti2\tS255\tS72\n"
344 "Component\tComponent\n"
345 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n";
347 static const CHAR ci2_component_dat
[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
348 "s72\tS38\ts72\ti2\tS255\tS72\n"
349 "Component\tComponent\n"
350 "augustus\t\tMSITESTDIR\t0\tUILevel=3 AND MYPROP=5\taugustus\n";
352 static const CHAR ci2_feature_comp_dat
[] = "Feature_\tComponent_\n"
354 "FeatureComponents\tFeature_\tComponent_\n"
357 static const CHAR ci2_file_dat
[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
358 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
360 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
362 static const CHAR spf_custom_action_dat
[] = "Action\tType\tSource\tTarget\tISComments\n"
363 "s72\ti2\tS64\tS0\tS255\n"
364 "CustomAction\tAction\n"
365 "SetFolderProp\t51\tMSITESTDIR\t[ProgramFilesFolder]\\msitest\\added\t\n";
367 static const CHAR spf_install_exec_seq_dat
[] = "Action\tCondition\tSequence\n"
369 "InstallExecuteSequence\tAction\n"
370 "CostFinalize\t\t1000\n"
371 "CostInitialize\t\t800\n"
373 "SetFolderProp\t\t950\n"
374 "InstallFiles\t\t4000\n"
375 "InstallServices\t\t5000\n"
376 "InstallFinalize\t\t6600\n"
377 "InstallInitialize\t\t1500\n"
378 "InstallValidate\t\t1400\n"
379 "LaunchConditions\t\t100";
381 static const CHAR spf_install_ui_seq_dat
[] = "Action\tCondition\tSequence\n"
383 "InstallUISequence\tAction\n"
384 "CostInitialize\t\t800\n"
386 "CostFinalize\t\t1000\n"
387 "ExecuteAction\t\t1100\n";
389 static const CHAR pp_install_exec_seq_dat
[] = "Action\tCondition\tSequence\n"
391 "InstallExecuteSequence\tAction\n"
392 "ValidateProductID\t\t700\n"
393 "CostInitialize\t\t800\n"
395 "CostFinalize\t\t1000\n"
396 "InstallValidate\t\t1400\n"
397 "InstallInitialize\t\t1500\n"
398 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
399 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
400 "RemoveFiles\t\t3500\n"
401 "InstallFiles\t\t4000\n"
402 "RegisterUser\t\t6000\n"
403 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
404 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
405 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
406 "InstallFinalize\t\t6600";
408 typedef struct _msi_table
410 const CHAR
*filename
;
415 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
417 static const msi_table tables
[] =
419 ADD_TABLE(component
),
420 ADD_TABLE(directory
),
422 ADD_TABLE(feature_comp
),
424 ADD_TABLE(install_exec_seq
),
428 ADD_TABLE(service_install
),
429 ADD_TABLE(service_control
)
432 static const msi_table cc_tables
[] =
434 ADD_TABLE(cc_component
),
435 ADD_TABLE(directory
),
436 ADD_TABLE(cc_feature
),
437 ADD_TABLE(cc_feature_comp
),
439 ADD_TABLE(install_exec_seq
),
444 static const msi_table co_tables
[] =
446 ADD_TABLE(cc_component
),
447 ADD_TABLE(directory
),
448 ADD_TABLE(cc_feature
),
449 ADD_TABLE(cc_feature_comp
),
451 ADD_TABLE(install_exec_seq
),
456 static const msi_table co2_tables
[] =
458 ADD_TABLE(cc_component
),
459 ADD_TABLE(directory
),
460 ADD_TABLE(cc_feature
),
461 ADD_TABLE(cc_feature_comp
),
463 ADD_TABLE(install_exec_seq
),
464 ADD_TABLE(co2_media
),
468 static const msi_table mm_tables
[] =
470 ADD_TABLE(cc_component
),
471 ADD_TABLE(directory
),
472 ADD_TABLE(cc_feature
),
473 ADD_TABLE(cc_feature_comp
),
475 ADD_TABLE(install_exec_seq
),
480 static const msi_table ss_tables
[] =
482 ADD_TABLE(cc_component
),
483 ADD_TABLE(directory
),
484 ADD_TABLE(cc_feature
),
485 ADD_TABLE(cc_feature_comp
),
487 ADD_TABLE(install_exec_seq
),
492 static const msi_table ui_tables
[] =
494 ADD_TABLE(ui_component
),
495 ADD_TABLE(directory
),
496 ADD_TABLE(cc_feature
),
497 ADD_TABLE(cc_feature_comp
),
499 ADD_TABLE(install_exec_seq
),
500 ADD_TABLE(ui_install_ui_seq
),
501 ADD_TABLE(ui_custom_action
),
506 static const msi_table rof_tables
[] =
508 ADD_TABLE(rof_component
),
509 ADD_TABLE(directory
),
510 ADD_TABLE(rof_feature
),
511 ADD_TABLE(rof_feature_comp
),
513 ADD_TABLE(install_exec_seq
),
514 ADD_TABLE(rof_media
),
518 static const msi_table sdp_tables
[] =
520 ADD_TABLE(rof_component
),
521 ADD_TABLE(directory
),
522 ADD_TABLE(rof_feature
),
523 ADD_TABLE(rof_feature_comp
),
525 ADD_TABLE(sdp_install_exec_seq
),
526 ADD_TABLE(sdp_custom_action
),
527 ADD_TABLE(rof_media
),
531 static const msi_table cie_tables
[] =
533 ADD_TABLE(cie_component
),
534 ADD_TABLE(directory
),
535 ADD_TABLE(cc_feature
),
536 ADD_TABLE(cie_feature_comp
),
538 ADD_TABLE(install_exec_seq
),
539 ADD_TABLE(cie_media
),
543 static const msi_table ci_tables
[] =
545 ADD_TABLE(ci_component
),
546 ADD_TABLE(directory
),
547 ADD_TABLE(rof_feature
),
548 ADD_TABLE(rof_feature_comp
),
550 ADD_TABLE(ci_install_exec_seq
),
551 ADD_TABLE(rof_media
),
553 ADD_TABLE(ci_custom_action
),
556 static const msi_table ci2_tables
[] =
558 ADD_TABLE(ci2_component
),
559 ADD_TABLE(directory
),
560 ADD_TABLE(rof_feature
),
561 ADD_TABLE(ci2_feature_comp
),
563 ADD_TABLE(install_exec_seq
),
564 ADD_TABLE(rof_media
),
568 static const msi_table spf_tables
[] =
570 ADD_TABLE(ci_component
),
571 ADD_TABLE(directory
),
572 ADD_TABLE(rof_feature
),
573 ADD_TABLE(rof_feature_comp
),
575 ADD_TABLE(spf_install_exec_seq
),
576 ADD_TABLE(rof_media
),
578 ADD_TABLE(spf_custom_action
),
579 ADD_TABLE(spf_install_ui_seq
),
582 static const msi_table pp_tables
[] =
584 ADD_TABLE(ci_component
),
585 ADD_TABLE(directory
),
586 ADD_TABLE(rof_feature
),
587 ADD_TABLE(rof_feature_comp
),
589 ADD_TABLE(pp_install_exec_seq
),
590 ADD_TABLE(rof_media
),
594 /* cabinet definitions */
596 /* make the max size large so there is only one cab file */
597 #define MEDIA_SIZE 0x7FFFFFFF
598 #define FOLDER_THRESHOLD 900000
600 /* the FCI callbacks */
602 static void *mem_alloc(ULONG cb
)
604 return HeapAlloc(GetProcessHeap(), 0, cb
);
607 static void mem_free(void *memory
)
609 HeapFree(GetProcessHeap(), 0, memory
);
612 static BOOL
get_next_cabinet(PCCAB pccab
, ULONG cbPrevCab
, void *pv
)
614 sprintf(pccab
->szCab
, pv
, pccab
->iCab
);
618 static long progress(UINT typeStatus
, ULONG cb1
, ULONG cb2
, void *pv
)
623 static int file_placed(PCCAB pccab
, char *pszFile
, long cbFile
,
624 BOOL fContinuation
, void *pv
)
629 static INT_PTR
fci_open(char *pszFile
, int oflag
, int pmode
, int *err
, void *pv
)
633 DWORD dwShareMode
= 0;
634 DWORD dwCreateDisposition
= OPEN_EXISTING
;
636 dwAccess
= GENERIC_READ
| GENERIC_WRITE
;
637 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
638 dwShareMode
= FILE_SHARE_READ
| FILE_SHARE_WRITE
;
640 if (GetFileAttributesA(pszFile
) != INVALID_FILE_ATTRIBUTES
)
641 dwCreateDisposition
= OPEN_EXISTING
;
643 dwCreateDisposition
= CREATE_NEW
;
645 handle
= CreateFileA(pszFile
, dwAccess
, dwShareMode
, NULL
,
646 dwCreateDisposition
, 0, NULL
);
648 ok(handle
!= INVALID_HANDLE_VALUE
, "Failed to CreateFile %s\n", pszFile
);
650 return (INT_PTR
)handle
;
653 static UINT
fci_read(INT_PTR hf
, void *memory
, UINT cb
, int *err
, void *pv
)
655 HANDLE handle
= (HANDLE
)hf
;
659 res
= ReadFile(handle
, memory
, cb
, &dwRead
, NULL
);
660 ok(res
, "Failed to ReadFile\n");
665 static UINT
fci_write(INT_PTR hf
, void *memory
, UINT cb
, int *err
, void *pv
)
667 HANDLE handle
= (HANDLE
)hf
;
671 res
= WriteFile(handle
, memory
, cb
, &dwWritten
, NULL
);
672 ok(res
, "Failed to WriteFile\n");
677 static int fci_close(INT_PTR hf
, int *err
, void *pv
)
679 HANDLE handle
= (HANDLE
)hf
;
680 ok(CloseHandle(handle
), "Failed to CloseHandle\n");
685 static long fci_seek(INT_PTR hf
, long dist
, int seektype
, int *err
, void *pv
)
687 HANDLE handle
= (HANDLE
)hf
;
690 ret
= SetFilePointer(handle
, dist
, NULL
, seektype
);
691 ok(ret
!= INVALID_SET_FILE_POINTER
, "Failed to SetFilePointer\n");
696 static int fci_delete(char *pszFile
, int *err
, void *pv
)
698 BOOL ret
= DeleteFileA(pszFile
);
699 ok(ret
, "Failed to DeleteFile %s\n", pszFile
);
704 static BOOL
check_record(MSIHANDLE rec
, UINT field
, LPCSTR val
)
711 r
= MsiRecordGetString(rec
, field
, buffer
, &sz
);
712 return (r
== ERROR_SUCCESS
) && !strcmp(val
, buffer
);
715 static BOOL
get_temp_file(char *pszTempName
, int cbTempName
, void *pv
)
719 tempname
= HeapAlloc(GetProcessHeap(), 0, MAX_PATH
);
720 GetTempFileNameA(".", "xx", 0, tempname
);
722 if (tempname
&& (strlen(tempname
) < (unsigned)cbTempName
))
724 lstrcpyA(pszTempName
, tempname
);
725 HeapFree(GetProcessHeap(), 0, tempname
);
729 HeapFree(GetProcessHeap(), 0, tempname
);
734 static INT_PTR
get_open_info(char *pszName
, USHORT
*pdate
, USHORT
*ptime
,
735 USHORT
*pattribs
, int *err
, void *pv
)
737 BY_HANDLE_FILE_INFORMATION finfo
;
743 handle
= CreateFile(pszName
, GENERIC_READ
, FILE_SHARE_READ
, NULL
,
744 OPEN_EXISTING
, FILE_ATTRIBUTE_NORMAL
| FILE_FLAG_SEQUENTIAL_SCAN
, NULL
);
746 ok(handle
!= INVALID_HANDLE_VALUE
, "Failed to CreateFile %s\n", pszName
);
748 res
= GetFileInformationByHandle(handle
, &finfo
);
749 ok(res
, "Expected GetFileInformationByHandle to succeed\n");
751 FileTimeToLocalFileTime(&finfo
.ftLastWriteTime
, &filetime
);
752 FileTimeToDosDateTime(&filetime
, pdate
, ptime
);
754 attrs
= GetFileAttributes(pszName
);
755 ok(attrs
!= INVALID_FILE_ATTRIBUTES
, "Failed to GetFileAttributes\n");
757 return (INT_PTR
)handle
;
760 static BOOL
add_file(HFCI hfci
, const char *file
, TCOMP compress
)
763 char filename
[MAX_PATH
];
765 lstrcpyA(path
, CURR_DIR
);
766 lstrcatA(path
, "\\");
767 lstrcatA(path
, file
);
769 lstrcpyA(filename
, file
);
771 return FCIAddFile(hfci
, path
, filename
, FALSE
, get_next_cabinet
,
772 progress
, get_open_info
, compress
);
775 static void set_cab_parameters(PCCAB pCabParams
, const CHAR
*name
, DWORD max_size
)
777 ZeroMemory(pCabParams
, sizeof(CCAB
));
779 pCabParams
->cb
= max_size
;
780 pCabParams
->cbFolderThresh
= FOLDER_THRESHOLD
;
781 pCabParams
->setID
= 0xbeef;
782 pCabParams
->iCab
= 1;
783 lstrcpyA(pCabParams
->szCabPath
, CURR_DIR
);
784 lstrcatA(pCabParams
->szCabPath
, "\\");
785 lstrcpyA(pCabParams
->szCab
, name
);
788 static void create_cab_file(const CHAR
*name
, DWORD max_size
, const CHAR
*files
)
796 set_cab_parameters(&cabParams
, name
, max_size
);
798 hfci
= FCICreate(&erf
, file_placed
, mem_alloc
, mem_free
, fci_open
,
799 fci_read
, fci_write
, fci_close
, fci_seek
, fci_delete
,
800 get_temp_file
, &cabParams
, NULL
);
802 ok(hfci
!= NULL
, "Failed to create an FCI context\n");
807 res
= add_file(hfci
, ptr
, tcompTYPE_MSZIP
);
808 ok(res
, "Failed to add file: %s\n", ptr
);
809 ptr
+= lstrlen(ptr
) + 1;
812 res
= FCIFlushCabinet(hfci
, FALSE
, get_next_cabinet
, progress
);
813 ok(res
, "Failed to flush the cabinet\n");
815 res
= FCIDestroy(hfci
);
816 ok(res
, "Failed to destroy the cabinet\n");
819 static BOOL
get_program_files_dir(LPSTR buf
)
822 DWORD type
= REG_EXPAND_SZ
, size
;
824 if (RegOpenKey(HKEY_LOCAL_MACHINE
,
825 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey
))
829 if (RegQueryValueEx(hkey
, "ProgramFilesDir", 0, &type
, (LPBYTE
)buf
, &size
))
836 static void create_file(const CHAR
*name
, DWORD size
)
841 file
= CreateFileA(name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, NULL
);
842 ok(file
!= INVALID_HANDLE_VALUE
, "Failure to open file %s\n", name
);
843 WriteFile(file
, name
, strlen(name
), &written
, NULL
);
844 WriteFile(file
, "\n", strlen("\n"), &written
, NULL
);
846 left
= size
- lstrlen(name
) - 1;
848 SetFilePointer(file
, left
, NULL
, FILE_CURRENT
);
854 static void create_test_files(void)
856 CreateDirectoryA("msitest", NULL
);
857 create_file("msitest\\one.txt", 100);
858 CreateDirectoryA("msitest\\first", NULL
);
859 create_file("msitest\\first\\two.txt", 100);
860 CreateDirectoryA("msitest\\second", NULL
);
861 create_file("msitest\\second\\three.txt", 100);
863 create_file("four.txt", 100);
864 create_file("five.txt", 100);
865 create_cab_file("msitest.cab", MEDIA_SIZE
, "four.txt\0five.txt\0");
867 create_file("msitest\\filename", 100);
868 create_file("msitest\\service.exe", 100);
870 DeleteFileA("four.txt");
871 DeleteFileA("five.txt");
874 static BOOL
delete_pf(const CHAR
*rel_path
, BOOL is_file
)
878 lstrcpyA(path
, PROG_FILES_DIR
);
879 lstrcatA(path
, "\\");
880 lstrcatA(path
, rel_path
);
883 return DeleteFileA(path
);
885 return RemoveDirectoryA(path
);
888 static void delete_test_files(void)
890 DeleteFileA("msitest.msi");
891 DeleteFileA("msitest.cab");
892 DeleteFileA("msitest\\second\\three.txt");
893 DeleteFileA("msitest\\first\\two.txt");
894 DeleteFileA("msitest\\one.txt");
895 DeleteFileA("msitest\\service.exe");
896 DeleteFileA("msitest\\filename");
897 RemoveDirectoryA("msitest\\second");
898 RemoveDirectoryA("msitest\\first");
899 RemoveDirectoryA("msitest");
902 static void write_file(const CHAR
*filename
, const char *data
, int data_size
)
906 HANDLE hf
= CreateFile(filename
, GENERIC_WRITE
, 0, NULL
,
907 CREATE_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, NULL
);
909 WriteFile(hf
, data
, data_size
, &size
, NULL
);
913 static void write_msi_summary_info(MSIHANDLE db
)
918 r
= MsiGetSummaryInformationA(db
, NULL
, 5, &summary
);
919 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
921 r
= MsiSummaryInfoSetPropertyA(summary
, PID_TEMPLATE
, VT_LPSTR
, 0, NULL
, ";1033");
922 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
924 r
= MsiSummaryInfoSetPropertyA(summary
, PID_REVNUMBER
, VT_LPSTR
, 0, NULL
,
925 "{004757CA-5092-49c2-AD20-28E1CE0DF5F2}");
926 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
928 r
= MsiSummaryInfoSetPropertyA(summary
, PID_PAGECOUNT
, VT_I4
, 100, NULL
, NULL
);
929 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
931 r
= MsiSummaryInfoSetPropertyA(summary
, PID_WORDCOUNT
, VT_I4
, 0, NULL
, NULL
);
932 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
934 r
= MsiSummaryInfoSetPropertyA(summary
, PID_TITLE
, VT_LPSTR
, 0, NULL
, "MSITEST");
935 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
937 /* write the summary changes back to the stream */
938 r
= MsiSummaryInfoPersist(summary
);
939 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
941 MsiCloseHandle(summary
);
944 static void create_database(const CHAR
*name
, const msi_table
*tables
, int num_tables
)
950 r
= MsiOpenDatabaseA(name
, MSIDBOPEN_CREATE
, &db
);
951 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
953 /* import the tables into the database */
954 for (j
= 0; j
< num_tables
; j
++)
956 const msi_table
*table
= &tables
[j
];
958 write_file(table
->filename
, table
->data
, (table
->size
- 1) * sizeof(char));
960 r
= MsiDatabaseImportA(db
, CURR_DIR
, table
->filename
);
961 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
963 DeleteFileA(table
->filename
);
966 write_msi_summary_info(db
);
968 r
= MsiDatabaseCommit(db
);
969 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
974 static void check_service_is_installed(void)
976 SC_HANDLE scm
, service
;
979 scm
= OpenSCManager(NULL
, NULL
, SC_MANAGER_ALL_ACCESS
);
980 ok(scm
!= NULL
, "Failed to open the SC Manager\n");
982 service
= OpenService(scm
, "TestService", SC_MANAGER_ALL_ACCESS
);
983 ok(service
!= NULL
, "Failed to open TestService\n");
985 res
= DeleteService(service
);
986 ok(res
, "Failed to delete TestService\n");
989 static void test_MsiInstallProduct(void)
995 DWORD num
, size
, type
;
998 create_database(msifile
, tables
, sizeof(tables
) / sizeof(msi_table
));
1000 r
= MsiInstallProductA(msifile
, NULL
);
1001 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1003 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE
), "File not installed\n");
1004 ok(delete_pf("msitest\\cabout\\new", FALSE
), "File not installed\n");
1005 ok(delete_pf("msitest\\cabout\\four.txt", TRUE
), "File not installed\n");
1006 ok(delete_pf("msitest\\cabout", FALSE
), "File not installed\n");
1007 ok(delete_pf("msitest\\changed\\three.txt", TRUE
), "File not installed\n");
1008 ok(delete_pf("msitest\\changed", FALSE
), "File not installed\n");
1009 ok(delete_pf("msitest\\first\\two.txt", TRUE
), "File not installed\n");
1010 ok(delete_pf("msitest\\first", FALSE
), "File not installed\n");
1011 ok(delete_pf("msitest\\one.txt", TRUE
), "File not installed\n");
1012 ok(delete_pf("msitest\\filename", TRUE
), "File not installed\n");
1013 ok(delete_pf("msitest\\service.exe", TRUE
), "File not installed\n");
1014 ok(delete_pf("msitest", FALSE
), "File not installed\n");
1016 res
= RegOpenKey(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Wine\\msitest", &hkey
);
1017 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1021 res
= RegQueryValueExA(hkey
, "Name", NULL
, &type
, (LPBYTE
)path
, &size
);
1022 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1023 ok(!lstrcmpA(path
, "imaname"), "Expected imaname, got %s\n", path
);
1027 res
= RegQueryValueExA(hkey
, "blah", NULL
, &type
, (LPBYTE
)path
, &size
);
1028 ok(res
== ERROR_FILE_NOT_FOUND
, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res
);
1032 res
= RegQueryValueExA(hkey
, "number", NULL
, &type
, (LPBYTE
)&num
, &size
);
1033 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1034 ok(num
== 314, "Expected 314, got %d\n", num
);
1038 res
= RegQueryValueExA(hkey
, "OrderTestName", NULL
, &type
, (LPBYTE
)path
, &size
);
1039 ok(res
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", res
);
1040 ok(!lstrcmpA(path
, "OrderTestValue"), "Expected imaname, got %s\n", path
);
1042 check_service_is_installed();
1044 RegDeleteKeyA(HKEY_LOCAL_MACHINE
, "SOFTWARE\\Wine\\msitest");
1046 delete_test_files();
1049 static void test_MsiSetComponentState(void)
1051 INSTALLSTATE installed
, action
;
1053 char path
[MAX_PATH
];
1056 create_database(msifile
, tables
, sizeof(tables
) / sizeof(msi_table
));
1060 lstrcpy(path
, CURR_DIR
);
1061 lstrcat(path
, "\\");
1062 lstrcat(path
, msifile
);
1064 r
= MsiOpenPackage(path
, &package
);
1065 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1067 r
= MsiDoAction(package
, "CostInitialize");
1068 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1070 r
= MsiDoAction(package
, "FileCost");
1071 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1073 r
= MsiDoAction(package
, "CostFinalize");
1074 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1076 r
= MsiGetComponentState(package
, "dangler", &installed
, &action
);
1077 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1078 ok(installed
== INSTALLSTATE_ABSENT
, "Expected INSTALLSTATE_ABSENT, got %d\n", installed
);
1079 ok(action
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action
);
1081 r
= MsiSetComponentState(package
, "dangler", INSTALLSTATE_SOURCE
);
1082 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1084 MsiCloseHandle(package
);
1087 DeleteFileA(msifile
);
1090 static void test_packagecoltypes(void)
1092 MSIHANDLE hdb
, view
, rec
;
1093 char path
[MAX_PATH
];
1097 create_database(msifile
, tables
, sizeof(tables
) / sizeof(msi_table
));
1101 lstrcpy(path
, CURR_DIR
);
1102 lstrcat(path
, "\\");
1103 lstrcat(path
, msifile
);
1105 r
= MsiOpenDatabase(path
, MSIDBOPEN_READONLY
, &hdb
);
1106 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1108 query
= "SELECT * FROM `Media`";
1109 r
= MsiDatabaseOpenView( hdb
, query
, &view
);
1110 ok(r
== ERROR_SUCCESS
, "MsiDatabaseOpenView failed\n");
1112 r
= MsiViewGetColumnInfo( view
, MSICOLINFO_NAMES
, &rec
);
1113 count
= MsiRecordGetFieldCount( rec
);
1114 ok(r
== ERROR_SUCCESS
, "MsiViewGetColumnInfo failed\n");
1115 ok(count
== 6, "Expected 6, got %d\n", count
);
1116 ok(check_record(rec
, 1, "DiskId"), "wrong column label\n");
1117 ok(check_record(rec
, 2, "LastSequence"), "wrong column label\n");
1118 ok(check_record(rec
, 3, "DiskPrompt"), "wrong column label\n");
1119 ok(check_record(rec
, 4, "Cabinet"), "wrong column label\n");
1120 ok(check_record(rec
, 5, "VolumeLabel"), "wrong column label\n");
1121 ok(check_record(rec
, 6, "Source"), "wrong column label\n");
1122 MsiCloseHandle(rec
);
1124 r
= MsiViewGetColumnInfo( view
, MSICOLINFO_TYPES
, &rec
);
1125 count
= MsiRecordGetFieldCount( rec
);
1126 ok(r
== ERROR_SUCCESS
, "MsiViewGetColumnInfo failed\n");
1127 ok(count
== 6, "Expected 6, got %d\n", count
);
1128 ok(check_record(rec
, 1, "i2"), "wrong column label\n");
1129 ok(check_record(rec
, 2, "i4"), "wrong column label\n");
1130 ok(check_record(rec
, 3, "L64"), "wrong column label\n");
1131 ok(check_record(rec
, 4, "S255"), "wrong column label\n");
1132 ok(check_record(rec
, 5, "S32"), "wrong column label\n");
1133 ok(check_record(rec
, 6, "S72"), "wrong column label\n");
1135 MsiCloseHandle(rec
);
1136 MsiCloseHandle(view
);
1137 MsiCloseHandle(hdb
);
1138 DeleteFile(msifile
);
1141 static void create_cc_test_files(void)
1146 static CHAR cab_context
[] = "test%d.cab";
1149 create_file("maximus", 500);
1150 create_file("augustus", 50000);
1151 create_file("caesar", 500);
1153 set_cab_parameters(&cabParams
, "test1.cab", 200);
1155 hfci
= FCICreate(&erf
, file_placed
, mem_alloc
, mem_free
, fci_open
,
1156 fci_read
, fci_write
, fci_close
, fci_seek
, fci_delete
,
1157 get_temp_file
, &cabParams
, cab_context
);
1158 ok(hfci
!= NULL
, "Failed to create an FCI context\n");
1160 res
= add_file(hfci
, "maximus", tcompTYPE_MSZIP
);
1161 ok(res
, "Failed to add file maximus\n");
1163 res
= add_file(hfci
, "augustus", tcompTYPE_MSZIP
);
1164 ok(res
, "Failed to add file augustus\n");
1166 res
= FCIFlushCabinet(hfci
, FALSE
, get_next_cabinet
, progress
);
1167 ok(res
, "Failed to flush the cabinet\n");
1169 res
= FCIDestroy(hfci
);
1170 ok(res
, "Failed to destroy the cabinet\n");
1172 create_cab_file("test3.cab", MEDIA_SIZE
, "caesar\0");
1174 DeleteFile("maximus");
1175 DeleteFile("augustus");
1176 DeleteFile("caesar");
1179 static void delete_cab_files(void)
1181 SHFILEOPSTRUCT shfl
;
1182 CHAR path
[MAX_PATH
+10];
1184 lstrcpyA(path
, CURR_DIR
);
1185 lstrcatA(path
, "\\*.cab");
1186 path
[strlen(path
) + 1] = '\0';
1189 shfl
.wFunc
= FO_DELETE
;
1192 shfl
.fFlags
= FOF_FILESONLY
| FOF_NOCONFIRMATION
| FOF_NORECURSION
| FOF_SILENT
;
1194 SHFileOperation(&shfl
);
1197 static void test_continuouscabs(void)
1201 create_cc_test_files();
1202 create_database(msifile
, cc_tables
, sizeof(cc_tables
) / sizeof(msi_table
));
1204 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
1206 r
= MsiInstallProductA(msifile
, NULL
);
1207 ok(delete_pf("msitest\\maximus", TRUE
), "File not installed\n");
1210 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1211 ok(delete_pf("msitest\\augustus", TRUE
), "File not installed\n");
1212 ok(delete_pf("msitest\\caesar", TRUE
), "File not installed\n");
1214 ok(delete_pf("msitest", FALSE
), "File not installed\n");
1217 DeleteFile(msifile
);
1220 static void test_caborder(void)
1224 create_file("imperator", 100);
1225 create_file("maximus", 500);
1226 create_file("augustus", 50000);
1227 create_file("caesar", 500);
1229 create_database(msifile
, cc_tables
, sizeof(cc_tables
) / sizeof(msi_table
));
1231 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
1233 create_cab_file("test1.cab", MEDIA_SIZE
, "maximus\0");
1234 create_cab_file("test2.cab", MEDIA_SIZE
, "augustus\0");
1235 create_cab_file("test3.cab", MEDIA_SIZE
, "caesar\0");
1237 r
= MsiInstallProductA(msifile
, NULL
);
1238 ok(r
== ERROR_INSTALL_FAILURE
, "Expected ERROR_INSTALL_FAILURE, got %u\n", r
);
1239 ok(!delete_pf("msitest\\augustus", TRUE
), "File is installed\n");
1240 ok(!delete_pf("msitest\\caesar", TRUE
), "File is installed\n");
1243 ok(!delete_pf("msitest\\maximus", TRUE
), "File is installed\n");
1244 ok(!delete_pf("msitest", FALSE
), "File is installed\n");
1249 create_cab_file("test1.cab", MEDIA_SIZE
, "imperator\0");
1250 create_cab_file("test2.cab", MEDIA_SIZE
, "maximus\0augustus\0");
1251 create_cab_file("test3.cab", MEDIA_SIZE
, "caesar\0");
1253 r
= MsiInstallProductA(msifile
, NULL
);
1254 ok(r
== ERROR_INSTALL_FAILURE
, "Expected ERROR_INSTALL_FAILURE, got %u\n", r
);
1255 ok(!delete_pf("msitest\\maximus", TRUE
), "File is installed\n");
1256 ok(!delete_pf("msitest\\augustus", TRUE
), "File is installed\n");
1257 ok(!delete_pf("msitest\\caesar", TRUE
), "File is installed\n");
1260 ok(!delete_pf("msitest", FALSE
), "File is installed\n");
1264 DeleteFile(msifile
);
1266 create_cc_test_files();
1267 create_database(msifile
, co_tables
, sizeof(co_tables
) / sizeof(msi_table
));
1269 r
= MsiInstallProductA(msifile
, NULL
);
1270 ok(!delete_pf("msitest\\augustus", TRUE
), "File is installed\n");
1271 ok(!delete_pf("msitest\\caesar", TRUE
), "File is installed\n");
1272 ok(!delete_pf("msitest", FALSE
), "File is installed\n");
1275 ok(!delete_pf("msitest\\maximus", TRUE
), "File is installed\n");
1276 ok(r
== ERROR_INSTALL_FAILURE
, "Expected ERROR_INSTALL_FAILURE, got %u\n", r
);
1280 DeleteFile(msifile
);
1282 create_cc_test_files();
1283 create_database(msifile
, co2_tables
, sizeof(co2_tables
) / sizeof(msi_table
));
1285 r
= MsiInstallProductA(msifile
, NULL
);
1286 ok(!delete_pf("msitest\\augustus", TRUE
), "File is installed\n");
1287 ok(!delete_pf("msitest\\caesar", TRUE
), "File is installed\n");
1290 ok(r
== ERROR_INSTALL_FAILURE
, "Expected ERROR_INSTALL_FAILURE, got %u\n", r
);
1291 ok(!delete_pf("msitest\\maximus", TRUE
), "File is installed\n");
1292 ok(!delete_pf("msitest", FALSE
), "File is installed\n");
1296 DeleteFile("imperator");
1297 DeleteFile("maximus");
1298 DeleteFile("augustus");
1299 DeleteFile("caesar");
1300 DeleteFile(msifile
);
1303 static void test_mixedmedia(void)
1307 CreateDirectoryA("msitest", NULL
);
1308 create_file("msitest\\maximus", 500);
1309 create_file("msitest\\augustus", 500);
1310 create_file("caesar", 500);
1312 create_database(msifile
, mm_tables
, sizeof(mm_tables
) / sizeof(msi_table
));
1314 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
1316 create_cab_file("test1.cab", MEDIA_SIZE
, "caesar\0");
1318 r
= MsiInstallProductA(msifile
, NULL
);
1319 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1320 ok(delete_pf("msitest\\augustus", TRUE
), "File not installed\n");
1321 ok(delete_pf("msitest\\caesar", TRUE
), "File not installed\n");
1322 ok(delete_pf("msitest\\maximus", TRUE
), "File not installed\n");
1323 ok(delete_pf("msitest", FALSE
), "File not installed\n");
1325 /* Delete the files in the temp (current) folder */
1326 DeleteFile("msitest\\maximus");
1327 DeleteFile("msitest\\augustus");
1328 RemoveDirectory("msitest");
1329 DeleteFile("caesar");
1330 DeleteFile("test1.cab");
1331 DeleteFile(msifile
);
1334 static void test_samesequence(void)
1338 create_cc_test_files();
1339 create_database(msifile
, ss_tables
, sizeof(ss_tables
) / sizeof(msi_table
));
1341 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
1343 r
= MsiInstallProductA(msifile
, NULL
);
1346 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1347 ok(delete_pf("msitest\\augustus", TRUE
), "File not installed\n");
1348 ok(delete_pf("msitest\\caesar", TRUE
), "File not installed\n");
1350 ok(delete_pf("msitest\\maximus", TRUE
), "File not installed\n");
1351 ok(delete_pf("msitest", FALSE
), "File not installed\n");
1354 DeleteFile(msifile
);
1357 static void test_uiLevelFlags(void)
1361 create_cc_test_files();
1362 create_database(msifile
, ui_tables
, sizeof(ui_tables
) / sizeof(msi_table
));
1364 MsiSetInternalUI(INSTALLUILEVEL_NONE
| INSTALLUILEVEL_SOURCERESONLY
, NULL
);
1366 r
= MsiInstallProductA(msifile
, NULL
);
1367 ok(!delete_pf("msitest\\maximus", TRUE
), "UI install occurred, but execute-only was requested.\n");
1370 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1371 ok(delete_pf("msitest\\caesar", TRUE
), "File not installed\n");
1373 ok(delete_pf("msitest\\augustus", TRUE
), "File not installed\n");
1374 ok(delete_pf("msitest", FALSE
), "File not installed\n");
1377 DeleteFile(msifile
);
1380 static BOOL
file_matches(LPSTR path
)
1386 file
= CreateFile(path
, GENERIC_READ
, FILE_SHARE_READ
| FILE_SHARE_WRITE
,
1387 NULL
, OPEN_EXISTING
, 0, NULL
);
1389 ZeroMemory(buf
, MAX_PATH
);
1390 ReadFile(file
, buf
, 15, &size
, NULL
);
1393 return !lstrcmp(buf
, "msitest\\maximus");
1396 static void test_readonlyfile(void)
1401 CHAR path
[MAX_PATH
];
1403 CreateDirectoryA("msitest", NULL
);
1404 create_file("msitest\\maximus", 500);
1405 create_database(msifile
, rof_tables
, sizeof(rof_tables
) / sizeof(msi_table
));
1407 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
1409 lstrcpy(path
, PROG_FILES_DIR
);
1410 lstrcat(path
, "\\msitest");
1411 CreateDirectory(path
, NULL
);
1413 lstrcat(path
, "\\maximus");
1414 file
= CreateFile(path
, GENERIC_READ
, FILE_SHARE_READ
| FILE_SHARE_WRITE
,
1415 NULL
, CREATE_NEW
, FILE_ATTRIBUTE_READONLY
, NULL
);
1417 WriteFile(file
, "readonlyfile", 20, &size
, NULL
);
1420 r
= MsiInstallProductA(msifile
, NULL
);
1421 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1422 ok(file_matches(path
), "Expected file to be overwritten\n");
1423 ok(delete_pf("msitest\\maximus", TRUE
), "File not installed\n");
1424 ok(delete_pf("msitest", FALSE
), "File not installed\n");
1426 /* Delete the files in the temp (current) folder */
1427 DeleteFile("msitest\\maximus");
1428 RemoveDirectory("msitest");
1429 DeleteFile(msifile
);
1432 static void test_setdirproperty(void)
1436 CreateDirectoryA("msitest", NULL
);
1437 create_file("msitest\\maximus", 500);
1438 create_database(msifile
, sdp_tables
, sizeof(sdp_tables
) / sizeof(msi_table
));
1440 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
1442 r
= MsiInstallProductA(msifile
, NULL
);
1443 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1444 ok(delete_pf("Common Files\\msitest\\maximus", TRUE
), "File not installed\n");
1445 ok(delete_pf("Common Files\\msitest", FALSE
), "File not installed\n");
1447 /* Delete the files in the temp (current) folder */
1448 DeleteFile(msifile
);
1449 DeleteFile("msitest\\maximus");
1450 RemoveDirectory("msitest");
1453 static void test_cabisextracted(void)
1457 CreateDirectoryA("msitest", NULL
);
1458 create_file("msitest\\gaius", 500);
1459 create_file("maximus", 500);
1460 create_file("augustus", 500);
1461 create_file("caesar", 500);
1463 create_cab_file("test1.cab", MEDIA_SIZE
, "maximus\0");
1464 create_cab_file("test2.cab", MEDIA_SIZE
, "augustus\0");
1465 create_cab_file("test3.cab", MEDIA_SIZE
, "caesar\0");
1467 create_database(msifile
, cie_tables
, sizeof(cie_tables
) / sizeof(msi_table
));
1469 MsiSetInternalUI(INSTALLUILEVEL_NONE
, NULL
);
1471 r
= MsiInstallProductA(msifile
, NULL
);
1472 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1473 ok(delete_pf("msitest\\maximus", TRUE
), "File not installed\n");
1474 ok(delete_pf("msitest\\augustus", TRUE
), "File not installed\n");
1475 ok(delete_pf("msitest\\caesar", TRUE
), "File not installed\n");
1476 ok(delete_pf("msitest\\gaius", TRUE
), "File not installed\n");
1477 ok(delete_pf("msitest", FALSE
), "File not installed\n");
1479 /* Delete the files in the temp (current) folder */
1481 DeleteFile(msifile
);
1482 DeleteFile("maximus");
1483 DeleteFile("augustus");
1484 DeleteFile("caesar");
1485 DeleteFile("msitest\\gaius");
1486 RemoveDirectory("msitest");
1489 static void test_concurrentinstall(void)
1492 CHAR path
[MAX_PATH
];
1494 CreateDirectoryA("msitest", NULL
);
1495 CreateDirectoryA("msitest\\msitest", NULL
);
1496 create_file("msitest\\maximus", 500);
1497 create_file("msitest\\msitest\\augustus", 500);
1499 create_database(msifile
, ci_tables
, sizeof(ci_tables
) / sizeof(msi_table
));
1501 lstrcpyA(path
, CURR_DIR
);
1502 lstrcatA(path
, "\\msitest\\concurrent.msi");
1503 create_database(path
, ci2_tables
, sizeof(ci2_tables
) / sizeof(msi_table
));
1505 MsiSetInternalUI(INSTALLUILEVEL_FULL
, NULL
);
1507 r
= MsiInstallProductA(msifile
, NULL
);
1508 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1509 ok(delete_pf("msitest\\maximus", TRUE
), "File not installed\n");
1510 ok(delete_pf("msitest\\augustus", TRUE
), "File not installed\n");
1511 ok(delete_pf("msitest", FALSE
), "File not installed\n");
1513 /* Delete the files in the temp (current) folder */
1514 DeleteFile(msifile
);
1516 DeleteFile("msitest\\msitest\\augustus");
1517 DeleteFile("msitest\\maximus");
1518 RemoveDirectory("msitest\\msitest");
1519 RemoveDirectory("msitest");
1522 static void test_setpropertyfolder(void)
1526 CreateDirectoryA("msitest", NULL
);
1527 create_file("msitest\\maximus", 500);
1529 create_database(msifile
, spf_tables
, sizeof(spf_tables
) / sizeof(msi_table
));
1531 MsiSetInternalUI(INSTALLUILEVEL_FULL
, NULL
);
1533 r
= MsiInstallProductA(msifile
, NULL
);
1534 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1535 ok(delete_pf("msitest\\added\\maximus", TRUE
), "File not installed\n");
1536 ok(delete_pf("msitest\\added", FALSE
), "File not installed\n");
1537 ok(delete_pf("msitest", FALSE
), "File not installed\n");
1539 /* Delete the files in the temp (current) folder */
1540 DeleteFile(msifile
);
1541 DeleteFile("msitest\\maximus");
1542 RemoveDirectory("msitest");
1545 static BOOL
file_exists(LPCSTR file
)
1547 return GetFileAttributes(file
) != INVALID_FILE_ATTRIBUTES
;
1550 static BOOL
pf_exists(LPCSTR file
)
1552 CHAR path
[MAX_PATH
];
1554 lstrcpyA(path
, PROG_FILES_DIR
);
1555 lstrcatA(path
, "\\");
1556 lstrcatA(path
, file
);
1558 return file_exists(path
);
1561 static void delete_pfmsitest_files(void)
1563 SHFILEOPSTRUCT shfl
;
1564 CHAR path
[MAX_PATH
+10];
1566 lstrcpyA(path
, PROG_FILES_DIR
);
1567 lstrcatA(path
, "\\msitest\\*");
1568 path
[strlen(path
) + 1] = '\0';
1571 shfl
.wFunc
= FO_DELETE
;
1574 shfl
.fFlags
= FOF_FILESONLY
| FOF_NOCONFIRMATION
| FOF_NORECURSION
| FOF_SILENT
;
1576 SHFileOperation(&shfl
);
1578 lstrcpyA(path
, PROG_FILES_DIR
);
1579 lstrcatA(path
, "\\msitest");
1580 RemoveDirectoryA(path
);
1583 static void test_publish(void)
1587 CHAR prodcode
[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
1589 CreateDirectoryA("msitest", NULL
);
1590 create_file("msitest\\maximus", 500);
1592 create_database(msifile
, pp_tables
, sizeof(pp_tables
) / sizeof(msi_table
));
1594 MsiSetInternalUI(INSTALLUILEVEL_FULL
, NULL
);
1596 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1597 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1599 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1600 if (state
!= INSTALLSTATE_UNKNOWN
)
1602 skip("Install database not in a clean state\n");
1606 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1608 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1609 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1611 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1612 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1613 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1614 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1616 /* nothing published */
1617 r
= MsiInstallProductA(msifile
, NULL
);
1618 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
1619 ok(pf_exists("msitest\\maximus"), "File not installed\n");
1620 ok(pf_exists("msitest"), "File not installed\n");
1622 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1623 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1625 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1626 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1628 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1629 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1631 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1632 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1633 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1634 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1637 r
= MsiInstallProductA(msifile
, NULL
);
1638 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1639 ok(pf_exists("msitest\\maximus"), "File not installed\n");
1640 ok(pf_exists("msitest"), "File not installed\n");
1642 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1643 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1645 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1646 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1648 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1649 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1651 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1652 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1653 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1654 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1656 /* try to uninstall */
1657 r
= MsiInstallProductA(msifile
, "REMOVE=ALL");
1660 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1662 ok(pf_exists("msitest\\maximus"), "File deleted\n");
1663 ok(pf_exists("msitest"), "File deleted\n");
1665 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1666 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1668 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1669 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1671 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1672 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1674 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1675 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1676 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1677 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1679 /* PublishProduct */
1680 r
= MsiInstallProductA(msifile
, "PUBLISH_PRODUCT=1");
1681 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1682 ok(pf_exists("msitest\\maximus"), "File not installed\n");
1683 ok(pf_exists("msitest"), "File not installed\n");
1685 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1686 ok(state
== INSTALLSTATE_ADVERTISED
, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state
);
1688 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1689 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1691 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1692 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1695 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1697 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1699 /* try to uninstall after PublishProduct */
1700 r
= MsiInstallProductA(msifile
, "REMOVE=ALL");
1701 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1702 ok(pf_exists("msitest\\maximus"), "File deleted\n");
1703 ok(pf_exists("msitest"), "File deleted\n");
1705 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1706 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1708 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1709 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1711 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1712 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1714 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1715 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1716 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1717 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1719 /* PublishProduct and RegisterProduct */
1720 r
= MsiInstallProductA(msifile
, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
1721 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1722 ok(pf_exists("msitest\\maximus"), "File not installed\n");
1723 ok(pf_exists("msitest"), "File not installed\n");
1725 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1726 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
1728 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1729 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1731 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1732 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1734 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1735 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1738 ok(r
== ERROR_UNKNOWN_COMPONENT
, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r
);
1740 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1743 r
= MsiInstallProductA(msifile
, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
1744 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1745 ok(pf_exists("msitest\\maximus"), "File not installed\n");
1746 ok(pf_exists("msitest"), "File not installed\n");
1748 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1751 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1754 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1755 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1757 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1758 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1760 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1761 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1762 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1763 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1765 /* uninstall has a problem with this */
1766 r
= MsiInstallProductA(msifile
, "FULL=1 REMOVE=ALL");
1769 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1771 ok(pf_exists("msitest\\maximus"), "File deleted\n");
1772 ok(pf_exists("msitest"), "File deleted\n");
1774 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1775 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1777 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1780 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1783 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1784 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1785 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1786 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1788 /* PublishProduct and RegisterProduct and ProcessComponents */
1789 r
= MsiInstallProductA(msifile
, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1 PROCESS_COMPONENTS=1");
1790 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1791 ok(pf_exists("msitest\\maximus"), "File not installed\n");
1792 ok(pf_exists("msitest"), "File not installed\n");
1794 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1795 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
1797 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1800 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1803 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1806 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1809 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1810 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1813 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1814 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1817 /* complete uninstall */
1818 r
= MsiInstallProductA(msifile
, "FULL=1 REMOVE=ALL");
1819 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1820 ok(pf_exists("msitest\\maximus"), "File deleted\n");
1821 ok(pf_exists("msitest"), "File deleted\n");
1823 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1824 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1826 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1829 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1832 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1835 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1838 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1839 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1840 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1841 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1843 /* PublishProduct, RegisterProduct, ProcessComponents, PublishFeatures */
1844 r
= MsiInstallProductA(msifile
, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1 PROCESS_COMPONENTS=1 PUBLISH_FEATURES=1");
1845 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1846 ok(pf_exists("msitest\\maximus"), "File not installed\n");
1847 ok(pf_exists("msitest"), "File not installed\n");
1849 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1850 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
1852 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1855 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1858 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1861 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1864 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1865 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1868 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1869 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1872 /* complete uninstall */
1873 r
= MsiInstallProductA(msifile
, "FULL=1 REMOVE=ALL");
1874 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1877 ok(!pf_exists("msitest\\maximus"), "File deleted\n");
1878 ok(!pf_exists("msitest"), "File deleted\n");
1881 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1882 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1884 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");\
1887 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1890 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1893 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1896 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1897 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1898 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1899 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1901 /* complete install */
1902 r
= MsiInstallProductA(msifile
, "FULL=1");
1903 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1904 ok(pf_exists("msitest\\maximus"), "File not installed\n");
1905 ok(pf_exists("msitest"), "File not installed\n");
1907 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1908 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
1910 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1913 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1916 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1919 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1922 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1923 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1926 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1927 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1930 /* no UnpublishFeatures */
1931 r
= MsiInstallProductA(msifile
, "REMOVE=ALL");
1932 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1935 ok(!pf_exists("msitest\\maximus"), "File deleted\n");
1936 ok(!pf_exists("msitest"), "File deleted\n");
1939 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1940 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1942 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1945 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1948 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1951 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1954 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1955 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1956 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
1957 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1959 /* complete install */
1960 r
= MsiInstallProductA(msifile
, "FULL=1");
1961 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1962 ok(pf_exists("msitest\\maximus"), "File not installed\n");
1963 ok(pf_exists("msitest"), "File not installed\n");
1965 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1966 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
1968 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1971 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1974 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1977 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
1980 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
1981 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
1984 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1985 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
1988 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
1989 r
= MsiInstallProductA(msifile
, "UNPUBLISH_FEATURES=1 REMOVE=feature");
1990 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
1991 ok(pf_exists("msitest\\maximus"), "File deleted\n");
1992 ok(pf_exists("msitest"), "File deleted\n");
1994 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1995 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
1997 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2000 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
2003 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2006 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
2009 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2010 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
2013 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2014 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
2017 /* complete install */
2018 r
= MsiInstallProductA(msifile
, "FULL=1");
2019 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2020 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2021 ok(pf_exists("msitest"), "File not installed\n");
2023 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2024 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
2026 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2029 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
2032 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2035 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
2038 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2039 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
2042 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2043 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
2046 /* UnpublishFeatures, both features removed */
2047 r
= MsiInstallProductA(msifile
, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
2048 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2051 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
2052 ok(!pf_exists("msitest"), "File not deleted\n");
2055 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2056 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2058 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2061 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2064 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2067 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2070 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2071 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
2072 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2073 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2075 /* complete install */
2076 r
= MsiInstallProductA(msifile
, "FULL=1");
2077 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2078 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2079 ok(pf_exists("msitest"), "File not installed\n");
2081 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2082 ok(state
== INSTALLSTATE_DEFAULT
, "Expected INSTALLSTATE_DEFAULT, got %d\n", state
);
2084 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2087 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
2090 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2093 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
2096 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2097 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
2100 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2101 ok(state
== INSTALLSTATE_LOCAL
, "Expected INSTALLSTATE_LOCAL, got %d\n", state
);
2104 /* complete uninstall */
2105 r
= MsiInstallProductA(msifile
, "FULL=1 REMOVE=ALL");
2106 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2109 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
2110 ok(!pf_exists("msitest"), "File not deleted\n");
2113 state
= MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2114 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2116 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2119 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2122 state
= MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2125 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2128 r
= MsiQueryComponentStateA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2129 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state
);
2130 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2131 ok(state
== INSTALLSTATE_UNKNOWN
, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state
);
2133 /* make sure 'Program Files\msitest' is removed */
2134 delete_pfmsitest_files();
2136 DeleteFile(msifile
);
2137 DeleteFile("msitest\\maximus");
2138 RemoveDirectory("msitest");
2141 static void test_publishsourcelist(void)
2145 CHAR value
[MAX_PATH
];
2146 CHAR prodcode
[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2148 CreateDirectoryA("msitest", NULL
);
2149 create_file("msitest\\maximus", 500);
2151 create_database(msifile
, pp_tables
, sizeof(pp_tables
) / sizeof(msi_table
));
2153 MsiSetInternalUI(INSTALLUILEVEL_FULL
, NULL
);
2155 r
= MsiInstallProductA(msifile
, NULL
);
2156 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2157 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2158 ok(pf_exists("msitest"), "File not installed\n");
2160 /* nothing published */
2162 r
= MsiSourceListGetInfoA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2163 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, &size
);
2164 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2165 ok(size
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size
);
2167 r
= MsiInstallProductA(msifile
, "REGISTER_PRODUCT=1");
2168 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2169 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2170 ok(pf_exists("msitest"), "File not installed\n");
2172 /* after RegisterProduct */
2174 r
= MsiSourceListGetInfoA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2175 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, &size
);
2176 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2177 ok(size
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size
);
2179 r
= MsiInstallProductA(msifile
, "PROCESS_COMPONENTS=1");
2180 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2181 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2182 ok(pf_exists("msitest"), "File not installed\n");
2184 /* after ProcessComponents */
2186 r
= MsiSourceListGetInfoA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2187 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, &size
);
2188 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2189 ok(size
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size
);
2191 r
= MsiInstallProductA(msifile
, "PUBLISH_FEATURES=1");
2192 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2193 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2194 ok(pf_exists("msitest"), "File not installed\n");
2196 /* after PublishFeatures */
2198 r
= MsiSourceListGetInfoA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2199 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, NULL
, &size
);
2200 ok(r
== ERROR_UNKNOWN_PRODUCT
, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r
);
2201 ok(size
== 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size
);
2203 r
= MsiInstallProductA(msifile
, "PUBLISH_PRODUCT=1");
2204 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %u\n", r
);
2205 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2206 ok(pf_exists("msitest"), "File not installed\n");
2208 /* after PublishProduct */
2210 lstrcpyA(value
, "aaa");
2211 r
= MsiSourceListGetInfoA(prodcode
, NULL
, MSIINSTALLCONTEXT_USERUNMANAGED
,
2212 MSICODE_PRODUCT
, INSTALLPROPERTY_PACKAGENAME
, value
, &size
);
2213 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2214 ok(!lstrcmpA(value
, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value
);
2215 ok(size
== 11, "Expected 11, got %d\n", size
);
2217 /* complete uninstall */
2218 r
= MsiInstallProductA(msifile
, "FULL=1 REMOVE=ALL");
2219 ok(r
== ERROR_SUCCESS
, "Expected ERROR_SUCCESS, got %d\n", r
);
2222 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
2223 ok(!pf_exists("msitest"), "File not deleted\n");
2226 /* make sure 'Program Files\msitest' is removed */
2227 delete_pfmsitest_files();
2229 DeleteFile(msifile
);
2230 DeleteFile("msitest\\maximus");
2231 RemoveDirectory("msitest");
2237 char temp_path
[MAX_PATH
], prev_path
[MAX_PATH
];
2239 GetCurrentDirectoryA(MAX_PATH
, prev_path
);
2240 GetTempPath(MAX_PATH
, temp_path
);
2241 SetCurrentDirectoryA(temp_path
);
2243 lstrcpyA(CURR_DIR
, temp_path
);
2244 len
= lstrlenA(CURR_DIR
);
2246 if(len
&& (CURR_DIR
[len
- 1] == '\\'))
2247 CURR_DIR
[len
- 1] = 0;
2249 get_program_files_dir(PROG_FILES_DIR
);
2251 test_MsiInstallProduct();
2252 test_MsiSetComponentState();
2253 test_packagecoltypes();
2254 test_continuouscabs();
2257 test_samesequence();
2258 test_uiLevelFlags();
2259 test_readonlyfile();
2260 test_setdirproperty();
2261 test_cabisextracted();
2262 test_concurrentinstall();
2263 test_setpropertyfolder();
2265 test_publishsourcelist();
2267 SetCurrentDirectoryA(prev_path
);