push 0e883ac4a03c91e56787e1ec12e001b6558b4b62
[wine/hacks.git] / dlls / msi / tests / install.c
blob40fabf8e0019640b7e75db84224ea97ed03a3629
1 /*
2 * Copyright (C) 2006 James Hawkins
4 * A test program for installing MSI products.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define _WIN32_MSI 300
22 #define COBJMACROS
24 #include <stdio.h>
26 #include <windows.h>
27 #include <msiquery.h>
28 #include <msidefs.h>
29 #include <msi.h>
30 #include <fci.h>
31 #include <objidl.h>
33 #include "wine/test.h"
35 static UINT (WINAPI *pMsiQueryComponentStateA)
36 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*);
37 static UINT (WINAPI *pMsiSourceListEnumSourcesA)
38 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
39 static UINT (WINAPI *pMsiSourceListGetInfoA)
40 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD);
42 static const char *msifile = "msitest.msi";
43 static const char *msifile2 = "winetest2.msi";
44 static const char *mstfile = "winetest.mst";
45 static CHAR CURR_DIR[MAX_PATH];
46 static CHAR PROG_FILES_DIR[MAX_PATH];
47 static CHAR COMMON_FILES_DIR[MAX_PATH];
49 /* msi database data */
51 static const CHAR component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
52 "s72\tS38\ts72\ti2\tS255\tS72\n"
53 "Component\tComponent\n"
54 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
55 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
56 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\t\tone.txt\n"
57 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
58 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
59 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
60 "component\t\tMSITESTDIR\t0\t1\tfile\n"
61 "service_comp\t\tMSITESTDIR\t0\t1\tservice_file";
63 static const CHAR directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
64 "s72\tS72\tl255\n"
65 "Directory\tDirectory\n"
66 "CABOUTDIR\tMSITESTDIR\tcabout\n"
67 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
68 "FIRSTDIR\tMSITESTDIR\tfirst\n"
69 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
70 "NEWDIR\tCABOUTDIR\tnew\n"
71 "ProgramFilesFolder\tTARGETDIR\t.\n"
72 "TARGETDIR\t\tSourceDir";
74 static const CHAR feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
75 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
76 "Feature\tFeature\n"
77 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
78 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
79 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
80 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
81 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
82 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
83 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
85 static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
86 "s38\ts72\n"
87 "FeatureComponents\tFeature_\tComponent_\n"
88 "Five\tFive\n"
89 "Four\tFour\n"
90 "One\tOne\n"
91 "Three\tThree\n"
92 "Two\tTwo\n"
93 "feature\tcomponent\n"
94 "service_feature\tservice_comp\n";
96 static const CHAR file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
97 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
98 "File\tFile\n"
99 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
100 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
101 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
102 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
103 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
104 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
105 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
107 static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
108 "s72\tS255\tI2\n"
109 "InstallExecuteSequence\tAction\n"
110 "AllocateRegistrySpace\tNOT Installed\t1550\n"
111 "CostFinalize\t\t1000\n"
112 "CostInitialize\t\t800\n"
113 "FileCost\t\t900\n"
114 "ResolveSource\t\t950\n"
115 "MoveFiles\t\t1700\n"
116 "InstallFiles\t\t4000\n"
117 "DuplicateFiles\t\t4500\n"
118 "InstallServices\t\t5000\n"
119 "InstallFinalize\t\t6600\n"
120 "InstallInitialize\t\t1500\n"
121 "InstallValidate\t\t1400\n"
122 "LaunchConditions\t\t100\n"
123 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
125 static const CHAR media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
126 "i2\ti4\tL64\tS255\tS32\tS72\n"
127 "Media\tDiskId\n"
128 "1\t3\t\t\tDISK1\t\n"
129 "2\t5\t\tmsitest.cab\tDISK2\t\n";
131 static const CHAR property_dat[] = "Property\tValue\n"
132 "s72\tl0\n"
133 "Property\tProperty\n"
134 "DefaultUIFont\tDlgFont8\n"
135 "HASUIRUN\t0\n"
136 "INSTALLLEVEL\t3\n"
137 "InstallMode\tTypical\n"
138 "Manufacturer\tWine\n"
139 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
140 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
141 "ProductID\tnone\n"
142 "ProductLanguage\t1033\n"
143 "ProductName\tMSITEST\n"
144 "ProductVersion\t1.1.1\n"
145 "PROMPTROLLBACKCOST\tP\n"
146 "Setup\tSetup\n"
147 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
148 "AdminProperties\tPOSTADMIN\n"
149 "ROOTDRIVE\tC:\\\n"
150 "SERVNAME\tTestService\n"
151 "SERVDISP\tTestServiceDisp\n";
153 static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
154 "s72\ti2\tl255\tL255\tL0\ts72\n"
155 "Registry\tRegistry\n"
156 "Apples\t2\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
157 "Oranges\t2\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
158 "regdata\t2\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
159 "OrderTest\t2\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
161 static const CHAR service_install_dat[] = "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
162 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
163 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
164 "ServiceInstall\tServiceInstall\n"
165 "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\t";
167 static const CHAR service_control_dat[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
168 "s72\tl255\ti2\tL255\tI2\ts72\n"
169 "ServiceControl\tServiceControl\n"
170 "ServiceControl\tTestService\t8\t\t0\tservice_comp";
172 /* tables for test_continuouscabs */
173 static const CHAR cc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
174 "s72\tS38\ts72\ti2\tS255\tS72\n"
175 "Component\tComponent\n"
176 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
177 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
178 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
180 static const CHAR cc2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
181 "s72\tS38\ts72\ti2\tS255\tS72\n"
182 "Component\tComponent\n"
183 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
184 "augustus\t\tMSITESTDIR\t0\t0\taugustus\n"
185 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
187 static const CHAR cc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
188 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
189 "Feature\tFeature\n"
190 "feature\t\t\t\t2\t1\tTARGETDIR\t0";
192 static const CHAR cc_feature_comp_dat[] = "Feature_\tComponent_\n"
193 "s38\ts72\n"
194 "FeatureComponents\tFeature_\tComponent_\n"
195 "feature\tmaximus\n"
196 "feature\taugustus\n"
197 "feature\tcaesar";
199 static const CHAR cc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
200 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
201 "File\tFile\n"
202 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
203 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
204 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
206 static const CHAR cc2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
207 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
208 "File\tFile\n"
209 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
210 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
211 "tiberius\tmaximus\ttiberius\t500\t\t\t16384\t3\n"
212 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
214 static const CHAR cc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
215 "i2\ti4\tL64\tS255\tS32\tS72\n"
216 "Media\tDiskId\n"
217 "1\t10\t\ttest1.cab\tDISK1\t\n"
218 "2\t2\t\ttest2.cab\tDISK2\t\n"
219 "3\t12\t\ttest3.cab\tDISK3\t\n";
221 static const CHAR co_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
222 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
223 "File\tFile\n"
224 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
225 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
226 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
228 static const CHAR co_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
229 "i2\ti4\tL64\tS255\tS32\tS72\n"
230 "Media\tDiskId\n"
231 "1\t10\t\ttest1.cab\tDISK1\t\n"
232 "2\t2\t\ttest2.cab\tDISK2\t\n"
233 "3\t3\t\ttest3.cab\tDISK3\t\n";
235 static const CHAR co2_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
236 "i2\ti4\tL64\tS255\tS32\tS72\n"
237 "Media\tDiskId\n"
238 "1\t10\t\ttest1.cab\tDISK1\t\n"
239 "2\t12\t\ttest3.cab\tDISK3\t\n"
240 "3\t2\t\ttest2.cab\tDISK2\t\n";
242 static const CHAR mm_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
243 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
244 "File\tFile\n"
245 "maximus\tmaximus\tmaximus\t500\t\t\t512\t1\n"
246 "augustus\taugustus\taugustus\t500\t\t\t512\t2\n"
247 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
249 static const CHAR mm_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
250 "i2\ti4\tL64\tS255\tS32\tS72\n"
251 "Media\tDiskId\n"
252 "1\t3\t\ttest1.cab\tDISK1\t\n";
254 static const CHAR ss_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
255 "i2\ti4\tL64\tS255\tS32\tS72\n"
256 "Media\tDiskId\n"
257 "1\t2\t\ttest1.cab\tDISK1\t\n"
258 "2\t2\t\ttest2.cab\tDISK2\t\n"
259 "3\t12\t\ttest3.cab\tDISK3\t\n";
261 /* tables for test_uiLevelFlags */
262 static const CHAR ui_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
263 "s72\tS38\ts72\ti2\tS255\tS72\n"
264 "Component\tComponent\n"
265 "maximus\t\tMSITESTDIR\t0\tHASUIRUN=1\tmaximus\n"
266 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
267 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
269 static const CHAR ui_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
270 "s72\tS255\tI2\n"
271 "InstallUISequence\tAction\n"
272 "SetUIProperty\t\t5\n"
273 "ExecuteAction\t\t1100\n";
275 static const CHAR ui_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
276 "s72\ti2\tS64\tS0\tS255\n"
277 "CustomAction\tAction\n"
278 "SetUIProperty\t51\tHASUIRUN\t1\t\n";
280 static const CHAR rof_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
281 "s72\tS38\ts72\ti2\tS255\tS72\n"
282 "Component\tComponent\n"
283 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
285 static const CHAR rof_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
286 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
287 "Feature\tFeature\n"
288 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
289 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
291 static const CHAR rof_feature_comp_dat[] = "Feature_\tComponent_\n"
292 "s38\ts72\n"
293 "FeatureComponents\tFeature_\tComponent_\n"
294 "feature\tmaximus\n"
295 "montecristo\tmaximus";
297 static const CHAR rof_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
298 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
299 "File\tFile\n"
300 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
302 static const CHAR rof_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
303 "i2\ti4\tL64\tS255\tS32\tS72\n"
304 "Media\tDiskId\n"
305 "1\t1\t\t\tDISK1\t\n";
307 static const CHAR sdp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
308 "s72\tS255\tI2\n"
309 "InstallExecuteSequence\tAction\n"
310 "AllocateRegistrySpace\tNOT Installed\t1550\n"
311 "CostFinalize\t\t1000\n"
312 "CostInitialize\t\t800\n"
313 "FileCost\t\t900\n"
314 "InstallFiles\t\t4000\n"
315 "InstallFinalize\t\t6600\n"
316 "InstallInitialize\t\t1500\n"
317 "InstallValidate\t\t1400\n"
318 "LaunchConditions\t\t100\n"
319 "SetDirProperty\t\t950";
321 static const CHAR sdp_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
322 "s72\ti2\tS64\tS0\tS255\n"
323 "CustomAction\tAction\n"
324 "SetDirProperty\t51\tMSITESTDIR\t[CommonFilesFolder]msitest\\\t\n";
326 static const CHAR cie_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
327 "s72\tS38\ts72\ti2\tS255\tS72\n"
328 "Component\tComponent\n"
329 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
330 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
331 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
332 "gaius\t\tMSITESTDIR\t0\t1\tgaius\n";
334 static const CHAR cie_feature_comp_dat[] = "Feature_\tComponent_\n"
335 "s38\ts72\n"
336 "FeatureComponents\tFeature_\tComponent_\n"
337 "feature\tmaximus\n"
338 "feature\taugustus\n"
339 "feature\tcaesar\n"
340 "feature\tgaius";
342 static const CHAR cie_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
343 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
344 "File\tFile\n"
345 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
346 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
347 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12\n"
348 "gaius\tgaius\tgaius\t500\t\t\t8192\t11";
350 static const CHAR cie_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
351 "i2\ti4\tL64\tS255\tS32\tS72\n"
352 "Media\tDiskId\n"
353 "1\t1\t\ttest1.cab\tDISK1\t\n"
354 "2\t2\t\ttest2.cab\tDISK2\t\n"
355 "3\t12\t\ttest3.cab\tDISK3\t\n";
357 static const CHAR ci_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
358 "s72\tS255\tI2\n"
359 "InstallExecuteSequence\tAction\n"
360 "CostFinalize\t\t1000\n"
361 "CostInitialize\t\t800\n"
362 "FileCost\t\t900\n"
363 "InstallFiles\t\t4000\n"
364 "InstallServices\t\t5000\n"
365 "InstallFinalize\t\t6600\n"
366 "InstallInitialize\t\t1500\n"
367 "RunInstall\t\t1600\n"
368 "InstallValidate\t\t1400\n"
369 "LaunchConditions\t\t100";
371 static const CHAR ci_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
372 "s72\ti2\tS64\tS0\tS255\n"
373 "CustomAction\tAction\n"
374 "RunInstall\t87\tmsitest\\concurrent.msi\tMYPROP=[UILevel]\t\n";
376 static const CHAR ci_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
377 "s72\tS38\ts72\ti2\tS255\tS72\n"
378 "Component\tComponent\n"
379 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n";
381 static const CHAR ci2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
382 "s72\tS38\ts72\ti2\tS255\tS72\n"
383 "Component\tComponent\n"
384 "augustus\t\tMSITESTDIR\t0\tUILevel=3 AND MYPROP=5\taugustus\n";
386 static const CHAR ci2_feature_comp_dat[] = "Feature_\tComponent_\n"
387 "s38\ts72\n"
388 "FeatureComponents\tFeature_\tComponent_\n"
389 "feature\taugustus";
391 static const CHAR ci2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
392 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
393 "File\tFile\n"
394 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
396 static const CHAR spf_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
397 "s72\ti2\tS64\tS0\tS255\n"
398 "CustomAction\tAction\n"
399 "SetFolderProp\t51\tMSITESTDIR\t[ProgramFilesFolder]\\msitest\\added\t\n";
401 static const CHAR spf_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
402 "s72\tS255\tI2\n"
403 "InstallExecuteSequence\tAction\n"
404 "CostFinalize\t\t1000\n"
405 "CostInitialize\t\t800\n"
406 "FileCost\t\t900\n"
407 "SetFolderProp\t\t950\n"
408 "InstallFiles\t\t4000\n"
409 "InstallServices\t\t5000\n"
410 "InstallFinalize\t\t6600\n"
411 "InstallInitialize\t\t1500\n"
412 "InstallValidate\t\t1400\n"
413 "LaunchConditions\t\t100";
415 static const CHAR spf_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
416 "s72\tS255\tI2\n"
417 "InstallUISequence\tAction\n"
418 "CostInitialize\t\t800\n"
419 "FileCost\t\t900\n"
420 "CostFinalize\t\t1000\n"
421 "ExecuteAction\t\t1100\n";
423 static const CHAR pp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
424 "s72\tS255\tI2\n"
425 "InstallExecuteSequence\tAction\n"
426 "ValidateProductID\t\t700\n"
427 "CostInitialize\t\t800\n"
428 "FileCost\t\t900\n"
429 "CostFinalize\t\t1000\n"
430 "InstallValidate\t\t1400\n"
431 "InstallInitialize\t\t1500\n"
432 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
433 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
434 "RemoveFiles\t\t3500\n"
435 "InstallFiles\t\t4000\n"
436 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
437 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
438 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
439 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
440 "InstallFinalize\t\t6600";
442 static const CHAR ppc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
443 "s72\tS38\ts72\ti2\tS255\tS72\n"
444 "Component\tComponent\n"
445 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n"
446 "augustus\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\taugustus\n";
448 static const CHAR ppc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
449 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
450 "File\tFile\n"
451 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1\n"
452 "augustus\taugustus\taugustus\t500\t\t\t8192\t2";
454 static const CHAR ppc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
455 "i2\ti4\tL64\tS255\tS32\tS72\n"
456 "Media\tDiskId\n"
457 "1\t2\t\t\tDISK1\t\n";
459 static const CHAR ppc_feature_comp_dat[] = "Feature_\tComponent_\n"
460 "s38\ts72\n"
461 "FeatureComponents\tFeature_\tComponent_\n"
462 "feature\tmaximus\n"
463 "feature\taugustus\n"
464 "montecristo\tmaximus";
466 static const CHAR tp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
467 "s72\tS38\ts72\ti2\tS255\tS72\n"
468 "Component\tComponent\n"
469 "augustus\t\tMSITESTDIR\t0\tprop=\"val\"\taugustus\n";
471 static const CHAR cwd_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
472 "s72\tS38\ts72\ti2\tS255\tS72\n"
473 "Component\tComponent\n"
474 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
476 static const CHAR adm_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
477 "s72\tS38\ts72\ti2\tS255\tS72\n"
478 "Component\tComponent\n"
479 "augustus\t\tMSITESTDIR\t0\tPOSTADMIN=1\taugustus";
481 static const CHAR adm_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
482 "s72\ti2\tS64\tS0\tS255\n"
483 "CustomAction\tAction\n"
484 "SetPOSTADMIN\t51\tPOSTADMIN\t1\t\n";
486 static const CHAR adm_admin_exec_seq_dat[] = "Action\tCondition\tSequence\n"
487 "s72\tS255\tI2\n"
488 "AdminExecuteSequence\tAction\n"
489 "CostFinalize\t\t1000\n"
490 "CostInitialize\t\t800\n"
491 "FileCost\t\t900\n"
492 "SetPOSTADMIN\t\t950\n"
493 "InstallFiles\t\t4000\n"
494 "InstallFinalize\t\t6600\n"
495 "InstallInitialize\t\t1500\n"
496 "InstallValidate\t\t1400\n"
497 "LaunchConditions\t\t100";
499 static const CHAR amp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
500 "s72\tS38\ts72\ti2\tS255\tS72\n"
501 "Component\tComponent\n"
502 "augustus\t\tMSITESTDIR\t0\tMYPROP=2718\taugustus\n";
504 static const CHAR rem_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
505 "s72\tS38\ts72\ti2\tS255\tS72\n"
506 "Component\tComponent\n"
507 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t0\t\thydrogen\n"
508 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\thelium\n"
509 "lithium\t\tMSITESTDIR\t2\t\tlithium\n";
511 static const CHAR rem_feature_comp_dat[] = "Feature_\tComponent_\n"
512 "s38\ts72\n"
513 "FeatureComponents\tFeature_\tComponent_\n"
514 "feature\thydrogen\n"
515 "feature\thelium\n"
516 "feature\tlithium";
518 static const CHAR rem_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
519 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
520 "File\tFile\n"
521 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
522 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
523 "lithium\tlithium\tlithium\t0\t\t\t8192\t1";
525 static const CHAR rem_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
526 "s72\tS255\tI2\n"
527 "InstallExecuteSequence\tAction\n"
528 "ValidateProductID\t\t700\n"
529 "CostInitialize\t\t800\n"
530 "FileCost\t\t900\n"
531 "CostFinalize\t\t1000\n"
532 "InstallValidate\t\t1400\n"
533 "InstallInitialize\t\t1500\n"
534 "ProcessComponents\t\t1600\n"
535 "UnpublishFeatures\t\t1800\n"
536 "RemoveFiles\t\t3500\n"
537 "InstallFiles\t\t4000\n"
538 "RegisterProduct\t\t6100\n"
539 "PublishFeatures\t\t6300\n"
540 "PublishProduct\t\t6400\n"
541 "InstallFinalize\t\t6600";
543 static const CHAR rem_remove_files_dat[] = "FileKey\tComponent_\tFileName\tDirProperty\tInstallMode\n"
544 "s72\ts72\tS255\ts72\tI2\n"
545 "RemoveFile\tFileKey\n"
546 "furlong\thydrogen\tfurlong\tMSITESTDIR\t1\n"
547 "firkin\thelium\tfirkin\tMSITESTDIR\t1\n"
548 "fortnight\tlithium\tfortnight\tMSITESTDIR\t1\n"
549 "becquerel\thydrogen\tbecquerel\tMSITESTDIR\t2\n"
550 "dioptre\thelium\tdioptre\tMSITESTDIR\t2\n"
551 "attoparsec\tlithium\tattoparsec\tMSITESTDIR\t2\n"
552 "storeys\thydrogen\tstoreys\tMSITESTDIR\t3\n"
553 "block\thelium\tblock\tMSITESTDIR\t3\n"
554 "siriometer\tlithium\tsiriometer\tMSITESTDIR\t3\n"
555 "nanoacre\thydrogen\t\tCABOUTDIR\t3\n";
557 static const CHAR mov_move_file_dat[] = "FileKey\tComponent_\tSourceName\tDestName\tSourceFolder\tDestFolder\tOptions\n"
558 "s72\ts72\tS255\tS255\tS72\ts72\ti2\n"
559 "MoveFile\tFileKey\n"
560 "abkhazia\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t0\n"
561 "bahamas\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t1\n"
562 "cambodia\taugustus\tcameroon\tcanada\tSourceDir\tMSITESTDIR\t0\n"
563 "denmark\taugustus\tdjibouti\tdominica\tSourceDir\tMSITESTDIR\t1\n"
564 "ecuador\taugustus\tegypt\telsalvador\tNotAProp\tMSITESTDIR\t1\n"
565 "fiji\taugustus\tfinland\tfrance\tSourceDir\tNotAProp\t1\n"
566 "gabon\taugustus\tgambia\tgeorgia\tSOURCEFULL\tMSITESTDIR\t1\n"
567 "haiti\taugustus\thonduras\thungary\tSourceDir\tDESTFULL\t1\n"
568 "iceland\taugustus\tindia\tindonesia\tMSITESTDIR\tMSITESTDIR\t1\n"
569 "jamaica\taugustus\tjapan\tjordan\tFILEPATHBAD\tMSITESTDIR\t1\n"
570 "kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n"
571 "laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n"
572 "namibia\taugustus\tnauru\tkiribati\tSourceDir\tMSITESTDIR\t1\n"
573 "wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
574 "single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
575 "wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
576 "singlenodest\taugustus\tb?r\t\tSourceDir\tMSITESTDIR\t1\n";
578 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
579 "s72\tS38\ts72\ti2\tS255\tS72\n"
580 "Component\tComponent\n"
581 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
582 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
583 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
584 "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n";
586 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
587 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
588 "File\tFile\n"
589 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
590 "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
591 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
592 "gaius\tgaius\tgaius\t500\t\t\t16384\t4";
594 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
595 "i2\ti4\tL64\tS255\tS32\tS72\n"
596 "Media\tDiskId\n"
597 "1\t1\t\ttest1.cab\tDISK1\t\n"
598 "2\t2\t\ttest2.cab\tDISK2\t\n"
599 "3\t3\t\ttest3.cab\tDISK3\t\n"
600 "4\t4\t\ttest3.cab\tDISK3\t\n";
602 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
603 "s72\ti2\ti4\ti4\ti4\ti4\n"
604 "MsiFileHash\tFile_\n"
605 "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
607 static const CHAR df_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
608 "s72\tS72\tl255\n"
609 "Directory\tDirectory\n"
610 "THIS\tMSITESTDIR\tthis\n"
611 "DOESNOT\tTHIS\tdoesnot\n"
612 "NONEXISTENT\tDOESNOT\texist\n"
613 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
614 "ProgramFilesFolder\tTARGETDIR\t.\n"
615 "TARGETDIR\t\tSourceDir";
617 static const CHAR df_duplicate_file_dat[] = "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
618 "s72\ts72\ts72\tS255\tS72\n"
619 "DuplicateFile\tFileKey\n"
620 "maximus\tmaximus\tmaximus\taugustus\t\n"
621 "caesar\tmaximus\tmaximus\t\tNONEXISTENT\n";
623 static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
624 "s72\tS38\ts72\ti2\tS255\tS72\n"
625 "Component\tComponent\n"
626 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
628 static const CHAR wrv_registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
629 "s72\ti2\tl255\tL255\tL0\ts72\n"
630 "Registry\tRegistry\n"
631 "regdata\t2\tSOFTWARE\\Wine\\msitest\tValue\t[~]one[~]two[~]three\taugustus";
633 static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
634 "s72\tS38\ts72\ti2\tS255\tS72\n"
635 "Component\tComponent\n"
636 "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
638 static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
639 "s72\tS255\tI2\n"
640 "InstallExecuteSequence\tAction\n"
641 "ValidateProductID\t\t700\n"
642 "GoodSetProperty\t\t725\n"
643 "BadSetProperty\t\t750\n"
644 "CostInitialize\t\t800\n"
645 "FileCost\t\t900\n"
646 "CostFinalize\t\t1000\n"
647 "InstallValidate\t\t1400\n"
648 "InstallInitialize\t\t1500\n"
649 "InstallFiles\t\t4000\n"
650 "InstallFinalize\t\t6600";
652 static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
653 "s72\ti2\tS64\tS0\n"
654 "CustomAction\tAction\n"
655 "GoodSetProperty\t51\tMYPROP\t42\n"
656 "BadSetProperty\t51\t\tMYPROP\n";
658 static const CHAR is_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
659 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
660 "Feature\tFeature\n"
661 "one\t\t\t\t2\t1\t\t0\n" /* favorLocal */
662 "two\t\t\t\t2\t1\t\t1\n" /* favorSource */
663 "three\t\t\t\t2\t1\t\t4\n" /* favorAdvertise */
664 "four\t\t\t\t2\t0\t\t0"; /* disabled */
666 static const CHAR is_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
667 "s72\tS38\ts72\ti2\tS255\tS72\n"
668 "Component\tComponent\n"
669 "alpha\t\tMSITESTDIR\t0\t\talpha_file\n" /* favorLocal:Local */
670 "beta\t\tMSITESTDIR\t1\t\tbeta_file\n" /* favorLocal:Source */
671 "gamma\t\tMSITESTDIR\t2\t\tgamma_file\n" /* favorLocal:Optional */
672 "theta\t\tMSITESTDIR\t0\t\ttheta_file\n" /* favorSource:Local */
673 "delta\t\tMSITESTDIR\t1\t\tdelta_file\n" /* favorSource:Source */
674 "epsilon\t\tMSITESTDIR\t2\t\tepsilon_file\n" /* favorSource:Optional */
675 "zeta\t\tMSITESTDIR\t0\t\tzeta_file\n" /* favorAdvertise:Local */
676 "iota\t\tMSITESTDIR\t1\t\tiota_file\n" /* favorAdvertise:Source */
677 "eta\t\tMSITESTDIR\t2\t\teta_file\n" /* favorAdvertise:Optional */
678 "kappa\t\tMSITESTDIR\t0\t\tkappa_file\n" /* disabled:Local */
679 "lambda\t\tMSITESTDIR\t1\t\tlambda_file\n" /* disabled:Source */
680 "mu\t\tMSITESTDIR\t2\t\tmu_file\n"; /* disabled:Optional */
682 static const CHAR is_feature_comp_dat[] = "Feature_\tComponent_\n"
683 "s38\ts72\n"
684 "FeatureComponents\tFeature_\tComponent_\n"
685 "one\talpha\n"
686 "one\tbeta\n"
687 "one\tgamma\n"
688 "two\ttheta\n"
689 "two\tdelta\n"
690 "two\tepsilon\n"
691 "three\tzeta\n"
692 "three\tiota\n"
693 "three\teta\n"
694 "four\tkappa\n"
695 "four\tlambda\n"
696 "four\tmu";
698 static const CHAR is_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
699 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
700 "File\tFile\n"
701 "alpha_file\talpha\talpha\t500\t\t\t8192\t1\n"
702 "beta_file\tbeta\tbeta\t500\t\t\t8291\t2\n"
703 "gamma_file\tgamma\tgamma\t500\t\t\t8192\t3\n"
704 "theta_file\ttheta\ttheta\t500\t\t\t8192\t4\n"
705 "delta_file\tdelta\tdelta\t500\t\t\t8192\t5\n"
706 "epsilon_file\tepsilon\tepsilon\t500\t\t\t8192\t6\n"
707 "zeta_file\tzeta\tzeta\t500\t\t\t8192\t7\n"
708 "iota_file\tiota\tiota\t500\t\t\t8192\t8\n"
709 "eta_file\teta\teta\t500\t\t\t8192\t9\n"
710 "kappa_file\tkappa\tkappa\t500\t\t\t8192\t10\n"
711 "lambda_file\tlambda\tlambda\t500\t\t\t8192\t11\n"
712 "mu_file\tmu\tmu\t500\t\t\t8192\t12";
714 static const CHAR is_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
715 "i2\ti4\tL64\tS255\tS32\tS72\n"
716 "Media\tDiskId\n"
717 "1\t12\t\t\tDISK1\t\n";
719 static const CHAR sp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
720 "s72\tS38\ts72\ti2\tS255\tS72\n"
721 "Component\tComponent\n"
722 "augustus\t\tTWODIR\t0\t\taugustus\n";
724 static const CHAR sp_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
725 "s72\tS72\tl255\n"
726 "Directory\tDirectory\n"
727 "TARGETDIR\t\tSourceDir\n"
728 "ProgramFilesFolder\tTARGETDIR\t.\n"
729 "MSITESTDIR\tProgramFilesFolder\tmsitest:.\n"
730 "ONEDIR\tMSITESTDIR\t.:shortone|longone\n"
731 "TWODIR\tONEDIR\t.:shorttwo|longtwo";
733 static const CHAR mcp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
734 "s72\tS38\ts72\ti2\tS255\tS72\n"
735 "Component\tComponent\n"
736 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t2\t\thydrogen\n"
737 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t2\t\thelium\n"
738 "lithium\t{4AF28FFC-71C7-4307-BDE4-B77C5338F56F}\tMSITESTDIR\t2\tPROPVAR=42\tlithium\n";
740 static const CHAR mcp_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
741 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
742 "Feature\tFeature\n"
743 "hydroxyl\t\thydroxyl\thydroxyl\t2\t1\tTARGETDIR\t0\n"
744 "heliox\t\theliox\theliox\t2\t5\tTARGETDIR\t0\n"
745 "lithia\t\tlithia\tlithia\t2\t10\tTARGETDIR\t0";
747 static const CHAR mcp_feature_comp_dat[] = "Feature_\tComponent_\n"
748 "s38\ts72\n"
749 "FeatureComponents\tFeature_\tComponent_\n"
750 "hydroxyl\thydrogen\n"
751 "heliox\thelium\n"
752 "lithia\tlithium";
754 static const CHAR mcomp_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
755 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
756 "File\tFile\n"
757 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
758 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
759 "lithium\tlithium\tlithium\t0\t\t\t8192\t1\n"
760 "beryllium\tmissingcomp\tberyllium\t0\t\t\t8192\t1";
762 typedef struct _msi_table
764 const CHAR *filename;
765 const CHAR *data;
766 int size;
767 } msi_table;
769 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
771 static const msi_table tables[] =
773 ADD_TABLE(component),
774 ADD_TABLE(directory),
775 ADD_TABLE(feature),
776 ADD_TABLE(feature_comp),
777 ADD_TABLE(file),
778 ADD_TABLE(install_exec_seq),
779 ADD_TABLE(media),
780 ADD_TABLE(property),
781 ADD_TABLE(registry),
782 ADD_TABLE(service_install),
783 ADD_TABLE(service_control)
786 static const msi_table cc_tables[] =
788 ADD_TABLE(cc_component),
789 ADD_TABLE(directory),
790 ADD_TABLE(cc_feature),
791 ADD_TABLE(cc_feature_comp),
792 ADD_TABLE(cc_file),
793 ADD_TABLE(install_exec_seq),
794 ADD_TABLE(cc_media),
795 ADD_TABLE(property),
798 static const msi_table cc2_tables[] =
800 ADD_TABLE(cc2_component),
801 ADD_TABLE(directory),
802 ADD_TABLE(cc_feature),
803 ADD_TABLE(cc_feature_comp),
804 ADD_TABLE(cc2_file),
805 ADD_TABLE(install_exec_seq),
806 ADD_TABLE(cc_media),
807 ADD_TABLE(property),
810 static const msi_table co_tables[] =
812 ADD_TABLE(cc_component),
813 ADD_TABLE(directory),
814 ADD_TABLE(cc_feature),
815 ADD_TABLE(cc_feature_comp),
816 ADD_TABLE(co_file),
817 ADD_TABLE(install_exec_seq),
818 ADD_TABLE(co_media),
819 ADD_TABLE(property),
822 static const msi_table co2_tables[] =
824 ADD_TABLE(cc_component),
825 ADD_TABLE(directory),
826 ADD_TABLE(cc_feature),
827 ADD_TABLE(cc_feature_comp),
828 ADD_TABLE(cc_file),
829 ADD_TABLE(install_exec_seq),
830 ADD_TABLE(co2_media),
831 ADD_TABLE(property),
834 static const msi_table mm_tables[] =
836 ADD_TABLE(cc_component),
837 ADD_TABLE(directory),
838 ADD_TABLE(cc_feature),
839 ADD_TABLE(cc_feature_comp),
840 ADD_TABLE(mm_file),
841 ADD_TABLE(install_exec_seq),
842 ADD_TABLE(mm_media),
843 ADD_TABLE(property),
846 static const msi_table ss_tables[] =
848 ADD_TABLE(cc_component),
849 ADD_TABLE(directory),
850 ADD_TABLE(cc_feature),
851 ADD_TABLE(cc_feature_comp),
852 ADD_TABLE(cc_file),
853 ADD_TABLE(install_exec_seq),
854 ADD_TABLE(ss_media),
855 ADD_TABLE(property),
858 static const msi_table ui_tables[] =
860 ADD_TABLE(ui_component),
861 ADD_TABLE(directory),
862 ADD_TABLE(cc_feature),
863 ADD_TABLE(cc_feature_comp),
864 ADD_TABLE(cc_file),
865 ADD_TABLE(install_exec_seq),
866 ADD_TABLE(ui_install_ui_seq),
867 ADD_TABLE(ui_custom_action),
868 ADD_TABLE(cc_media),
869 ADD_TABLE(property),
872 static const msi_table rof_tables[] =
874 ADD_TABLE(rof_component),
875 ADD_TABLE(directory),
876 ADD_TABLE(rof_feature),
877 ADD_TABLE(rof_feature_comp),
878 ADD_TABLE(rof_file),
879 ADD_TABLE(install_exec_seq),
880 ADD_TABLE(rof_media),
881 ADD_TABLE(property),
884 static const msi_table sdp_tables[] =
886 ADD_TABLE(rof_component),
887 ADD_TABLE(directory),
888 ADD_TABLE(rof_feature),
889 ADD_TABLE(rof_feature_comp),
890 ADD_TABLE(rof_file),
891 ADD_TABLE(sdp_install_exec_seq),
892 ADD_TABLE(sdp_custom_action),
893 ADD_TABLE(rof_media),
894 ADD_TABLE(property),
897 static const msi_table cie_tables[] =
899 ADD_TABLE(cie_component),
900 ADD_TABLE(directory),
901 ADD_TABLE(cc_feature),
902 ADD_TABLE(cie_feature_comp),
903 ADD_TABLE(cie_file),
904 ADD_TABLE(install_exec_seq),
905 ADD_TABLE(cie_media),
906 ADD_TABLE(property),
909 static const msi_table ci_tables[] =
911 ADD_TABLE(ci_component),
912 ADD_TABLE(directory),
913 ADD_TABLE(rof_feature),
914 ADD_TABLE(rof_feature_comp),
915 ADD_TABLE(rof_file),
916 ADD_TABLE(ci_install_exec_seq),
917 ADD_TABLE(rof_media),
918 ADD_TABLE(property),
919 ADD_TABLE(ci_custom_action),
922 static const msi_table ci2_tables[] =
924 ADD_TABLE(ci2_component),
925 ADD_TABLE(directory),
926 ADD_TABLE(rof_feature),
927 ADD_TABLE(ci2_feature_comp),
928 ADD_TABLE(ci2_file),
929 ADD_TABLE(install_exec_seq),
930 ADD_TABLE(rof_media),
931 ADD_TABLE(property),
934 static const msi_table spf_tables[] =
936 ADD_TABLE(ci_component),
937 ADD_TABLE(directory),
938 ADD_TABLE(rof_feature),
939 ADD_TABLE(rof_feature_comp),
940 ADD_TABLE(rof_file),
941 ADD_TABLE(spf_install_exec_seq),
942 ADD_TABLE(rof_media),
943 ADD_TABLE(property),
944 ADD_TABLE(spf_custom_action),
945 ADD_TABLE(spf_install_ui_seq),
948 static const msi_table pp_tables[] =
950 ADD_TABLE(ci_component),
951 ADD_TABLE(directory),
952 ADD_TABLE(rof_feature),
953 ADD_TABLE(rof_feature_comp),
954 ADD_TABLE(rof_file),
955 ADD_TABLE(pp_install_exec_seq),
956 ADD_TABLE(rof_media),
957 ADD_TABLE(property),
960 static const msi_table ppc_tables[] =
962 ADD_TABLE(ppc_component),
963 ADD_TABLE(directory),
964 ADD_TABLE(rof_feature),
965 ADD_TABLE(ppc_feature_comp),
966 ADD_TABLE(ppc_file),
967 ADD_TABLE(pp_install_exec_seq),
968 ADD_TABLE(ppc_media),
969 ADD_TABLE(property),
972 static const msi_table tp_tables[] =
974 ADD_TABLE(tp_component),
975 ADD_TABLE(directory),
976 ADD_TABLE(rof_feature),
977 ADD_TABLE(ci2_feature_comp),
978 ADD_TABLE(ci2_file),
979 ADD_TABLE(install_exec_seq),
980 ADD_TABLE(rof_media),
981 ADD_TABLE(property),
984 static const msi_table cwd_tables[] =
986 ADD_TABLE(cwd_component),
987 ADD_TABLE(directory),
988 ADD_TABLE(rof_feature),
989 ADD_TABLE(ci2_feature_comp),
990 ADD_TABLE(ci2_file),
991 ADD_TABLE(install_exec_seq),
992 ADD_TABLE(rof_media),
993 ADD_TABLE(property),
996 static const msi_table adm_tables[] =
998 ADD_TABLE(adm_component),
999 ADD_TABLE(directory),
1000 ADD_TABLE(rof_feature),
1001 ADD_TABLE(ci2_feature_comp),
1002 ADD_TABLE(ci2_file),
1003 ADD_TABLE(install_exec_seq),
1004 ADD_TABLE(rof_media),
1005 ADD_TABLE(property),
1006 ADD_TABLE(adm_custom_action),
1007 ADD_TABLE(adm_admin_exec_seq),
1010 static const msi_table amp_tables[] =
1012 ADD_TABLE(amp_component),
1013 ADD_TABLE(directory),
1014 ADD_TABLE(rof_feature),
1015 ADD_TABLE(ci2_feature_comp),
1016 ADD_TABLE(ci2_file),
1017 ADD_TABLE(install_exec_seq),
1018 ADD_TABLE(rof_media),
1019 ADD_TABLE(property),
1022 static const msi_table rem_tables[] =
1024 ADD_TABLE(rem_component),
1025 ADD_TABLE(directory),
1026 ADD_TABLE(rof_feature),
1027 ADD_TABLE(rem_feature_comp),
1028 ADD_TABLE(rem_file),
1029 ADD_TABLE(rem_install_exec_seq),
1030 ADD_TABLE(rof_media),
1031 ADD_TABLE(property),
1032 ADD_TABLE(rem_remove_files),
1035 static const msi_table mov_tables[] =
1037 ADD_TABLE(cwd_component),
1038 ADD_TABLE(directory),
1039 ADD_TABLE(rof_feature),
1040 ADD_TABLE(ci2_feature_comp),
1041 ADD_TABLE(ci2_file),
1042 ADD_TABLE(install_exec_seq),
1043 ADD_TABLE(rof_media),
1044 ADD_TABLE(property),
1045 ADD_TABLE(mov_move_file),
1048 static const msi_table mc_tables[] =
1050 ADD_TABLE(mc_component),
1051 ADD_TABLE(directory),
1052 ADD_TABLE(cc_feature),
1053 ADD_TABLE(cie_feature_comp),
1054 ADD_TABLE(mc_file),
1055 ADD_TABLE(install_exec_seq),
1056 ADD_TABLE(mc_media),
1057 ADD_TABLE(property),
1058 ADD_TABLE(mc_file_hash),
1061 static const msi_table df_tables[] =
1063 ADD_TABLE(rof_component),
1064 ADD_TABLE(df_directory),
1065 ADD_TABLE(rof_feature),
1066 ADD_TABLE(rof_feature_comp),
1067 ADD_TABLE(rof_file),
1068 ADD_TABLE(install_exec_seq),
1069 ADD_TABLE(rof_media),
1070 ADD_TABLE(property),
1071 ADD_TABLE(df_duplicate_file),
1074 static const msi_table wrv_tables[] =
1076 ADD_TABLE(wrv_component),
1077 ADD_TABLE(directory),
1078 ADD_TABLE(rof_feature),
1079 ADD_TABLE(ci2_feature_comp),
1080 ADD_TABLE(ci2_file),
1081 ADD_TABLE(install_exec_seq),
1082 ADD_TABLE(rof_media),
1083 ADD_TABLE(property),
1084 ADD_TABLE(wrv_registry),
1087 static const msi_table sf_tables[] =
1089 ADD_TABLE(wrv_component),
1090 ADD_TABLE(directory),
1091 ADD_TABLE(rof_feature),
1092 ADD_TABLE(ci2_feature_comp),
1093 ADD_TABLE(ci2_file),
1094 ADD_TABLE(install_exec_seq),
1095 ADD_TABLE(rof_media),
1096 ADD_TABLE(property),
1099 static const msi_table ca51_tables[] =
1101 ADD_TABLE(ca51_component),
1102 ADD_TABLE(directory),
1103 ADD_TABLE(rof_feature),
1104 ADD_TABLE(ci2_feature_comp),
1105 ADD_TABLE(ci2_file),
1106 ADD_TABLE(ca51_install_exec_seq),
1107 ADD_TABLE(rof_media),
1108 ADD_TABLE(property),
1109 ADD_TABLE(ca51_custom_action),
1112 static const msi_table is_tables[] =
1114 ADD_TABLE(is_component),
1115 ADD_TABLE(directory),
1116 ADD_TABLE(is_feature),
1117 ADD_TABLE(is_feature_comp),
1118 ADD_TABLE(is_file),
1119 ADD_TABLE(install_exec_seq),
1120 ADD_TABLE(is_media),
1121 ADD_TABLE(property),
1124 static const msi_table sp_tables[] =
1126 ADD_TABLE(sp_component),
1127 ADD_TABLE(sp_directory),
1128 ADD_TABLE(rof_feature),
1129 ADD_TABLE(ci2_feature_comp),
1130 ADD_TABLE(ci2_file),
1131 ADD_TABLE(install_exec_seq),
1132 ADD_TABLE(rof_media),
1133 ADD_TABLE(property),
1136 static const msi_table mcp_tables[] =
1138 ADD_TABLE(mcp_component),
1139 ADD_TABLE(directory),
1140 ADD_TABLE(mcp_feature),
1141 ADD_TABLE(mcp_feature_comp),
1142 ADD_TABLE(rem_file),
1143 ADD_TABLE(rem_install_exec_seq),
1144 ADD_TABLE(rof_media),
1145 ADD_TABLE(property),
1148 static const msi_table mcomp_tables[] =
1150 ADD_TABLE(mcp_component),
1151 ADD_TABLE(directory),
1152 ADD_TABLE(mcp_feature),
1153 ADD_TABLE(mcp_feature_comp),
1154 ADD_TABLE(mcomp_file),
1155 ADD_TABLE(rem_install_exec_seq),
1156 ADD_TABLE(rof_media),
1157 ADD_TABLE(property),
1160 /* cabinet definitions */
1162 /* make the max size large so there is only one cab file */
1163 #define MEDIA_SIZE 0x7FFFFFFF
1164 #define FOLDER_THRESHOLD 900000
1166 /* the FCI callbacks */
1168 static void *mem_alloc(ULONG cb)
1170 return HeapAlloc(GetProcessHeap(), 0, cb);
1173 static void mem_free(void *memory)
1175 HeapFree(GetProcessHeap(), 0, memory);
1178 static BOOL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
1180 sprintf(pccab->szCab, pv, pccab->iCab);
1181 return TRUE;
1184 static long progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
1186 return 0;
1189 static int file_placed(PCCAB pccab, char *pszFile, long cbFile,
1190 BOOL fContinuation, void *pv)
1192 return 0;
1195 static INT_PTR fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
1197 HANDLE handle;
1198 DWORD dwAccess = 0;
1199 DWORD dwShareMode = 0;
1200 DWORD dwCreateDisposition = OPEN_EXISTING;
1202 dwAccess = GENERIC_READ | GENERIC_WRITE;
1203 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
1204 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
1206 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
1207 dwCreateDisposition = OPEN_EXISTING;
1208 else
1209 dwCreateDisposition = CREATE_NEW;
1211 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
1212 dwCreateDisposition, 0, NULL);
1214 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
1216 return (INT_PTR)handle;
1219 static UINT fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1221 HANDLE handle = (HANDLE)hf;
1222 DWORD dwRead;
1223 BOOL res;
1225 res = ReadFile(handle, memory, cb, &dwRead, NULL);
1226 ok(res, "Failed to ReadFile\n");
1228 return dwRead;
1231 static UINT fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1233 HANDLE handle = (HANDLE)hf;
1234 DWORD dwWritten;
1235 BOOL res;
1237 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
1238 ok(res, "Failed to WriteFile\n");
1240 return dwWritten;
1243 static int fci_close(INT_PTR hf, int *err, void *pv)
1245 HANDLE handle = (HANDLE)hf;
1246 ok(CloseHandle(handle), "Failed to CloseHandle\n");
1248 return 0;
1251 static long fci_seek(INT_PTR hf, long dist, int seektype, int *err, void *pv)
1253 HANDLE handle = (HANDLE)hf;
1254 DWORD ret;
1256 ret = SetFilePointer(handle, dist, NULL, seektype);
1257 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
1259 return ret;
1262 static int fci_delete(char *pszFile, int *err, void *pv)
1264 BOOL ret = DeleteFileA(pszFile);
1265 ok(ret, "Failed to DeleteFile %s\n", pszFile);
1267 return 0;
1270 static void init_functionpointers(void)
1272 HMODULE hmsi = GetModuleHandleA("msi.dll");
1274 #define GET_PROC(func) \
1275 p ## func = (void*)GetProcAddress(hmsi, #func); \
1276 if(!p ## func) \
1277 trace("GetProcAddress(%s) failed\n", #func);
1279 GET_PROC(MsiQueryComponentStateA);
1280 GET_PROC(MsiSourceListEnumSourcesA);
1281 GET_PROC(MsiSourceListGetInfoA);
1283 #undef GET_PROC
1286 static void get_user_sid(LPSTR *usersid)
1288 HANDLE token;
1289 BYTE buf[1024];
1290 DWORD size;
1291 PTOKEN_USER user;
1292 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
1293 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
1295 *usersid = NULL;
1296 pConvertSidToStringSidA = (void *)GetProcAddress(hadvapi32, "ConvertSidToStringSidA");
1297 if (!pConvertSidToStringSidA)
1298 return;
1300 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
1301 size = sizeof(buf);
1302 GetTokenInformation(token, TokenUser, (void *)buf, size, &size);
1303 user = (PTOKEN_USER)buf;
1304 pConvertSidToStringSidA(user->User.Sid, usersid);
1307 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
1309 CHAR buffer[0x20];
1310 UINT r;
1311 DWORD sz;
1313 sz = sizeof buffer;
1314 r = MsiRecordGetString(rec, field, buffer, &sz);
1315 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
1318 static BOOL get_temp_file(char *pszTempName, int cbTempName, void *pv)
1320 LPSTR tempname;
1322 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
1323 GetTempFileNameA(".", "xx", 0, tempname);
1325 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
1327 lstrcpyA(pszTempName, tempname);
1328 HeapFree(GetProcessHeap(), 0, tempname);
1329 return TRUE;
1332 HeapFree(GetProcessHeap(), 0, tempname);
1334 return FALSE;
1337 static INT_PTR get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
1338 USHORT *pattribs, int *err, void *pv)
1340 BY_HANDLE_FILE_INFORMATION finfo;
1341 FILETIME filetime;
1342 HANDLE handle;
1343 DWORD attrs;
1344 BOOL res;
1346 handle = CreateFile(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
1347 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
1349 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
1351 res = GetFileInformationByHandle(handle, &finfo);
1352 ok(res, "Expected GetFileInformationByHandle to succeed\n");
1354 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
1355 FileTimeToDosDateTime(&filetime, pdate, ptime);
1357 attrs = GetFileAttributes(pszName);
1358 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
1360 return (INT_PTR)handle;
1363 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
1365 char path[MAX_PATH];
1366 char filename[MAX_PATH];
1368 lstrcpyA(path, CURR_DIR);
1369 lstrcatA(path, "\\");
1370 lstrcatA(path, file);
1372 lstrcpyA(filename, file);
1374 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
1375 progress, get_open_info, compress);
1378 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
1380 ZeroMemory(pCabParams, sizeof(CCAB));
1382 pCabParams->cb = max_size;
1383 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
1384 pCabParams->setID = 0xbeef;
1385 pCabParams->iCab = 1;
1386 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
1387 lstrcatA(pCabParams->szCabPath, "\\");
1388 lstrcpyA(pCabParams->szCab, name);
1391 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
1393 CCAB cabParams;
1394 LPCSTR ptr;
1395 HFCI hfci;
1396 ERF erf;
1397 BOOL res;
1399 set_cab_parameters(&cabParams, name, max_size);
1401 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
1402 fci_read, fci_write, fci_close, fci_seek, fci_delete,
1403 get_temp_file, &cabParams, NULL);
1405 ok(hfci != NULL, "Failed to create an FCI context\n");
1407 ptr = files;
1408 while (*ptr)
1410 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
1411 ok(res, "Failed to add file: %s\n", ptr);
1412 ptr += lstrlen(ptr) + 1;
1415 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
1416 ok(res, "Failed to flush the cabinet\n");
1418 res = FCIDestroy(hfci);
1419 ok(res, "Failed to destroy the cabinet\n");
1422 static BOOL get_program_files_dir(LPSTR buf, LPSTR buf2)
1424 HKEY hkey;
1425 DWORD type, size;
1427 if (RegOpenKey(HKEY_LOCAL_MACHINE,
1428 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
1429 return FALSE;
1431 size = MAX_PATH;
1432 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) {
1433 RegCloseKey(hkey);
1434 return FALSE;
1437 size = MAX_PATH;
1438 if (RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size)) {
1439 RegCloseKey(hkey);
1440 return FALSE;
1443 RegCloseKey(hkey);
1444 return TRUE;
1447 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
1449 HANDLE file;
1450 DWORD written;
1452 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
1453 if (file == INVALID_HANDLE_VALUE)
1454 return;
1456 WriteFile(file, data, strlen(data), &written, NULL);
1458 if (size)
1460 SetFilePointer(file, size, NULL, FILE_BEGIN);
1461 SetEndOfFile(file);
1464 CloseHandle(file);
1467 #define create_file(name, size) create_file_data(name, name, size)
1469 static void create_test_files(void)
1471 CreateDirectoryA("msitest", NULL);
1472 create_file("msitest\\one.txt", 100);
1473 CreateDirectoryA("msitest\\first", NULL);
1474 create_file("msitest\\first\\two.txt", 100);
1475 CreateDirectoryA("msitest\\second", NULL);
1476 create_file("msitest\\second\\three.txt", 100);
1478 create_file("four.txt", 100);
1479 create_file("five.txt", 100);
1480 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
1482 create_file("msitest\\filename", 100);
1483 create_file("msitest\\service.exe", 100);
1485 DeleteFileA("four.txt");
1486 DeleteFileA("five.txt");
1489 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
1491 CHAR path[MAX_PATH];
1493 lstrcpyA(path, PROG_FILES_DIR);
1494 lstrcatA(path, "\\");
1495 lstrcatA(path, rel_path);
1497 if (is_file)
1498 return DeleteFileA(path);
1499 else
1500 return RemoveDirectoryA(path);
1503 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
1505 CHAR path[MAX_PATH];
1507 lstrcpyA(path, COMMON_FILES_DIR);
1508 lstrcatA(path, "\\");
1509 lstrcatA(path, rel_path);
1511 if (is_file)
1512 return DeleteFileA(path);
1513 else
1514 return RemoveDirectoryA(path);
1517 static void delete_test_files(void)
1519 DeleteFileA("msitest.msi");
1520 DeleteFileA("msitest.cab");
1521 DeleteFileA("msitest\\second\\three.txt");
1522 DeleteFileA("msitest\\first\\two.txt");
1523 DeleteFileA("msitest\\one.txt");
1524 DeleteFileA("msitest\\service.exe");
1525 DeleteFileA("msitest\\filename");
1526 RemoveDirectoryA("msitest\\second");
1527 RemoveDirectoryA("msitest\\first");
1528 RemoveDirectoryA("msitest");
1531 static void write_file(const CHAR *filename, const char *data, int data_size)
1533 DWORD size;
1535 HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
1536 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
1538 WriteFile(hf, data, data_size, &size, NULL);
1539 CloseHandle(hf);
1542 static void write_msi_summary_info(MSIHANDLE db)
1544 MSIHANDLE summary;
1545 UINT r;
1547 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
1548 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1550 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, ";1033");
1551 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1553 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
1554 "{004757CA-5092-49c2-AD20-28E1CE0DF5F2}");
1555 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1557 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
1558 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1560 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 0, NULL, NULL);
1561 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1563 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
1564 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1566 /* write the summary changes back to the stream */
1567 r = MsiSummaryInfoPersist(summary);
1568 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1570 MsiCloseHandle(summary);
1573 static void create_database(const CHAR *name, const msi_table *tables, int num_tables)
1575 MSIHANDLE db;
1576 UINT r;
1577 int j;
1579 r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db);
1580 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1582 /* import the tables into the database */
1583 for (j = 0; j < num_tables; j++)
1585 const msi_table *table = &tables[j];
1587 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
1589 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
1590 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1592 DeleteFileA(table->filename);
1595 write_msi_summary_info(db);
1597 r = MsiDatabaseCommit(db);
1598 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1600 MsiCloseHandle(db);
1603 static void check_service_is_installed(void)
1605 SC_HANDLE scm, service;
1606 BOOL res;
1608 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
1609 ok(scm != NULL, "Failed to open the SC Manager\n");
1611 service = OpenService(scm, "TestService", SC_MANAGER_ALL_ACCESS);
1612 ok(service != NULL, "Failed to open TestService\n");
1614 res = DeleteService(service);
1615 ok(res, "Failed to delete TestService\n");
1617 CloseServiceHandle(service);
1618 CloseServiceHandle(scm);
1621 static void test_MsiInstallProduct(void)
1623 UINT r;
1624 CHAR path[MAX_PATH];
1625 LONG res;
1626 HKEY hkey;
1627 DWORD num, size, type;
1628 SC_HANDLE scm;
1630 scm = OpenSCManager(NULL, NULL, GENERIC_ALL);
1631 if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
1633 skip("Services are not implemented, we are most likely on win9x\n");
1634 return;
1636 CloseServiceHandle(scm);
1638 create_test_files();
1639 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1641 r = MsiInstallProductA(msifile, NULL);
1642 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1644 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
1645 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
1646 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
1647 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
1648 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
1649 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
1650 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
1651 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
1652 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
1653 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
1654 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
1655 ok(delete_pf("msitest", FALSE), "File not installed\n");
1657 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
1658 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1660 size = MAX_PATH;
1661 type = REG_SZ;
1662 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
1663 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1664 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
1666 size = MAX_PATH;
1667 type = REG_SZ;
1668 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
1669 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
1671 size = sizeof(num);
1672 type = REG_DWORD;
1673 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
1674 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1675 ok(num == 314, "Expected 314, got %d\n", num);
1677 size = MAX_PATH;
1678 type = REG_SZ;
1679 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
1680 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1681 ok(!lstrcmpA(path, "OrderTestValue"), "Expected imaname, got %s\n", path);
1683 check_service_is_installed();
1685 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
1687 delete_test_files();
1690 static void test_MsiSetComponentState(void)
1692 INSTALLSTATE installed, action;
1693 MSIHANDLE package;
1694 char path[MAX_PATH];
1695 UINT r;
1697 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1699 CoInitialize(NULL);
1701 lstrcpy(path, CURR_DIR);
1702 lstrcat(path, "\\");
1703 lstrcat(path, msifile);
1705 r = MsiOpenPackage(path, &package);
1706 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1708 r = MsiDoAction(package, "CostInitialize");
1709 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1711 r = MsiDoAction(package, "FileCost");
1712 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1714 r = MsiDoAction(package, "CostFinalize");
1715 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1717 r = MsiGetComponentState(package, "dangler", &installed, &action);
1718 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1719 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
1720 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
1722 r = MsiSetComponentState(package, "dangler", INSTALLSTATE_SOURCE);
1723 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1725 MsiCloseHandle(package);
1726 CoUninitialize();
1728 DeleteFileA(msifile);
1731 static void test_packagecoltypes(void)
1733 MSIHANDLE hdb, view, rec;
1734 char path[MAX_PATH];
1735 LPCSTR query;
1736 UINT r, count;
1738 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1740 CoInitialize(NULL);
1742 lstrcpy(path, CURR_DIR);
1743 lstrcat(path, "\\");
1744 lstrcat(path, msifile);
1746 r = MsiOpenDatabase(path, MSIDBOPEN_READONLY, &hdb);
1747 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1749 query = "SELECT * FROM `Media`";
1750 r = MsiDatabaseOpenView( hdb, query, &view );
1751 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
1753 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
1754 count = MsiRecordGetFieldCount( rec );
1755 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
1756 ok(count == 6, "Expected 6, got %d\n", count);
1757 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
1758 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
1759 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
1760 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
1761 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
1762 ok(check_record(rec, 6, "Source"), "wrong column label\n");
1763 MsiCloseHandle(rec);
1765 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
1766 count = MsiRecordGetFieldCount( rec );
1767 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
1768 ok(count == 6, "Expected 6, got %d\n", count);
1769 ok(check_record(rec, 1, "i2"), "wrong column label\n");
1770 ok(check_record(rec, 2, "i4"), "wrong column label\n");
1771 ok(check_record(rec, 3, "L64"), "wrong column label\n");
1772 ok(check_record(rec, 4, "S255"), "wrong column label\n");
1773 ok(check_record(rec, 5, "S32"), "wrong column label\n");
1774 ok(check_record(rec, 6, "S72"), "wrong column label\n");
1776 MsiCloseHandle(rec);
1777 MsiCloseHandle(view);
1778 MsiCloseHandle(hdb);
1779 DeleteFile(msifile);
1782 static void create_cc_test_files(void)
1784 CCAB cabParams;
1785 HFCI hfci;
1786 ERF erf;
1787 static CHAR cab_context[] = "test%d.cab";
1788 BOOL res;
1790 create_file("maximus", 500);
1791 create_file("augustus", 50000);
1792 create_file("tiberius", 500);
1793 create_file("caesar", 500);
1795 set_cab_parameters(&cabParams, "test1.cab", 40000);
1797 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
1798 fci_read, fci_write, fci_close, fci_seek, fci_delete,
1799 get_temp_file, &cabParams, cab_context);
1800 ok(hfci != NULL, "Failed to create an FCI context\n");
1802 res = add_file(hfci, "maximus", tcompTYPE_NONE);
1803 ok(res, "Failed to add file maximus\n");
1805 res = add_file(hfci, "augustus", tcompTYPE_NONE);
1806 ok(res, "Failed to add file augustus\n");
1808 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
1809 ok(res, "Failed to add file tiberius\n");
1811 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
1812 ok(res, "Failed to flush the cabinet\n");
1814 res = FCIDestroy(hfci);
1815 ok(res, "Failed to destroy the cabinet\n");
1817 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1819 DeleteFile("maximus");
1820 DeleteFile("augustus");
1821 DeleteFile("tiberius");
1822 DeleteFile("caesar");
1825 static void delete_cab_files(void)
1827 SHFILEOPSTRUCT shfl;
1828 CHAR path[MAX_PATH+10];
1830 lstrcpyA(path, CURR_DIR);
1831 lstrcatA(path, "\\*.cab");
1832 path[strlen(path) + 1] = '\0';
1834 shfl.hwnd = NULL;
1835 shfl.wFunc = FO_DELETE;
1836 shfl.pFrom = path;
1837 shfl.pTo = NULL;
1838 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
1840 SHFileOperation(&shfl);
1843 static void test_continuouscabs(void)
1845 UINT r;
1847 create_cc_test_files();
1848 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
1850 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1852 r = MsiInstallProductA(msifile, NULL);
1853 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
1855 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1856 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
1857 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1858 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1859 ok(delete_pf("msitest", FALSE), "File not installed\n");
1862 delete_cab_files();
1863 DeleteFile(msifile);
1865 create_cc_test_files();
1866 create_database(msifile, cc2_tables, sizeof(cc2_tables) / sizeof(msi_table));
1868 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1870 r = MsiInstallProductA(msifile, NULL);
1871 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1872 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1873 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
1874 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
1875 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1876 ok(delete_pf("msitest", FALSE), "File not installed\n");
1878 delete_cab_files();
1879 DeleteFile(msifile);
1882 static void test_caborder(void)
1884 UINT r;
1886 create_file("imperator", 100);
1887 create_file("maximus", 500);
1888 create_file("augustus", 50000);
1889 create_file("caesar", 500);
1891 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
1893 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1895 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
1896 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
1897 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1899 r = MsiInstallProductA(msifile, NULL);
1900 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1901 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1902 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1903 todo_wine
1905 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1906 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1909 delete_cab_files();
1911 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
1912 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
1913 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1915 r = MsiInstallProductA(msifile, NULL);
1916 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1917 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1918 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1919 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1920 todo_wine
1922 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1925 delete_cab_files();
1926 DeleteFile(msifile);
1928 create_cc_test_files();
1929 create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
1931 r = MsiInstallProductA(msifile, NULL);
1932 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1933 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1934 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1935 todo_wine
1937 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1938 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1941 delete_cab_files();
1942 DeleteFile(msifile);
1944 create_cc_test_files();
1945 create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
1947 r = MsiInstallProductA(msifile, NULL);
1948 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1949 todo_wine
1951 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1952 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1953 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1954 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1957 delete_cab_files();
1958 DeleteFile("imperator");
1959 DeleteFile("maximus");
1960 DeleteFile("augustus");
1961 DeleteFile("caesar");
1962 DeleteFile(msifile);
1965 static void test_mixedmedia(void)
1967 UINT r;
1969 CreateDirectoryA("msitest", NULL);
1970 create_file("msitest\\maximus", 500);
1971 create_file("msitest\\augustus", 500);
1972 create_file("caesar", 500);
1974 create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
1976 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1978 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
1980 r = MsiInstallProductA(msifile, NULL);
1981 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1982 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
1983 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1984 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1985 ok(delete_pf("msitest", FALSE), "File not installed\n");
1987 /* Delete the files in the temp (current) folder */
1988 DeleteFile("msitest\\maximus");
1989 DeleteFile("msitest\\augustus");
1990 RemoveDirectory("msitest");
1991 DeleteFile("caesar");
1992 DeleteFile("test1.cab");
1993 DeleteFile(msifile);
1996 static void test_samesequence(void)
1998 UINT r;
2000 create_cc_test_files();
2001 create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
2003 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2005 r = MsiInstallProductA(msifile, NULL);
2006 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
2008 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2009 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2010 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2011 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2012 ok(delete_pf("msitest", FALSE), "File not installed\n");
2015 delete_cab_files();
2016 DeleteFile(msifile);
2019 static void test_uiLevelFlags(void)
2021 UINT r;
2023 create_cc_test_files();
2024 create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
2026 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
2028 r = MsiInstallProductA(msifile, NULL);
2029 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
2031 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2032 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
2033 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2034 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2035 ok(delete_pf("msitest", FALSE), "File not installed\n");
2038 delete_cab_files();
2039 DeleteFile(msifile);
2042 static BOOL file_matches(LPSTR path)
2044 CHAR buf[MAX_PATH];
2045 HANDLE file;
2046 DWORD size;
2048 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
2049 NULL, OPEN_EXISTING, 0, NULL);
2051 ZeroMemory(buf, MAX_PATH);
2052 ReadFile(file, buf, 15, &size, NULL);
2053 CloseHandle(file);
2055 return !lstrcmp(buf, "msitest\\maximus");
2058 static void test_readonlyfile(void)
2060 UINT r;
2061 DWORD size;
2062 HANDLE file;
2063 CHAR path[MAX_PATH];
2065 CreateDirectoryA("msitest", NULL);
2066 create_file("msitest\\maximus", 500);
2067 create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
2069 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2071 lstrcpy(path, PROG_FILES_DIR);
2072 lstrcat(path, "\\msitest");
2073 CreateDirectory(path, NULL);
2075 lstrcat(path, "\\maximus");
2076 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
2077 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
2079 WriteFile(file, "readonlyfile", 20, &size, NULL);
2080 CloseHandle(file);
2082 r = MsiInstallProductA(msifile, NULL);
2083 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2084 ok(file_matches(path), "Expected file to be overwritten\n");
2085 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2086 ok(delete_pf("msitest", FALSE), "File not installed\n");
2088 /* Delete the files in the temp (current) folder */
2089 DeleteFile("msitest\\maximus");
2090 RemoveDirectory("msitest");
2091 DeleteFile(msifile);
2094 static void test_setdirproperty(void)
2096 UINT r;
2098 CreateDirectoryA("msitest", NULL);
2099 create_file("msitest\\maximus", 500);
2100 create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
2102 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2104 r = MsiInstallProductA(msifile, NULL);
2105 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2106 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
2107 ok(delete_cf("msitest", FALSE), "File not installed\n");
2109 /* Delete the files in the temp (current) folder */
2110 DeleteFile(msifile);
2111 DeleteFile("msitest\\maximus");
2112 RemoveDirectory("msitest");
2115 static void test_cabisextracted(void)
2117 UINT r;
2119 CreateDirectoryA("msitest", NULL);
2120 create_file("msitest\\gaius", 500);
2121 create_file("maximus", 500);
2122 create_file("augustus", 500);
2123 create_file("caesar", 500);
2125 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
2126 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
2127 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2129 create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
2131 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2133 r = MsiInstallProductA(msifile, NULL);
2134 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2135 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2136 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2137 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2138 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
2139 ok(delete_pf("msitest", FALSE), "File not installed\n");
2141 /* Delete the files in the temp (current) folder */
2142 delete_cab_files();
2143 DeleteFile(msifile);
2144 DeleteFile("maximus");
2145 DeleteFile("augustus");
2146 DeleteFile("caesar");
2147 DeleteFile("msitest\\gaius");
2148 RemoveDirectory("msitest");
2151 static void test_concurrentinstall(void)
2153 UINT r;
2154 CHAR path[MAX_PATH];
2156 CreateDirectoryA("msitest", NULL);
2157 CreateDirectoryA("msitest\\msitest", NULL);
2158 create_file("msitest\\maximus", 500);
2159 create_file("msitest\\msitest\\augustus", 500);
2161 create_database(msifile, ci_tables, sizeof(ci_tables) / sizeof(msi_table));
2163 lstrcpyA(path, CURR_DIR);
2164 lstrcatA(path, "\\msitest\\concurrent.msi");
2165 create_database(path, ci2_tables, sizeof(ci2_tables) / sizeof(msi_table));
2167 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2169 r = MsiInstallProductA(msifile, NULL);
2170 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2171 if (!delete_pf("msitest\\augustus", TRUE))
2172 trace("concurrent installs not supported\n");
2173 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2174 ok(delete_pf("msitest", FALSE), "File not installed\n");
2176 DeleteFile(path);
2178 r = MsiInstallProductA(msifile, NULL);
2179 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2180 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2181 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
2182 ok(delete_pf("msitest", FALSE), "File not installed\n");
2184 DeleteFile(msifile);
2185 DeleteFile("msitest\\msitest\\augustus");
2186 DeleteFile("msitest\\maximus");
2187 RemoveDirectory("msitest\\msitest");
2188 RemoveDirectory("msitest");
2191 static void test_setpropertyfolder(void)
2193 UINT r;
2194 CHAR path[MAX_PATH];
2196 lstrcpyA(path, PROG_FILES_DIR);
2197 lstrcatA(path, "\\msitest\\added");
2199 CreateDirectoryA("msitest", NULL);
2200 create_file("msitest\\maximus", 500);
2202 create_database(msifile, spf_tables, sizeof(spf_tables) / sizeof(msi_table));
2204 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2206 r = MsiInstallProductA(msifile, NULL);
2207 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2208 if (GetFileAttributesA(path) == FILE_ATTRIBUTE_DIRECTORY)
2210 ok(delete_pf("msitest\\added\\maximus", TRUE), "File not installed\n");
2211 ok(delete_pf("msitest\\added", FALSE), "File not installed\n");
2212 ok(delete_pf("msitest", FALSE), "File not installed\n");
2214 else
2216 trace("changing folder property not supported\n");
2217 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2218 ok(delete_pf("msitest", FALSE), "File not installed\n");
2221 /* Delete the files in the temp (current) folder */
2222 DeleteFile(msifile);
2223 DeleteFile("msitest\\maximus");
2224 RemoveDirectory("msitest");
2227 static BOOL file_exists(LPCSTR file)
2229 return GetFileAttributes(file) != INVALID_FILE_ATTRIBUTES;
2232 static BOOL pf_exists(LPCSTR file)
2234 CHAR path[MAX_PATH];
2236 lstrcpyA(path, PROG_FILES_DIR);
2237 lstrcatA(path, "\\");
2238 lstrcatA(path, file);
2240 return file_exists(path);
2243 static void delete_pfmsitest_files(void)
2245 SHFILEOPSTRUCT shfl;
2246 CHAR path[MAX_PATH+11];
2248 lstrcpyA(path, PROG_FILES_DIR);
2249 lstrcatA(path, "\\msitest\\*");
2250 path[strlen(path) + 1] = '\0';
2252 shfl.hwnd = NULL;
2253 shfl.wFunc = FO_DELETE;
2254 shfl.pFrom = path;
2255 shfl.pTo = NULL;
2256 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
2258 SHFileOperation(&shfl);
2260 lstrcpyA(path, PROG_FILES_DIR);
2261 lstrcatA(path, "\\msitest");
2262 RemoveDirectoryA(path);
2265 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
2267 char val[MAX_PATH];
2268 DWORD size, type;
2269 LONG res;
2271 size = MAX_PATH;
2272 val[0] = '\0';
2273 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
2275 if (res != ERROR_SUCCESS ||
2276 (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
2278 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2279 return;
2282 if (!expected)
2283 ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val);
2284 else
2286 if (bcase)
2287 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
2288 else
2289 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
2293 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
2295 DWORD val, size, type;
2296 LONG res;
2298 size = sizeof(DWORD);
2299 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2301 if (res != ERROR_SUCCESS || type != REG_DWORD)
2303 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2304 return;
2307 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
2310 #define CHECK_REG_STR(prodkey, name, expected) \
2311 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
2313 #define CHECK_DEL_REG_STR(prodkey, name, expected) \
2314 check_reg_str(prodkey, name, expected, TRUE, __LINE__); \
2315 RegDeleteValueA(prodkey, name);
2317 #define CHECK_REG_ISTR(prodkey, name, expected) \
2318 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
2320 #define CHECK_DEL_REG_ISTR(prodkey, name, expected) \
2321 check_reg_str(prodkey, name, expected, FALSE, __LINE__); \
2322 RegDeleteValueA(prodkey, name);
2324 #define CHECK_REG_DWORD(prodkey, name, expected) \
2325 check_reg_dword(prodkey, name, expected, __LINE__);
2327 #define CHECK_DEL_REG_DWORD(prodkey, name, expected) \
2328 check_reg_dword(prodkey, name, expected, __LINE__); \
2329 RegDeleteValueA(prodkey, name);
2331 static void get_date_str(LPSTR date)
2333 SYSTEMTIME systime;
2335 static const char date_fmt[] = "%d%02d%02d";
2336 GetLocalTime(&systime);
2337 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
2340 static void test_publish_registerproduct(void)
2342 UINT r;
2343 LONG res;
2344 HKEY hkey;
2345 HKEY props, usage;
2346 LPSTR usersid;
2347 char date[MAX_PATH];
2348 char temp[MAX_PATH];
2349 char keypath[MAX_PATH];
2351 static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2352 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2353 static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2354 "\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2355 static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2356 "\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2357 static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2358 "\\51AAE0C44620A5E4788506E91F249BD2";
2360 get_user_sid(&usersid);
2361 if (!usersid)
2363 skip("ConvertSidToStringSidA is not available\n");
2364 return;
2367 get_date_str(date);
2368 GetTempPath(MAX_PATH, temp);
2370 CreateDirectoryA("msitest", NULL);
2371 create_file("msitest\\maximus", 500);
2373 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2375 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2377 /* RegisterProduct */
2378 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
2379 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2380 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2381 ok(delete_pf("msitest", FALSE), "File not installed\n");
2383 res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
2384 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2386 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
2387 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2389 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2390 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2391 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2392 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2393 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2394 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2395 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2396 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2397 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2398 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2399 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2400 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2401 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2402 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2403 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2404 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2405 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2406 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2407 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2408 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2409 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2410 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2411 todo_wine
2413 CHECK_DEL_REG_DWORD(hkey, "EstimatedSize", 12);
2416 RegDeleteKeyA(hkey, "");
2417 RegCloseKey(hkey);
2419 sprintf(keypath, userdata, usersid);
2420 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2421 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2423 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2424 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2426 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2427 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2428 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2429 CHECK_DEL_REG_STR(props, "InstallDate", date);
2430 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2431 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2432 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2433 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2434 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2435 CHECK_DEL_REG_STR(props, "Comments", NULL);
2436 CHECK_DEL_REG_STR(props, "Contact", NULL);
2437 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2438 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2439 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2440 CHECK_DEL_REG_STR(props, "Readme", NULL);
2441 CHECK_DEL_REG_STR(props, "Size", NULL);
2442 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2443 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2444 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2445 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2446 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2447 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2448 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2449 todo_wine
2451 CHECK_DEL_REG_DWORD(props, "EstimatedSize", 12);
2454 RegDeleteKeyA(props, "");
2455 RegCloseKey(props);
2457 res = RegOpenKeyA(hkey, "Usage", &usage);
2458 todo_wine
2460 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2463 RegDeleteKeyA(usage, "");
2464 RegCloseKey(usage);
2465 RegDeleteKeyA(hkey, "");
2466 RegCloseKey(hkey);
2468 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
2469 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2471 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2473 RegDeleteKeyA(hkey, "");
2474 RegCloseKey(hkey);
2476 /* RegisterProduct, machine */
2477 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 ALLUSERS=1");
2478 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2479 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2480 ok(delete_pf("msitest", FALSE), "File not installed\n");
2482 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, userugkey, &hkey);
2483 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2485 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
2486 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2488 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2489 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2490 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2491 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2492 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2493 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2494 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2495 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2496 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2497 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2498 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2499 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2500 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2501 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2502 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2503 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2504 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2505 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2506 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2507 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2508 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2509 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2510 todo_wine
2512 CHECK_DEL_REG_DWORD(hkey, "EstimatedSize", 12);
2515 RegDeleteKeyA(hkey, "");
2516 RegCloseKey(hkey);
2518 sprintf(keypath, userdata, "S-1-5-18");
2519 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2520 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2522 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2523 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2525 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2526 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2527 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2528 CHECK_DEL_REG_STR(props, "InstallDate", date);
2529 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2530 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2531 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2532 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2533 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2534 CHECK_DEL_REG_STR(props, "Comments", NULL);
2535 CHECK_DEL_REG_STR(props, "Contact", NULL);
2536 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2537 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2538 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2539 CHECK_DEL_REG_STR(props, "Readme", NULL);
2540 CHECK_DEL_REG_STR(props, "Size", NULL);
2541 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2542 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2543 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2544 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2545 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2546 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2547 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2548 todo_wine
2550 CHECK_DEL_REG_DWORD(props, "EstimatedSize", 12);
2553 RegDeleteKeyA(props, "");
2554 RegCloseKey(props);
2556 res = RegOpenKeyA(hkey, "Usage", &usage);
2557 todo_wine
2559 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2562 RegDeleteKeyA(usage, "");
2563 RegCloseKey(usage);
2564 RegDeleteKeyA(hkey, "");
2565 RegCloseKey(hkey);
2567 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
2568 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2570 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2572 RegDeleteKeyA(hkey, "");
2573 RegCloseKey(hkey);
2575 DeleteFile(msifile);
2576 DeleteFile("msitest\\maximus");
2577 RemoveDirectory("msitest");
2578 HeapFree(GetProcessHeap(), 0, usersid);
2581 static void test_publish_publishproduct(void)
2583 UINT r;
2584 LONG res;
2585 LPSTR usersid;
2586 HKEY sourcelist, net, props;
2587 HKEY hkey, patches, media;
2588 CHAR keypath[MAX_PATH];
2589 CHAR temp[MAX_PATH];
2590 CHAR path[MAX_PATH];
2592 static const CHAR prodpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2593 "\\Installer\\UserData\\%s\\Products"
2594 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2595 static const CHAR cuprodpath[] = "Software\\Microsoft\\Installer\\Products"
2596 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2597 static const CHAR cuupgrades[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2598 "\\51AAE0C44620A5E4788506E91F249BD2";
2599 static const CHAR badprod[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2600 "\\Installer\\Products"
2601 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2602 static const CHAR machprod[] = "Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2603 static const CHAR machup[] = "Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2605 get_user_sid(&usersid);
2606 if (!usersid)
2608 skip("ConvertSidToStringSidA is not available\n");
2609 return;
2612 GetTempPath(MAX_PATH, temp);
2614 CreateDirectoryA("msitest", NULL);
2615 create_file("msitest\\maximus", 500);
2617 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2619 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2621 /* PublishProduct, current user */
2622 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2623 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2624 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2625 ok(delete_pf("msitest", FALSE), "File not installed\n");
2627 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
2628 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2630 sprintf(keypath, prodpath, usersid);
2631 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2632 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2634 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2635 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2637 res = RegOpenKeyA(hkey, "Patches", &patches);
2638 todo_wine
2640 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2642 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
2645 RegDeleteKeyA(patches, "");
2646 RegCloseKey(patches);
2647 RegDeleteKeyA(hkey, "");
2648 RegCloseKey(hkey);
2650 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
2651 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2653 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
2654 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
2655 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2656 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2657 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
2658 CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
2659 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
2660 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
2661 CHECK_DEL_REG_STR(hkey, "Clients", ":");
2663 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
2664 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2666 lstrcpyA(path, "n;1;");
2667 lstrcatA(path, temp);
2668 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
2669 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
2671 res = RegOpenKeyA(sourcelist, "Net", &net);
2672 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2674 CHECK_DEL_REG_STR(net, "1", temp);
2676 RegDeleteKeyA(net, "");
2677 RegCloseKey(net);
2679 res = RegOpenKeyA(sourcelist, "Media", &media);
2680 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2682 CHECK_DEL_REG_STR(media, "1", "DISK1;");
2684 RegDeleteKeyA(media, "");
2685 RegCloseKey(media);
2686 RegDeleteKeyA(sourcelist, "");
2687 RegCloseKey(sourcelist);
2688 RegDeleteKeyA(hkey, "");
2689 RegCloseKey(hkey);
2691 res = RegOpenKeyA(HKEY_CURRENT_USER, cuupgrades, &hkey);
2692 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2694 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2696 RegDeleteKeyA(hkey, "");
2697 RegCloseKey(hkey);
2699 /* PublishProduct, machine */
2700 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
2701 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2702 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2703 ok(delete_pf("msitest", FALSE), "File not installed\n");
2705 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
2706 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2708 sprintf(keypath, prodpath, "S-1-5-18");
2709 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2710 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2712 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2713 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2715 res = RegOpenKeyA(hkey, "Patches", &patches);
2716 todo_wine
2718 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2720 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
2723 RegDeleteKeyA(patches, "");
2724 RegCloseKey(patches);
2725 RegDeleteKeyA(hkey, "");
2726 RegCloseKey(hkey);
2728 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machprod, &hkey);
2729 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2731 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
2732 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
2733 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2734 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2735 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
2736 todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
2737 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
2738 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
2739 CHECK_DEL_REG_STR(hkey, "Clients", ":");
2741 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
2742 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2744 lstrcpyA(path, "n;1;");
2745 lstrcatA(path, temp);
2746 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
2747 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
2749 res = RegOpenKeyA(sourcelist, "Net", &net);
2750 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2752 CHECK_DEL_REG_STR(net, "1", temp);
2754 RegDeleteKeyA(net, "");
2755 RegCloseKey(net);
2757 res = RegOpenKeyA(sourcelist, "Media", &media);
2758 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2760 CHECK_DEL_REG_STR(media, "1", "DISK1;");
2762 RegDeleteKeyA(media, "");
2763 RegCloseKey(media);
2764 RegDeleteKeyA(sourcelist, "");
2765 RegCloseKey(sourcelist);
2766 RegDeleteKeyA(hkey, "");
2767 RegCloseKey(hkey);
2769 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machup, &hkey);
2770 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2772 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2774 RegDeleteKeyA(hkey, "");
2775 RegCloseKey(hkey);
2777 DeleteFile(msifile);
2778 DeleteFile("msitest\\maximus");
2779 RemoveDirectory("msitest");
2780 HeapFree(GetProcessHeap(), 0, usersid);
2783 static void test_publish_publishfeatures(void)
2785 UINT r;
2786 LONG res;
2787 HKEY hkey;
2788 LPSTR usersid;
2789 CHAR keypath[MAX_PATH];
2791 static const CHAR cupath[] = "Software\\Microsoft\\Installer\\Features"
2792 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2793 static const CHAR udpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2794 "\\Installer\\UserData\\%s\\Products"
2795 "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
2796 static const CHAR featkey[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2797 "\\Installer\\Features";
2798 static const CHAR classfeat[] = "Software\\Classes\\Installer\\Features"
2799 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2801 get_user_sid(&usersid);
2802 if (!usersid)
2804 skip("ConvertSidToStringSidA is not available\n");
2805 return;
2808 CreateDirectoryA("msitest", NULL);
2809 create_file("msitest\\maximus", 500);
2811 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2813 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2815 /* PublishFeatures, current user */
2816 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
2817 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2818 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2819 ok(delete_pf("msitest", FALSE), "File not installed\n");
2821 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
2822 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2824 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
2825 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2827 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
2828 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2830 CHECK_REG_STR(hkey, "feature", "");
2831 CHECK_REG_STR(hkey, "montecristo", "");
2833 RegDeleteValueA(hkey, "feature");
2834 RegDeleteValueA(hkey, "montecristo");
2835 RegDeleteKeyA(hkey, "");
2836 RegCloseKey(hkey);
2838 sprintf(keypath, udpath, usersid);
2839 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2840 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2842 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
2843 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
2845 RegDeleteValueA(hkey, "feature");
2846 RegDeleteValueA(hkey, "montecristo");
2847 RegDeleteKeyA(hkey, "");
2848 RegCloseKey(hkey);
2850 /* PublishFeatures, machine */
2851 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
2852 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2853 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2854 ok(delete_pf("msitest", FALSE), "File not installed\n");
2856 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
2857 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2859 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
2860 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2862 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
2863 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2865 CHECK_REG_STR(hkey, "feature", "");
2866 CHECK_REG_STR(hkey, "montecristo", "");
2868 RegDeleteValueA(hkey, "feature");
2869 RegDeleteValueA(hkey, "montecristo");
2870 RegDeleteKeyA(hkey, "");
2871 RegCloseKey(hkey);
2873 sprintf(keypath, udpath, "S-1-5-18");
2874 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2875 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2877 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
2878 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
2880 RegDeleteValueA(hkey, "feature");
2881 RegDeleteValueA(hkey, "montecristo");
2882 RegDeleteKeyA(hkey, "");
2883 RegCloseKey(hkey);
2885 DeleteFile(msifile);
2886 DeleteFile("msitest\\maximus");
2887 RemoveDirectory("msitest");
2888 HeapFree(GetProcessHeap(), 0, usersid);
2891 static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
2893 DWORD len = 0;
2894 LPSTR val;
2895 LONG r;
2897 r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
2898 if (r != ERROR_SUCCESS)
2899 return NULL;
2901 len += sizeof (WCHAR);
2902 val = HeapAlloc(GetProcessHeap(), 0, len);
2903 if (!val) return NULL;
2904 val[0] = 0;
2905 RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
2906 return val;
2909 static void get_owner_company(LPSTR *owner, LPSTR *company)
2911 LONG res;
2912 HKEY hkey;
2914 *owner = *company = NULL;
2916 res = RegOpenKeyA(HKEY_CURRENT_USER,
2917 "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
2918 if (res == ERROR_SUCCESS)
2920 *owner = reg_get_val_str(hkey, "DefName");
2921 *company = reg_get_val_str(hkey, "DefCompany");
2922 RegCloseKey(hkey);
2925 if (!*owner || !*company)
2927 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
2928 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey);
2929 if (res == ERROR_SUCCESS)
2931 *owner = reg_get_val_str(hkey, "RegisteredOwner");
2932 *company = reg_get_val_str(hkey, "RegisteredOrganization");
2933 RegCloseKey(hkey);
2937 if (!*owner || !*company)
2939 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
2940 "Software\\Microsoft\\Windows NT\\CurrentVersion", &hkey);
2941 if (res == ERROR_SUCCESS)
2943 *owner = reg_get_val_str(hkey, "RegisteredOwner");
2944 *company = reg_get_val_str(hkey, "RegisteredOrganization");
2945 RegCloseKey(hkey);
2950 static void test_publish_registeruser(void)
2952 UINT r;
2953 LONG res;
2954 HKEY props;
2955 LPSTR usersid;
2956 LPSTR owner, company;
2957 CHAR keypath[MAX_PATH];
2959 static const CHAR keyfmt[] =
2960 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
2961 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
2963 get_user_sid(&usersid);
2964 if (!usersid)
2966 skip("ConvertSidToStringSidA is not available\n");
2967 return;
2970 get_owner_company(&owner, &company);
2972 CreateDirectoryA("msitest", NULL);
2973 create_file("msitest\\maximus", 500);
2975 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2977 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2979 /* RegisterUser, per-user */
2980 r = MsiInstallProductA(msifile, "REGISTER_USER=1");
2981 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2982 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2983 ok(delete_pf("msitest", FALSE), "File not installed\n");
2985 sprintf(keypath, keyfmt, usersid);
2987 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
2988 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2990 CHECK_REG_STR(props, "ProductID", "none");
2991 CHECK_REG_STR(props, "RegCompany", company);
2992 CHECK_REG_STR(props, "RegOwner", owner);
2994 RegDeleteValueA(props, "ProductID");
2995 RegDeleteValueA(props, "RegCompany");
2996 RegDeleteValueA(props, "RegOwner");
2997 RegDeleteKeyA(props, "");
2998 RegCloseKey(props);
3000 /* RegisterUser, machine */
3001 r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
3002 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3003 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3004 ok(delete_pf("msitest", FALSE), "File not installed\n");
3006 sprintf(keypath, keyfmt, "S-1-5-18");
3008 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
3009 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3011 CHECK_REG_STR(props, "ProductID", "none");
3012 CHECK_REG_STR(props, "RegCompany", company);
3013 CHECK_REG_STR(props, "RegOwner", owner);
3015 RegDeleteValueA(props, "ProductID");
3016 RegDeleteValueA(props, "RegCompany");
3017 RegDeleteValueA(props, "RegOwner");
3018 RegDeleteKeyA(props, "");
3019 RegCloseKey(props);
3021 HeapFree(GetProcessHeap(), 0, company);
3022 HeapFree(GetProcessHeap(), 0, owner);
3024 DeleteFile(msifile);
3025 DeleteFile("msitest\\maximus");
3026 RemoveDirectory("msitest");
3029 static void test_publish_processcomponents(void)
3031 UINT r;
3032 LONG res;
3033 DWORD size;
3034 HKEY comp, hkey;
3035 LPSTR usersid;
3036 CHAR val[MAX_PATH];
3037 CHAR keypath[MAX_PATH];
3039 static const CHAR keyfmt[] =
3040 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3041 "UserData\\%s\\Components\\%s";
3042 static const CHAR compkey[] =
3043 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
3045 get_user_sid(&usersid);
3046 if (!usersid)
3048 skip("ConvertSidToStringSidA is not available\n");
3049 return;
3052 CreateDirectoryA("msitest", NULL);
3053 create_file("msitest\\maximus", 500);
3055 create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table));
3057 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3059 /* ProcessComponents, per-user */
3060 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3061 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3062 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3063 ok(delete_pf("msitest", FALSE), "File not installed\n");
3065 sprintf(keypath, keyfmt, usersid, "CBABC2FDCCB35E749A8944D8C1C098B5");
3067 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
3068 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3070 size = MAX_PATH;
3071 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3072 NULL, NULL, (LPBYTE)val, &size);
3073 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3074 ok(!lstrcmpA(val, "C:\\Program Files\\msitest\\maximus"),
3075 "Expected \"%s\", got \"%s\"\n", "C:\\Program Files\\msitest\\maximus", val);
3077 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
3078 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3080 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3081 RegDeleteKeyA(comp, "");
3082 RegCloseKey(comp);
3084 sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
3086 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
3087 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3089 size = MAX_PATH;
3090 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3091 NULL, NULL, (LPBYTE)val, &size);
3092 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3093 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3094 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3096 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
3097 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3099 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3100 RegDeleteKeyA(comp, "");
3101 RegCloseKey(comp);
3103 /* ProcessComponents, machine */
3104 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
3105 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3106 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3107 ok(delete_pf("msitest", FALSE), "File not installed\n");
3109 sprintf(keypath, keyfmt, "S-1-5-18", "CBABC2FDCCB35E749A8944D8C1C098B5");
3111 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
3112 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3114 size = MAX_PATH;
3115 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3116 NULL, NULL, (LPBYTE)val, &size);
3117 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3118 ok(!lstrcmpA(val, "C:\\Program Files\\msitest\\maximus"),
3119 "Expected \"%s\", got \"%s\"\n", "C:\\Program Files\\msitest\\maximus", val);
3121 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
3122 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3124 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3125 RegDeleteKeyA(comp, "");
3126 RegCloseKey(comp);
3128 sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
3130 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
3131 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3133 size = MAX_PATH;
3134 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3135 NULL, NULL, (LPBYTE)val, &size);
3136 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3137 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3138 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3140 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
3141 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3143 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3144 RegDeleteKeyA(comp, "");
3145 RegCloseKey(comp);
3147 DeleteFile(msifile);
3148 DeleteFile("msitest\\maximus");
3149 RemoveDirectory("msitest");
3152 static void test_publish(void)
3154 UINT r;
3155 LONG res;
3156 HKEY uninstall, prodkey;
3157 INSTALLSTATE state;
3158 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3159 char date[MAX_PATH];
3160 char temp[MAX_PATH];
3162 static const CHAR subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3164 if (!pMsiQueryComponentStateA)
3166 skip("MsiQueryComponentStateA is not available\n");
3167 return;
3170 get_date_str(date);
3171 GetTempPath(MAX_PATH, temp);
3173 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, subkey, &uninstall);
3174 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3176 CreateDirectoryA("msitest", NULL);
3177 create_file("msitest\\maximus", 500);
3179 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3181 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3183 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3184 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3186 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3187 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3189 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3190 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3192 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3193 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3194 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3195 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3197 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3198 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3200 /* nothing published */
3201 r = MsiInstallProductA(msifile, NULL);
3202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3203 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3204 ok(pf_exists("msitest"), "File not installed\n");
3206 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3207 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3209 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3210 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3212 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3213 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3215 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3216 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3217 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3218 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3220 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3221 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3223 /* PublishProduct and RegisterProduct */
3224 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
3225 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3226 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3227 ok(pf_exists("msitest"), "File not installed\n");
3229 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3230 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3232 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3233 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3235 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3236 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3238 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3239 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3240 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
3241 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3243 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3244 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3246 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3247 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3248 CHECK_REG_STR(prodkey, "InstallDate", date);
3249 CHECK_REG_STR(prodkey, "InstallSource", temp);
3250 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3251 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3252 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3253 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3254 CHECK_REG_STR(prodkey, "Comments", NULL);
3255 CHECK_REG_STR(prodkey, "Contact", NULL);
3256 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3257 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3258 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3259 CHECK_REG_STR(prodkey, "Readme", NULL);
3260 CHECK_REG_STR(prodkey, "Size", NULL);
3261 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3262 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3263 CHECK_REG_DWORD(prodkey, "Language", 1033);
3264 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3265 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3266 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3267 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3268 todo_wine
3270 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3273 RegCloseKey(prodkey);
3275 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3276 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3277 ok(pf_exists("msitest\\maximus"), "File deleted\n");
3278 ok(pf_exists("msitest"), "File deleted\n");
3280 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3281 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3283 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3284 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3286 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3287 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3289 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3290 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3291 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3292 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3294 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3295 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3297 /* complete install */
3298 r = MsiInstallProductA(msifile, "FULL=1");
3299 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3300 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3301 ok(pf_exists("msitest"), "File not installed\n");
3303 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3304 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3306 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3307 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3309 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3310 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3312 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3313 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3314 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3315 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3317 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3318 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3320 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3321 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3322 CHECK_REG_STR(prodkey, "InstallDate", date);
3323 CHECK_REG_STR(prodkey, "InstallSource", temp);
3324 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3325 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3326 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3327 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3328 CHECK_REG_STR(prodkey, "Comments", NULL);
3329 CHECK_REG_STR(prodkey, "Contact", NULL);
3330 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3331 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3332 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3333 CHECK_REG_STR(prodkey, "Readme", NULL);
3334 CHECK_REG_STR(prodkey, "Size", NULL);
3335 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3336 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3337 CHECK_REG_DWORD(prodkey, "Language", 1033);
3338 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3339 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3340 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3341 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3342 todo_wine
3344 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3347 RegCloseKey(prodkey);
3349 /* no UnpublishFeatures */
3350 r = MsiInstallProductA(msifile, "REMOVE=ALL");
3351 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3352 ok(!pf_exists("msitest\\maximus"), "File deleted\n");
3353 todo_wine
3355 ok(!pf_exists("msitest"), "File deleted\n");
3358 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3359 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3361 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3362 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3364 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3365 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3367 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3368 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3369 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3370 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3372 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3373 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3375 /* complete install */
3376 r = MsiInstallProductA(msifile, "FULL=1");
3377 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3378 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3379 ok(pf_exists("msitest"), "File not installed\n");
3381 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3382 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3384 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3385 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3387 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3388 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3390 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3391 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3392 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3393 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3395 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3396 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3398 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3399 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3400 CHECK_REG_STR(prodkey, "InstallDate", date);
3401 CHECK_REG_STR(prodkey, "InstallSource", temp);
3402 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3403 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3404 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3405 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3406 CHECK_REG_STR(prodkey, "Comments", NULL);
3407 CHECK_REG_STR(prodkey, "Contact", NULL);
3408 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3409 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3410 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3411 CHECK_REG_STR(prodkey, "Readme", NULL);
3412 CHECK_REG_STR(prodkey, "Size", NULL);
3413 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3414 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3415 CHECK_REG_DWORD(prodkey, "Language", 1033);
3416 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3417 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3418 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3419 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3420 todo_wine
3422 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3425 RegCloseKey(prodkey);
3427 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
3428 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
3429 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3430 todo_wine ok(pf_exists("msitest\\maximus"), "File deleted\n");
3431 ok(pf_exists("msitest"), "File deleted\n");
3433 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3434 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3436 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3437 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3439 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3440 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3442 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3443 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3444 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3445 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3447 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3448 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3450 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3451 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3452 CHECK_REG_STR(prodkey, "InstallDate", date);
3453 CHECK_REG_STR(prodkey, "InstallSource", temp);
3454 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3455 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3456 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3457 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3458 CHECK_REG_STR(prodkey, "Comments", NULL);
3459 CHECK_REG_STR(prodkey, "Contact", NULL);
3460 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3461 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3462 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3463 CHECK_REG_STR(prodkey, "Readme", NULL);
3464 CHECK_REG_STR(prodkey, "Size", NULL);
3465 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3466 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3467 CHECK_REG_DWORD(prodkey, "Language", 1033);
3468 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3469 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3470 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3471 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3472 todo_wine
3474 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3477 RegCloseKey(prodkey);
3479 /* complete install */
3480 r = MsiInstallProductA(msifile, "FULL=1");
3481 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3482 todo_wine
3484 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3486 ok(pf_exists("msitest"), "File not installed\n");
3488 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3489 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3491 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3492 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3494 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3495 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3497 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3498 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3499 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3500 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3502 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3503 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3505 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3506 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3507 CHECK_REG_STR(prodkey, "InstallDate", date);
3508 CHECK_REG_STR(prodkey, "InstallSource", temp);
3509 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3510 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3511 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3512 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3513 CHECK_REG_STR(prodkey, "Comments", NULL);
3514 CHECK_REG_STR(prodkey, "Contact", NULL);
3515 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3516 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3517 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3518 CHECK_REG_STR(prodkey, "Readme", NULL);
3519 CHECK_REG_STR(prodkey, "Size", NULL);
3520 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3521 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3522 CHECK_REG_DWORD(prodkey, "Language", 1033);
3523 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3524 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3525 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3526 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3527 todo_wine
3529 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3532 RegCloseKey(prodkey);
3534 /* UnpublishFeatures, both features removed */
3535 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
3536 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3537 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3538 todo_wine
3540 ok(!pf_exists("msitest"), "File not deleted\n");
3543 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3544 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3546 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3547 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3549 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3550 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3552 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3553 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3554 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3555 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3557 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3558 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3560 /* complete install */
3561 r = MsiInstallProductA(msifile, "FULL=1");
3562 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3563 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3564 ok(pf_exists("msitest"), "File not installed\n");
3566 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3567 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3569 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3570 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3572 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3573 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3575 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3576 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3577 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3578 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3580 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3581 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3583 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3584 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3585 CHECK_REG_STR(prodkey, "InstallDate", date);
3586 CHECK_REG_STR(prodkey, "InstallSource", temp);
3587 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3588 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3589 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3590 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3591 CHECK_REG_STR(prodkey, "Comments", NULL);
3592 CHECK_REG_STR(prodkey, "Contact", NULL);
3593 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3594 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3595 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3596 CHECK_REG_STR(prodkey, "Readme", NULL);
3597 CHECK_REG_STR(prodkey, "Size", NULL);
3598 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3599 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3600 CHECK_REG_DWORD(prodkey, "Language", 1033);
3601 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3602 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3603 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3604 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3605 todo_wine
3607 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3610 RegCloseKey(prodkey);
3612 /* complete uninstall */
3613 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3614 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3615 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3616 todo_wine
3618 ok(!pf_exists("msitest"), "File not deleted\n");
3621 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3622 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3624 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3625 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3627 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3628 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3630 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3631 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3632 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3633 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3635 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3636 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3638 /* make sure 'Program Files\msitest' is removed */
3639 delete_pfmsitest_files();
3641 RegCloseKey(uninstall);
3642 DeleteFile(msifile);
3643 DeleteFile("msitest\\maximus");
3644 RemoveDirectory("msitest");
3647 static void test_publishsourcelist(void)
3649 UINT r;
3650 DWORD size;
3651 CHAR value[MAX_PATH];
3652 CHAR path[MAX_PATH];
3653 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3655 if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
3657 skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
3658 return;
3661 CreateDirectoryA("msitest", NULL);
3662 create_file("msitest\\maximus", 500);
3664 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3666 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3668 r = MsiInstallProductA(msifile, NULL);
3669 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3670 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3671 ok(pf_exists("msitest"), "File not installed\n");
3673 /* nothing published */
3674 size = 0xdeadbeef;
3675 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3676 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3677 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3678 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3680 size = 0xdeadbeef;
3681 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3682 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3683 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3684 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3686 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
3687 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3688 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3689 ok(pf_exists("msitest"), "File not installed\n");
3691 /* after RegisterProduct */
3692 size = 0xdeadbeef;
3693 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3694 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3695 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3696 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3698 size = 0xdeadbeef;
3699 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3700 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3701 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3702 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3704 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3705 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3706 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3707 ok(pf_exists("msitest"), "File not installed\n");
3709 /* after ProcessComponents */
3710 size = 0xdeadbeef;
3711 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3712 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3713 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3714 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3716 size = 0xdeadbeef;
3717 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3718 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3719 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3720 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3722 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
3723 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3724 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3725 ok(pf_exists("msitest"), "File not installed\n");
3727 /* after PublishFeatures */
3728 size = 0xdeadbeef;
3729 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3730 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3731 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3732 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3734 size = 0xdeadbeef;
3735 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3736 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3737 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3738 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3740 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
3741 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3742 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3743 ok(pf_exists("msitest"), "File not installed\n");
3745 /* after PublishProduct */
3746 size = MAX_PATH;
3747 lstrcpyA(value, "aaa");
3748 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3749 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
3750 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3751 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
3752 ok(size == 11, "Expected 11, got %d\n", size);
3754 size = MAX_PATH;
3755 lstrcpyA(value, "aaa");
3756 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3757 MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATH, value, &size);
3758 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3759 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
3760 ok(size == 0, "Expected 0, got %d\n", size);
3762 size = MAX_PATH;
3763 lstrcpyA(value, "aaa");
3764 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3765 MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPT, value, &size);
3766 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3767 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
3768 ok(size == 0, "Expected 0, got %d\n", size);
3770 lstrcpyA(path, CURR_DIR);
3771 lstrcatA(path, "\\");
3773 size = MAX_PATH;
3774 lstrcpyA(value, "aaa");
3775 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3776 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3777 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3778 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3779 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3781 size = MAX_PATH;
3782 lstrcpyA(value, "aaa");
3783 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3784 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE, value, &size);
3785 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3786 ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
3787 ok(size == 1, "Expected 1, got %d\n", size);
3789 size = MAX_PATH;
3790 lstrcpyA(value, "aaa");
3791 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3792 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
3793 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
3794 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
3795 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
3797 size = MAX_PATH;
3798 lstrcpyA(value, "aaa");
3799 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3800 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
3801 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3802 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3803 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3805 size = MAX_PATH;
3806 lstrcpyA(value, "aaa");
3807 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3808 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
3809 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
3810 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
3811 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
3813 /* complete uninstall */
3814 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3815 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3816 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3817 todo_wine
3819 ok(!pf_exists("msitest"), "File not deleted\n");
3822 /* make sure 'Program Files\msitest' is removed */
3823 delete_pfmsitest_files();
3825 DeleteFile(msifile);
3826 DeleteFile("msitest\\maximus");
3827 RemoveDirectory("msitest");
3830 static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
3832 MSIHANDLE hview = 0;
3833 UINT r;
3835 r = MsiDatabaseOpenView(hdb, query, &hview);
3836 if(r != ERROR_SUCCESS)
3837 return r;
3839 r = MsiViewExecute(hview, hrec);
3840 if(r == ERROR_SUCCESS)
3841 r = MsiViewClose(hview);
3842 MsiCloseHandle(hview);
3843 return r;
3846 static void set_transform_summary_info(void)
3848 UINT r;
3849 MSIHANDLE suminfo = 0;
3851 /* build summary info */
3852 r = MsiGetSummaryInformation(0, mstfile, 3, &suminfo);
3853 todo_wine
3855 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
3858 r = MsiSummaryInfoSetProperty(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
3859 todo_wine
3861 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3864 r = MsiSummaryInfoSetProperty(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
3865 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3866 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3867 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
3868 todo_wine
3870 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
3873 r = MsiSummaryInfoSetProperty(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
3874 todo_wine
3876 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3879 r = MsiSummaryInfoPersist(suminfo);
3880 todo_wine
3882 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
3885 r = MsiCloseHandle(suminfo);
3886 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
3889 static void generate_transform(void)
3891 MSIHANDLE hdb1, hdb2;
3892 LPCSTR query;
3893 UINT r;
3895 /* start with two identical databases */
3896 CopyFile(msifile, msifile2, FALSE);
3898 r = MsiOpenDatabase(msifile2, MSIDBOPEN_TRANSACT, &hdb1);
3899 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3901 r = MsiDatabaseCommit(hdb1);
3902 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
3904 r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb2);
3905 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3907 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
3908 r = run_query(hdb1, 0, query);
3909 ok(r == ERROR_SUCCESS, "failed to add property\n");
3911 /* database needs to be committed */
3912 MsiDatabaseCommit(hdb1);
3914 r = MsiDatabaseGenerateTransform(hdb1, hdb2, mstfile, 0, 0);
3915 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3917 #if 0 /* not implemented in wine yet */
3918 r = MsiCreateTransformSummaryInfo(hdb2, hdb2, mstfile, 0, 0);
3919 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3920 #endif
3922 MsiCloseHandle(hdb1);
3923 MsiCloseHandle(hdb2);
3926 /* data for generating a transform */
3928 /* tables transform names - encoded as they would be in an msi database file */
3929 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
3930 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
3931 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
3933 /* data in each table */
3934 static const char data1[] = /* _StringData */
3935 "propval"; /* all the strings squashed together */
3937 static const WCHAR data2[] = { /* _StringPool */
3938 /* len, refs */
3939 0, 0, /* string 0 '' */
3940 4, 1, /* string 1 'prop' */
3941 3, 1, /* string 2 'val' */
3944 static const WCHAR data3[] = { /* Property */
3945 0x0201, 0x0001, 0x0002,
3948 static const struct {
3949 LPCWSTR name;
3950 const void *data;
3951 DWORD size;
3952 } table_transform_data[] =
3954 { name1, data1, sizeof data1 - 1 },
3955 { name2, data2, sizeof data2 },
3956 { name3, data3, sizeof data3 },
3959 #define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
3961 static void generate_transform_manual(void)
3963 IStorage *stg = NULL;
3964 IStream *stm;
3965 WCHAR name[0x20];
3966 HRESULT r;
3967 DWORD i, count;
3968 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
3970 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
3972 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
3974 r = StgCreateDocfile(name, mode, 0, &stg);
3975 ok(r == S_OK, "failed to create storage\n");
3976 if (!stg)
3977 return;
3979 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
3980 ok(r == S_OK, "failed to set storage type\n");
3982 for (i=0; i<NUM_TRANSFORM_TABLES; i++)
3984 r = IStorage_CreateStream(stg, table_transform_data[i].name,
3985 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3986 if (FAILED(r))
3988 ok(0, "failed to create stream %08x\n", r);
3989 continue;
3992 r = IStream_Write(stm, table_transform_data[i].data,
3993 table_transform_data[i].size, &count);
3994 if (FAILED(r) || count != table_transform_data[i].size)
3995 ok(0, "failed to write stream\n");
3996 IStream_Release(stm);
3999 IStorage_Release(stg);
4001 set_transform_summary_info();
4004 static void test_transformprop(void)
4006 UINT r;
4008 CreateDirectoryA("msitest", NULL);
4009 create_file("msitest\\augustus", 500);
4011 create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
4013 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4015 r = MsiInstallProductA(msifile, NULL);
4016 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4017 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4018 ok(!delete_pf("msitest", FALSE), "File installed\n");
4020 if (0)
4021 generate_transform();
4022 else
4023 generate_transform_manual();
4025 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
4026 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4027 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4028 ok(delete_pf("msitest", FALSE), "File not installed\n");
4030 /* Delete the files in the temp (current) folder */
4031 DeleteFile(msifile);
4032 DeleteFile(msifile2);
4033 DeleteFile(mstfile);
4034 DeleteFile("msitest\\augustus");
4035 RemoveDirectory("msitest");
4038 static void test_currentworkingdir(void)
4040 UINT r;
4041 CHAR path[MAX_PATH];
4042 LPSTR ptr, ptr2;
4044 CreateDirectoryA("msitest", NULL);
4045 create_file("msitest\\augustus", 500);
4047 create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
4049 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4051 CreateDirectoryA("diffdir", NULL);
4052 SetCurrentDirectoryA("diffdir");
4054 sprintf(path, "..\\%s", msifile);
4055 r = MsiInstallProductA(path, NULL);
4056 todo_wine
4058 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
4059 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4060 ok(!delete_pf("msitest", FALSE), "File installed\n");
4063 sprintf(path, "%s\\%s", CURR_DIR, msifile);
4064 r = MsiInstallProductA(path, NULL);
4065 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4066 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4067 ok(delete_pf("msitest", FALSE), "File not installed\n");
4069 lstrcpyA(path, CURR_DIR);
4070 if (path[lstrlenA(path) - 1] != '\\')
4071 lstrcatA(path, "\\");
4072 lstrcatA(path, "msitest.msi");
4074 ptr2 = strrchr(path, '\\');
4075 *ptr2 = '\0';
4076 ptr = strrchr(path, '\\');
4077 *ptr2 = '\\';
4078 *(ptr++) = '\0';
4080 SetCurrentDirectoryA(path);
4082 r = MsiInstallProductA(ptr, NULL);
4083 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4084 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4085 ok(delete_pf("msitest", FALSE), "File not installed\n");
4087 SetCurrentDirectoryA(CURR_DIR);
4089 DeleteFile(msifile);
4090 DeleteFile("msitest\\augustus");
4091 RemoveDirectory("msitest");
4092 RemoveDirectory("diffdir");
4095 static void set_admin_summary_info(const CHAR *name)
4097 MSIHANDLE db, summary;
4098 UINT r;
4100 r = MsiOpenDatabaseA(name, MSIDBOPEN_DIRECT, &db);
4101 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4103 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
4104 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4106 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
4107 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4109 /* write the summary changes back to the stream */
4110 r = MsiSummaryInfoPersist(summary);
4111 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4113 MsiCloseHandle(summary);
4115 r = MsiDatabaseCommit(db);
4116 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4118 MsiCloseHandle(db);
4121 static void test_admin(void)
4123 UINT r;
4125 CreateDirectoryA("msitest", NULL);
4126 create_file("msitest\\augustus", 500);
4128 create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
4129 set_admin_summary_info(msifile);
4131 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4133 r = MsiInstallProductA(msifile, NULL);
4134 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4135 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4136 ok(!delete_pf("msitest", FALSE), "File installed\n");
4137 ok(!DeleteFile("c:\\msitest\\augustus"), "File installed\n");
4138 ok(!RemoveDirectory("c:\\msitest"), "File installed\n");
4140 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
4141 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4142 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4143 ok(!delete_pf("msitest", FALSE), "File installed\n");
4144 todo_wine
4146 ok(DeleteFile("c:\\msitest\\augustus"), "File not installed\n");
4147 ok(RemoveDirectory("c:\\msitest"), "File not installed\n");
4150 DeleteFile(msifile);
4151 DeleteFile("msitest\\augustus");
4152 RemoveDirectory("msitest");
4155 static void set_admin_property_stream(LPCSTR file)
4157 IStorage *stg;
4158 IStream *stm;
4159 WCHAR fileW[MAX_PATH];
4160 HRESULT hr;
4161 DWORD count;
4162 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
4164 /* AdminProperties */
4165 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
4166 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',0};
4168 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
4170 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
4171 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4172 if (!stg)
4173 return;
4175 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
4176 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4178 hr = IStream_Write(stm, data, sizeof(data), &count);
4179 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4181 IStream_Release(stm);
4182 IStorage_Release(stg);
4185 static void test_adminprops(void)
4187 UINT r;
4189 CreateDirectoryA("msitest", NULL);
4190 create_file("msitest\\augustus", 500);
4192 create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
4193 set_admin_summary_info(msifile);
4194 set_admin_property_stream(msifile);
4196 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4198 r = MsiInstallProductA(msifile, NULL);
4199 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4200 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4201 ok(delete_pf("msitest", FALSE), "File installed\n");
4203 DeleteFile(msifile);
4204 DeleteFile("msitest\\augustus");
4205 RemoveDirectory("msitest");
4208 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
4210 CHAR path[MAX_PATH];
4212 lstrcpyA(path, PROG_FILES_DIR);
4213 lstrcatA(path, "\\");
4214 lstrcatA(path, file);
4216 if (is_file)
4217 create_file_data(path, data, 500);
4218 else
4219 CreateDirectoryA(path, NULL);
4222 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
4224 static void test_removefiles(void)
4226 UINT r;
4228 CreateDirectoryA("msitest", NULL);
4229 create_file("msitest\\hydrogen", 500);
4230 create_file("msitest\\helium", 500);
4231 create_file("msitest\\lithium", 500);
4233 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
4235 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4237 r = MsiInstallProductA(msifile, NULL);
4238 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4239 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4240 ok(!pf_exists("msitest\\helium"), "File installed\n");
4241 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4242 ok(pf_exists("msitest"), "File not installed\n");
4244 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4245 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4246 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4247 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
4248 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4249 ok(delete_pf("msitest", FALSE), "File deleted\n");
4251 create_pf("msitest", FALSE);
4252 create_pf("msitest\\hydrogen", TRUE);
4253 create_pf("msitest\\helium", TRUE);
4254 create_pf("msitest\\lithium", TRUE);
4256 r = MsiInstallProductA(msifile, NULL);
4257 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4258 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4259 ok(pf_exists("msitest\\helium"), "File not installed\n");
4260 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4261 ok(pf_exists("msitest"), "File not installed\n");
4263 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4264 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4265 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4266 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
4267 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4268 ok(delete_pf("msitest", FALSE), "File deleted\n");
4270 create_pf("msitest", FALSE);
4271 create_pf("msitest\\furlong", TRUE);
4272 create_pf("msitest\\firkin", TRUE);
4273 create_pf("msitest\\fortnight", TRUE);
4274 create_pf("msitest\\becquerel", TRUE);
4275 create_pf("msitest\\dioptre", TRUE);
4276 create_pf("msitest\\attoparsec", TRUE);
4277 create_pf("msitest\\storeys", TRUE);
4278 create_pf("msitest\\block", TRUE);
4279 create_pf("msitest\\siriometer", TRUE);
4280 create_pf("msitest\\cabout", FALSE);
4281 create_pf("msitest\\cabout\\blocker", TRUE);
4283 r = MsiInstallProductA(msifile, NULL);
4284 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4285 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4286 ok(!pf_exists("msitest\\helium"), "File installed\n");
4287 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4288 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
4289 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
4290 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
4291 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
4292 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
4293 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
4294 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
4295 ok(!pf_exists("msitest\\block"), "File not deleted\n");
4296 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
4297 ok(pf_exists("msitest\\cabout"), "Directory removed\n");
4298 ok(pf_exists("msitest"), "File not installed\n");
4300 create_pf("msitest\\furlong", TRUE);
4301 create_pf("msitest\\firkin", TRUE);
4302 create_pf("msitest\\fortnight", TRUE);
4303 create_pf("msitest\\storeys", TRUE);
4304 create_pf("msitest\\block", TRUE);
4305 create_pf("msitest\\siriometer", TRUE);
4307 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4308 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4309 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
4310 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
4311 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4312 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
4313 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
4314 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
4315 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
4316 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
4317 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
4318 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
4319 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
4320 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
4321 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4322 ok(pf_exists("msitest"), "Directory deleted\n");
4324 r = MsiInstallProductA(msifile, NULL);
4325 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4326 ok(delete_pf("msitest\\hydrogen", TRUE), "File not installed\n");
4327 ok(!delete_pf("msitest\\helium", TRUE), "File installed\n");
4328 ok(delete_pf("msitest\\lithium", TRUE), "File not installed\n");
4329 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4330 ok(pf_exists("msitest"), "Directory deleted\n");
4332 delete_pf("msitest\\cabout\\blocker", TRUE);
4334 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4335 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4336 ok(!delete_pf("msitest\\cabout", FALSE), "Directory not deleted\n");
4337 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4339 DeleteFile(msifile);
4340 DeleteFile("msitest\\hydrogen");
4341 DeleteFile("msitest\\helium");
4342 DeleteFile("msitest\\lithium");
4343 RemoveDirectory("msitest");
4346 static void test_movefiles(void)
4348 UINT r;
4349 char props[MAX_PATH];
4351 CreateDirectoryA("msitest", NULL);
4352 create_file("msitest\\augustus", 100);
4353 create_file("cameroon", 100);
4354 create_file("djibouti", 100);
4355 create_file("egypt", 100);
4356 create_file("finland", 100);
4357 create_file("gambai", 100);
4358 create_file("honduras", 100);
4359 create_file("msitest\\india", 100);
4360 create_file("japan", 100);
4361 create_file("kenya", 100);
4362 CreateDirectoryA("latvia", NULL);
4363 create_file("nauru", 100);
4364 create_file("apple", 100);
4365 create_file("application", 100);
4366 create_file("ape", 100);
4367 create_file("foo", 100);
4368 create_file("fao", 100);
4369 create_file("fbod", 100);
4370 create_file("budding", 100);
4371 create_file("buddy", 100);
4372 create_file("bud", 100);
4373 create_file("bar", 100);
4374 create_file("bur", 100);
4375 create_file("bird", 100);
4377 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
4379 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4381 /* if the source or dest property is not a full path,
4382 * windows tries to access it as a network resource
4385 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
4386 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
4387 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
4389 r = MsiInstallProductA(msifile, props);
4390 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4391 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4392 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
4393 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
4394 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
4395 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
4396 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
4397 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
4398 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
4399 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
4400 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
4401 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
4402 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
4403 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
4404 /* either apple or application will be moved depending on directory order */
4405 if (!delete_pf("msitest\\apple", TRUE))
4406 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
4407 else
4408 ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
4409 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
4410 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
4411 /* either fao or foo will be moved depending on directory order */
4412 if (delete_pf("msitest\\foo", TRUE))
4413 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
4414 else
4415 ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
4416 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
4417 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
4418 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
4419 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
4420 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
4421 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
4422 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
4423 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
4424 ok(delete_pf("msitest", FALSE), "File not installed\n");
4425 ok(DeleteFileA("cameroon"), "File moved\n");
4426 ok(!DeleteFileA("djibouti"), "File not moved\n");
4427 ok(DeleteFileA("egypt"), "File moved\n");
4428 ok(DeleteFileA("finland"), "File moved\n");
4429 ok(DeleteFileA("gambai"), "File moved\n");
4430 ok(!DeleteFileA("honduras"), "File not moved\n");
4431 ok(DeleteFileA("msitest\\india"), "File moved\n");
4432 ok(DeleteFileA("japan"), "File moved\n");
4433 ok(!DeleteFileA("kenya"), "File not moved\n");
4434 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
4435 ok(!DeleteFileA("nauru"), "File not moved\n");
4436 ok(!DeleteFileA("apple"), "File not moved\n");
4437 ok(!DeleteFileA("application"), "File not moved\n");
4438 ok(DeleteFileA("ape"), "File moved\n");
4439 ok(!DeleteFileA("foo"), "File not moved\n");
4440 ok(!DeleteFileA("fao"), "File not moved\n");
4441 ok(DeleteFileA("fbod"), "File moved\n");
4442 ok(!DeleteFileA("budding"), "File not moved\n");
4443 ok(!DeleteFileA("buddy"), "File not moved\n");
4444 ok(DeleteFileA("bud"), "File moved\n");
4445 ok(!DeleteFileA("bar"), "File not moved\n");
4446 ok(!DeleteFileA("bur"), "File not moved\n");
4447 ok(DeleteFileA("bird"), "File moved\n");
4449 DeleteFile("msitest\\augustus");
4450 RemoveDirectory("msitest");
4451 DeleteFile(msifile);
4454 static void test_missingcab(void)
4456 UINT r;
4458 CreateDirectoryA("msitest", NULL);
4459 create_file("msitest\\augustus", 500);
4460 create_file("maximus", 500);
4462 create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
4464 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4466 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
4468 create_pf("msitest", FALSE);
4469 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
4471 r = MsiInstallProductA(msifile, NULL);
4472 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4473 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4474 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
4475 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4476 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
4477 ok(delete_pf("msitest", FALSE), "File not installed\n");
4479 create_pf("msitest", FALSE);
4480 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
4481 create_pf("msitest\\gaius", TRUE);
4483 r = MsiInstallProductA(msifile, "GAIUS=1");
4484 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4485 todo_wine
4487 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
4488 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4490 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
4491 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
4492 ok(delete_pf("msitest", FALSE), "File not installed\n");
4494 DeleteFile("msitest\\augustus");
4495 RemoveDirectory("msitest");
4496 DeleteFile("maximus");
4497 DeleteFile("test1.cab");
4498 DeleteFile(msifile);
4501 static void test_duplicatefiles(void)
4503 UINT r;
4505 CreateDirectoryA("msitest", NULL);
4506 create_file("msitest\\maximus", 500);
4507 create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
4509 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4511 /* fails if the destination folder is not a valid property */
4513 r = MsiInstallProductA(msifile, NULL);
4514 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4515 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4516 ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
4517 ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
4518 ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "File not duplicated\n");
4519 ok(delete_pf("msitest\\this\\doesnot", FALSE), "File not duplicated\n");
4520 ok(delete_pf("msitest\\this", FALSE), "File not duplicated\n");
4521 ok(delete_pf("msitest", FALSE), "File not installed\n");
4523 DeleteFile("msitest\\maximus");
4524 RemoveDirectory("msitest");
4525 DeleteFile(msifile);
4528 static void test_writeregistryvalues(void)
4530 UINT r;
4531 LONG res;
4532 HKEY hkey;
4533 DWORD type, size;
4534 CHAR path[MAX_PATH];
4536 CreateDirectoryA("msitest", NULL);
4537 create_file("msitest\\augustus", 500);
4539 create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
4541 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4543 r = MsiInstallProductA(msifile, NULL);
4544 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4545 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4546 ok(delete_pf("msitest", FALSE), "File installed\n");
4548 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
4549 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4551 size = MAX_PATH;
4552 type = REG_MULTI_SZ;
4553 memset(path, 'a', MAX_PATH);
4554 res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size);
4555 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4556 ok(!memcmp(path, "one\0two\0three\0\0", size), "Wrong multi-sz data\n");
4557 ok(size == 15, "Expected 15, got %d\n", size);
4558 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4560 DeleteFile(msifile);
4561 DeleteFile("msitest\\augustus");
4562 RemoveDirectory("msitest");
4564 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
4565 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine");
4568 static void test_sourcefolder(void)
4570 UINT r;
4572 CreateDirectoryA("msitest", NULL);
4573 create_file("augustus", 500);
4575 create_database(msifile, sf_tables, sizeof(sf_tables) / sizeof(msi_table));
4577 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4579 r = MsiInstallProductA(msifile, NULL);
4580 ok(r == ERROR_INSTALL_FAILURE,
4581 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4582 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4583 todo_wine
4585 ok(!delete_pf("msitest", FALSE), "File installed\n");
4588 RemoveDirectoryA("msitest");
4590 r = MsiInstallProductA(msifile, NULL);
4591 ok(r == ERROR_INSTALL_FAILURE,
4592 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4593 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4594 todo_wine
4596 ok(!delete_pf("msitest", FALSE), "File installed\n");
4599 DeleteFile(msifile);
4600 DeleteFile("augustus");
4603 static void test_customaction51(void)
4605 UINT r;
4607 CreateDirectoryA("msitest", NULL);
4608 create_file("msitest\\augustus", 500);
4610 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
4612 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4614 r = MsiInstallProductA(msifile, NULL);
4615 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4616 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4617 ok(delete_pf("msitest", FALSE), "File installed\n");
4619 DeleteFile(msifile);
4620 DeleteFile("msitest\\augustus");
4621 RemoveDirectory("msitest");
4624 static void test_installstate(void)
4626 UINT r;
4628 CreateDirectoryA("msitest", NULL);
4629 create_file("msitest\\alpha", 500);
4630 create_file("msitest\\beta", 500);
4631 create_file("msitest\\gamma", 500);
4632 create_file("msitest\\theta", 500);
4633 create_file("msitest\\delta", 500);
4634 create_file("msitest\\epsilon", 500);
4635 create_file("msitest\\zeta", 500);
4636 create_file("msitest\\iota", 500);
4637 create_file("msitest\\eta", 500);
4638 create_file("msitest\\kappa", 500);
4639 create_file("msitest\\lambda", 500);
4640 create_file("msitest\\mu", 500);
4642 create_database(msifile, is_tables, sizeof(is_tables) / sizeof(msi_table));
4644 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4646 r = MsiInstallProductA(msifile, NULL);
4647 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4648 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4649 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4650 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4651 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4652 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4653 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4654 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4655 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4656 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4657 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4658 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4659 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4660 ok(delete_pf("msitest", FALSE), "File not installed\n");
4662 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
4663 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4664 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4665 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4666 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4667 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4668 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4669 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
4670 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4671 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4672 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
4673 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4674 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4675 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4676 ok(delete_pf("msitest", FALSE), "File not installed\n");
4678 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
4679 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4680 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4681 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4682 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4683 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4684 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4685 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4686 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4687 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4688 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4689 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4690 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4691 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4692 ok(delete_pf("msitest", FALSE), "File not installed\n");
4694 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
4695 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4696 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
4697 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4698 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4699 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
4700 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4701 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4702 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4703 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4704 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4705 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4706 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4707 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4708 ok(!delete_pf("msitest", FALSE), "File installed\n");
4710 DeleteFile(msifile);
4711 DeleteFile("msitest\\alpha");
4712 DeleteFile("msitest\\beta");
4713 DeleteFile("msitest\\gamma");
4714 DeleteFile("msitest\\theta");
4715 DeleteFile("msitest\\delta");
4716 DeleteFile("msitest\\epsilon");
4717 DeleteFile("msitest\\zeta");
4718 DeleteFile("msitest\\iota");
4719 DeleteFile("msitest\\eta");
4720 DeleteFile("msitest\\kappa");
4721 DeleteFile("msitest\\lambda");
4722 DeleteFile("msitest\\mu");
4723 RemoveDirectory("msitest");
4726 struct sourcepathmap
4728 BOOL sost; /* shortone\shorttwo */
4729 BOOL solt; /* shortone\longtwo */
4730 BOOL lost; /* longone\shorttwo */
4731 BOOL lolt; /* longone\longtwo */
4732 BOOL soste; /* shortone\shorttwo source exists */
4733 BOOL solte; /* shortone\longtwo source exists */
4734 BOOL loste; /* longone\shorttwo source exists */
4735 BOOL lolte; /* longone\longtwo source exists */
4736 UINT err;
4737 DWORD size;
4738 } spmap[256] =
4740 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4741 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4742 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4743 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4744 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4745 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4746 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4747 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4748 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4749 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4750 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4751 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4752 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4753 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4754 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4755 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4756 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4757 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4758 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4759 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4760 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4761 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4762 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4763 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4764 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4765 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4766 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4767 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4768 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4769 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4770 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4771 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4772 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4773 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4774 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4775 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4776 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4777 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4778 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4779 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4780 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4781 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4782 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4783 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4784 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4785 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4786 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4787 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4788 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4789 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4790 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4791 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4792 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4793 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4794 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4795 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4796 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4797 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4798 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4799 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4800 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4801 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4802 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4803 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4804 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4805 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4806 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4807 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4808 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4809 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4810 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4811 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4812 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4813 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4814 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4815 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4816 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4817 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4818 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4819 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4820 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4821 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4822 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4823 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4824 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4825 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4826 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4827 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4828 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4829 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4830 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4831 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4832 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4833 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4834 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4835 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4836 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4837 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4838 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4839 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4840 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4841 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4842 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4843 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4844 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4845 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4846 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4847 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4848 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4849 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4850 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4851 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4852 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4853 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4854 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4855 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4856 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4857 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4858 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4859 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4860 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4861 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4862 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4863 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4864 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4865 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4866 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4867 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4868 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4869 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4870 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4871 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4872 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4873 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4874 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4875 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4876 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4877 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4878 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4879 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4880 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4881 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4882 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4883 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4884 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4885 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4886 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4887 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4888 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4889 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4890 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4891 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4892 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4893 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4894 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4895 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4896 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4897 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4898 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4899 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4900 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4901 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4902 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4903 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4904 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4905 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4906 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4907 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4908 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4909 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4910 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4911 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4912 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4913 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4914 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4915 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4916 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4917 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4918 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4919 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4920 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4921 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4922 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4923 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4924 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4925 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4926 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4927 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4928 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4929 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4930 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4931 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4932 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4933 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4934 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4935 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4936 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4937 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4938 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4939 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4940 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4941 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4942 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4943 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4944 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4945 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4946 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4947 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4948 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4949 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4950 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4951 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4952 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4953 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4954 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4955 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4956 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4957 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4958 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4959 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4960 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4961 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4962 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4963 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4964 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4965 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4966 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4967 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4968 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4969 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4970 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4971 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4972 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4973 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4974 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4975 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4976 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4977 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4978 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4979 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4980 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4981 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4982 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4983 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4984 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4985 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4986 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4987 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4988 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4989 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4990 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4991 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4992 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4993 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4994 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4995 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4998 static DWORD get_pf_file_size(LPCSTR file)
5000 CHAR path[MAX_PATH];
5001 HANDLE hfile;
5002 DWORD size;
5004 lstrcpyA(path, PROG_FILES_DIR);
5005 lstrcatA(path, "\\");
5006 lstrcatA(path, file);
5008 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
5009 if (hfile == INVALID_HANDLE_VALUE)
5010 return 0;
5012 size = GetFileSize(hfile, NULL);
5013 CloseHandle(hfile);
5014 return size;
5017 static void test_sourcepath(void)
5019 UINT r, i;
5021 create_database(msifile, sp_tables, sizeof(sp_tables) / sizeof(msi_table));
5023 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5025 for (i = 0; i < sizeof(spmap) / sizeof(spmap[0]); i++)
5027 if (spmap[i].sost)
5029 CreateDirectoryA("shortone", NULL);
5030 CreateDirectoryA("shortone\\shorttwo", NULL);
5033 if (spmap[i].solt)
5035 CreateDirectoryA("shortone", NULL);
5036 CreateDirectoryA("shortone\\longtwo", NULL);
5039 if (spmap[i].lost)
5041 CreateDirectoryA("longone", NULL);
5042 CreateDirectoryA("longone\\shorttwo", NULL);
5045 if (spmap[i].lolt)
5047 CreateDirectoryA("longone", NULL);
5048 CreateDirectoryA("longone\\longtwo", NULL);
5051 if (spmap[i].soste)
5052 create_file("shortone\\shorttwo\\augustus", 50);
5053 if (spmap[i].solte)
5054 create_file("shortone\\longtwo\\augustus", 100);
5055 if (spmap[i].loste)
5056 create_file("longone\\shorttwo\\augustus", 150);
5057 if (spmap[i].lolte)
5058 create_file("longone\\longtwo\\augustus", 200);
5060 r = MsiInstallProductA(msifile, NULL);
5061 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
5062 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
5063 "%d: Expected %d, got %d\n", i, spmap[i].size,
5064 get_pf_file_size("msitest\\augustus"));
5066 if (r == ERROR_SUCCESS)
5068 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
5069 ok(delete_pf("msitest", FALSE), "%d: File not installed\n", i);
5071 else
5073 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
5074 todo_wine ok(!delete_pf("msitest", FALSE), "%d: File installed\n", i);
5077 DeleteFileA("shortone\\shorttwo\\augustus");
5078 DeleteFileA("shortone\\longtwo\\augustus");
5079 DeleteFileA("longone\\shorttwo\\augustus");
5080 DeleteFileA("longone\\longtwo\\augustus");
5081 RemoveDirectoryA("shortone\\shorttwo");
5082 RemoveDirectoryA("shortone\\longtwo");
5083 RemoveDirectoryA("longone\\shorttwo");
5084 RemoveDirectoryA("longone\\longtwo");
5085 RemoveDirectoryA("shortone");
5086 RemoveDirectoryA("longone");
5089 DeleteFileA(msifile);
5092 static void test_MsiConfigureProductEx(void)
5094 UINT r;
5095 LONG res;
5096 DWORD type, size;
5097 HKEY props, source;
5098 CHAR keypath[MAX_PATH * 2];
5099 CHAR localpack[MAX_PATH];
5101 CreateDirectoryA("msitest", NULL);
5102 create_file("msitest\\hydrogen", 500);
5103 create_file("msitest\\helium", 500);
5104 create_file("msitest\\lithium", 500);
5106 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
5108 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5110 /* NULL szProduct */
5111 r = MsiConfigureProductExA(NULL, INSTALLLEVEL_DEFAULT,
5112 INSTALLSTATE_DEFAULT, "PROPVAR=42");
5113 ok(r == ERROR_INVALID_PARAMETER,
5114 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5116 /* empty szProduct */
5117 r = MsiConfigureProductExA("", INSTALLLEVEL_DEFAULT,
5118 INSTALLSTATE_DEFAULT, "PROPVAR=42");
5119 ok(r == ERROR_INVALID_PARAMETER,
5120 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5122 /* garbage szProduct */
5123 r = MsiConfigureProductExA("garbage", INSTALLLEVEL_DEFAULT,
5124 INSTALLSTATE_DEFAULT, "PROPVAR=42");
5125 ok(r == ERROR_INVALID_PARAMETER,
5126 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5128 /* guid without brackets */
5129 r = MsiConfigureProductExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
5130 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5131 "PROPVAR=42");
5132 ok(r == ERROR_INVALID_PARAMETER,
5133 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5135 /* guid with brackets */
5136 r = MsiConfigureProductExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
5137 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5138 "PROPVAR=42");
5139 ok(r == ERROR_UNKNOWN_PRODUCT,
5140 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5142 /* same length as guid, but random */
5143 r = MsiConfigureProductExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93",
5144 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5145 "PROPVAR=42");
5146 ok(r == ERROR_UNKNOWN_PRODUCT,
5147 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5149 /* product not installed yet */
5150 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5151 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5152 "PROPVAR=42");
5153 ok(r == ERROR_UNKNOWN_PRODUCT,
5154 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5156 /* install the product, per-user unmanaged */
5157 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
5158 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5159 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5160 ok(pf_exists("msitest\\helium"), "File not installed\n");
5161 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5162 ok(pf_exists("msitest"), "File not installed\n");
5164 /* product is installed per-user managed, remove it */
5165 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5166 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5167 "PROPVAR=42");
5168 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5169 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5170 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5171 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5172 todo_wine
5174 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5177 /* product has been removed */
5178 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5179 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5180 "PROPVAR=42");
5181 ok(r == ERROR_UNKNOWN_PRODUCT,
5182 "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
5184 /* install the product, machine */
5185 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
5186 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5187 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5188 ok(pf_exists("msitest\\helium"), "File not installed\n");
5189 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5190 ok(pf_exists("msitest"), "File not installed\n");
5192 /* product is installed machine, remove it */
5193 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5194 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5195 "PROPVAR=42");
5196 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5197 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5198 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5199 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5200 todo_wine
5202 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5205 /* product has been removed */
5206 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5207 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5208 "PROPVAR=42");
5209 ok(r == ERROR_UNKNOWN_PRODUCT,
5210 "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
5212 /* install the product, machine */
5213 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
5214 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5215 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5216 ok(pf_exists("msitest\\helium"), "File not installed\n");
5217 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5218 ok(pf_exists("msitest"), "File not installed\n");
5220 DeleteFileA(msifile);
5222 /* local msifile is removed */
5223 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5224 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5225 "PROPVAR=42");
5226 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5227 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5228 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5229 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5230 todo_wine
5232 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5235 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
5237 /* install the product, machine */
5238 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
5239 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5240 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5241 ok(pf_exists("msitest\\helium"), "File not installed\n");
5242 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5243 ok(pf_exists("msitest"), "File not installed\n");
5245 DeleteFileA(msifile);
5247 lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
5248 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
5249 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties");
5251 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
5252 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5254 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
5255 (const BYTE *)"C:\\idontexist.msi", 18);
5256 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5258 /* LocalPackage is used to find the cached msi package */
5259 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5260 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5261 "PROPVAR=42");
5262 ok(r == ERROR_INSTALL_SOURCE_ABSENT,
5263 "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
5264 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5265 ok(pf_exists("msitest\\helium"), "File not installed\n");
5266 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5267 ok(pf_exists("msitest"), "File not installed\n");
5269 RegCloseKey(props);
5270 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
5272 /* LastUsedSource (local msi package) can be used as a last resort */
5273 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5274 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5275 "PROPVAR=42");
5276 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5277 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5278 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5279 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5280 todo_wine
5282 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5285 /* install the product, machine */
5286 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
5287 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5288 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5289 ok(pf_exists("msitest\\helium"), "File not installed\n");
5290 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5291 ok(pf_exists("msitest"), "File not installed\n");
5293 lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
5294 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
5295 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties");
5297 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
5298 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5300 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
5301 (const BYTE *)"C:\\idontexist.msi", 18);
5302 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5304 lstrcpyA(keypath, "SOFTWARE\\Classes\\Installer\\Products\\");
5305 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\SourceList");
5307 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &source);
5308 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5310 type = REG_SZ;
5311 size = MAX_PATH;
5312 res = RegQueryValueExA(source, "PackageName", NULL, &type,
5313 (LPBYTE)localpack, &size);
5314 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5316 res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
5317 (const BYTE *)"idontexist.msi", 15);
5318 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5320 /* SourceList is altered */
5321 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5322 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5323 "PROPVAR=42");
5324 ok(r == ERROR_INSTALL_SOURCE_ABSENT,
5325 "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
5326 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5327 ok(pf_exists("msitest\\helium"), "File not installed\n");
5328 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5329 ok(pf_exists("msitest"), "File not installed\n");
5331 /* restore the SourceList */
5332 res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
5333 (const BYTE *)localpack, lstrlenA(localpack) + 1);
5334 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5336 /* finally remove the product */
5337 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5338 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5339 "PROPVAR=42");
5340 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5341 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5342 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5343 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5344 todo_wine
5346 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5349 DeleteFileA(msifile);
5350 RegCloseKey(source);
5351 RegCloseKey(props);
5352 DeleteFileA("msitest\\hydrogen");
5353 DeleteFileA("msitest\\helium");
5354 DeleteFileA("msitest\\lithium");
5355 RemoveDirectoryA("msitest");
5358 static void test_missingcomponent(void)
5360 UINT r;
5362 CreateDirectoryA("msitest", NULL);
5363 create_file("msitest\\hydrogen", 500);
5364 create_file("msitest\\helium", 500);
5365 create_file("msitest\\lithium", 500);
5366 create_file("beryllium", 500);
5368 create_database(msifile, mcomp_tables, sizeof(mcomp_tables) / sizeof(msi_table));
5370 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5372 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
5373 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5374 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5375 ok(pf_exists("msitest\\helium"), "File not installed\n");
5376 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5377 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
5378 ok(pf_exists("msitest"), "File not installed\n");
5380 r = MsiInstallProductA(msifile, "REMOVE=ALL INSTALLLEVEL=10 PROPVAR=42");
5381 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5382 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5383 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5384 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5385 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
5386 todo_wine
5388 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5391 DeleteFileA(msifile);
5392 DeleteFileA("msitest\\hydrogen");
5393 DeleteFileA("msitest\\helium");
5394 DeleteFileA("msitest\\lithium");
5395 DeleteFileA("beryllium");
5396 RemoveDirectoryA("msitest");
5399 START_TEST(install)
5401 DWORD len;
5402 char temp_path[MAX_PATH], prev_path[MAX_PATH];
5404 init_functionpointers();
5406 GetCurrentDirectoryA(MAX_PATH, prev_path);
5407 GetTempPath(MAX_PATH, temp_path);
5408 SetCurrentDirectoryA(temp_path);
5410 lstrcpyA(CURR_DIR, temp_path);
5411 len = lstrlenA(CURR_DIR);
5413 if(len && (CURR_DIR[len - 1] == '\\'))
5414 CURR_DIR[len - 1] = 0;
5416 get_program_files_dir(PROG_FILES_DIR, COMMON_FILES_DIR);
5418 test_MsiInstallProduct();
5419 test_MsiSetComponentState();
5420 test_packagecoltypes();
5421 test_continuouscabs();
5422 test_caborder();
5423 test_mixedmedia();
5424 test_samesequence();
5425 test_uiLevelFlags();
5426 test_readonlyfile();
5427 test_setdirproperty();
5428 test_cabisextracted();
5429 test_concurrentinstall();
5430 test_setpropertyfolder();
5431 test_publish_registerproduct();
5432 test_publish_publishproduct();
5433 test_publish_publishfeatures();
5434 test_publish_registeruser();
5435 test_publish_processcomponents();
5436 test_publish();
5437 test_publishsourcelist();
5438 test_transformprop();
5439 test_currentworkingdir();
5440 test_admin();
5441 test_adminprops();
5442 test_removefiles();
5443 test_movefiles();
5444 test_missingcab();
5445 test_duplicatefiles();
5446 test_writeregistryvalues();
5447 test_sourcefolder();
5448 test_customaction51();
5449 test_installstate();
5450 test_sourcepath();
5451 test_MsiConfigureProductEx();
5452 test_missingcomponent();
5454 SetCurrentDirectoryA(prev_path);