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
33 #include "wine/test.h"
35 static UINT (WINAPI *pMsiQueryComponentStateA)
36 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*);
37 static UINT (WINAPI *pMsiSourceListGetInfoA)
38 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD);
40 static const char *msifile = "msitest.msi";
41 static const char *msifile2 = "winetest2.msi";
42 static const char *mstfile = "winetest.mst";
43 static CHAR CURR_DIR[MAX_PATH];
44 static CHAR PROG_FILES_DIR[MAX_PATH];
45 static CHAR COMMON_FILES_DIR[MAX_PATH];
47 /* msi database data */
49 static const CHAR component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
50 "s72\tS38\ts72\ti2\tS255\tS72\n"
51 "Component\tComponent\n"
52 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
53 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
54 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\t\tone.txt\n"
55 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
56 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
57 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
58 "component\t\tMSITESTDIR\t0\t1\tfile\n"
59 "service_comp\t\tMSITESTDIR\t0\t1\tservice_file";
61 static const CHAR directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
63 "Directory\tDirectory\n"
64 "CABOUTDIR\tMSITESTDIR\tcabout\n"
65 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
66 "FIRSTDIR\tMSITESTDIR\tfirst\n"
67 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
68 "NEWDIR\tCABOUTDIR\tnew\n"
69 "ProgramFilesFolder\tTARGETDIR\t.\n"
70 "TARGETDIR\t\tSourceDir";
72 static const CHAR feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
73 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
75 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
76 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
77 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
78 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
79 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
80 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
81 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
83 static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
85 "FeatureComponents\tFeature_\tComponent_\n"
91 "feature\tcomponent\n"
92 "service_feature\tservice_comp\n";
94 static const CHAR file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
95 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
97 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
98 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
99 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
100 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
101 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
102 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
103 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
105 static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
107 "InstallExecuteSequence\tAction\n"
108 "AllocateRegistrySpace\tNOT Installed\t1550\n"
109 "CostFinalize\t\t1000\n"
110 "CostInitialize\t\t800\n"
112 "ResolveSource\t\t950\n"
113 "MoveFiles\t\t1700\n"
114 "InstallFiles\t\t4000\n"
115 "InstallServices\t\t5000\n"
116 "InstallFinalize\t\t6600\n"
117 "InstallInitialize\t\t1500\n"
118 "InstallValidate\t\t1400\n"
119 "LaunchConditions\t\t100\n"
120 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
122 static const CHAR media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
123 "i2\ti4\tL64\tS255\tS32\tS72\n"
125 "1\t3\t\t\tDISK1\t\n"
126 "2\t5\t\tmsitest.cab\tDISK2\t\n";
128 static const CHAR property_dat[] = "Property\tValue\n"
130 "Property\tProperty\n"
131 "DefaultUIFont\tDlgFont8\n"
134 "InstallMode\tTypical\n"
135 "Manufacturer\tWine\n"
136 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
137 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
139 "ProductLanguage\t1033\n"
140 "ProductName\tMSITEST\n"
141 "ProductVersion\t1.1.1\n"
142 "PROMPTROLLBACKCOST\tP\n"
144 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
145 "AdminProperties\tPOSTADMIN\n"
148 static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
149 "s72\ti2\tl255\tL255\tL0\ts72\n"
150 "Registry\tRegistry\n"
151 "Apples\t2\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
152 "Oranges\t2\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
153 "regdata\t2\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
154 "OrderTest\t2\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
156 static const CHAR service_install_dat[] = "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
157 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
158 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
159 "ServiceInstall\tServiceInstall\n"
160 "TestService\tTestService\tTestService\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\t";
162 static const CHAR service_control_dat[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
163 "s72\tl255\ti2\tL255\tI2\ts72\n"
164 "ServiceControl\tServiceControl\n"
165 "ServiceControl\tTestService\t8\t\t0\tservice_comp";
167 /* tables for test_continuouscabs */
168 static const CHAR cc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
169 "s72\tS38\ts72\ti2\tS255\tS72\n"
170 "Component\tComponent\n"
171 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
172 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
173 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
175 static const CHAR cc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
176 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
178 "feature\t\t\t\t2\t1\tTARGETDIR\t0";
180 static const CHAR cc_feature_comp_dat[] = "Feature_\tComponent_\n"
182 "FeatureComponents\tFeature_\tComponent_\n"
184 "feature\taugustus\n"
187 static const CHAR cc_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\t12";
194 static const CHAR cc_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\t12\t\ttest3.cab\tDISK3\t\n";
201 static const CHAR co_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
202 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
204 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
205 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
206 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
208 static const CHAR co_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
209 "i2\ti4\tL64\tS255\tS32\tS72\n"
211 "1\t10\t\ttest1.cab\tDISK1\t\n"
212 "2\t2\t\ttest2.cab\tDISK2\t\n"
213 "3\t3\t\ttest3.cab\tDISK3\t\n";
215 static const CHAR co2_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
216 "i2\ti4\tL64\tS255\tS32\tS72\n"
218 "1\t10\t\ttest1.cab\tDISK1\t\n"
219 "2\t12\t\ttest3.cab\tDISK3\t\n"
220 "3\t2\t\ttest2.cab\tDISK2\t\n";
222 static const CHAR mm_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
223 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
225 "maximus\tmaximus\tmaximus\t500\t\t\t512\t1\n"
226 "augustus\taugustus\taugustus\t500\t\t\t512\t2\n"
227 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
229 static const CHAR mm_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
230 "i2\ti4\tL64\tS255\tS32\tS72\n"
232 "1\t3\t\ttest1.cab\tDISK1\t\n";
234 static const CHAR ss_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
235 "i2\ti4\tL64\tS255\tS32\tS72\n"
237 "1\t2\t\ttest1.cab\tDISK1\t\n"
238 "2\t2\t\ttest2.cab\tDISK2\t\n"
239 "3\t12\t\ttest3.cab\tDISK3\t\n";
241 /* tables for test_uiLevelFlags */
242 static const CHAR ui_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
243 "s72\tS38\ts72\ti2\tS255\tS72\n"
244 "Component\tComponent\n"
245 "maximus\t\tMSITESTDIR\t0\tHASUIRUN=1\tmaximus\n"
246 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
247 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
249 static const CHAR ui_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
251 "InstallUISequence\tAction\n"
252 "SetUIProperty\t\t5\n"
253 "ExecuteAction\t\t1100\n";
255 static const CHAR ui_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
256 "s72\ti2\tS64\tS0\tS255\n"
257 "CustomAction\tAction\n"
258 "SetUIProperty\t51\tHASUIRUN\t1\t\n";
260 static const CHAR rof_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
261 "s72\tS38\ts72\ti2\tS255\tS72\n"
262 "Component\tComponent\n"
263 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
265 static const CHAR rof_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
266 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
268 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
269 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
271 static const CHAR rof_feature_comp_dat[] = "Feature_\tComponent_\n"
273 "FeatureComponents\tFeature_\tComponent_\n"
275 "montecristo\tmaximus";
277 static const CHAR rof_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
278 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
280 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
282 static const CHAR rof_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
283 "i2\ti4\tL64\tS255\tS32\tS72\n"
285 "1\t1\t\t\tDISK1\t\n";
287 static const CHAR sdp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
289 "InstallExecuteSequence\tAction\n"
290 "AllocateRegistrySpace\tNOT Installed\t1550\n"
291 "CostFinalize\t\t1000\n"
292 "CostInitialize\t\t800\n"
294 "InstallFiles\t\t4000\n"
295 "InstallFinalize\t\t6600\n"
296 "InstallInitialize\t\t1500\n"
297 "InstallValidate\t\t1400\n"
298 "LaunchConditions\t\t100\n"
299 "SetDirProperty\t\t950";
301 static const CHAR sdp_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
302 "s72\ti2\tS64\tS0\tS255\n"
303 "CustomAction\tAction\n"
304 "SetDirProperty\t51\tMSITESTDIR\t[CommonFilesFolder]msitest\\\t\n";
306 static const CHAR cie_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
307 "s72\tS38\ts72\ti2\tS255\tS72\n"
308 "Component\tComponent\n"
309 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
310 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
311 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
312 "gaius\t\tMSITESTDIR\t0\t1\tgaius\n";
314 static const CHAR cie_feature_comp_dat[] = "Feature_\tComponent_\n"
316 "FeatureComponents\tFeature_\tComponent_\n"
318 "feature\taugustus\n"
322 static const CHAR cie_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
323 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
325 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
326 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
327 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12\n"
328 "gaius\tgaius\tgaius\t500\t\t\t8192\t11";
330 static const CHAR cie_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
331 "i2\ti4\tL64\tS255\tS32\tS72\n"
333 "1\t1\t\ttest1.cab\tDISK1\t\n"
334 "2\t2\t\ttest2.cab\tDISK2\t\n"
335 "3\t12\t\ttest3.cab\tDISK3\t\n";
337 static const CHAR ci_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
339 "InstallExecuteSequence\tAction\n"
340 "CostFinalize\t\t1000\n"
341 "CostInitialize\t\t800\n"
343 "InstallFiles\t\t4000\n"
344 "InstallServices\t\t5000\n"
345 "InstallFinalize\t\t6600\n"
346 "InstallInitialize\t\t1500\n"
347 "RunInstall\t\t1600\n"
348 "InstallValidate\t\t1400\n"
349 "LaunchConditions\t\t100";
351 static const CHAR ci_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
352 "s72\ti2\tS64\tS0\tS255\n"
353 "CustomAction\tAction\n"
354 "RunInstall\t23\tmsitest\\concurrent.msi\tMYPROP=[UILevel]\t\n";
356 static const CHAR ci_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
357 "s72\tS38\ts72\ti2\tS255\tS72\n"
358 "Component\tComponent\n"
359 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n";
361 static const CHAR ci2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
362 "s72\tS38\ts72\ti2\tS255\tS72\n"
363 "Component\tComponent\n"
364 "augustus\t\tMSITESTDIR\t0\tUILevel=3 AND MYPROP=5\taugustus\n";
366 static const CHAR ci2_feature_comp_dat[] = "Feature_\tComponent_\n"
368 "FeatureComponents\tFeature_\tComponent_\n"
371 static const CHAR ci2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
372 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
374 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
376 static const CHAR spf_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
377 "s72\ti2\tS64\tS0\tS255\n"
378 "CustomAction\tAction\n"
379 "SetFolderProp\t51\tMSITESTDIR\t[ProgramFilesFolder]\\msitest\\added\t\n";
381 static const CHAR spf_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
383 "InstallExecuteSequence\tAction\n"
384 "CostFinalize\t\t1000\n"
385 "CostInitialize\t\t800\n"
387 "SetFolderProp\t\t950\n"
388 "InstallFiles\t\t4000\n"
389 "InstallServices\t\t5000\n"
390 "InstallFinalize\t\t6600\n"
391 "InstallInitialize\t\t1500\n"
392 "InstallValidate\t\t1400\n"
393 "LaunchConditions\t\t100";
395 static const CHAR spf_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
397 "InstallUISequence\tAction\n"
398 "CostInitialize\t\t800\n"
400 "CostFinalize\t\t1000\n"
401 "ExecuteAction\t\t1100\n";
403 static const CHAR pp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
405 "InstallExecuteSequence\tAction\n"
406 "ValidateProductID\t\t700\n"
407 "CostInitialize\t\t800\n"
409 "CostFinalize\t\t1000\n"
410 "InstallValidate\t\t1400\n"
411 "InstallInitialize\t\t1500\n"
412 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
413 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
414 "RemoveFiles\t\t3500\n"
415 "InstallFiles\t\t4000\n"
416 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
417 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
418 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
419 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
420 "InstallFinalize\t\t6600";
422 static const CHAR tp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
423 "s72\tS38\ts72\ti2\tS255\tS72\n"
424 "Component\tComponent\n"
425 "augustus\t\tMSITESTDIR\t0\tprop=\"val\"\taugustus\n";
427 static const CHAR cwd_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
428 "s72\tS38\ts72\ti2\tS255\tS72\n"
429 "Component\tComponent\n"
430 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
432 static const CHAR adm_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
433 "s72\tS38\ts72\ti2\tS255\tS72\n"
434 "Component\tComponent\n"
435 "augustus\t\tMSITESTDIR\t0\tPOSTADMIN=1\taugustus";
437 static const CHAR adm_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
438 "s72\ti2\tS64\tS0\tS255\n"
439 "CustomAction\tAction\n"
440 "SetPOSTADMIN\t51\tPOSTADMIN\t1\t\n";
442 static const CHAR adm_admin_exec_seq_dat[] = "Action\tCondition\tSequence\n"
444 "AdminExecuteSequence\tAction\n"
445 "CostFinalize\t\t1000\n"
446 "CostInitialize\t\t800\n"
448 "SetPOSTADMIN\t\t950\n"
449 "InstallFiles\t\t4000\n"
450 "InstallFinalize\t\t6600\n"
451 "InstallInitialize\t\t1500\n"
452 "InstallValidate\t\t1400\n"
453 "LaunchConditions\t\t100";
455 static const CHAR amp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
456 "s72\tS38\ts72\ti2\tS255\tS72\n"
457 "Component\tComponent\n"
458 "augustus\t\tMSITESTDIR\t0\tMYPROP=2718\taugustus\n";
460 static const CHAR rem_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
461 "s72\tS38\ts72\ti2\tS255\tS72\n"
462 "Component\tComponent\n"
463 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t0\t\thydrogen\n"
464 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\thelium\n"
465 "lithium\t\tMSITESTDIR\t2\t\tlithium\n";
467 static const CHAR rem_feature_comp_dat[] = "Feature_\tComponent_\n"
469 "FeatureComponents\tFeature_\tComponent_\n"
470 "feature\thydrogen\n"
474 static const CHAR rem_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
475 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
477 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
478 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
479 "lithium\tlithium\tlithium\t0\t\t\t8192\t1";
481 static const CHAR rem_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
483 "InstallExecuteSequence\tAction\n"
484 "ValidateProductID\t\t700\n"
485 "CostInitialize\t\t800\n"
487 "CostFinalize\t\t1000\n"
488 "InstallValidate\t\t1400\n"
489 "InstallInitialize\t\t1500\n"
490 "ProcessComponents\t\t1600\n"
491 "UnpublishFeatures\t\t1800\n"
492 "RemoveFiles\t\t3500\n"
493 "InstallFiles\t\t4000\n"
494 "RegisterProduct\t\t6100\n"
495 "PublishFeatures\t\t6300\n"
496 "PublishProduct\t\t6400\n"
497 "InstallFinalize\t\t6600";
499 static const CHAR rem_remove_files_dat[] = "FileKey\tComponent_\tFileName\tDirProperty\tInstallMode\n"
500 "s72\ts72\tS255\ts72\tI2\n"
501 "RemoveFile\tFileKey\n"
502 "furlong\thydrogen\tfurlong\tMSITESTDIR\t1\n"
503 "firkin\thelium\tfirkin\tMSITESTDIR\t1\n"
504 "fortnight\tlithium\tfortnight\tMSITESTDIR\t1\n"
505 "becquerel\thydrogen\tbecquerel\tMSITESTDIR\t2\n"
506 "dioptre\thelium\tdioptre\tMSITESTDIR\t2\n"
507 "attoparsec\tlithium\tattoparsec\tMSITESTDIR\t2\n"
508 "storeys\thydrogen\tstoreys\tMSITESTDIR\t3\n"
509 "block\thelium\tblock\tMSITESTDIR\t3\n"
510 "siriometer\tlithium\tsiriometer\tMSITESTDIR\t3\n";
512 static const CHAR mov_move_file_dat[] = "FileKey\tComponent_\tSourceName\tDestName\tSourceFolder\tDestFolder\tOptions\n"
513 "s72\ts72\tS255\tS255\tS72\ts72\ti2\n"
514 "MoveFile\tFileKey\n"
515 "abkhazia\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t0\n"
516 "bahamas\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t1\n"
517 "cambodia\taugustus\tcameroon\tcanada\tSourceDir\tMSITESTDIR\t0\n"
518 "denmark\taugustus\tdjibouti\tdominica\tSourceDir\tMSITESTDIR\t1\n"
519 "ecuador\taugustus\tegypt\telsalvador\tNotAProp\tMSITESTDIR\t1\n"
520 "fiji\taugustus\tfinland\tfrance\tSourceDir\tNotAProp\t1\n"
521 "gabon\taugustus\tgambia\tgeorgia\tSOURCEFULL\tMSITESTDIR\t1\n"
522 "haiti\taugustus\thonduras\thungary\tSourceDir\tDESTFULL\t1\n"
523 "iceland\taugustus\tindia\tindonesia\tMSITESTDIR\tMSITESTDIR\t1\n"
524 "jamaica\taugustus\tjapan\tjordan\tFILEPATHBAD\tMSITESTDIR\t1\n"
525 "kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n"
526 "laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n"
527 "namibia\taugustus\tnauru\tkiribati\tSourceDir\tMSITESTDIR\t1\n"
528 "wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
529 "single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
530 "wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
531 "singlenodest\taugustus\tb?r\t\tSourceDir\tMSITESTDIR\t1\n";
533 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
534 "s72\tS38\ts72\ti2\tS255\tS72\n"
535 "Component\tComponent\n"
536 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
537 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
538 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
539 "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n";
541 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
542 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
544 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
545 "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
546 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
547 "gaius\tgaius\tgaius\t500\t\t\t16384\t4";
549 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
550 "i2\ti4\tL64\tS255\tS32\tS72\n"
552 "1\t1\t\ttest1.cab\tDISK1\t\n"
553 "2\t2\t\ttest2.cab\tDISK2\t\n"
554 "3\t3\t\ttest3.cab\tDISK3\t\n"
555 "4\t4\t\ttest3.cab\tDISK3\t\n";
557 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
558 "s72\ti2\ti4\ti4\ti4\ti4\n"
559 "MsiFileHash\tFile_\n"
560 "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
562 typedef struct _msi_table
564 const CHAR *filename;
569 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
571 static const msi_table tables[] =
573 ADD_TABLE(component),
574 ADD_TABLE(directory),
576 ADD_TABLE(feature_comp),
578 ADD_TABLE(install_exec_seq),
582 ADD_TABLE(service_install),
583 ADD_TABLE(service_control)
586 static const msi_table cc_tables[] =
588 ADD_TABLE(cc_component),
589 ADD_TABLE(directory),
590 ADD_TABLE(cc_feature),
591 ADD_TABLE(cc_feature_comp),
593 ADD_TABLE(install_exec_seq),
598 static const msi_table co_tables[] =
600 ADD_TABLE(cc_component),
601 ADD_TABLE(directory),
602 ADD_TABLE(cc_feature),
603 ADD_TABLE(cc_feature_comp),
605 ADD_TABLE(install_exec_seq),
610 static const msi_table co2_tables[] =
612 ADD_TABLE(cc_component),
613 ADD_TABLE(directory),
614 ADD_TABLE(cc_feature),
615 ADD_TABLE(cc_feature_comp),
617 ADD_TABLE(install_exec_seq),
618 ADD_TABLE(co2_media),
622 static const msi_table mm_tables[] =
624 ADD_TABLE(cc_component),
625 ADD_TABLE(directory),
626 ADD_TABLE(cc_feature),
627 ADD_TABLE(cc_feature_comp),
629 ADD_TABLE(install_exec_seq),
634 static const msi_table ss_tables[] =
636 ADD_TABLE(cc_component),
637 ADD_TABLE(directory),
638 ADD_TABLE(cc_feature),
639 ADD_TABLE(cc_feature_comp),
641 ADD_TABLE(install_exec_seq),
646 static const msi_table ui_tables[] =
648 ADD_TABLE(ui_component),
649 ADD_TABLE(directory),
650 ADD_TABLE(cc_feature),
651 ADD_TABLE(cc_feature_comp),
653 ADD_TABLE(install_exec_seq),
654 ADD_TABLE(ui_install_ui_seq),
655 ADD_TABLE(ui_custom_action),
660 static const msi_table rof_tables[] =
662 ADD_TABLE(rof_component),
663 ADD_TABLE(directory),
664 ADD_TABLE(rof_feature),
665 ADD_TABLE(rof_feature_comp),
667 ADD_TABLE(install_exec_seq),
668 ADD_TABLE(rof_media),
672 static const msi_table sdp_tables[] =
674 ADD_TABLE(rof_component),
675 ADD_TABLE(directory),
676 ADD_TABLE(rof_feature),
677 ADD_TABLE(rof_feature_comp),
679 ADD_TABLE(sdp_install_exec_seq),
680 ADD_TABLE(sdp_custom_action),
681 ADD_TABLE(rof_media),
685 static const msi_table cie_tables[] =
687 ADD_TABLE(cie_component),
688 ADD_TABLE(directory),
689 ADD_TABLE(cc_feature),
690 ADD_TABLE(cie_feature_comp),
692 ADD_TABLE(install_exec_seq),
693 ADD_TABLE(cie_media),
697 static const msi_table ci_tables[] =
699 ADD_TABLE(ci_component),
700 ADD_TABLE(directory),
701 ADD_TABLE(rof_feature),
702 ADD_TABLE(rof_feature_comp),
704 ADD_TABLE(ci_install_exec_seq),
705 ADD_TABLE(rof_media),
707 ADD_TABLE(ci_custom_action),
710 static const msi_table ci2_tables[] =
712 ADD_TABLE(ci2_component),
713 ADD_TABLE(directory),
714 ADD_TABLE(rof_feature),
715 ADD_TABLE(ci2_feature_comp),
717 ADD_TABLE(install_exec_seq),
718 ADD_TABLE(rof_media),
722 static const msi_table spf_tables[] =
724 ADD_TABLE(ci_component),
725 ADD_TABLE(directory),
726 ADD_TABLE(rof_feature),
727 ADD_TABLE(rof_feature_comp),
729 ADD_TABLE(spf_install_exec_seq),
730 ADD_TABLE(rof_media),
732 ADD_TABLE(spf_custom_action),
733 ADD_TABLE(spf_install_ui_seq),
736 static const msi_table pp_tables[] =
738 ADD_TABLE(ci_component),
739 ADD_TABLE(directory),
740 ADD_TABLE(rof_feature),
741 ADD_TABLE(rof_feature_comp),
743 ADD_TABLE(pp_install_exec_seq),
744 ADD_TABLE(rof_media),
748 static const msi_table tp_tables[] =
750 ADD_TABLE(tp_component),
751 ADD_TABLE(directory),
752 ADD_TABLE(rof_feature),
753 ADD_TABLE(ci2_feature_comp),
755 ADD_TABLE(install_exec_seq),
756 ADD_TABLE(rof_media),
760 static const msi_table cwd_tables[] =
762 ADD_TABLE(cwd_component),
763 ADD_TABLE(directory),
764 ADD_TABLE(rof_feature),
765 ADD_TABLE(ci2_feature_comp),
767 ADD_TABLE(install_exec_seq),
768 ADD_TABLE(rof_media),
772 static const msi_table adm_tables[] =
774 ADD_TABLE(adm_component),
775 ADD_TABLE(directory),
776 ADD_TABLE(rof_feature),
777 ADD_TABLE(ci2_feature_comp),
779 ADD_TABLE(install_exec_seq),
780 ADD_TABLE(rof_media),
782 ADD_TABLE(adm_custom_action),
783 ADD_TABLE(adm_admin_exec_seq),
786 static const msi_table amp_tables[] =
788 ADD_TABLE(amp_component),
789 ADD_TABLE(directory),
790 ADD_TABLE(rof_feature),
791 ADD_TABLE(ci2_feature_comp),
793 ADD_TABLE(install_exec_seq),
794 ADD_TABLE(rof_media),
798 static const msi_table rem_tables[] =
800 ADD_TABLE(rem_component),
801 ADD_TABLE(directory),
802 ADD_TABLE(rof_feature),
803 ADD_TABLE(rem_feature_comp),
805 ADD_TABLE(rem_install_exec_seq),
806 ADD_TABLE(rof_media),
808 ADD_TABLE(rem_remove_files),
811 static const msi_table mov_tables[] =
813 ADD_TABLE(cwd_component),
814 ADD_TABLE(directory),
815 ADD_TABLE(rof_feature),
816 ADD_TABLE(ci2_feature_comp),
818 ADD_TABLE(install_exec_seq),
819 ADD_TABLE(rof_media),
821 ADD_TABLE(mov_move_file),
825 static const msi_table mc_tables[] =
827 ADD_TABLE(mc_component),
828 ADD_TABLE(directory),
829 ADD_TABLE(cc_feature),
830 ADD_TABLE(cie_feature_comp),
832 ADD_TABLE(install_exec_seq),
835 ADD_TABLE(mc_file_hash),
838 /* cabinet definitions */
840 /* make the max size large so there is only one cab file */
841 #define MEDIA_SIZE 0x7FFFFFFF
842 #define FOLDER_THRESHOLD 900000
844 /* the FCI callbacks */
846 static void *mem_alloc(ULONG cb)
848 return HeapAlloc(GetProcessHeap(), 0, cb);
851 static void mem_free(void *memory)
853 HeapFree(GetProcessHeap(), 0, memory);
856 static BOOL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
858 sprintf(pccab->szCab, pv, pccab->iCab);
862 static long progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
867 static int file_placed(PCCAB pccab, char *pszFile, long cbFile,
868 BOOL fContinuation, void *pv)
873 static INT_PTR fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
877 DWORD dwShareMode = 0;
878 DWORD dwCreateDisposition = OPEN_EXISTING;
880 dwAccess = GENERIC_READ | GENERIC_WRITE;
881 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
882 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
884 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
885 dwCreateDisposition = OPEN_EXISTING;
887 dwCreateDisposition = CREATE_NEW;
889 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
890 dwCreateDisposition, 0, NULL);
892 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
894 return (INT_PTR)handle;
897 static UINT fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
899 HANDLE handle = (HANDLE)hf;
903 res = ReadFile(handle, memory, cb, &dwRead, NULL);
904 ok(res, "Failed to ReadFile\n");
909 static UINT fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
911 HANDLE handle = (HANDLE)hf;
915 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
916 ok(res, "Failed to WriteFile\n");
921 static int fci_close(INT_PTR hf, int *err, void *pv)
923 HANDLE handle = (HANDLE)hf;
924 ok(CloseHandle(handle), "Failed to CloseHandle\n");
929 static long fci_seek(INT_PTR hf, long dist, int seektype, int *err, void *pv)
931 HANDLE handle = (HANDLE)hf;
934 ret = SetFilePointer(handle, dist, NULL, seektype);
935 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
940 static int fci_delete(char *pszFile, int *err, void *pv)
942 BOOL ret = DeleteFileA(pszFile);
943 ok(ret, "Failed to DeleteFile %s\n", pszFile);
948 static void init_functionpointers(void)
950 HMODULE hmsi = GetModuleHandleA("msi.dll");
952 #define GET_PROC(func) \
953 p ## func = (void*)GetProcAddress(hmsi, #func); \
955 trace("GetProcAddress(%s) failed\n", #func);
957 GET_PROC(MsiQueryComponentStateA);
958 GET_PROC(MsiSourceListGetInfoA);
963 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
970 r = MsiRecordGetString(rec, field, buffer, &sz);
971 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
974 static BOOL get_temp_file(char *pszTempName, int cbTempName, void *pv)
978 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
979 GetTempFileNameA(".", "xx", 0, tempname);
981 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
983 lstrcpyA(pszTempName, tempname);
984 HeapFree(GetProcessHeap(), 0, tempname);
988 HeapFree(GetProcessHeap(), 0, tempname);
993 static INT_PTR get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
994 USHORT *pattribs, int *err, void *pv)
996 BY_HANDLE_FILE_INFORMATION finfo;
1002 handle = CreateFile(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
1003 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
1005 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
1007 res = GetFileInformationByHandle(handle, &finfo);
1008 ok(res, "Expected GetFileInformationByHandle to succeed\n");
1010 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
1011 FileTimeToDosDateTime(&filetime, pdate, ptime);
1013 attrs = GetFileAttributes(pszName);
1014 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
1016 return (INT_PTR)handle;
1019 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
1021 char path[MAX_PATH];
1022 char filename[MAX_PATH];
1024 lstrcpyA(path, CURR_DIR);
1025 lstrcatA(path, "\\");
1026 lstrcatA(path, file);
1028 lstrcpyA(filename, file);
1030 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
1031 progress, get_open_info, compress);
1034 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
1036 ZeroMemory(pCabParams, sizeof(CCAB));
1038 pCabParams->cb = max_size;
1039 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
1040 pCabParams->setID = 0xbeef;
1041 pCabParams->iCab = 1;
1042 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
1043 lstrcatA(pCabParams->szCabPath, "\\");
1044 lstrcpyA(pCabParams->szCab, name);
1047 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
1055 set_cab_parameters(&cabParams, name, max_size);
1057 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
1058 fci_read, fci_write, fci_close, fci_seek, fci_delete,
1059 get_temp_file, &cabParams, NULL);
1061 ok(hfci != NULL, "Failed to create an FCI context\n");
1066 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
1067 ok(res, "Failed to add file: %s\n", ptr);
1068 ptr += lstrlen(ptr) + 1;
1071 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
1072 ok(res, "Failed to flush the cabinet\n");
1074 res = FCIDestroy(hfci);
1075 ok(res, "Failed to destroy the cabinet\n");
1078 static BOOL get_program_files_dir(LPSTR buf, LPSTR buf2)
1083 if (RegOpenKey(HKEY_LOCAL_MACHINE,
1084 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
1088 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) {
1094 if (RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size)) {
1103 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
1108 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
1109 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
1110 WriteFile(file, data, strlen(data), &written, NULL);
1114 SetFilePointer(file, size, NULL, FILE_BEGIN);
1121 #define create_file(name, size) create_file_data(name, name, size)
1123 static void create_test_files(void)
1125 CreateDirectoryA("msitest", NULL);
1126 create_file("msitest\\one.txt", 100);
1127 CreateDirectoryA("msitest\\first", NULL);
1128 create_file("msitest\\first\\two.txt", 100);
1129 CreateDirectoryA("msitest\\second", NULL);
1130 create_file("msitest\\second\\three.txt", 100);
1132 create_file("four.txt", 100);
1133 create_file("five.txt", 100);
1134 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
1136 create_file("msitest\\filename", 100);
1137 create_file("msitest\\service.exe", 100);
1139 DeleteFileA("four.txt");
1140 DeleteFileA("five.txt");
1143 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
1145 CHAR path[MAX_PATH];
1147 lstrcpyA(path, PROG_FILES_DIR);
1148 lstrcatA(path, "\\");
1149 lstrcatA(path, rel_path);
1152 return DeleteFileA(path);
1154 return RemoveDirectoryA(path);
1157 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
1159 CHAR path[MAX_PATH];
1161 lstrcpyA(path, COMMON_FILES_DIR);
1162 lstrcatA(path, "\\");
1163 lstrcatA(path, rel_path);
1166 return DeleteFileA(path);
1168 return RemoveDirectoryA(path);
1171 static void delete_test_files(void)
1173 DeleteFileA("msitest.msi");
1174 DeleteFileA("msitest.cab");
1175 DeleteFileA("msitest\\second\\three.txt");
1176 DeleteFileA("msitest\\first\\two.txt");
1177 DeleteFileA("msitest\\one.txt");
1178 DeleteFileA("msitest\\service.exe");
1179 DeleteFileA("msitest\\filename");
1180 RemoveDirectoryA("msitest\\second");
1181 RemoveDirectoryA("msitest\\first");
1182 RemoveDirectoryA("msitest");
1185 static void write_file(const CHAR *filename, const char *data, int data_size)
1189 HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
1190 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
1192 WriteFile(hf, data, data_size, &size, NULL);
1196 static void write_msi_summary_info(MSIHANDLE db)
1201 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
1202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1204 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, ";1033");
1205 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1207 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
1208 "{004757CA-5092-49c2-AD20-28E1CE0DF5F2}");
1209 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1211 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
1212 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1214 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 0, NULL, NULL);
1215 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1217 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
1218 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1220 /* write the summary changes back to the stream */
1221 r = MsiSummaryInfoPersist(summary);
1222 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1224 MsiCloseHandle(summary);
1227 static void create_database(const CHAR *name, const msi_table *tables, int num_tables)
1233 r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db);
1234 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1236 /* import the tables into the database */
1237 for (j = 0; j < num_tables; j++)
1239 const msi_table *table = &tables[j];
1241 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
1243 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
1244 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1246 DeleteFileA(table->filename);
1249 write_msi_summary_info(db);
1251 r = MsiDatabaseCommit(db);
1252 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1257 static void check_service_is_installed(void)
1259 SC_HANDLE scm, service;
1262 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
1263 ok(scm != NULL, "Failed to open the SC Manager\n");
1265 service = OpenService(scm, "TestService", SC_MANAGER_ALL_ACCESS);
1266 ok(service != NULL, "Failed to open TestService\n");
1268 res = DeleteService(service);
1269 ok(res, "Failed to delete TestService\n");
1271 CloseServiceHandle(service);
1272 CloseServiceHandle(scm);
1275 static void test_MsiInstallProduct(void)
1278 CHAR path[MAX_PATH];
1281 DWORD num, size, type;
1283 create_test_files();
1284 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1286 r = MsiInstallProductA(msifile, NULL);
1287 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1289 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
1290 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
1291 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
1292 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
1293 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
1294 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
1295 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
1296 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
1297 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
1298 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
1299 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
1300 ok(delete_pf("msitest", FALSE), "File not installed\n");
1302 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
1303 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1307 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
1308 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1309 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
1313 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
1314 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
1318 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
1319 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1320 ok(num == 314, "Expected 314, got %d\n", num);
1324 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
1325 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1326 ok(!lstrcmpA(path, "OrderTestValue"), "Expected imaname, got %s\n", path);
1328 check_service_is_installed();
1330 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
1332 delete_test_files();
1335 static void test_MsiSetComponentState(void)
1337 INSTALLSTATE installed, action;
1339 char path[MAX_PATH];
1342 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1346 lstrcpy(path, CURR_DIR);
1347 lstrcat(path, "\\");
1348 lstrcat(path, msifile);
1350 r = MsiOpenPackage(path, &package);
1351 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1353 r = MsiDoAction(package, "CostInitialize");
1354 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1356 r = MsiDoAction(package, "FileCost");
1357 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1359 r = MsiDoAction(package, "CostFinalize");
1360 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1362 r = MsiGetComponentState(package, "dangler", &installed, &action);
1363 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1364 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
1365 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
1367 r = MsiSetComponentState(package, "dangler", INSTALLSTATE_SOURCE);
1368 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1370 MsiCloseHandle(package);
1373 DeleteFileA(msifile);
1376 static void test_packagecoltypes(void)
1378 MSIHANDLE hdb, view, rec;
1379 char path[MAX_PATH];
1383 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1387 lstrcpy(path, CURR_DIR);
1388 lstrcat(path, "\\");
1389 lstrcat(path, msifile);
1391 r = MsiOpenDatabase(path, MSIDBOPEN_READONLY, &hdb);
1392 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1394 query = "SELECT * FROM `Media`";
1395 r = MsiDatabaseOpenView( hdb, query, &view );
1396 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
1398 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
1399 count = MsiRecordGetFieldCount( rec );
1400 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
1401 ok(count == 6, "Expected 6, got %d\n", count);
1402 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
1403 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
1404 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
1405 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
1406 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
1407 ok(check_record(rec, 6, "Source"), "wrong column label\n");
1408 MsiCloseHandle(rec);
1410 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
1411 count = MsiRecordGetFieldCount( rec );
1412 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
1413 ok(count == 6, "Expected 6, got %d\n", count);
1414 ok(check_record(rec, 1, "i2"), "wrong column label\n");
1415 ok(check_record(rec, 2, "i4"), "wrong column label\n");
1416 ok(check_record(rec, 3, "L64"), "wrong column label\n");
1417 ok(check_record(rec, 4, "S255"), "wrong column label\n");
1418 ok(check_record(rec, 5, "S32"), "wrong column label\n");
1419 ok(check_record(rec, 6, "S72"), "wrong column label\n");
1421 MsiCloseHandle(rec);
1422 MsiCloseHandle(view);
1423 MsiCloseHandle(hdb);
1424 DeleteFile(msifile);
1427 static void create_cc_test_files(void)
1432 static CHAR cab_context[] = "test%d.cab";
1435 create_file("maximus", 500);
1436 create_file("augustus", 50000);
1437 create_file("caesar", 500);
1439 set_cab_parameters(&cabParams, "test1.cab", 200);
1441 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
1442 fci_read, fci_write, fci_close, fci_seek, fci_delete,
1443 get_temp_file, &cabParams, cab_context);
1444 ok(hfci != NULL, "Failed to create an FCI context\n");
1446 res = add_file(hfci, "maximus", tcompTYPE_MSZIP);
1447 ok(res, "Failed to add file maximus\n");
1449 res = add_file(hfci, "augustus", tcompTYPE_MSZIP);
1450 ok(res, "Failed to add file augustus\n");
1452 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
1453 ok(res, "Failed to flush the cabinet\n");
1455 res = FCIDestroy(hfci);
1456 ok(res, "Failed to destroy the cabinet\n");
1458 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1460 DeleteFile("maximus");
1461 DeleteFile("augustus");
1462 DeleteFile("caesar");
1465 static void delete_cab_files(void)
1467 SHFILEOPSTRUCT shfl;
1468 CHAR path[MAX_PATH+10];
1470 lstrcpyA(path, CURR_DIR);
1471 lstrcatA(path, "\\*.cab");
1472 path[strlen(path) + 1] = '\0';
1475 shfl.wFunc = FO_DELETE;
1478 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
1480 SHFileOperation(&shfl);
1483 static void test_continuouscabs(void)
1487 create_cc_test_files();
1488 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
1490 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1492 r = MsiInstallProductA(msifile, NULL);
1493 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1496 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1497 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
1498 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1500 ok(delete_pf("msitest", FALSE), "File not installed\n");
1503 DeleteFile(msifile);
1506 static void test_caborder(void)
1510 create_file("imperator", 100);
1511 create_file("maximus", 500);
1512 create_file("augustus", 50000);
1513 create_file("caesar", 500);
1515 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
1517 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1519 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
1520 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
1521 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1523 r = MsiInstallProductA(msifile, NULL);
1524 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1525 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1526 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1529 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1530 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1535 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
1536 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
1537 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1539 r = MsiInstallProductA(msifile, NULL);
1540 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1541 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1542 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1543 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1546 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1550 DeleteFile(msifile);
1552 create_cc_test_files();
1553 create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
1555 r = MsiInstallProductA(msifile, NULL);
1556 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1557 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1558 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1561 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1562 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1566 DeleteFile(msifile);
1568 create_cc_test_files();
1569 create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
1571 r = MsiInstallProductA(msifile, NULL);
1572 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1573 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1576 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1577 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1578 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1582 DeleteFile("imperator");
1583 DeleteFile("maximus");
1584 DeleteFile("augustus");
1585 DeleteFile("caesar");
1586 DeleteFile(msifile);
1589 static void test_mixedmedia(void)
1593 CreateDirectoryA("msitest", NULL);
1594 create_file("msitest\\maximus", 500);
1595 create_file("msitest\\augustus", 500);
1596 create_file("caesar", 500);
1598 create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
1600 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1602 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
1604 r = MsiInstallProductA(msifile, NULL);
1605 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1606 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
1607 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1608 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1609 ok(delete_pf("msitest", FALSE), "File not installed\n");
1611 /* Delete the files in the temp (current) folder */
1612 DeleteFile("msitest\\maximus");
1613 DeleteFile("msitest\\augustus");
1614 RemoveDirectory("msitest");
1615 DeleteFile("caesar");
1616 DeleteFile("test1.cab");
1617 DeleteFile(msifile);
1620 static void test_samesequence(void)
1624 create_cc_test_files();
1625 create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
1627 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1629 r = MsiInstallProductA(msifile, NULL);
1632 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1633 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
1634 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1636 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1637 ok(delete_pf("msitest", FALSE), "File not installed\n");
1640 DeleteFile(msifile);
1643 static void test_uiLevelFlags(void)
1647 create_cc_test_files();
1648 create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
1650 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
1652 r = MsiInstallProductA(msifile, NULL);
1653 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
1656 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1657 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1659 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
1660 ok(delete_pf("msitest", FALSE), "File not installed\n");
1663 DeleteFile(msifile);
1666 static BOOL file_matches(LPSTR path)
1672 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
1673 NULL, OPEN_EXISTING, 0, NULL);
1675 ZeroMemory(buf, MAX_PATH);
1676 ReadFile(file, buf, 15, &size, NULL);
1679 return !lstrcmp(buf, "msitest\\maximus");
1682 static void test_readonlyfile(void)
1687 CHAR path[MAX_PATH];
1689 CreateDirectoryA("msitest", NULL);
1690 create_file("msitest\\maximus", 500);
1691 create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
1693 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1695 lstrcpy(path, PROG_FILES_DIR);
1696 lstrcat(path, "\\msitest");
1697 CreateDirectory(path, NULL);
1699 lstrcat(path, "\\maximus");
1700 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
1701 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
1703 WriteFile(file, "readonlyfile", 20, &size, NULL);
1706 r = MsiInstallProductA(msifile, NULL);
1707 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1708 ok(file_matches(path), "Expected file to be overwritten\n");
1709 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1710 ok(delete_pf("msitest", FALSE), "File not installed\n");
1712 /* Delete the files in the temp (current) folder */
1713 DeleteFile("msitest\\maximus");
1714 RemoveDirectory("msitest");
1715 DeleteFile(msifile);
1718 static void test_setdirproperty(void)
1722 CreateDirectoryA("msitest", NULL);
1723 create_file("msitest\\maximus", 500);
1724 create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
1726 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1728 r = MsiInstallProductA(msifile, NULL);
1729 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1730 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
1731 ok(delete_cf("msitest", FALSE), "File not installed\n");
1733 /* Delete the files in the temp (current) folder */
1734 DeleteFile(msifile);
1735 DeleteFile("msitest\\maximus");
1736 RemoveDirectory("msitest");
1739 static void test_cabisextracted(void)
1743 CreateDirectoryA("msitest", NULL);
1744 create_file("msitest\\gaius", 500);
1745 create_file("maximus", 500);
1746 create_file("augustus", 500);
1747 create_file("caesar", 500);
1749 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
1750 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
1751 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1753 create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
1755 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1757 r = MsiInstallProductA(msifile, NULL);
1758 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1759 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1760 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
1761 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1762 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
1763 ok(delete_pf("msitest", FALSE), "File not installed\n");
1765 /* Delete the files in the temp (current) folder */
1767 DeleteFile(msifile);
1768 DeleteFile("maximus");
1769 DeleteFile("augustus");
1770 DeleteFile("caesar");
1771 DeleteFile("msitest\\gaius");
1772 RemoveDirectory("msitest");
1775 static void test_concurrentinstall(void)
1778 CHAR path[MAX_PATH];
1780 CreateDirectoryA("msitest", NULL);
1781 CreateDirectoryA("msitest\\msitest", NULL);
1782 create_file("msitest\\maximus", 500);
1783 create_file("msitest\\msitest\\augustus", 500);
1785 create_database(msifile, ci_tables, sizeof(ci_tables) / sizeof(msi_table));
1787 lstrcpyA(path, CURR_DIR);
1788 lstrcatA(path, "\\msitest\\concurrent.msi");
1789 create_database(path, ci2_tables, sizeof(ci2_tables) / sizeof(msi_table));
1791 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
1793 r = MsiInstallProductA(msifile, NULL);
1794 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1795 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1796 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
1797 ok(delete_pf("msitest", FALSE), "File not installed\n");
1799 /* Delete the files in the temp (current) folder */
1800 DeleteFile(msifile);
1802 DeleteFile("msitest\\msitest\\augustus");
1803 DeleteFile("msitest\\maximus");
1804 RemoveDirectory("msitest\\msitest");
1805 RemoveDirectory("msitest");
1808 static void test_setpropertyfolder(void)
1812 CreateDirectoryA("msitest", NULL);
1813 create_file("msitest\\maximus", 500);
1815 create_database(msifile, spf_tables, sizeof(spf_tables) / sizeof(msi_table));
1817 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
1819 r = MsiInstallProductA(msifile, NULL);
1820 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1821 ok(delete_pf("msitest\\added\\maximus", TRUE), "File not installed\n");
1822 ok(delete_pf("msitest\\added", FALSE), "File not installed\n");
1823 ok(delete_pf("msitest", FALSE), "File not installed\n");
1825 /* Delete the files in the temp (current) folder */
1826 DeleteFile(msifile);
1827 DeleteFile("msitest\\maximus");
1828 RemoveDirectory("msitest");
1831 static BOOL file_exists(LPCSTR file)
1833 return GetFileAttributes(file) != INVALID_FILE_ATTRIBUTES;
1836 static BOOL pf_exists(LPCSTR file)
1838 CHAR path[MAX_PATH];
1840 lstrcpyA(path, PROG_FILES_DIR);
1841 lstrcatA(path, "\\");
1842 lstrcatA(path, file);
1844 return file_exists(path);
1847 static void delete_pfmsitest_files(void)
1849 SHFILEOPSTRUCT shfl;
1850 CHAR path[MAX_PATH+11];
1852 lstrcpyA(path, PROG_FILES_DIR);
1853 lstrcatA(path, "\\msitest\\*");
1854 path[strlen(path) + 1] = '\0';
1857 shfl.wFunc = FO_DELETE;
1860 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
1862 SHFileOperation(&shfl);
1864 lstrcpyA(path, PROG_FILES_DIR);
1865 lstrcatA(path, "\\msitest");
1866 RemoveDirectoryA(path);
1869 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
1877 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
1879 if (res != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ))
1881 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
1886 ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val);
1890 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
1892 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
1896 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
1898 DWORD val, size, type;
1901 size = sizeof(DWORD);
1902 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
1904 if (res != ERROR_SUCCESS || type != REG_DWORD)
1906 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
1910 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
1913 #define CHECK_REG_STR(prodkey, name, expected) \
1914 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
1916 #define CHECK_REG_ISTR(prodkey, name, expected) \
1917 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
1919 #define CHECK_REG_DWORD(prodkey, name, expected) \
1920 check_reg_dword(prodkey, name, expected, __LINE__);
1922 static void get_date_str(LPSTR date)
1926 static const char date_fmt[] = "%d%d%d";
1927 GetLocalTime(&systime);
1928 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
1931 static void test_publish(void)
1935 HKEY uninstall, prodkey;
1937 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
1938 char date[MAX_PATH];
1939 char temp[MAX_PATH];
1941 static const CHAR subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
1944 GetTempPath(MAX_PATH, temp);
1946 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, subkey, &uninstall);
1947 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1949 CreateDirectoryA("msitest", NULL);
1950 create_file("msitest\\maximus", 500);
1952 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
1954 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
1956 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1957 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1959 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1960 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1962 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1963 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1965 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
1966 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
1967 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
1968 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1970 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
1971 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
1973 /* nothing published */
1974 r = MsiInstallProductA(msifile, NULL);
1975 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1976 ok(pf_exists("msitest\\maximus"), "File not installed\n");
1977 ok(pf_exists("msitest"), "File not installed\n");
1979 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
1980 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1982 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
1983 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1985 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
1986 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1988 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
1989 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
1990 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
1991 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
1993 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
1994 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
1997 r = MsiInstallProductA(msifile, NULL);
1998 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
1999 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2000 ok(pf_exists("msitest"), "File not installed\n");
2002 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2003 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2005 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2006 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2008 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2009 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2011 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2012 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2013 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2014 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2016 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2017 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2019 /* try to uninstall */
2020 r = MsiInstallProductA(msifile, "REMOVE=ALL");
2023 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2025 ok(pf_exists("msitest\\maximus"), "File deleted\n");
2026 ok(pf_exists("msitest"), "File deleted\n");
2028 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2029 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2031 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2032 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2034 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2035 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2037 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2038 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2039 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2040 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2042 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2043 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2045 /* PublishProduct */
2046 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2047 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2048 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2049 ok(pf_exists("msitest"), "File not installed\n");
2051 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2052 ok(state == INSTALLSTATE_ADVERTISED, "Expected INSTALLSTATE_ADVERTISED, got %d\n", state);
2054 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2055 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2057 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2058 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2059 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
2060 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2062 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2063 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2065 /* try to uninstall after PublishProduct */
2066 r = MsiInstallProductA(msifile, "REMOVE=ALL");
2067 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2068 ok(pf_exists("msitest\\maximus"), "File deleted\n");
2069 ok(pf_exists("msitest"), "File deleted\n");
2071 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2072 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2074 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2075 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2077 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2078 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2080 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2081 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2082 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2083 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2085 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2086 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2088 /* RegisterProduct */
2089 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
2090 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2091 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2092 ok(pf_exists("msitest"), "File not installed\n");
2094 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2095 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2097 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2098 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2100 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2101 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2102 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
2103 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2105 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2106 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2108 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
2109 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
2110 CHECK_REG_STR(prodkey, "InstallDate", date);
2111 CHECK_REG_STR(prodkey, "InstallSource", temp);
2112 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2113 CHECK_REG_STR(prodkey, "Publisher", "Wine");
2114 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2115 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
2116 CHECK_REG_STR(prodkey, "Comments", NULL);
2117 CHECK_REG_STR(prodkey, "Contact", NULL);
2118 CHECK_REG_STR(prodkey, "HelpLink", NULL);
2119 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
2120 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
2121 CHECK_REG_STR(prodkey, "Readme", NULL);
2122 CHECK_REG_STR(prodkey, "Size", NULL);
2123 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
2124 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
2125 CHECK_REG_DWORD(prodkey, "Language", 1033);
2126 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
2127 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
2128 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
2129 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
2132 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
2135 RegCloseKey(prodkey);
2137 /* complete uninstall */
2138 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
2141 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2143 ok(pf_exists("msitest\\maximus"), "File deleted\n");
2144 ok(pf_exists("msitest"), "File deleted\n");
2146 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2149 ok(state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
2152 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2153 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2155 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2156 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2158 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2159 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2162 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
2164 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2166 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2167 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2171 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
2172 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
2173 CHECK_REG_STR(prodkey, "InstallDate", date);
2174 CHECK_REG_STR(prodkey, "InstallSource", temp);
2175 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2176 CHECK_REG_STR(prodkey, "Publisher", "Wine");
2177 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2178 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
2179 CHECK_REG_STR(prodkey, "Comments", NULL);
2180 CHECK_REG_STR(prodkey, "Contact", NULL);
2181 CHECK_REG_STR(prodkey, "HelpLink", NULL);
2182 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
2183 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
2184 CHECK_REG_STR(prodkey, "Readme", NULL);
2185 CHECK_REG_STR(prodkey, "Size", NULL);
2186 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
2187 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
2188 CHECK_REG_DWORD(prodkey, "Language", 1033);
2189 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
2190 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
2191 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
2192 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
2193 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
2196 RegCloseKey(prodkey);
2198 /* PublishProduct and RegisterProduct */
2199 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
2200 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2201 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2202 ok(pf_exists("msitest"), "File not installed\n");
2204 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2205 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
2207 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2208 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2210 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2211 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2213 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2214 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2215 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
2216 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2218 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2219 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2221 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
2222 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
2223 CHECK_REG_STR(prodkey, "InstallDate", date);
2224 CHECK_REG_STR(prodkey, "InstallSource", temp);
2225 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2226 CHECK_REG_STR(prodkey, "Publisher", "Wine");
2227 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2228 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
2229 CHECK_REG_STR(prodkey, "Comments", NULL);
2230 CHECK_REG_STR(prodkey, "Contact", NULL);
2231 CHECK_REG_STR(prodkey, "HelpLink", NULL);
2232 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
2233 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
2234 CHECK_REG_STR(prodkey, "Readme", NULL);
2235 CHECK_REG_STR(prodkey, "Size", NULL);
2236 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
2237 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
2238 CHECK_REG_DWORD(prodkey, "Language", 1033);
2239 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
2240 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
2241 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
2242 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
2245 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
2248 RegCloseKey(prodkey);
2251 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
2252 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2253 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2254 ok(pf_exists("msitest"), "File not installed\n");
2256 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2259 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2262 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2263 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2265 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2266 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2268 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2269 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2272 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2274 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2276 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2279 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2282 /* uninstall has a problem with this */
2283 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
2286 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2288 ok(pf_exists("msitest\\maximus"), "File deleted\n");
2289 ok(pf_exists("msitest"), "File deleted\n");
2291 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2292 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2294 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2295 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2297 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2298 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2299 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2300 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2302 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2305 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2308 /* PublishProduct and RegisterProduct and ProcessComponents */
2309 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1 PROCESS_COMPONENTS=1");
2310 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2311 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2312 ok(pf_exists("msitest"), "File not installed\n");
2314 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2315 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
2317 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2318 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2320 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2321 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2323 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2324 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2325 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2326 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2328 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2329 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2331 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
2332 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
2333 CHECK_REG_STR(prodkey, "InstallDate", date);
2334 CHECK_REG_STR(prodkey, "InstallSource", temp);
2335 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2336 CHECK_REG_STR(prodkey, "Publisher", "Wine");
2337 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2338 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
2339 CHECK_REG_STR(prodkey, "Comments", NULL);
2340 CHECK_REG_STR(prodkey, "Contact", NULL);
2341 CHECK_REG_STR(prodkey, "HelpLink", NULL);
2342 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
2343 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
2344 CHECK_REG_STR(prodkey, "Readme", NULL);
2345 CHECK_REG_STR(prodkey, "Size", NULL);
2346 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
2347 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
2348 CHECK_REG_DWORD(prodkey, "Language", 1033);
2349 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
2350 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
2351 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
2352 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
2355 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
2358 RegCloseKey(prodkey);
2360 /* complete uninstall */
2361 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
2362 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2363 ok(pf_exists("msitest\\maximus"), "File deleted\n");
2364 ok(pf_exists("msitest"), "File deleted\n");
2366 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2367 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2369 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2370 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2372 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2373 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2375 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2376 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2377 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2378 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2380 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2383 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2386 /* PublishProduct, RegisterProduct, ProcessComponents, PublishFeatures */
2387 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1 PROCESS_COMPONENTS=1 PUBLISH_FEATURES=1");
2388 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2389 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2390 ok(pf_exists("msitest"), "File not installed\n");
2392 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2393 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
2395 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2396 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2398 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2399 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2401 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2402 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2403 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2404 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2406 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2407 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2409 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
2410 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
2411 CHECK_REG_STR(prodkey, "InstallDate", date);
2412 CHECK_REG_STR(prodkey, "InstallSource", temp);
2413 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2414 CHECK_REG_STR(prodkey, "Publisher", "Wine");
2415 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2416 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
2417 CHECK_REG_STR(prodkey, "Comments", NULL);
2418 CHECK_REG_STR(prodkey, "Contact", NULL);
2419 CHECK_REG_STR(prodkey, "HelpLink", NULL);
2420 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
2421 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
2422 CHECK_REG_STR(prodkey, "Readme", NULL);
2423 CHECK_REG_STR(prodkey, "Size", NULL);
2424 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
2425 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
2426 CHECK_REG_DWORD(prodkey, "Language", 1033);
2427 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
2428 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
2429 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
2430 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
2433 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
2436 RegCloseKey(prodkey);
2438 /* complete uninstall */
2439 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
2440 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2443 ok(!pf_exists("msitest\\maximus"), "File deleted\n");
2444 ok(!pf_exists("msitest"), "File deleted\n");
2447 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2448 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2450 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");\
2451 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2453 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2454 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2456 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2457 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2458 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2459 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2461 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2464 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2467 /* complete install */
2468 r = MsiInstallProductA(msifile, "FULL=1");
2469 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2470 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2471 ok(pf_exists("msitest"), "File not installed\n");
2473 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2474 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
2476 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2477 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2479 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2480 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2482 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2483 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2484 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2485 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2487 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2488 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2490 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
2491 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
2492 CHECK_REG_STR(prodkey, "InstallDate", date);
2493 CHECK_REG_STR(prodkey, "InstallSource", temp);
2494 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2495 CHECK_REG_STR(prodkey, "Publisher", "Wine");
2496 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2497 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
2498 CHECK_REG_STR(prodkey, "Comments", NULL);
2499 CHECK_REG_STR(prodkey, "Contact", NULL);
2500 CHECK_REG_STR(prodkey, "HelpLink", NULL);
2501 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
2502 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
2503 CHECK_REG_STR(prodkey, "Readme", NULL);
2504 CHECK_REG_STR(prodkey, "Size", NULL);
2505 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
2506 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
2507 CHECK_REG_DWORD(prodkey, "Language", 1033);
2508 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
2509 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
2510 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
2511 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
2514 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
2517 RegCloseKey(prodkey);
2519 /* no UnpublishFeatures */
2520 r = MsiInstallProductA(msifile, "REMOVE=ALL");
2521 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2524 ok(!pf_exists("msitest\\maximus"), "File deleted\n");
2525 ok(!pf_exists("msitest"), "File deleted\n");
2528 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2529 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2531 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2532 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2534 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2535 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2537 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2538 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2539 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2540 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2542 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2543 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2545 /* complete install */
2546 r = MsiInstallProductA(msifile, "FULL=1");
2547 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2548 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2549 ok(pf_exists("msitest"), "File not installed\n");
2551 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2552 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
2554 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2555 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2557 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2558 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2560 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2561 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2562 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2563 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2565 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2566 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2568 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
2569 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
2570 CHECK_REG_STR(prodkey, "InstallDate", date);
2571 CHECK_REG_STR(prodkey, "InstallSource", temp);
2572 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2573 CHECK_REG_STR(prodkey, "Publisher", "Wine");
2574 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2575 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
2576 CHECK_REG_STR(prodkey, "Comments", NULL);
2577 CHECK_REG_STR(prodkey, "Contact", NULL);
2578 CHECK_REG_STR(prodkey, "HelpLink", NULL);
2579 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
2580 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
2581 CHECK_REG_STR(prodkey, "Readme", NULL);
2582 CHECK_REG_STR(prodkey, "Size", NULL);
2583 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
2584 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
2585 CHECK_REG_DWORD(prodkey, "Language", 1033);
2586 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
2587 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
2588 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
2589 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
2592 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
2595 RegCloseKey(prodkey);
2597 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
2598 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
2599 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2600 ok(pf_exists("msitest\\maximus"), "File deleted\n");
2601 ok(pf_exists("msitest"), "File deleted\n");
2603 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2604 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
2606 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2607 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2609 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2610 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2612 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2613 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2614 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2615 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2617 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2618 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2620 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
2621 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
2622 CHECK_REG_STR(prodkey, "InstallDate", date);
2623 CHECK_REG_STR(prodkey, "InstallSource", temp);
2624 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2625 CHECK_REG_STR(prodkey, "Publisher", "Wine");
2626 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2627 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
2628 CHECK_REG_STR(prodkey, "Comments", NULL);
2629 CHECK_REG_STR(prodkey, "Contact", NULL);
2630 CHECK_REG_STR(prodkey, "HelpLink", NULL);
2631 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
2632 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
2633 CHECK_REG_STR(prodkey, "Readme", NULL);
2634 CHECK_REG_STR(prodkey, "Size", NULL);
2635 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
2636 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
2637 CHECK_REG_DWORD(prodkey, "Language", 1033);
2638 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
2639 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
2640 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
2641 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
2644 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
2647 RegCloseKey(prodkey);
2649 /* complete install */
2650 r = MsiInstallProductA(msifile, "FULL=1");
2651 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2652 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2653 ok(pf_exists("msitest"), "File not installed\n");
2655 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2656 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
2658 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2659 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2661 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2662 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2664 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2665 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2666 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2667 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2669 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2670 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2672 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
2673 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
2674 CHECK_REG_STR(prodkey, "InstallDate", date);
2675 CHECK_REG_STR(prodkey, "InstallSource", temp);
2676 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2677 CHECK_REG_STR(prodkey, "Publisher", "Wine");
2678 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2679 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
2680 CHECK_REG_STR(prodkey, "Comments", NULL);
2681 CHECK_REG_STR(prodkey, "Contact", NULL);
2682 CHECK_REG_STR(prodkey, "HelpLink", NULL);
2683 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
2684 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
2685 CHECK_REG_STR(prodkey, "Readme", NULL);
2686 CHECK_REG_STR(prodkey, "Size", NULL);
2687 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
2688 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
2689 CHECK_REG_DWORD(prodkey, "Language", 1033);
2690 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
2691 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
2692 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
2693 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
2696 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
2699 RegCloseKey(prodkey);
2701 /* UnpublishFeatures, both features removed */
2702 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
2703 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2706 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
2707 ok(!pf_exists("msitest"), "File not deleted\n");
2710 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2711 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2713 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2714 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2716 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2717 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2719 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2720 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2721 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2722 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2724 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2725 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2727 /* complete install */
2728 r = MsiInstallProductA(msifile, "FULL=1");
2729 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2730 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2731 ok(pf_exists("msitest"), "File not installed\n");
2733 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2734 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
2736 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2737 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2739 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2740 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2742 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2743 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2744 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2745 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
2747 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2748 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2750 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
2751 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
2752 CHECK_REG_STR(prodkey, "InstallDate", date);
2753 CHECK_REG_STR(prodkey, "InstallSource", temp);
2754 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2755 CHECK_REG_STR(prodkey, "Publisher", "Wine");
2756 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2757 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
2758 CHECK_REG_STR(prodkey, "Comments", NULL);
2759 CHECK_REG_STR(prodkey, "Contact", NULL);
2760 CHECK_REG_STR(prodkey, "HelpLink", NULL);
2761 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
2762 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
2763 CHECK_REG_STR(prodkey, "Readme", NULL);
2764 CHECK_REG_STR(prodkey, "Size", NULL);
2765 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
2766 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
2767 CHECK_REG_DWORD(prodkey, "Language", 1033);
2768 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
2769 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
2770 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
2771 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
2774 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
2777 RegCloseKey(prodkey);
2779 /* complete uninstall */
2780 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
2781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2784 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
2785 ok(!pf_exists("msitest"), "File not deleted\n");
2788 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2789 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2791 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
2792 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2794 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
2795 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2797 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2798 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
2799 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2800 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
2802 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
2805 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2808 /* make sure 'Program Files\msitest' is removed */
2809 delete_pfmsitest_files();
2811 RegCloseKey(uninstall);
2812 DeleteFile(msifile);
2813 DeleteFile("msitest\\maximus");
2814 RemoveDirectory("msitest");
2817 static void test_publishsourcelist(void)
2821 CHAR value[MAX_PATH];
2822 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2824 CreateDirectoryA("msitest", NULL);
2825 create_file("msitest\\maximus", 500);
2827 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2829 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2831 r = MsiInstallProductA(msifile, NULL);
2832 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2833 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2834 ok(pf_exists("msitest"), "File not installed\n");
2836 /* nothing published */
2838 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2839 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
2840 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2841 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
2843 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
2844 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2845 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2846 ok(pf_exists("msitest"), "File not installed\n");
2848 /* after RegisterProduct */
2850 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2851 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
2852 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2853 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
2855 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
2856 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2857 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2858 ok(pf_exists("msitest"), "File not installed\n");
2860 /* after ProcessComponents */
2862 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2863 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
2864 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2865 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
2867 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
2868 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2869 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2870 ok(pf_exists("msitest"), "File not installed\n");
2872 /* after PublishFeatures */
2874 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2875 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
2876 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
2877 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
2879 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2880 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2881 ok(pf_exists("msitest\\maximus"), "File not installed\n");
2882 ok(pf_exists("msitest"), "File not installed\n");
2884 /* after PublishProduct */
2886 lstrcpyA(value, "aaa");
2887 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
2888 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
2891 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2892 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
2893 ok(size == 11, "Expected 11, got %d\n", size);
2896 /* complete uninstall */
2897 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
2898 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2901 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
2902 ok(!pf_exists("msitest"), "File not deleted\n");
2905 /* make sure 'Program Files\msitest' is removed */
2906 delete_pfmsitest_files();
2908 DeleteFile(msifile);
2909 DeleteFile("msitest\\maximus");
2910 RemoveDirectory("msitest");
2913 static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
2915 MSIHANDLE hview = 0;
2918 r = MsiDatabaseOpenView(hdb, query, &hview);
2919 if(r != ERROR_SUCCESS)
2922 r = MsiViewExecute(hview, hrec);
2923 if(r == ERROR_SUCCESS)
2924 r = MsiViewClose(hview);
2925 MsiCloseHandle(hview);
2929 static void set_transform_summary_info(void)
2932 MSIHANDLE suminfo = 0;
2934 /* build summmary info */
2935 r = MsiGetSummaryInformation(0, mstfile, 3, &suminfo);
2938 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
2941 r = MsiSummaryInfoSetProperty(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2944 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
2947 r = MsiSummaryInfoSetProperty(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
2948 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
2949 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
2950 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
2953 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
2956 r = MsiSummaryInfoSetProperty(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
2959 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
2962 r = MsiSummaryInfoPersist(suminfo);
2965 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
2968 r = MsiCloseHandle(suminfo);
2969 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
2972 static void generate_transform(void)
2974 MSIHANDLE hdb1, hdb2;
2978 /* start with two identical databases */
2979 CopyFile(msifile, msifile2, FALSE);
2981 r = MsiOpenDatabase(msifile2, MSIDBOPEN_TRANSACT, &hdb1);
2982 ok(r == ERROR_SUCCESS , "Failed to create database\n");
2984 r = MsiDatabaseCommit(hdb1);
2985 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
2987 r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb2);
2988 ok(r == ERROR_SUCCESS , "Failed to create database\n");
2990 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
2991 r = run_query(hdb1, 0, query);
2992 ok(r == ERROR_SUCCESS, "failed to add property\n");
2994 /* database needs to be committed */
2995 MsiDatabaseCommit(hdb1);
2997 r = MsiDatabaseGenerateTransform(hdb1, hdb2, mstfile, 0, 0);
2998 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3000 #if 0 /* not implemented in wine yet */
3001 r = MsiCreateTransformSummaryInfo(hdb2, hdb2, mstfile, 0, 0);
3002 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3005 MsiCloseHandle(hdb1);
3006 MsiCloseHandle(hdb2);
3009 /* data for generating a transform */
3011 /* tables transform names - encoded as they would be in an msi database file */
3012 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
3013 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
3014 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
3016 /* data in each table */
3017 static const char data1[] = /* _StringData */
3018 "propval"; /* all the strings squashed together */
3020 static const WCHAR data2[] = { /* _StringPool */
3022 0, 0, /* string 0 '' */
3023 4, 1, /* string 1 'prop' */
3024 3, 1, /* string 2 'val' */
3027 static const WCHAR data3[] = { /* Property */
3028 0x0201, 0x0001, 0x0002,
3031 static const struct {
3035 } table_transform_data[] =
3037 { name1, data1, sizeof data1 - 1 },
3038 { name2, data2, sizeof data2 },
3039 { name3, data3, sizeof data3 },
3042 #define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
3044 static void generate_transform_manual(void)
3046 IStorage *stg = NULL;
3051 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
3053 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
3055 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
3057 r = StgCreateDocfile(name, mode, 0, &stg);
3058 ok(r == S_OK, "failed to create storage\n");
3062 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
3063 ok(r == S_OK, "failed to set storage type\n");
3065 for (i=0; i<NUM_TRANSFORM_TABLES; i++)
3067 r = IStorage_CreateStream(stg, table_transform_data[i].name,
3068 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3071 ok(0, "failed to create stream %08x\n", r);
3075 r = IStream_Write(stm, table_transform_data[i].data,
3076 table_transform_data[i].size, &count);
3077 if (FAILED(r) || count != table_transform_data[i].size)
3078 ok(0, "failed to write stream\n");
3079 IStream_Release(stm);
3082 IStorage_Release(stg);
3084 set_transform_summary_info();
3087 static void test_transformprop(void)
3091 CreateDirectoryA("msitest", NULL);
3092 create_file("msitest\\augustus", 500);
3094 create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
3096 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3098 r = MsiInstallProductA(msifile, NULL);
3099 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3100 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3101 ok(!delete_pf("msitest", FALSE), "File installed\n");
3104 generate_transform();
3106 generate_transform_manual();
3108 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
3109 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3110 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3111 ok(delete_pf("msitest", FALSE), "File not installed\n");
3113 /* Delete the files in the temp (current) folder */
3114 DeleteFile(msifile);
3115 DeleteFile(msifile2);
3116 DeleteFile(mstfile);
3117 DeleteFile("msitest\\augustus");
3118 RemoveDirectory("msitest");
3121 static void test_currentworkingdir(void)
3124 CHAR path[MAX_PATH];
3127 CreateDirectoryA("msitest", NULL);
3128 create_file("msitest\\augustus", 500);
3130 create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
3132 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3134 CreateDirectoryA("diffdir", NULL);
3135 SetCurrentDirectoryA("diffdir");
3137 sprintf(path, "..\\%s", msifile);
3138 r = MsiInstallProductA(path, NULL);
3141 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
3142 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3143 ok(!delete_pf("msitest", FALSE), "File installed\n");
3146 sprintf(path, "%s\\%s", CURR_DIR, msifile);
3147 r = MsiInstallProductA(path, NULL);
3148 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3149 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3150 ok(delete_pf("msitest", FALSE), "File not installed\n");
3152 lstrcpyA(path, CURR_DIR);
3153 if (path[lstrlenA(path) - 1] != '\\')
3154 lstrcatA(path, "\\");
3155 lstrcatA(path, "msitest.msi");
3157 ptr2 = strrchr(path, '\\');
3159 ptr = strrchr(path, '\\');
3163 SetCurrentDirectoryA(path);
3165 r = MsiInstallProductA(ptr, NULL);
3166 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3167 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3168 ok(delete_pf("msitest", FALSE), "File not installed\n");
3170 SetCurrentDirectoryA(CURR_DIR);
3172 DeleteFile(msifile);
3173 DeleteFile("msitest\\augustus");
3174 RemoveDirectory("msitest");
3175 RemoveDirectory("diffdir");
3178 static void set_admin_summary_info(const CHAR *name)
3180 MSIHANDLE db, summary;
3183 r = MsiOpenDatabaseA(name, MSIDBOPEN_DIRECT, &db);
3184 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3186 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
3187 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3189 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
3190 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3192 /* write the summary changes back to the stream */
3193 r = MsiSummaryInfoPersist(summary);
3194 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3196 MsiCloseHandle(summary);
3198 r = MsiDatabaseCommit(db);
3199 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3204 static void test_admin(void)
3208 CreateDirectoryA("msitest", NULL);
3209 create_file("msitest\\augustus", 500);
3211 create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
3212 set_admin_summary_info(msifile);
3214 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3216 r = MsiInstallProductA(msifile, NULL);
3217 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3218 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3219 ok(!delete_pf("msitest", FALSE), "File installed\n");
3220 ok(!DeleteFile("c:\\msitest\\augustus"), "File installed\n");
3221 ok(!RemoveDirectory("c:\\msitest"), "File installed\n");
3223 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
3224 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3225 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3226 ok(!delete_pf("msitest", FALSE), "File installed\n");
3229 ok(DeleteFile("c:\\msitest\\augustus"), "File not installed\n");
3230 ok(RemoveDirectory("c:\\msitest"), "File not installed\n");
3233 DeleteFile(msifile);
3234 DeleteFile("msitest\\augustus");
3235 RemoveDirectory("msitest");
3238 static void set_admin_property_stream(LPCSTR file)
3242 WCHAR fileW[MAX_PATH];
3245 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
3247 /* AdminProperties */
3248 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
3249 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',0};
3251 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
3253 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
3254 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3258 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3259 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3261 hr = IStream_Write(stm, data, sizeof(data), &count);
3262 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
3264 IStream_Release(stm);
3265 IStorage_Release(stg);
3268 static void test_adminprops(void)
3272 CreateDirectoryA("msitest", NULL);
3273 create_file("msitest\\augustus", 500);
3275 create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
3276 set_admin_summary_info(msifile);
3277 set_admin_property_stream(msifile);
3279 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3281 r = MsiInstallProductA(msifile, NULL);
3282 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3283 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
3284 ok(delete_pf("msitest", FALSE), "File installed\n");
3286 DeleteFile(msifile);
3287 DeleteFile("msitest\\augustus");
3288 RemoveDirectory("msitest");
3291 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
3293 CHAR path[MAX_PATH];
3295 lstrcpyA(path, PROG_FILES_DIR);
3296 lstrcatA(path, "\\");
3297 lstrcatA(path, file);
3300 create_file_data(path, data, 500);
3302 CreateDirectoryA(path, NULL);
3305 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
3307 static void test_removefiles(void)
3311 CreateDirectoryA("msitest", NULL);
3312 create_file("msitest\\hydrogen", 500);
3313 create_file("msitest\\helium", 500);
3314 create_file("msitest\\lithium", 500);
3316 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
3318 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3320 r = MsiInstallProductA(msifile, NULL);
3321 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3322 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
3323 ok(!pf_exists("msitest\\helium"), "File installed\n");
3324 ok(pf_exists("msitest\\lithium"), "File not installed\n");
3325 ok(pf_exists("msitest"), "File not installed\n");
3327 r = MsiInstallProductA(msifile, "REMOVE=ALL");
3328 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3329 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
3330 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
3333 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
3334 ok(delete_pf("msitest", FALSE), "File deleted\n");
3337 create_pf("msitest", FALSE);
3338 create_pf("msitest\\hydrogen", TRUE);
3339 create_pf("msitest\\helium", TRUE);
3340 create_pf("msitest\\lithium", TRUE);
3342 r = MsiInstallProductA(msifile, NULL);
3343 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3344 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
3345 ok(pf_exists("msitest\\helium"), "File not installed\n");
3346 ok(pf_exists("msitest\\lithium"), "File not installed\n");
3347 ok(pf_exists("msitest"), "File not installed\n");
3349 r = MsiInstallProductA(msifile, "REMOVE=ALL");
3350 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3351 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
3352 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
3355 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
3356 ok(delete_pf("msitest", FALSE), "File deleted\n");
3359 create_pf("msitest", FALSE);
3360 create_pf("msitest\\furlong", TRUE);
3361 create_pf("msitest\\firkin", TRUE);
3362 create_pf("msitest\\fortnight", TRUE);
3363 create_pf("msitest\\becquerel", TRUE);
3364 create_pf("msitest\\dioptre", TRUE);
3365 create_pf("msitest\\attoparsec", TRUE);
3366 create_pf("msitest\\storeys", TRUE);
3367 create_pf("msitest\\block", TRUE);
3368 create_pf("msitest\\siriometer", TRUE);
3370 r = MsiInstallProductA(msifile, NULL);
3371 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3372 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
3373 ok(!pf_exists("msitest\\helium"), "File installed\n");
3374 ok(pf_exists("msitest\\lithium"), "File not installed\n");
3375 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
3376 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
3377 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
3378 ok(pf_exists("msitest"), "File not installed\n");
3381 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
3382 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
3383 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
3384 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
3385 ok(!pf_exists("msitest\\block"), "File not deleted\n");
3386 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
3389 create_pf("msitest\\furlong", TRUE);
3390 create_pf("msitest\\firkin", TRUE);
3391 create_pf("msitest\\fortnight", TRUE);
3392 create_pf("msitest\\storeys", TRUE);
3393 create_pf("msitest\\block", TRUE);
3394 create_pf("msitest\\siriometer", TRUE);
3396 r = MsiInstallProductA(msifile, "REMOVE=ALL");
3397 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3398 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
3399 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
3400 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
3401 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
3402 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
3403 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
3404 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
3407 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
3408 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
3409 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
3410 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
3411 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
3413 ok(delete_pf("msitest", FALSE), "File deleted\n");
3415 DeleteFile(msifile);
3416 DeleteFile("msitest\\hydrogen");
3417 DeleteFile("msitest\\helium");
3418 DeleteFile("msitest\\lithium");
3419 RemoveDirectory("msitest");
3422 static void test_movefiles(void)
3425 char props[MAX_PATH];
3427 CreateDirectoryA("msitest", NULL);
3428 create_file("msitest\\augustus", 100);
3429 create_file("cameroon", 100);
3430 create_file("djibouti", 100);
3431 create_file("egypt", 100);
3432 create_file("finland", 100);
3433 create_file("gambai", 100);
3434 create_file("honduras", 100);
3435 create_file("msitest\\india", 100);
3436 create_file("japan", 100);
3437 create_file("kenya", 100);
3438 CreateDirectoryA("latvia", NULL);
3439 create_file("nauru", 100);
3440 create_file("apple", 100);
3441 create_file("application", 100);
3442 create_file("ape", 100);
3443 create_file("foo", 100);
3444 create_file("fao", 100);
3445 create_file("fbod", 100);
3446 create_file("budding", 100);
3447 create_file("buddy", 100);
3448 create_file("bud", 100);
3449 create_file("bar", 100);
3450 create_file("bur", 100);
3451 create_file("bird", 100);
3453 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
3455 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3456 MsiEnableLog(INSTALLLOGMODE_VERBOSE | INSTALLLOGMODE_EXTRADEBUG, "log.txt", 0);
3458 /* if the source or dest property is not a full path,
3459 * windows tries to access it as a network resource
3462 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
3463 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
3464 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
3466 r = MsiInstallProductA(msifile, props);
3467 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3468 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3469 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
3470 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
3471 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
3472 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
3473 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
3474 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
3475 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
3476 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
3477 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
3478 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
3479 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
3480 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
3481 ok(!delete_pf("msitest\\apple", TRUE), "File should not exist\n");
3482 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
3483 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
3484 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
3485 ok(delete_pf("msitest\\foo", TRUE), "File not moved\n");
3486 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
3487 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
3488 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
3489 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
3490 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
3491 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
3492 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
3493 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
3494 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
3495 ok(delete_pf("msitest", FALSE), "File not installed\n");
3496 ok(DeleteFileA("cameroon"), "File moved\n");
3497 ok(!DeleteFileA("djibouti"), "File not moved\n");
3498 ok(DeleteFileA("egypt"), "File moved\n");
3499 ok(DeleteFileA("finland"), "File moved\n");
3500 ok(DeleteFileA("gambai"), "File moved\n");
3501 ok(!DeleteFileA("honduras"), "File not moved\n");
3502 ok(DeleteFileA("msitest\\india"), "File moved\n");
3503 ok(DeleteFileA("japan"), "File moved\n");
3504 ok(!DeleteFileA("kenya"), "File not moved\n");
3505 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
3506 ok(!DeleteFileA("nauru"), "File not moved\n");
3507 ok(!DeleteFileA("apple"), "File not moved\n");
3508 ok(!DeleteFileA("application"), "File not moved\n");
3509 ok(DeleteFileA("ape"), "File moved\n");
3510 ok(!DeleteFileA("foo"), "File not moved\n");
3511 ok(!DeleteFileA("fao"), "File not moved\n");
3512 ok(DeleteFileA("fbod"), "File moved\n");
3513 ok(!DeleteFileA("budding"), "File not moved\n");
3514 ok(!DeleteFileA("buddy"), "File not moved\n");
3515 ok(DeleteFileA("bud"), "File moved\n");
3516 ok(!DeleteFileA("bar"), "File not moved\n");
3517 ok(!DeleteFileA("bur"), "File not moved\n");
3518 ok(DeleteFileA("bird"), "File moved\n");
3520 DeleteFile("msitest\\augustus");
3521 RemoveDirectory("msitest");
3522 DeleteFile(msifile);
3525 static void test_missingcab(void)
3529 CreateDirectoryA("msitest", NULL);
3530 create_file("msitest\\augustus", 500);
3531 create_file("maximus", 500);
3533 create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
3535 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3537 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3539 create_pf("msitest", FALSE);
3540 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
3542 r = MsiInstallProductA(msifile, NULL);
3543 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3544 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3545 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3546 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3547 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
3548 ok(delete_pf("msitest", FALSE), "File not installed\n");
3550 create_pf("msitest", FALSE);
3551 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
3552 create_pf("msitest\\gaius", TRUE);
3554 r = MsiInstallProductA(msifile, "GAIUS=1");
3555 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3558 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
3559 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3561 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
3562 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
3563 ok(delete_pf("msitest", FALSE), "File not installed\n");
3565 DeleteFile("msitest\\augustus");
3566 RemoveDirectory("msitest");
3567 DeleteFile("maximus");
3568 DeleteFile("test1.cab");
3569 DeleteFile(msifile);
3575 char temp_path[MAX_PATH], prev_path[MAX_PATH];
3577 init_functionpointers();
3579 GetCurrentDirectoryA(MAX_PATH, prev_path);
3580 GetTempPath(MAX_PATH, temp_path);
3581 SetCurrentDirectoryA(temp_path);
3583 lstrcpyA(CURR_DIR, temp_path);
3584 len = lstrlenA(CURR_DIR);
3586 if(len && (CURR_DIR[len - 1] == '\\'))
3587 CURR_DIR[len - 1] = 0;
3589 get_program_files_dir(PROG_FILES_DIR, COMMON_FILES_DIR);
3591 test_MsiInstallProduct();
3592 test_MsiSetComponentState();
3593 test_packagecoltypes();
3594 test_continuouscabs();
3597 test_samesequence();
3598 test_uiLevelFlags();
3599 test_readonlyfile();
3600 test_setdirproperty();
3601 test_cabisextracted();
3602 test_concurrentinstall();
3603 test_setpropertyfolder();
3605 test_publishsourcelist();
3606 test_transformprop();
3607 test_currentworkingdir();
3614 SetCurrentDirectoryA(prev_path);