push 9758e6fe7ae8fbab538c98c718d6619029bb3457
[wine/hacks.git] / dlls / msi / tests / install.c
blob4748831365d008fa794631743290bce311041d59
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 tp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
443 "s72\tS38\ts72\ti2\tS255\tS72\n"
444 "Component\tComponent\n"
445 "augustus\t\tMSITESTDIR\t0\tprop=\"val\"\taugustus\n";
447 static const CHAR cwd_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
448 "s72\tS38\ts72\ti2\tS255\tS72\n"
449 "Component\tComponent\n"
450 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
452 static const CHAR adm_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
453 "s72\tS38\ts72\ti2\tS255\tS72\n"
454 "Component\tComponent\n"
455 "augustus\t\tMSITESTDIR\t0\tPOSTADMIN=1\taugustus";
457 static const CHAR adm_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
458 "s72\ti2\tS64\tS0\tS255\n"
459 "CustomAction\tAction\n"
460 "SetPOSTADMIN\t51\tPOSTADMIN\t1\t\n";
462 static const CHAR adm_admin_exec_seq_dat[] = "Action\tCondition\tSequence\n"
463 "s72\tS255\tI2\n"
464 "AdminExecuteSequence\tAction\n"
465 "CostFinalize\t\t1000\n"
466 "CostInitialize\t\t800\n"
467 "FileCost\t\t900\n"
468 "SetPOSTADMIN\t\t950\n"
469 "InstallFiles\t\t4000\n"
470 "InstallFinalize\t\t6600\n"
471 "InstallInitialize\t\t1500\n"
472 "InstallValidate\t\t1400\n"
473 "LaunchConditions\t\t100";
475 static const CHAR amp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
476 "s72\tS38\ts72\ti2\tS255\tS72\n"
477 "Component\tComponent\n"
478 "augustus\t\tMSITESTDIR\t0\tMYPROP=2718\taugustus\n";
480 static const CHAR rem_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
481 "s72\tS38\ts72\ti2\tS255\tS72\n"
482 "Component\tComponent\n"
483 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t0\t\thydrogen\n"
484 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\thelium\n"
485 "lithium\t\tMSITESTDIR\t2\t\tlithium\n";
487 static const CHAR rem_feature_comp_dat[] = "Feature_\tComponent_\n"
488 "s38\ts72\n"
489 "FeatureComponents\tFeature_\tComponent_\n"
490 "feature\thydrogen\n"
491 "feature\thelium\n"
492 "feature\tlithium";
494 static const CHAR rem_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
495 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
496 "File\tFile\n"
497 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
498 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
499 "lithium\tlithium\tlithium\t0\t\t\t8192\t1";
501 static const CHAR rem_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
502 "s72\tS255\tI2\n"
503 "InstallExecuteSequence\tAction\n"
504 "ValidateProductID\t\t700\n"
505 "CostInitialize\t\t800\n"
506 "FileCost\t\t900\n"
507 "CostFinalize\t\t1000\n"
508 "InstallValidate\t\t1400\n"
509 "InstallInitialize\t\t1500\n"
510 "ProcessComponents\t\t1600\n"
511 "UnpublishFeatures\t\t1800\n"
512 "RemoveFiles\t\t3500\n"
513 "InstallFiles\t\t4000\n"
514 "RegisterProduct\t\t6100\n"
515 "PublishFeatures\t\t6300\n"
516 "PublishProduct\t\t6400\n"
517 "InstallFinalize\t\t6600";
519 static const CHAR rem_remove_files_dat[] = "FileKey\tComponent_\tFileName\tDirProperty\tInstallMode\n"
520 "s72\ts72\tS255\ts72\tI2\n"
521 "RemoveFile\tFileKey\n"
522 "furlong\thydrogen\tfurlong\tMSITESTDIR\t1\n"
523 "firkin\thelium\tfirkin\tMSITESTDIR\t1\n"
524 "fortnight\tlithium\tfortnight\tMSITESTDIR\t1\n"
525 "becquerel\thydrogen\tbecquerel\tMSITESTDIR\t2\n"
526 "dioptre\thelium\tdioptre\tMSITESTDIR\t2\n"
527 "attoparsec\tlithium\tattoparsec\tMSITESTDIR\t2\n"
528 "storeys\thydrogen\tstoreys\tMSITESTDIR\t3\n"
529 "block\thelium\tblock\tMSITESTDIR\t3\n"
530 "siriometer\tlithium\tsiriometer\tMSITESTDIR\t3\n";
532 static const CHAR mov_move_file_dat[] = "FileKey\tComponent_\tSourceName\tDestName\tSourceFolder\tDestFolder\tOptions\n"
533 "s72\ts72\tS255\tS255\tS72\ts72\ti2\n"
534 "MoveFile\tFileKey\n"
535 "abkhazia\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t0\n"
536 "bahamas\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t1\n"
537 "cambodia\taugustus\tcameroon\tcanada\tSourceDir\tMSITESTDIR\t0\n"
538 "denmark\taugustus\tdjibouti\tdominica\tSourceDir\tMSITESTDIR\t1\n"
539 "ecuador\taugustus\tegypt\telsalvador\tNotAProp\tMSITESTDIR\t1\n"
540 "fiji\taugustus\tfinland\tfrance\tSourceDir\tNotAProp\t1\n"
541 "gabon\taugustus\tgambia\tgeorgia\tSOURCEFULL\tMSITESTDIR\t1\n"
542 "haiti\taugustus\thonduras\thungary\tSourceDir\tDESTFULL\t1\n"
543 "iceland\taugustus\tindia\tindonesia\tMSITESTDIR\tMSITESTDIR\t1\n"
544 "jamaica\taugustus\tjapan\tjordan\tFILEPATHBAD\tMSITESTDIR\t1\n"
545 "kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n"
546 "laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n"
547 "namibia\taugustus\tnauru\tkiribati\tSourceDir\tMSITESTDIR\t1\n"
548 "wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
549 "single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
550 "wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
551 "singlenodest\taugustus\tb?r\t\tSourceDir\tMSITESTDIR\t1\n";
553 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
554 "s72\tS38\ts72\ti2\tS255\tS72\n"
555 "Component\tComponent\n"
556 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
557 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
558 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
559 "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n";
561 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
562 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
563 "File\tFile\n"
564 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
565 "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
566 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
567 "gaius\tgaius\tgaius\t500\t\t\t16384\t4";
569 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
570 "i2\ti4\tL64\tS255\tS32\tS72\n"
571 "Media\tDiskId\n"
572 "1\t1\t\ttest1.cab\tDISK1\t\n"
573 "2\t2\t\ttest2.cab\tDISK2\t\n"
574 "3\t3\t\ttest3.cab\tDISK3\t\n"
575 "4\t4\t\ttest3.cab\tDISK3\t\n";
577 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
578 "s72\ti2\ti4\ti4\ti4\ti4\n"
579 "MsiFileHash\tFile_\n"
580 "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
582 static const CHAR df_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
583 "s72\tS72\tl255\n"
584 "Directory\tDirectory\n"
585 "THIS\tMSITESTDIR\tthis\n"
586 "DOESNOT\tTHIS\tdoesnot\n"
587 "NONEXISTENT\tDOESNOT\texist\n"
588 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
589 "ProgramFilesFolder\tTARGETDIR\t.\n"
590 "TARGETDIR\t\tSourceDir";
592 static const CHAR df_duplicate_file_dat[] = "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
593 "s72\ts72\ts72\tS255\tS72\n"
594 "DuplicateFile\tFileKey\n"
595 "maximus\tmaximus\tmaximus\taugustus\t\n"
596 "caesar\tmaximus\tmaximus\t\tNONEXISTENT\n";
598 static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
599 "s72\tS38\ts72\ti2\tS255\tS72\n"
600 "Component\tComponent\n"
601 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
603 static const CHAR wrv_registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
604 "s72\ti2\tl255\tL255\tL0\ts72\n"
605 "Registry\tRegistry\n"
606 "regdata\t2\tSOFTWARE\\Wine\\msitest\tValue\t[~]one[~]two[~]three\taugustus";
608 static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
609 "s72\tS38\ts72\ti2\tS255\tS72\n"
610 "Component\tComponent\n"
611 "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
613 static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
614 "s72\tS255\tI2\n"
615 "InstallExecuteSequence\tAction\n"
616 "ValidateProductID\t\t700\n"
617 "GoodSetProperty\t\t725\n"
618 "BadSetProperty\t\t750\n"
619 "CostInitialize\t\t800\n"
620 "FileCost\t\t900\n"
621 "CostFinalize\t\t1000\n"
622 "InstallValidate\t\t1400\n"
623 "InstallInitialize\t\t1500\n"
624 "InstallFiles\t\t4000\n"
625 "InstallFinalize\t\t6600";
627 static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
628 "s72\ti2\tS64\tS0\n"
629 "CustomAction\tAction\n"
630 "GoodSetProperty\t51\tMYPROP\t42\n"
631 "BadSetProperty\t51\t\tMYPROP\n";
633 static const CHAR is_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
634 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
635 "Feature\tFeature\n"
636 "one\t\t\t\t2\t1\t\t0\n" /* favorLocal */
637 "two\t\t\t\t2\t1\t\t1\n" /* favorSource */
638 "three\t\t\t\t2\t1\t\t4\n" /* favorAdvertise */
639 "four\t\t\t\t2\t0\t\t0"; /* disabled */
641 static const CHAR is_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
642 "s72\tS38\ts72\ti2\tS255\tS72\n"
643 "Component\tComponent\n"
644 "alpha\t\tMSITESTDIR\t0\t\talpha_file\n" /* favorLocal:Local */
645 "beta\t\tMSITESTDIR\t1\t\tbeta_file\n" /* favorLocal:Source */
646 "gamma\t\tMSITESTDIR\t2\t\tgamma_file\n" /* favorLocal:Optional */
647 "theta\t\tMSITESTDIR\t0\t\ttheta_file\n" /* favorSource:Local */
648 "delta\t\tMSITESTDIR\t1\t\tdelta_file\n" /* favorSource:Source */
649 "epsilon\t\tMSITESTDIR\t2\t\tepsilon_file\n" /* favorSource:Optional */
650 "zeta\t\tMSITESTDIR\t0\t\tzeta_file\n" /* favorAdvertise:Local */
651 "iota\t\tMSITESTDIR\t1\t\tiota_file\n" /* favorAdvertise:Source */
652 "eta\t\tMSITESTDIR\t2\t\teta_file\n" /* favorAdvertise:Optional */
653 "kappa\t\tMSITESTDIR\t0\t\tkappa_file\n" /* disabled:Local */
654 "lambda\t\tMSITESTDIR\t1\t\tlambda_file\n" /* disabled:Source */
655 "mu\t\tMSITESTDIR\t2\t\tmu_file\n"; /* disabled:Optional */
657 static const CHAR is_feature_comp_dat[] = "Feature_\tComponent_\n"
658 "s38\ts72\n"
659 "FeatureComponents\tFeature_\tComponent_\n"
660 "one\talpha\n"
661 "one\tbeta\n"
662 "one\tgamma\n"
663 "two\ttheta\n"
664 "two\tdelta\n"
665 "two\tepsilon\n"
666 "three\tzeta\n"
667 "three\tiota\n"
668 "three\teta\n"
669 "four\tkappa\n"
670 "four\tlambda\n"
671 "four\tmu";
673 static const CHAR is_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
674 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
675 "File\tFile\n"
676 "alpha_file\talpha\talpha\t500\t\t\t8192\t1\n"
677 "beta_file\tbeta\tbeta\t500\t\t\t8291\t2\n"
678 "gamma_file\tgamma\tgamma\t500\t\t\t8192\t3\n"
679 "theta_file\ttheta\ttheta\t500\t\t\t8192\t4\n"
680 "delta_file\tdelta\tdelta\t500\t\t\t8192\t5\n"
681 "epsilon_file\tepsilon\tepsilon\t500\t\t\t8192\t6\n"
682 "zeta_file\tzeta\tzeta\t500\t\t\t8192\t7\n"
683 "iota_file\tiota\tiota\t500\t\t\t8192\t8\n"
684 "eta_file\teta\teta\t500\t\t\t8192\t9\n"
685 "kappa_file\tkappa\tkappa\t500\t\t\t8192\t10\n"
686 "lambda_file\tlambda\tlambda\t500\t\t\t8192\t11\n"
687 "mu_file\tmu\tmu\t500\t\t\t8192\t12";
689 static const CHAR is_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
690 "i2\ti4\tL64\tS255\tS32\tS72\n"
691 "Media\tDiskId\n"
692 "1\t12\t\t\tDISK1\t\n";
694 static const CHAR sp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
695 "s72\tS38\ts72\ti2\tS255\tS72\n"
696 "Component\tComponent\n"
697 "augustus\t\tTWODIR\t0\t\taugustus\n";
699 static const CHAR sp_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
700 "s72\tS72\tl255\n"
701 "Directory\tDirectory\n"
702 "TARGETDIR\t\tSourceDir\n"
703 "ProgramFilesFolder\tTARGETDIR\t.\n"
704 "MSITESTDIR\tProgramFilesFolder\tmsitest:.\n"
705 "ONEDIR\tMSITESTDIR\t.:shortone|longone\n"
706 "TWODIR\tONEDIR\t.:shorttwo|longtwo";
708 typedef struct _msi_table
710 const CHAR *filename;
711 const CHAR *data;
712 int size;
713 } msi_table;
715 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
717 static const msi_table tables[] =
719 ADD_TABLE(component),
720 ADD_TABLE(directory),
721 ADD_TABLE(feature),
722 ADD_TABLE(feature_comp),
723 ADD_TABLE(file),
724 ADD_TABLE(install_exec_seq),
725 ADD_TABLE(media),
726 ADD_TABLE(property),
727 ADD_TABLE(registry),
728 ADD_TABLE(service_install),
729 ADD_TABLE(service_control)
732 static const msi_table cc_tables[] =
734 ADD_TABLE(cc_component),
735 ADD_TABLE(directory),
736 ADD_TABLE(cc_feature),
737 ADD_TABLE(cc_feature_comp),
738 ADD_TABLE(cc_file),
739 ADD_TABLE(install_exec_seq),
740 ADD_TABLE(cc_media),
741 ADD_TABLE(property),
744 static const msi_table cc2_tables[] =
746 ADD_TABLE(cc2_component),
747 ADD_TABLE(directory),
748 ADD_TABLE(cc_feature),
749 ADD_TABLE(cc_feature_comp),
750 ADD_TABLE(cc2_file),
751 ADD_TABLE(install_exec_seq),
752 ADD_TABLE(cc_media),
753 ADD_TABLE(property),
756 static const msi_table co_tables[] =
758 ADD_TABLE(cc_component),
759 ADD_TABLE(directory),
760 ADD_TABLE(cc_feature),
761 ADD_TABLE(cc_feature_comp),
762 ADD_TABLE(co_file),
763 ADD_TABLE(install_exec_seq),
764 ADD_TABLE(co_media),
765 ADD_TABLE(property),
768 static const msi_table co2_tables[] =
770 ADD_TABLE(cc_component),
771 ADD_TABLE(directory),
772 ADD_TABLE(cc_feature),
773 ADD_TABLE(cc_feature_comp),
774 ADD_TABLE(cc_file),
775 ADD_TABLE(install_exec_seq),
776 ADD_TABLE(co2_media),
777 ADD_TABLE(property),
780 static const msi_table mm_tables[] =
782 ADD_TABLE(cc_component),
783 ADD_TABLE(directory),
784 ADD_TABLE(cc_feature),
785 ADD_TABLE(cc_feature_comp),
786 ADD_TABLE(mm_file),
787 ADD_TABLE(install_exec_seq),
788 ADD_TABLE(mm_media),
789 ADD_TABLE(property),
792 static const msi_table ss_tables[] =
794 ADD_TABLE(cc_component),
795 ADD_TABLE(directory),
796 ADD_TABLE(cc_feature),
797 ADD_TABLE(cc_feature_comp),
798 ADD_TABLE(cc_file),
799 ADD_TABLE(install_exec_seq),
800 ADD_TABLE(ss_media),
801 ADD_TABLE(property),
804 static const msi_table ui_tables[] =
806 ADD_TABLE(ui_component),
807 ADD_TABLE(directory),
808 ADD_TABLE(cc_feature),
809 ADD_TABLE(cc_feature_comp),
810 ADD_TABLE(cc_file),
811 ADD_TABLE(install_exec_seq),
812 ADD_TABLE(ui_install_ui_seq),
813 ADD_TABLE(ui_custom_action),
814 ADD_TABLE(cc_media),
815 ADD_TABLE(property),
818 static const msi_table rof_tables[] =
820 ADD_TABLE(rof_component),
821 ADD_TABLE(directory),
822 ADD_TABLE(rof_feature),
823 ADD_TABLE(rof_feature_comp),
824 ADD_TABLE(rof_file),
825 ADD_TABLE(install_exec_seq),
826 ADD_TABLE(rof_media),
827 ADD_TABLE(property),
830 static const msi_table sdp_tables[] =
832 ADD_TABLE(rof_component),
833 ADD_TABLE(directory),
834 ADD_TABLE(rof_feature),
835 ADD_TABLE(rof_feature_comp),
836 ADD_TABLE(rof_file),
837 ADD_TABLE(sdp_install_exec_seq),
838 ADD_TABLE(sdp_custom_action),
839 ADD_TABLE(rof_media),
840 ADD_TABLE(property),
843 static const msi_table cie_tables[] =
845 ADD_TABLE(cie_component),
846 ADD_TABLE(directory),
847 ADD_TABLE(cc_feature),
848 ADD_TABLE(cie_feature_comp),
849 ADD_TABLE(cie_file),
850 ADD_TABLE(install_exec_seq),
851 ADD_TABLE(cie_media),
852 ADD_TABLE(property),
855 static const msi_table ci_tables[] =
857 ADD_TABLE(ci_component),
858 ADD_TABLE(directory),
859 ADD_TABLE(rof_feature),
860 ADD_TABLE(rof_feature_comp),
861 ADD_TABLE(rof_file),
862 ADD_TABLE(ci_install_exec_seq),
863 ADD_TABLE(rof_media),
864 ADD_TABLE(property),
865 ADD_TABLE(ci_custom_action),
868 static const msi_table ci2_tables[] =
870 ADD_TABLE(ci2_component),
871 ADD_TABLE(directory),
872 ADD_TABLE(rof_feature),
873 ADD_TABLE(ci2_feature_comp),
874 ADD_TABLE(ci2_file),
875 ADD_TABLE(install_exec_seq),
876 ADD_TABLE(rof_media),
877 ADD_TABLE(property),
880 static const msi_table spf_tables[] =
882 ADD_TABLE(ci_component),
883 ADD_TABLE(directory),
884 ADD_TABLE(rof_feature),
885 ADD_TABLE(rof_feature_comp),
886 ADD_TABLE(rof_file),
887 ADD_TABLE(spf_install_exec_seq),
888 ADD_TABLE(rof_media),
889 ADD_TABLE(property),
890 ADD_TABLE(spf_custom_action),
891 ADD_TABLE(spf_install_ui_seq),
894 static const msi_table pp_tables[] =
896 ADD_TABLE(ci_component),
897 ADD_TABLE(directory),
898 ADD_TABLE(rof_feature),
899 ADD_TABLE(rof_feature_comp),
900 ADD_TABLE(rof_file),
901 ADD_TABLE(pp_install_exec_seq),
902 ADD_TABLE(rof_media),
903 ADD_TABLE(property),
906 static const msi_table tp_tables[] =
908 ADD_TABLE(tp_component),
909 ADD_TABLE(directory),
910 ADD_TABLE(rof_feature),
911 ADD_TABLE(ci2_feature_comp),
912 ADD_TABLE(ci2_file),
913 ADD_TABLE(install_exec_seq),
914 ADD_TABLE(rof_media),
915 ADD_TABLE(property),
918 static const msi_table cwd_tables[] =
920 ADD_TABLE(cwd_component),
921 ADD_TABLE(directory),
922 ADD_TABLE(rof_feature),
923 ADD_TABLE(ci2_feature_comp),
924 ADD_TABLE(ci2_file),
925 ADD_TABLE(install_exec_seq),
926 ADD_TABLE(rof_media),
927 ADD_TABLE(property),
930 static const msi_table adm_tables[] =
932 ADD_TABLE(adm_component),
933 ADD_TABLE(directory),
934 ADD_TABLE(rof_feature),
935 ADD_TABLE(ci2_feature_comp),
936 ADD_TABLE(ci2_file),
937 ADD_TABLE(install_exec_seq),
938 ADD_TABLE(rof_media),
939 ADD_TABLE(property),
940 ADD_TABLE(adm_custom_action),
941 ADD_TABLE(adm_admin_exec_seq),
944 static const msi_table amp_tables[] =
946 ADD_TABLE(amp_component),
947 ADD_TABLE(directory),
948 ADD_TABLE(rof_feature),
949 ADD_TABLE(ci2_feature_comp),
950 ADD_TABLE(ci2_file),
951 ADD_TABLE(install_exec_seq),
952 ADD_TABLE(rof_media),
953 ADD_TABLE(property),
956 static const msi_table rem_tables[] =
958 ADD_TABLE(rem_component),
959 ADD_TABLE(directory),
960 ADD_TABLE(rof_feature),
961 ADD_TABLE(rem_feature_comp),
962 ADD_TABLE(rem_file),
963 ADD_TABLE(rem_install_exec_seq),
964 ADD_TABLE(rof_media),
965 ADD_TABLE(property),
966 ADD_TABLE(rem_remove_files),
969 static const msi_table mov_tables[] =
971 ADD_TABLE(cwd_component),
972 ADD_TABLE(directory),
973 ADD_TABLE(rof_feature),
974 ADD_TABLE(ci2_feature_comp),
975 ADD_TABLE(ci2_file),
976 ADD_TABLE(install_exec_seq),
977 ADD_TABLE(rof_media),
978 ADD_TABLE(property),
979 ADD_TABLE(mov_move_file),
982 static const msi_table mc_tables[] =
984 ADD_TABLE(mc_component),
985 ADD_TABLE(directory),
986 ADD_TABLE(cc_feature),
987 ADD_TABLE(cie_feature_comp),
988 ADD_TABLE(mc_file),
989 ADD_TABLE(install_exec_seq),
990 ADD_TABLE(mc_media),
991 ADD_TABLE(property),
992 ADD_TABLE(mc_file_hash),
995 static const msi_table df_tables[] =
997 ADD_TABLE(rof_component),
998 ADD_TABLE(df_directory),
999 ADD_TABLE(rof_feature),
1000 ADD_TABLE(rof_feature_comp),
1001 ADD_TABLE(rof_file),
1002 ADD_TABLE(install_exec_seq),
1003 ADD_TABLE(rof_media),
1004 ADD_TABLE(property),
1005 ADD_TABLE(df_duplicate_file),
1008 static const msi_table wrv_tables[] =
1010 ADD_TABLE(wrv_component),
1011 ADD_TABLE(directory),
1012 ADD_TABLE(rof_feature),
1013 ADD_TABLE(ci2_feature_comp),
1014 ADD_TABLE(ci2_file),
1015 ADD_TABLE(install_exec_seq),
1016 ADD_TABLE(rof_media),
1017 ADD_TABLE(property),
1018 ADD_TABLE(wrv_registry),
1021 static const msi_table sf_tables[] =
1023 ADD_TABLE(wrv_component),
1024 ADD_TABLE(directory),
1025 ADD_TABLE(rof_feature),
1026 ADD_TABLE(ci2_feature_comp),
1027 ADD_TABLE(ci2_file),
1028 ADD_TABLE(install_exec_seq),
1029 ADD_TABLE(rof_media),
1030 ADD_TABLE(property),
1033 static const msi_table ca51_tables[] =
1035 ADD_TABLE(ca51_component),
1036 ADD_TABLE(directory),
1037 ADD_TABLE(rof_feature),
1038 ADD_TABLE(ci2_feature_comp),
1039 ADD_TABLE(ci2_file),
1040 ADD_TABLE(ca51_install_exec_seq),
1041 ADD_TABLE(rof_media),
1042 ADD_TABLE(property),
1043 ADD_TABLE(ca51_custom_action),
1046 static const msi_table is_tables[] =
1048 ADD_TABLE(is_component),
1049 ADD_TABLE(directory),
1050 ADD_TABLE(is_feature),
1051 ADD_TABLE(is_feature_comp),
1052 ADD_TABLE(is_file),
1053 ADD_TABLE(install_exec_seq),
1054 ADD_TABLE(is_media),
1055 ADD_TABLE(property),
1058 static const msi_table sp_tables[] =
1060 ADD_TABLE(sp_component),
1061 ADD_TABLE(sp_directory),
1062 ADD_TABLE(rof_feature),
1063 ADD_TABLE(ci2_feature_comp),
1064 ADD_TABLE(ci2_file),
1065 ADD_TABLE(install_exec_seq),
1066 ADD_TABLE(rof_media),
1067 ADD_TABLE(property),
1070 /* cabinet definitions */
1072 /* make the max size large so there is only one cab file */
1073 #define MEDIA_SIZE 0x7FFFFFFF
1074 #define FOLDER_THRESHOLD 900000
1076 /* the FCI callbacks */
1078 static void *mem_alloc(ULONG cb)
1080 return HeapAlloc(GetProcessHeap(), 0, cb);
1083 static void mem_free(void *memory)
1085 HeapFree(GetProcessHeap(), 0, memory);
1088 static BOOL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
1090 sprintf(pccab->szCab, pv, pccab->iCab);
1091 return TRUE;
1094 static long progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
1096 return 0;
1099 static int file_placed(PCCAB pccab, char *pszFile, long cbFile,
1100 BOOL fContinuation, void *pv)
1102 return 0;
1105 static INT_PTR fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
1107 HANDLE handle;
1108 DWORD dwAccess = 0;
1109 DWORD dwShareMode = 0;
1110 DWORD dwCreateDisposition = OPEN_EXISTING;
1112 dwAccess = GENERIC_READ | GENERIC_WRITE;
1113 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
1114 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
1116 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
1117 dwCreateDisposition = OPEN_EXISTING;
1118 else
1119 dwCreateDisposition = CREATE_NEW;
1121 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
1122 dwCreateDisposition, 0, NULL);
1124 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
1126 return (INT_PTR)handle;
1129 static UINT fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1131 HANDLE handle = (HANDLE)hf;
1132 DWORD dwRead;
1133 BOOL res;
1135 res = ReadFile(handle, memory, cb, &dwRead, NULL);
1136 ok(res, "Failed to ReadFile\n");
1138 return dwRead;
1141 static UINT fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1143 HANDLE handle = (HANDLE)hf;
1144 DWORD dwWritten;
1145 BOOL res;
1147 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
1148 ok(res, "Failed to WriteFile\n");
1150 return dwWritten;
1153 static int fci_close(INT_PTR hf, int *err, void *pv)
1155 HANDLE handle = (HANDLE)hf;
1156 ok(CloseHandle(handle), "Failed to CloseHandle\n");
1158 return 0;
1161 static long fci_seek(INT_PTR hf, long dist, int seektype, int *err, void *pv)
1163 HANDLE handle = (HANDLE)hf;
1164 DWORD ret;
1166 ret = SetFilePointer(handle, dist, NULL, seektype);
1167 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
1169 return ret;
1172 static int fci_delete(char *pszFile, int *err, void *pv)
1174 BOOL ret = DeleteFileA(pszFile);
1175 ok(ret, "Failed to DeleteFile %s\n", pszFile);
1177 return 0;
1180 static void init_functionpointers(void)
1182 HMODULE hmsi = GetModuleHandleA("msi.dll");
1184 #define GET_PROC(func) \
1185 p ## func = (void*)GetProcAddress(hmsi, #func); \
1186 if(!p ## func) \
1187 trace("GetProcAddress(%s) failed\n", #func);
1189 GET_PROC(MsiQueryComponentStateA);
1190 GET_PROC(MsiSourceListEnumSourcesA);
1191 GET_PROC(MsiSourceListGetInfoA);
1193 #undef GET_PROC
1196 static void get_user_sid(LPSTR *usersid)
1198 HANDLE token;
1199 BYTE buf[1024];
1200 DWORD size;
1201 PTOKEN_USER user;
1202 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
1203 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
1205 *usersid = NULL;
1206 pConvertSidToStringSidA = (void *)GetProcAddress(hadvapi32, "ConvertSidToStringSidA");
1207 if (!pConvertSidToStringSidA)
1208 return;
1210 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
1211 size = sizeof(buf);
1212 GetTokenInformation(token, TokenUser, (void *)buf, size, &size);
1213 user = (PTOKEN_USER)buf;
1214 pConvertSidToStringSidA(user->User.Sid, usersid);
1217 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
1219 CHAR buffer[0x20];
1220 UINT r;
1221 DWORD sz;
1223 sz = sizeof buffer;
1224 r = MsiRecordGetString(rec, field, buffer, &sz);
1225 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
1228 static BOOL get_temp_file(char *pszTempName, int cbTempName, void *pv)
1230 LPSTR tempname;
1232 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
1233 GetTempFileNameA(".", "xx", 0, tempname);
1235 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
1237 lstrcpyA(pszTempName, tempname);
1238 HeapFree(GetProcessHeap(), 0, tempname);
1239 return TRUE;
1242 HeapFree(GetProcessHeap(), 0, tempname);
1244 return FALSE;
1247 static INT_PTR get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
1248 USHORT *pattribs, int *err, void *pv)
1250 BY_HANDLE_FILE_INFORMATION finfo;
1251 FILETIME filetime;
1252 HANDLE handle;
1253 DWORD attrs;
1254 BOOL res;
1256 handle = CreateFile(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
1257 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
1259 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
1261 res = GetFileInformationByHandle(handle, &finfo);
1262 ok(res, "Expected GetFileInformationByHandle to succeed\n");
1264 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
1265 FileTimeToDosDateTime(&filetime, pdate, ptime);
1267 attrs = GetFileAttributes(pszName);
1268 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
1270 return (INT_PTR)handle;
1273 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
1275 char path[MAX_PATH];
1276 char filename[MAX_PATH];
1278 lstrcpyA(path, CURR_DIR);
1279 lstrcatA(path, "\\");
1280 lstrcatA(path, file);
1282 lstrcpyA(filename, file);
1284 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
1285 progress, get_open_info, compress);
1288 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
1290 ZeroMemory(pCabParams, sizeof(CCAB));
1292 pCabParams->cb = max_size;
1293 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
1294 pCabParams->setID = 0xbeef;
1295 pCabParams->iCab = 1;
1296 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
1297 lstrcatA(pCabParams->szCabPath, "\\");
1298 lstrcpyA(pCabParams->szCab, name);
1301 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
1303 CCAB cabParams;
1304 LPCSTR ptr;
1305 HFCI hfci;
1306 ERF erf;
1307 BOOL res;
1309 set_cab_parameters(&cabParams, name, max_size);
1311 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
1312 fci_read, fci_write, fci_close, fci_seek, fci_delete,
1313 get_temp_file, &cabParams, NULL);
1315 ok(hfci != NULL, "Failed to create an FCI context\n");
1317 ptr = files;
1318 while (*ptr)
1320 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
1321 ok(res, "Failed to add file: %s\n", ptr);
1322 ptr += lstrlen(ptr) + 1;
1325 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
1326 ok(res, "Failed to flush the cabinet\n");
1328 res = FCIDestroy(hfci);
1329 ok(res, "Failed to destroy the cabinet\n");
1332 static BOOL get_program_files_dir(LPSTR buf, LPSTR buf2)
1334 HKEY hkey;
1335 DWORD type, size;
1337 if (RegOpenKey(HKEY_LOCAL_MACHINE,
1338 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
1339 return FALSE;
1341 size = MAX_PATH;
1342 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) {
1343 RegCloseKey(hkey);
1344 return FALSE;
1347 size = MAX_PATH;
1348 if (RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size)) {
1349 RegCloseKey(hkey);
1350 return FALSE;
1353 RegCloseKey(hkey);
1354 return TRUE;
1357 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
1359 HANDLE file;
1360 DWORD written;
1362 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
1363 if (file == INVALID_HANDLE_VALUE)
1364 return;
1366 WriteFile(file, data, strlen(data), &written, NULL);
1368 if (size)
1370 SetFilePointer(file, size, NULL, FILE_BEGIN);
1371 SetEndOfFile(file);
1374 CloseHandle(file);
1377 #define create_file(name, size) create_file_data(name, name, size)
1379 static void create_test_files(void)
1381 CreateDirectoryA("msitest", NULL);
1382 create_file("msitest\\one.txt", 100);
1383 CreateDirectoryA("msitest\\first", NULL);
1384 create_file("msitest\\first\\two.txt", 100);
1385 CreateDirectoryA("msitest\\second", NULL);
1386 create_file("msitest\\second\\three.txt", 100);
1388 create_file("four.txt", 100);
1389 create_file("five.txt", 100);
1390 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
1392 create_file("msitest\\filename", 100);
1393 create_file("msitest\\service.exe", 100);
1395 DeleteFileA("four.txt");
1396 DeleteFileA("five.txt");
1399 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
1401 CHAR path[MAX_PATH];
1403 lstrcpyA(path, PROG_FILES_DIR);
1404 lstrcatA(path, "\\");
1405 lstrcatA(path, rel_path);
1407 if (is_file)
1408 return DeleteFileA(path);
1409 else
1410 return RemoveDirectoryA(path);
1413 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
1415 CHAR path[MAX_PATH];
1417 lstrcpyA(path, COMMON_FILES_DIR);
1418 lstrcatA(path, "\\");
1419 lstrcatA(path, rel_path);
1421 if (is_file)
1422 return DeleteFileA(path);
1423 else
1424 return RemoveDirectoryA(path);
1427 static void delete_test_files(void)
1429 DeleteFileA("msitest.msi");
1430 DeleteFileA("msitest.cab");
1431 DeleteFileA("msitest\\second\\three.txt");
1432 DeleteFileA("msitest\\first\\two.txt");
1433 DeleteFileA("msitest\\one.txt");
1434 DeleteFileA("msitest\\service.exe");
1435 DeleteFileA("msitest\\filename");
1436 RemoveDirectoryA("msitest\\second");
1437 RemoveDirectoryA("msitest\\first");
1438 RemoveDirectoryA("msitest");
1441 static void write_file(const CHAR *filename, const char *data, int data_size)
1443 DWORD size;
1445 HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
1446 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
1448 WriteFile(hf, data, data_size, &size, NULL);
1449 CloseHandle(hf);
1452 static void write_msi_summary_info(MSIHANDLE db)
1454 MSIHANDLE summary;
1455 UINT r;
1457 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
1458 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1460 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, ";1033");
1461 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1463 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
1464 "{004757CA-5092-49c2-AD20-28E1CE0DF5F2}");
1465 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1467 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
1468 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1470 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 0, NULL, NULL);
1471 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1473 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
1474 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1476 /* write the summary changes back to the stream */
1477 r = MsiSummaryInfoPersist(summary);
1478 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1480 MsiCloseHandle(summary);
1483 static void create_database(const CHAR *name, const msi_table *tables, int num_tables)
1485 MSIHANDLE db;
1486 UINT r;
1487 int j;
1489 r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db);
1490 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1492 /* import the tables into the database */
1493 for (j = 0; j < num_tables; j++)
1495 const msi_table *table = &tables[j];
1497 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
1499 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
1500 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1502 DeleteFileA(table->filename);
1505 write_msi_summary_info(db);
1507 r = MsiDatabaseCommit(db);
1508 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1510 MsiCloseHandle(db);
1513 static void check_service_is_installed(void)
1515 SC_HANDLE scm, service;
1516 BOOL res;
1518 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
1519 ok(scm != NULL, "Failed to open the SC Manager\n");
1521 service = OpenService(scm, "TestService", SC_MANAGER_ALL_ACCESS);
1522 ok(service != NULL, "Failed to open TestService\n");
1524 res = DeleteService(service);
1525 ok(res, "Failed to delete TestService\n");
1527 CloseServiceHandle(service);
1528 CloseServiceHandle(scm);
1531 static void test_MsiInstallProduct(void)
1533 UINT r;
1534 CHAR path[MAX_PATH];
1535 LONG res;
1536 HKEY hkey;
1537 DWORD num, size, type;
1538 SC_HANDLE scm;
1540 scm = OpenSCManager(NULL, NULL, GENERIC_ALL);
1541 if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
1543 skip("Services are not implemented, we are most likely on win9x\n");
1544 return;
1546 CloseServiceHandle(scm);
1548 create_test_files();
1549 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1551 r = MsiInstallProductA(msifile, NULL);
1552 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1554 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
1555 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
1556 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
1557 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
1558 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
1559 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
1560 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
1561 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
1562 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
1563 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
1564 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
1565 ok(delete_pf("msitest", FALSE), "File not installed\n");
1567 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
1568 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1570 size = MAX_PATH;
1571 type = REG_SZ;
1572 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
1573 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1574 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
1576 size = MAX_PATH;
1577 type = REG_SZ;
1578 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
1579 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
1581 size = sizeof(num);
1582 type = REG_DWORD;
1583 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
1584 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1585 ok(num == 314, "Expected 314, got %d\n", num);
1587 size = MAX_PATH;
1588 type = REG_SZ;
1589 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
1590 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1591 ok(!lstrcmpA(path, "OrderTestValue"), "Expected imaname, got %s\n", path);
1593 check_service_is_installed();
1595 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
1597 delete_test_files();
1600 static void test_MsiSetComponentState(void)
1602 INSTALLSTATE installed, action;
1603 MSIHANDLE package;
1604 char path[MAX_PATH];
1605 UINT r;
1607 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1609 CoInitialize(NULL);
1611 lstrcpy(path, CURR_DIR);
1612 lstrcat(path, "\\");
1613 lstrcat(path, msifile);
1615 r = MsiOpenPackage(path, &package);
1616 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1618 r = MsiDoAction(package, "CostInitialize");
1619 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1621 r = MsiDoAction(package, "FileCost");
1622 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1624 r = MsiDoAction(package, "CostFinalize");
1625 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1627 r = MsiGetComponentState(package, "dangler", &installed, &action);
1628 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1629 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
1630 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
1632 r = MsiSetComponentState(package, "dangler", INSTALLSTATE_SOURCE);
1633 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1635 MsiCloseHandle(package);
1636 CoUninitialize();
1638 DeleteFileA(msifile);
1641 static void test_packagecoltypes(void)
1643 MSIHANDLE hdb, view, rec;
1644 char path[MAX_PATH];
1645 LPCSTR query;
1646 UINT r, count;
1648 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1650 CoInitialize(NULL);
1652 lstrcpy(path, CURR_DIR);
1653 lstrcat(path, "\\");
1654 lstrcat(path, msifile);
1656 r = MsiOpenDatabase(path, MSIDBOPEN_READONLY, &hdb);
1657 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1659 query = "SELECT * FROM `Media`";
1660 r = MsiDatabaseOpenView( hdb, query, &view );
1661 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
1663 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
1664 count = MsiRecordGetFieldCount( rec );
1665 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
1666 ok(count == 6, "Expected 6, got %d\n", count);
1667 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
1668 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
1669 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
1670 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
1671 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
1672 ok(check_record(rec, 6, "Source"), "wrong column label\n");
1673 MsiCloseHandle(rec);
1675 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
1676 count = MsiRecordGetFieldCount( rec );
1677 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
1678 ok(count == 6, "Expected 6, got %d\n", count);
1679 ok(check_record(rec, 1, "i2"), "wrong column label\n");
1680 ok(check_record(rec, 2, "i4"), "wrong column label\n");
1681 ok(check_record(rec, 3, "L64"), "wrong column label\n");
1682 ok(check_record(rec, 4, "S255"), "wrong column label\n");
1683 ok(check_record(rec, 5, "S32"), "wrong column label\n");
1684 ok(check_record(rec, 6, "S72"), "wrong column label\n");
1686 MsiCloseHandle(rec);
1687 MsiCloseHandle(view);
1688 MsiCloseHandle(hdb);
1689 DeleteFile(msifile);
1692 static void create_cc_test_files(void)
1694 CCAB cabParams;
1695 HFCI hfci;
1696 ERF erf;
1697 static CHAR cab_context[] = "test%d.cab";
1698 BOOL res;
1700 create_file("maximus", 500);
1701 create_file("augustus", 50000);
1702 create_file("tiberius", 500);
1703 create_file("caesar", 500);
1705 set_cab_parameters(&cabParams, "test1.cab", 40000);
1707 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
1708 fci_read, fci_write, fci_close, fci_seek, fci_delete,
1709 get_temp_file, &cabParams, cab_context);
1710 ok(hfci != NULL, "Failed to create an FCI context\n");
1712 res = add_file(hfci, "maximus", tcompTYPE_NONE);
1713 ok(res, "Failed to add file maximus\n");
1715 res = add_file(hfci, "augustus", tcompTYPE_NONE);
1716 ok(res, "Failed to add file augustus\n");
1718 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
1719 ok(res, "Failed to add file tiberius\n");
1721 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
1722 ok(res, "Failed to flush the cabinet\n");
1724 res = FCIDestroy(hfci);
1725 ok(res, "Failed to destroy the cabinet\n");
1727 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1729 DeleteFile("maximus");
1730 DeleteFile("augustus");
1731 DeleteFile("tiberius");
1732 DeleteFile("caesar");
1735 static void delete_cab_files(void)
1737 SHFILEOPSTRUCT shfl;
1738 CHAR path[MAX_PATH+10];
1740 lstrcpyA(path, CURR_DIR);
1741 lstrcatA(path, "\\*.cab");
1742 path[strlen(path) + 1] = '\0';
1744 shfl.hwnd = NULL;
1745 shfl.wFunc = FO_DELETE;
1746 shfl.pFrom = path;
1747 shfl.pTo = NULL;
1748 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
1750 SHFileOperation(&shfl);
1753 static void test_continuouscabs(void)
1755 UINT r;
1757 create_cc_test_files();
1758 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
1760 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1762 r = MsiInstallProductA(msifile, NULL);
1763 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
1765 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1766 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
1767 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1768 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1769 ok(delete_pf("msitest", FALSE), "File not installed\n");
1772 delete_cab_files();
1773 DeleteFile(msifile);
1775 create_cc_test_files();
1776 create_database(msifile, cc2_tables, sizeof(cc2_tables) / sizeof(msi_table));
1778 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1780 r = MsiInstallProductA(msifile, NULL);
1781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1782 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1783 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
1784 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
1785 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1786 ok(delete_pf("msitest", FALSE), "File not installed\n");
1788 delete_cab_files();
1789 DeleteFile(msifile);
1792 static void test_caborder(void)
1794 UINT r;
1796 create_file("imperator", 100);
1797 create_file("maximus", 500);
1798 create_file("augustus", 50000);
1799 create_file("caesar", 500);
1801 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
1803 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1805 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
1806 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
1807 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1809 r = MsiInstallProductA(msifile, NULL);
1810 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1811 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1812 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1813 todo_wine
1815 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1816 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1819 delete_cab_files();
1821 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
1822 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
1823 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1825 r = MsiInstallProductA(msifile, NULL);
1826 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1827 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1828 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1829 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1830 todo_wine
1832 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1835 delete_cab_files();
1836 DeleteFile(msifile);
1838 create_cc_test_files();
1839 create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
1841 r = MsiInstallProductA(msifile, NULL);
1842 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1843 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1844 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1845 todo_wine
1847 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1848 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1851 delete_cab_files();
1852 DeleteFile(msifile);
1854 create_cc_test_files();
1855 create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
1857 r = MsiInstallProductA(msifile, NULL);
1858 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1859 todo_wine
1861 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1862 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1863 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1864 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1867 delete_cab_files();
1868 DeleteFile("imperator");
1869 DeleteFile("maximus");
1870 DeleteFile("augustus");
1871 DeleteFile("caesar");
1872 DeleteFile(msifile);
1875 static void test_mixedmedia(void)
1877 UINT r;
1879 CreateDirectoryA("msitest", NULL);
1880 create_file("msitest\\maximus", 500);
1881 create_file("msitest\\augustus", 500);
1882 create_file("caesar", 500);
1884 create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
1886 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1888 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
1890 r = MsiInstallProductA(msifile, NULL);
1891 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1892 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
1893 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1894 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1895 ok(delete_pf("msitest", FALSE), "File not installed\n");
1897 /* Delete the files in the temp (current) folder */
1898 DeleteFile("msitest\\maximus");
1899 DeleteFile("msitest\\augustus");
1900 RemoveDirectory("msitest");
1901 DeleteFile("caesar");
1902 DeleteFile("test1.cab");
1903 DeleteFile(msifile);
1906 static void test_samesequence(void)
1908 UINT r;
1910 create_cc_test_files();
1911 create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
1913 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1915 r = MsiInstallProductA(msifile, NULL);
1916 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
1918 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1919 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
1920 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1921 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1922 ok(delete_pf("msitest", FALSE), "File not installed\n");
1925 delete_cab_files();
1926 DeleteFile(msifile);
1929 static void test_uiLevelFlags(void)
1931 UINT r;
1933 create_cc_test_files();
1934 create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
1936 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
1938 r = MsiInstallProductA(msifile, NULL);
1939 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
1941 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1942 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
1943 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1944 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
1945 ok(delete_pf("msitest", FALSE), "File not installed\n");
1948 delete_cab_files();
1949 DeleteFile(msifile);
1952 static BOOL file_matches(LPSTR path)
1954 CHAR buf[MAX_PATH];
1955 HANDLE file;
1956 DWORD size;
1958 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
1959 NULL, OPEN_EXISTING, 0, NULL);
1961 ZeroMemory(buf, MAX_PATH);
1962 ReadFile(file, buf, 15, &size, NULL);
1963 CloseHandle(file);
1965 return !lstrcmp(buf, "msitest\\maximus");
1968 static void test_readonlyfile(void)
1970 UINT r;
1971 DWORD size;
1972 HANDLE file;
1973 CHAR path[MAX_PATH];
1975 CreateDirectoryA("msitest", NULL);
1976 create_file("msitest\\maximus", 500);
1977 create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
1979 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1981 lstrcpy(path, PROG_FILES_DIR);
1982 lstrcat(path, "\\msitest");
1983 CreateDirectory(path, NULL);
1985 lstrcat(path, "\\maximus");
1986 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
1987 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
1989 WriteFile(file, "readonlyfile", 20, &size, NULL);
1990 CloseHandle(file);
1992 r = MsiInstallProductA(msifile, NULL);
1993 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1994 ok(file_matches(path), "Expected file to be overwritten\n");
1995 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1996 ok(delete_pf("msitest", FALSE), "File not installed\n");
1998 /* Delete the files in the temp (current) folder */
1999 DeleteFile("msitest\\maximus");
2000 RemoveDirectory("msitest");
2001 DeleteFile(msifile);
2004 static void test_setdirproperty(void)
2006 UINT r;
2008 CreateDirectoryA("msitest", NULL);
2009 create_file("msitest\\maximus", 500);
2010 create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
2012 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2014 r = MsiInstallProductA(msifile, NULL);
2015 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2016 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
2017 ok(delete_cf("msitest", FALSE), "File not installed\n");
2019 /* Delete the files in the temp (current) folder */
2020 DeleteFile(msifile);
2021 DeleteFile("msitest\\maximus");
2022 RemoveDirectory("msitest");
2025 static void test_cabisextracted(void)
2027 UINT r;
2029 CreateDirectoryA("msitest", NULL);
2030 create_file("msitest\\gaius", 500);
2031 create_file("maximus", 500);
2032 create_file("augustus", 500);
2033 create_file("caesar", 500);
2035 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
2036 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
2037 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2039 create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
2041 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2043 r = MsiInstallProductA(msifile, NULL);
2044 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2045 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2046 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2047 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2048 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
2049 ok(delete_pf("msitest", FALSE), "File not installed\n");
2051 /* Delete the files in the temp (current) folder */
2052 delete_cab_files();
2053 DeleteFile(msifile);
2054 DeleteFile("maximus");
2055 DeleteFile("augustus");
2056 DeleteFile("caesar");
2057 DeleteFile("msitest\\gaius");
2058 RemoveDirectory("msitest");
2061 static void test_concurrentinstall(void)
2063 UINT r;
2064 CHAR path[MAX_PATH];
2066 CreateDirectoryA("msitest", NULL);
2067 CreateDirectoryA("msitest\\msitest", NULL);
2068 create_file("msitest\\maximus", 500);
2069 create_file("msitest\\msitest\\augustus", 500);
2071 create_database(msifile, ci_tables, sizeof(ci_tables) / sizeof(msi_table));
2073 lstrcpyA(path, CURR_DIR);
2074 lstrcatA(path, "\\msitest\\concurrent.msi");
2075 create_database(path, ci2_tables, sizeof(ci2_tables) / sizeof(msi_table));
2077 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2079 r = MsiInstallProductA(msifile, NULL);
2080 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2081 if (!delete_pf("msitest\\augustus", TRUE))
2082 trace("concurrent installs not supported\n");
2083 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2084 ok(delete_pf("msitest", FALSE), "File not installed\n");
2086 DeleteFile(path);
2088 r = MsiInstallProductA(msifile, NULL);
2089 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2090 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2091 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
2092 ok(delete_pf("msitest", FALSE), "File not installed\n");
2094 DeleteFile(msifile);
2095 DeleteFile("msitest\\msitest\\augustus");
2096 DeleteFile("msitest\\maximus");
2097 RemoveDirectory("msitest\\msitest");
2098 RemoveDirectory("msitest");
2101 static void test_setpropertyfolder(void)
2103 UINT r;
2104 CHAR path[MAX_PATH];
2106 lstrcpyA(path, PROG_FILES_DIR);
2107 lstrcatA(path, "\\msitest\\added");
2109 CreateDirectoryA("msitest", NULL);
2110 create_file("msitest\\maximus", 500);
2112 create_database(msifile, spf_tables, sizeof(spf_tables) / sizeof(msi_table));
2114 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2116 r = MsiInstallProductA(msifile, NULL);
2117 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2118 if (GetFileAttributesA(path) == FILE_ATTRIBUTE_DIRECTORY)
2120 ok(delete_pf("msitest\\added\\maximus", TRUE), "File not installed\n");
2121 ok(delete_pf("msitest\\added", FALSE), "File not installed\n");
2122 ok(delete_pf("msitest", FALSE), "File not installed\n");
2124 else
2126 trace("changing folder property not supported\n");
2127 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2128 ok(delete_pf("msitest", FALSE), "File not installed\n");
2131 /* Delete the files in the temp (current) folder */
2132 DeleteFile(msifile);
2133 DeleteFile("msitest\\maximus");
2134 RemoveDirectory("msitest");
2137 static BOOL file_exists(LPCSTR file)
2139 return GetFileAttributes(file) != INVALID_FILE_ATTRIBUTES;
2142 static BOOL pf_exists(LPCSTR file)
2144 CHAR path[MAX_PATH];
2146 lstrcpyA(path, PROG_FILES_DIR);
2147 lstrcatA(path, "\\");
2148 lstrcatA(path, file);
2150 return file_exists(path);
2153 static void delete_pfmsitest_files(void)
2155 SHFILEOPSTRUCT shfl;
2156 CHAR path[MAX_PATH+11];
2158 lstrcpyA(path, PROG_FILES_DIR);
2159 lstrcatA(path, "\\msitest\\*");
2160 path[strlen(path) + 1] = '\0';
2162 shfl.hwnd = NULL;
2163 shfl.wFunc = FO_DELETE;
2164 shfl.pFrom = path;
2165 shfl.pTo = NULL;
2166 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
2168 SHFileOperation(&shfl);
2170 lstrcpyA(path, PROG_FILES_DIR);
2171 lstrcatA(path, "\\msitest");
2172 RemoveDirectoryA(path);
2175 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
2177 char val[MAX_PATH];
2178 DWORD size, type;
2179 LONG res;
2181 size = MAX_PATH;
2182 val[0] = '\0';
2183 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
2185 if (res != ERROR_SUCCESS ||
2186 (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
2188 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2189 return;
2192 if (!expected)
2193 ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val);
2194 else
2196 if (bcase)
2197 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
2198 else
2199 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
2203 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
2205 DWORD val, size, type;
2206 LONG res;
2208 size = sizeof(DWORD);
2209 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2211 if (res != ERROR_SUCCESS || type != REG_DWORD)
2213 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2214 return;
2217 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
2220 #define CHECK_REG_STR(prodkey, name, expected) \
2221 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
2223 #define CHECK_DEL_REG_STR(prodkey, name, expected) \
2224 check_reg_str(prodkey, name, expected, TRUE, __LINE__); \
2225 RegDeleteValueA(prodkey, name);
2227 #define CHECK_REG_ISTR(prodkey, name, expected) \
2228 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
2230 #define CHECK_DEL_REG_ISTR(prodkey, name, expected) \
2231 check_reg_str(prodkey, name, expected, FALSE, __LINE__); \
2232 RegDeleteValueA(prodkey, name);
2234 #define CHECK_REG_DWORD(prodkey, name, expected) \
2235 check_reg_dword(prodkey, name, expected, __LINE__);
2237 #define CHECK_DEL_REG_DWORD(prodkey, name, expected) \
2238 check_reg_dword(prodkey, name, expected, __LINE__); \
2239 RegDeleteValueA(prodkey, name);
2241 static void get_date_str(LPSTR date)
2243 SYSTEMTIME systime;
2245 static const char date_fmt[] = "%d%02d%02d";
2246 GetLocalTime(&systime);
2247 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
2250 static void test_publish_registerproduct(void)
2252 UINT r;
2253 LONG res;
2254 HKEY hkey;
2255 HKEY props, usage;
2256 LPSTR usersid;
2257 char date[MAX_PATH];
2258 char temp[MAX_PATH];
2259 char keypath[MAX_PATH];
2261 static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2262 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2263 static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2264 "\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2265 static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2266 "\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2267 static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2268 "\\51AAE0C44620A5E4788506E91F249BD2";
2270 get_user_sid(&usersid);
2271 if (!usersid)
2273 skip("ConvertSidToStringSidA is not available\n");
2274 return;
2277 get_date_str(date);
2278 GetTempPath(MAX_PATH, temp);
2280 CreateDirectoryA("msitest", NULL);
2281 create_file("msitest\\maximus", 500);
2283 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2285 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2287 /* RegisterProduct */
2288 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
2289 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2290 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2291 ok(delete_pf("msitest", FALSE), "File not installed\n");
2293 res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
2294 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2296 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
2297 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2299 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2300 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2301 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2302 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2303 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2304 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2305 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2306 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2307 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2308 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2309 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2310 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2311 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2312 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2313 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2314 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2315 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2316 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2317 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2318 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2319 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2320 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2321 todo_wine
2323 CHECK_DEL_REG_DWORD(hkey, "EstimatedSize", 12);
2326 RegDeleteKeyA(hkey, "");
2327 RegCloseKey(hkey);
2329 sprintf(keypath, userdata, usersid);
2330 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2331 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2333 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2334 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2336 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2337 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2338 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2339 CHECK_DEL_REG_STR(props, "InstallDate", date);
2340 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2341 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2342 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2343 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2344 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2345 CHECK_DEL_REG_STR(props, "Comments", NULL);
2346 CHECK_DEL_REG_STR(props, "Contact", NULL);
2347 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2348 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2349 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2350 CHECK_DEL_REG_STR(props, "Readme", NULL);
2351 CHECK_DEL_REG_STR(props, "Size", NULL);
2352 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2353 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2354 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2355 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2356 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2357 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2358 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2359 todo_wine
2361 CHECK_DEL_REG_DWORD(props, "EstimatedSize", 12);
2364 RegDeleteKeyA(props, "");
2365 RegCloseKey(props);
2367 res = RegOpenKeyA(hkey, "Usage", &usage);
2368 todo_wine
2370 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2373 RegDeleteKeyA(usage, "");
2374 RegCloseKey(usage);
2375 RegDeleteKeyA(hkey, "");
2376 RegCloseKey(hkey);
2378 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
2379 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2381 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2383 RegDeleteKeyA(hkey, "");
2384 RegCloseKey(hkey);
2386 /* RegisterProduct, machine */
2387 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 ALLUSERS=1");
2388 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2389 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2390 ok(delete_pf("msitest", FALSE), "File not installed\n");
2392 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, userugkey, &hkey);
2393 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2395 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
2396 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2398 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2399 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2400 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2401 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2402 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2403 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2404 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2405 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2406 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2407 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2408 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2409 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2410 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2411 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2412 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2413 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2414 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2415 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2416 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2417 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2418 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2419 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2420 todo_wine
2422 CHECK_DEL_REG_DWORD(hkey, "EstimatedSize", 12);
2425 RegDeleteKeyA(hkey, "");
2426 RegCloseKey(hkey);
2428 sprintf(keypath, userdata, "S-1-5-18");
2429 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2430 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2432 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2433 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2435 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2436 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2437 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2438 CHECK_DEL_REG_STR(props, "InstallDate", date);
2439 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2440 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2441 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2442 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2443 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2444 CHECK_DEL_REG_STR(props, "Comments", NULL);
2445 CHECK_DEL_REG_STR(props, "Contact", NULL);
2446 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2447 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2448 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2449 CHECK_DEL_REG_STR(props, "Readme", NULL);
2450 CHECK_DEL_REG_STR(props, "Size", NULL);
2451 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2452 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2453 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2454 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2455 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2456 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2457 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2458 todo_wine
2460 CHECK_DEL_REG_DWORD(props, "EstimatedSize", 12);
2463 RegDeleteKeyA(props, "");
2464 RegCloseKey(props);
2466 res = RegOpenKeyA(hkey, "Usage", &usage);
2467 todo_wine
2469 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2472 RegDeleteKeyA(usage, "");
2473 RegCloseKey(usage);
2474 RegDeleteKeyA(hkey, "");
2475 RegCloseKey(hkey);
2477 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
2478 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2480 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2482 RegDeleteKeyA(hkey, "");
2483 RegCloseKey(hkey);
2485 DeleteFile(msifile);
2486 DeleteFile("msitest\\maximus");
2487 RemoveDirectory("msitest");
2488 HeapFree(GetProcessHeap(), 0, usersid);
2491 static void test_publish_publishproduct(void)
2493 UINT r;
2494 LONG res;
2495 LPSTR usersid;
2496 HKEY sourcelist, net, props;
2497 HKEY hkey, patches, media;
2498 CHAR keypath[MAX_PATH];
2499 CHAR temp[MAX_PATH];
2500 CHAR path[MAX_PATH];
2502 static const CHAR prodpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2503 "\\Installer\\UserData\\%s\\Products"
2504 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2505 static const CHAR cuprodpath[] = "Software\\Microsoft\\Installer\\Products"
2506 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2507 static const CHAR cuupgrades[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2508 "\\51AAE0C44620A5E4788506E91F249BD2";
2509 static const CHAR badprod[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2510 "\\Installer\\Products"
2511 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2512 static const CHAR machprod[] = "Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2513 static const CHAR machup[] = "Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2515 get_user_sid(&usersid);
2516 if (!usersid)
2518 skip("ConvertSidToStringSidA is not available\n");
2519 return;
2522 GetTempPath(MAX_PATH, temp);
2524 CreateDirectoryA("msitest", NULL);
2525 create_file("msitest\\maximus", 500);
2527 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2529 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2531 /* PublishProduct, current user */
2532 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2533 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2534 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2535 ok(delete_pf("msitest", FALSE), "File not installed\n");
2537 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
2538 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2540 sprintf(keypath, prodpath, usersid);
2541 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2542 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2544 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2545 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2547 res = RegOpenKeyA(hkey, "Patches", &patches);
2548 todo_wine
2550 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2552 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
2555 RegDeleteKeyA(patches, "");
2556 RegCloseKey(patches);
2557 RegDeleteKeyA(hkey, "");
2558 RegCloseKey(hkey);
2560 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
2561 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2563 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
2564 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
2565 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2566 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2567 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
2568 CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
2569 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
2570 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
2571 CHECK_DEL_REG_STR(hkey, "Clients", ":");
2573 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
2574 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2576 lstrcpyA(path, "n;1;");
2577 lstrcatA(path, temp);
2578 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
2579 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
2581 res = RegOpenKeyA(sourcelist, "Net", &net);
2582 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2584 CHECK_DEL_REG_STR(net, "1", temp);
2586 RegDeleteKeyA(net, "");
2587 RegCloseKey(net);
2589 res = RegOpenKeyA(sourcelist, "Media", &media);
2590 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2592 CHECK_DEL_REG_STR(media, "1", "DISK1;");
2594 RegDeleteKeyA(media, "");
2595 RegCloseKey(media);
2596 RegDeleteKeyA(sourcelist, "");
2597 RegCloseKey(sourcelist);
2598 RegDeleteKeyA(hkey, "");
2599 RegCloseKey(hkey);
2601 res = RegOpenKeyA(HKEY_CURRENT_USER, cuupgrades, &hkey);
2602 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2604 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2606 RegDeleteKeyA(hkey, "");
2607 RegCloseKey(hkey);
2609 /* PublishProduct, machine */
2610 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
2611 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2612 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2613 ok(delete_pf("msitest", FALSE), "File not installed\n");
2615 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
2616 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2618 sprintf(keypath, prodpath, "S-1-5-18");
2619 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2620 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2622 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2623 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2625 res = RegOpenKeyA(hkey, "Patches", &patches);
2626 todo_wine
2628 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2630 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
2633 RegDeleteKeyA(patches, "");
2634 RegCloseKey(patches);
2635 RegDeleteKeyA(hkey, "");
2636 RegCloseKey(hkey);
2638 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machprod, &hkey);
2639 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2641 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
2642 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
2643 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2644 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2645 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
2646 todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
2647 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
2648 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
2649 CHECK_DEL_REG_STR(hkey, "Clients", ":");
2651 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
2652 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2654 lstrcpyA(path, "n;1;");
2655 lstrcatA(path, temp);
2656 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
2657 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
2659 res = RegOpenKeyA(sourcelist, "Net", &net);
2660 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2662 CHECK_DEL_REG_STR(net, "1", temp);
2664 RegDeleteKeyA(net, "");
2665 RegCloseKey(net);
2667 res = RegOpenKeyA(sourcelist, "Media", &media);
2668 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2670 CHECK_DEL_REG_STR(media, "1", "DISK1;");
2672 RegDeleteKeyA(media, "");
2673 RegCloseKey(media);
2674 RegDeleteKeyA(sourcelist, "");
2675 RegCloseKey(sourcelist);
2676 RegDeleteKeyA(hkey, "");
2677 RegCloseKey(hkey);
2679 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machup, &hkey);
2680 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2682 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2684 RegDeleteKeyA(hkey, "");
2685 RegCloseKey(hkey);
2687 DeleteFile(msifile);
2688 DeleteFile("msitest\\maximus");
2689 RemoveDirectory("msitest");
2690 HeapFree(GetProcessHeap(), 0, usersid);
2693 static void test_publish_publishfeatures(void)
2695 UINT r;
2696 LONG res;
2697 HKEY hkey;
2698 LPSTR usersid;
2699 CHAR keypath[MAX_PATH];
2701 static const CHAR cupath[] = "Software\\Microsoft\\Installer\\Features"
2702 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2703 static const CHAR udpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2704 "\\Installer\\UserData\\%s\\Products"
2705 "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
2706 static const CHAR featkey[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2707 "\\Installer\\Features";
2708 static const CHAR classfeat[] = "Software\\Classes\\Installer\\Features"
2709 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2711 get_user_sid(&usersid);
2712 if (!usersid)
2714 skip("ConvertSidToStringSidA is not available\n");
2715 return;
2718 CreateDirectoryA("msitest", NULL);
2719 create_file("msitest\\maximus", 500);
2721 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2723 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2725 /* PublishFeatures, current user */
2726 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
2727 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2728 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2729 ok(delete_pf("msitest", FALSE), "File not installed\n");
2731 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
2732 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2734 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
2735 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2737 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
2738 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2740 CHECK_REG_STR(hkey, "feature", "");
2741 CHECK_REG_STR(hkey, "montecristo", "");
2743 RegDeleteValueA(hkey, "feature");
2744 RegDeleteValueA(hkey, "montecristo");
2745 RegDeleteKeyA(hkey, "");
2746 RegCloseKey(hkey);
2748 sprintf(keypath, udpath, usersid);
2749 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2750 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2752 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
2753 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
2755 RegDeleteValueA(hkey, "feature");
2756 RegDeleteValueA(hkey, "montecristo");
2757 RegDeleteKeyA(hkey, "");
2758 RegCloseKey(hkey);
2760 /* PublishFeatures, machine */
2761 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
2762 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2763 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2764 ok(delete_pf("msitest", FALSE), "File not installed\n");
2766 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
2767 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2769 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
2770 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2772 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
2773 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2775 CHECK_REG_STR(hkey, "feature", "");
2776 CHECK_REG_STR(hkey, "montecristo", "");
2778 RegDeleteValueA(hkey, "feature");
2779 RegDeleteValueA(hkey, "montecristo");
2780 RegDeleteKeyA(hkey, "");
2781 RegCloseKey(hkey);
2783 sprintf(keypath, udpath, "S-1-5-18");
2784 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2785 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2787 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
2788 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
2790 RegDeleteValueA(hkey, "feature");
2791 RegDeleteValueA(hkey, "montecristo");
2792 RegDeleteKeyA(hkey, "");
2793 RegCloseKey(hkey);
2795 DeleteFile(msifile);
2796 DeleteFile("msitest\\maximus");
2797 RemoveDirectory("msitest");
2798 HeapFree(GetProcessHeap(), 0, usersid);
2801 static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
2803 DWORD len = 0;
2804 LPSTR val;
2805 LONG r;
2807 r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
2808 if (r != ERROR_SUCCESS)
2809 return NULL;
2811 len += sizeof (WCHAR);
2812 val = HeapAlloc(GetProcessHeap(), 0, len);
2813 if (!val) return NULL;
2814 val[0] = 0;
2815 RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
2816 return val;
2819 static void get_owner_company(LPSTR *owner, LPSTR *company)
2821 LONG res;
2822 HKEY hkey;
2824 *owner = *company = NULL;
2826 res = RegOpenKeyA(HKEY_CURRENT_USER,
2827 "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
2828 if (res == ERROR_SUCCESS)
2830 *owner = reg_get_val_str(hkey, "DefName");
2831 *company = reg_get_val_str(hkey, "DefCompany");
2832 RegCloseKey(hkey);
2835 if (!*owner || !*company)
2837 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
2838 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey);
2839 if (res == ERROR_SUCCESS)
2841 *owner = reg_get_val_str(hkey, "RegisteredOwner");
2842 *company = reg_get_val_str(hkey, "RegisteredOrganization");
2843 RegCloseKey(hkey);
2847 if (!*owner || !*company)
2849 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
2850 "Software\\Microsoft\\Windows NT\\CurrentVersion", &hkey);
2851 if (res == ERROR_SUCCESS)
2853 *owner = reg_get_val_str(hkey, "RegisteredOwner");
2854 *company = reg_get_val_str(hkey, "RegisteredOrganization");
2855 RegCloseKey(hkey);
2860 static void test_publish_registeruser(void)
2862 UINT r;
2863 LONG res;
2864 HKEY props;
2865 LPSTR usersid;
2866 LPSTR owner, company;
2867 CHAR keypath[MAX_PATH];
2869 static const CHAR keyfmt[] =
2870 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
2871 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
2873 get_user_sid(&usersid);
2874 if (!usersid)
2876 skip("ConvertSidToStringSidA is not available\n");
2877 return;
2880 get_owner_company(&owner, &company);
2882 CreateDirectoryA("msitest", NULL);
2883 create_file("msitest\\maximus", 500);
2885 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2887 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2889 /* RegisterUser, per-user */
2890 r = MsiInstallProductA(msifile, "REGISTER_USER=1");
2891 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2892 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2893 ok(delete_pf("msitest", FALSE), "File not installed\n");
2895 sprintf(keypath, keyfmt, usersid);
2897 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
2898 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2900 CHECK_REG_STR(props, "ProductID", "none");
2901 CHECK_REG_STR(props, "RegCompany", company);
2902 CHECK_REG_STR(props, "RegOwner", owner);
2904 RegDeleteValueA(props, "ProductID");
2905 RegDeleteValueA(props, "RegCompany");
2906 RegDeleteValueA(props, "RegOwner");
2907 RegDeleteKeyA(props, "");
2908 RegCloseKey(props);
2910 /* RegisterUser, machine */
2911 r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
2912 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2913 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2914 ok(delete_pf("msitest", FALSE), "File not installed\n");
2916 sprintf(keypath, keyfmt, "S-1-5-18");
2918 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
2919 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2921 CHECK_REG_STR(props, "ProductID", "none");
2922 CHECK_REG_STR(props, "RegCompany", company);
2923 CHECK_REG_STR(props, "RegOwner", owner);
2925 RegDeleteValueA(props, "ProductID");
2926 RegDeleteValueA(props, "RegCompany");
2927 RegDeleteValueA(props, "RegOwner");
2928 RegDeleteKeyA(props, "");
2929 RegCloseKey(props);
2931 HeapFree(GetProcessHeap(), 0, company);
2932 HeapFree(GetProcessHeap(), 0, owner);
2934 DeleteFile(msifile);
2935 DeleteFile("msitest\\maximus");
2936 RemoveDirectory("msitest");
2939 static void test_publish_processcomponents(void)
2941 UINT r;
2942 LONG res;
2943 DWORD size;
2944 HKEY comp, hkey;
2945 LPSTR usersid;
2946 CHAR val[MAX_PATH];
2947 CHAR keypath[MAX_PATH];
2949 static const CHAR keyfmt[] =
2950 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
2951 "UserData\\%s\\Components\\CBABC2FDCCB35E749A8944D8C1C098B5";
2952 static const CHAR compkey[] =
2953 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
2955 get_user_sid(&usersid);
2956 if (!usersid)
2958 skip("ConvertSidToStringSidA is not available\n");
2959 return;
2962 CreateDirectoryA("msitest", NULL);
2963 create_file("msitest\\maximus", 500);
2965 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2967 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2969 /* ProcessComponents, per-user */
2970 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
2971 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2972 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2973 ok(delete_pf("msitest", FALSE), "File not installed\n");
2975 sprintf(keypath, keyfmt, usersid);
2977 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
2978 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2980 size = MAX_PATH;
2981 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
2982 NULL, NULL, (LPBYTE)val, &size);
2983 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2984 ok(!lstrcmpA(val, "C:\\Program Files\\msitest\\maximus"),
2985 "Expected \"%s\", got \"%s\"\n", "C:\\Program Files\\msitest\\maximus", val);
2987 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
2988 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2990 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
2991 RegDeleteKeyA(comp, "");
2992 RegCloseKey(comp);
2994 /* ProcessComponents, machine */
2995 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
2996 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2997 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2998 ok(delete_pf("msitest", FALSE), "File not installed\n");
3000 sprintf(keypath, keyfmt, "S-1-5-18");
3002 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
3003 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3005 size = MAX_PATH;
3006 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3007 NULL, NULL, (LPBYTE)val, &size);
3008 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3009 ok(!lstrcmpA(val, "C:\\Program Files\\msitest\\maximus"),
3010 "Expected \"%s\", got \"%s\"\n", "C:\\Program Files\\msitest\\maximus", val);
3012 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
3013 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3015 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3016 RegDeleteKeyA(comp, "");
3017 RegCloseKey(comp);
3019 DeleteFile(msifile);
3020 DeleteFile("msitest\\maximus");
3021 RemoveDirectory("msitest");
3024 static void test_publish(void)
3026 UINT r;
3027 LONG res;
3028 HKEY uninstall, prodkey;
3029 INSTALLSTATE state;
3030 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3031 char date[MAX_PATH];
3032 char temp[MAX_PATH];
3034 static const CHAR subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3036 if (!pMsiQueryComponentStateA)
3038 skip("MsiQueryComponentStateA is not available\n");
3039 return;
3042 get_date_str(date);
3043 GetTempPath(MAX_PATH, temp);
3045 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, subkey, &uninstall);
3046 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3048 CreateDirectoryA("msitest", NULL);
3049 create_file("msitest\\maximus", 500);
3051 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3053 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3055 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3056 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3058 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3059 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3061 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3062 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3064 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3065 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3066 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3067 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3069 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3070 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3072 /* nothing published */
3073 r = MsiInstallProductA(msifile, NULL);
3074 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3075 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3076 ok(pf_exists("msitest"), "File not installed\n");
3078 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3079 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3081 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3082 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3084 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3085 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3087 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3088 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3089 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3090 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3092 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3093 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3095 /* PublishProduct and RegisterProduct */
3096 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
3097 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3098 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3099 ok(pf_exists("msitest"), "File not installed\n");
3101 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3102 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3104 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3105 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3107 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3108 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3110 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3111 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3112 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
3113 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3115 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3116 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3118 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3119 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3120 CHECK_REG_STR(prodkey, "InstallDate", date);
3121 CHECK_REG_STR(prodkey, "InstallSource", temp);
3122 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3123 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3124 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3125 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3126 CHECK_REG_STR(prodkey, "Comments", NULL);
3127 CHECK_REG_STR(prodkey, "Contact", NULL);
3128 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3129 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3130 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3131 CHECK_REG_STR(prodkey, "Readme", NULL);
3132 CHECK_REG_STR(prodkey, "Size", NULL);
3133 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3134 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3135 CHECK_REG_DWORD(prodkey, "Language", 1033);
3136 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3137 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3138 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3139 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3140 todo_wine
3142 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3145 RegCloseKey(prodkey);
3147 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3148 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3149 ok(pf_exists("msitest\\maximus"), "File deleted\n");
3150 ok(pf_exists("msitest"), "File deleted\n");
3152 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3153 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3155 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3156 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3158 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3159 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3161 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3162 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3163 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3164 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3166 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3167 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3169 /* complete install */
3170 r = MsiInstallProductA(msifile, "FULL=1");
3171 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3172 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3173 ok(pf_exists("msitest"), "File not installed\n");
3175 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3176 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3178 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3179 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3181 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3182 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3184 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3185 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3186 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3187 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3189 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3190 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3192 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3193 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3194 CHECK_REG_STR(prodkey, "InstallDate", date);
3195 CHECK_REG_STR(prodkey, "InstallSource", temp);
3196 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3197 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3198 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3199 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3200 CHECK_REG_STR(prodkey, "Comments", NULL);
3201 CHECK_REG_STR(prodkey, "Contact", NULL);
3202 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3203 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3204 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3205 CHECK_REG_STR(prodkey, "Readme", NULL);
3206 CHECK_REG_STR(prodkey, "Size", NULL);
3207 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3208 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3209 CHECK_REG_DWORD(prodkey, "Language", 1033);
3210 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3211 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3212 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3213 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3214 todo_wine
3216 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3219 RegCloseKey(prodkey);
3221 /* no UnpublishFeatures */
3222 r = MsiInstallProductA(msifile, "REMOVE=ALL");
3223 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3224 todo_wine
3226 ok(!pf_exists("msitest\\maximus"), "File deleted\n");
3227 ok(!pf_exists("msitest"), "File deleted\n");
3230 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3231 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3233 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3234 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3236 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3237 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3239 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3240 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3241 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3242 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3244 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3245 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3247 /* complete install */
3248 r = MsiInstallProductA(msifile, "FULL=1");
3249 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3250 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3251 ok(pf_exists("msitest"), "File not installed\n");
3253 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3254 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3256 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3257 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3259 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3260 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3262 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3263 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3264 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3265 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3267 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3268 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3270 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3271 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3272 CHECK_REG_STR(prodkey, "InstallDate", date);
3273 CHECK_REG_STR(prodkey, "InstallSource", temp);
3274 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3275 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3276 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3277 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3278 CHECK_REG_STR(prodkey, "Comments", NULL);
3279 CHECK_REG_STR(prodkey, "Contact", NULL);
3280 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3281 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3282 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3283 CHECK_REG_STR(prodkey, "Readme", NULL);
3284 CHECK_REG_STR(prodkey, "Size", NULL);
3285 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3286 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3287 CHECK_REG_DWORD(prodkey, "Language", 1033);
3288 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3289 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3290 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3291 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3292 todo_wine
3294 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3297 RegCloseKey(prodkey);
3299 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
3300 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
3301 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3302 ok(pf_exists("msitest\\maximus"), "File deleted\n");
3303 ok(pf_exists("msitest"), "File deleted\n");
3305 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3306 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3308 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3309 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3311 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3312 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3314 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3315 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3316 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3317 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3319 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3320 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3322 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3323 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3324 CHECK_REG_STR(prodkey, "InstallDate", date);
3325 CHECK_REG_STR(prodkey, "InstallSource", temp);
3326 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3327 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3328 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3329 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3330 CHECK_REG_STR(prodkey, "Comments", NULL);
3331 CHECK_REG_STR(prodkey, "Contact", NULL);
3332 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3333 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3334 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3335 CHECK_REG_STR(prodkey, "Readme", NULL);
3336 CHECK_REG_STR(prodkey, "Size", NULL);
3337 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3338 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3339 CHECK_REG_DWORD(prodkey, "Language", 1033);
3340 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3341 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3342 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3343 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3344 todo_wine
3346 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3349 RegCloseKey(prodkey);
3351 /* complete install */
3352 r = MsiInstallProductA(msifile, "FULL=1");
3353 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3354 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3355 ok(pf_exists("msitest"), "File not installed\n");
3357 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3358 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3360 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3361 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3363 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3364 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3366 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3367 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3368 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3369 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3371 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3372 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3374 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3375 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3376 CHECK_REG_STR(prodkey, "InstallDate", date);
3377 CHECK_REG_STR(prodkey, "InstallSource", temp);
3378 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3379 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3380 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3381 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3382 CHECK_REG_STR(prodkey, "Comments", NULL);
3383 CHECK_REG_STR(prodkey, "Contact", NULL);
3384 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3385 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3386 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3387 CHECK_REG_STR(prodkey, "Readme", NULL);
3388 CHECK_REG_STR(prodkey, "Size", NULL);
3389 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3390 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3391 CHECK_REG_DWORD(prodkey, "Language", 1033);
3392 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3393 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3394 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3395 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3396 todo_wine
3398 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3401 RegCloseKey(prodkey);
3403 /* UnpublishFeatures, both features removed */
3404 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
3405 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3406 todo_wine
3408 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3409 ok(!pf_exists("msitest"), "File not deleted\n");
3412 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3413 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3415 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3416 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3418 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3419 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3421 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3422 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3423 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3424 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3426 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3427 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3429 /* complete install */
3430 r = MsiInstallProductA(msifile, "FULL=1");
3431 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3432 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3433 ok(pf_exists("msitest"), "File not installed\n");
3435 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3436 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3438 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3439 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3441 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3442 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3444 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3445 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3446 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3447 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3449 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3450 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3452 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3453 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3454 CHECK_REG_STR(prodkey, "InstallDate", date);
3455 CHECK_REG_STR(prodkey, "InstallSource", temp);
3456 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3457 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3458 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3459 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3460 CHECK_REG_STR(prodkey, "Comments", NULL);
3461 CHECK_REG_STR(prodkey, "Contact", NULL);
3462 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3463 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3464 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3465 CHECK_REG_STR(prodkey, "Readme", NULL);
3466 CHECK_REG_STR(prodkey, "Size", NULL);
3467 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3468 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3469 CHECK_REG_DWORD(prodkey, "Language", 1033);
3470 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3471 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3472 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3473 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3474 todo_wine
3476 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3479 RegCloseKey(prodkey);
3481 /* complete uninstall */
3482 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3483 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3484 todo_wine
3486 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3487 ok(!pf_exists("msitest"), "File not deleted\n");
3490 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3491 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3493 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3494 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3496 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3497 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3499 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3500 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3501 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3502 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3504 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3505 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3507 /* make sure 'Program Files\msitest' is removed */
3508 delete_pfmsitest_files();
3510 RegCloseKey(uninstall);
3511 DeleteFile(msifile);
3512 DeleteFile("msitest\\maximus");
3513 RemoveDirectory("msitest");
3516 static void test_publishsourcelist(void)
3518 UINT r;
3519 DWORD size;
3520 CHAR value[MAX_PATH];
3521 CHAR path[MAX_PATH];
3522 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3524 if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
3526 skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
3527 return;
3530 CreateDirectoryA("msitest", NULL);
3531 create_file("msitest\\maximus", 500);
3533 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3535 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3537 r = MsiInstallProductA(msifile, NULL);
3538 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3539 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3540 ok(pf_exists("msitest"), "File not installed\n");
3542 /* nothing published */
3543 size = 0xdeadbeef;
3544 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3545 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3546 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3547 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3549 size = 0xdeadbeef;
3550 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3551 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3552 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3553 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3555 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
3556 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3557 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3558 ok(pf_exists("msitest"), "File not installed\n");
3560 /* after RegisterProduct */
3561 size = 0xdeadbeef;
3562 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3563 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3564 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3565 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3567 size = 0xdeadbeef;
3568 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3569 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3570 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3571 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3573 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3574 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3575 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3576 ok(pf_exists("msitest"), "File not installed\n");
3578 /* after ProcessComponents */
3579 size = 0xdeadbeef;
3580 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3581 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3582 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3583 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3585 size = 0xdeadbeef;
3586 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3587 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3588 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3589 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3591 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
3592 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3593 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3594 ok(pf_exists("msitest"), "File not installed\n");
3596 /* after PublishFeatures */
3597 size = 0xdeadbeef;
3598 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3599 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3600 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3601 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3603 size = 0xdeadbeef;
3604 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3605 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3606 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3607 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3609 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
3610 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3611 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3612 ok(pf_exists("msitest"), "File not installed\n");
3614 /* after PublishProduct */
3615 size = MAX_PATH;
3616 lstrcpyA(value, "aaa");
3617 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3618 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
3619 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3620 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
3621 ok(size == 11, "Expected 11, got %d\n", size);
3623 size = MAX_PATH;
3624 lstrcpyA(value, "aaa");
3625 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3626 MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATH, value, &size);
3627 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3628 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
3629 ok(size == 0, "Expected 0, got %d\n", size);
3631 size = MAX_PATH;
3632 lstrcpyA(value, "aaa");
3633 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3634 MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPT, value, &size);
3635 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3636 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
3637 ok(size == 0, "Expected 0, got %d\n", size);
3639 lstrcpyA(path, CURR_DIR);
3640 lstrcatA(path, "\\");
3642 size = MAX_PATH;
3643 lstrcpyA(value, "aaa");
3644 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3645 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3646 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3647 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3648 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3650 size = MAX_PATH;
3651 lstrcpyA(value, "aaa");
3652 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3653 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE, value, &size);
3654 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3655 ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
3656 ok(size == 1, "Expected 1, got %d\n", size);
3658 size = MAX_PATH;
3659 lstrcpyA(value, "aaa");
3660 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3661 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
3662 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
3663 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
3664 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
3666 size = MAX_PATH;
3667 lstrcpyA(value, "aaa");
3668 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3669 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
3670 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3671 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3672 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3674 size = MAX_PATH;
3675 lstrcpyA(value, "aaa");
3676 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3677 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
3678 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
3679 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
3680 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
3682 /* complete uninstall */
3683 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3684 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3685 todo_wine
3687 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3688 ok(!pf_exists("msitest"), "File not deleted\n");
3691 /* make sure 'Program Files\msitest' is removed */
3692 delete_pfmsitest_files();
3694 DeleteFile(msifile);
3695 DeleteFile("msitest\\maximus");
3696 RemoveDirectory("msitest");
3699 static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
3701 MSIHANDLE hview = 0;
3702 UINT r;
3704 r = MsiDatabaseOpenView(hdb, query, &hview);
3705 if(r != ERROR_SUCCESS)
3706 return r;
3708 r = MsiViewExecute(hview, hrec);
3709 if(r == ERROR_SUCCESS)
3710 r = MsiViewClose(hview);
3711 MsiCloseHandle(hview);
3712 return r;
3715 static void set_transform_summary_info(void)
3717 UINT r;
3718 MSIHANDLE suminfo = 0;
3720 /* build summary info */
3721 r = MsiGetSummaryInformation(0, mstfile, 3, &suminfo);
3722 todo_wine
3724 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
3727 r = MsiSummaryInfoSetProperty(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
3728 todo_wine
3730 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3733 r = MsiSummaryInfoSetProperty(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
3734 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3735 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3736 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
3737 todo_wine
3739 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
3742 r = MsiSummaryInfoSetProperty(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
3743 todo_wine
3745 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3748 r = MsiSummaryInfoPersist(suminfo);
3749 todo_wine
3751 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
3754 r = MsiCloseHandle(suminfo);
3755 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
3758 static void generate_transform(void)
3760 MSIHANDLE hdb1, hdb2;
3761 LPCSTR query;
3762 UINT r;
3764 /* start with two identical databases */
3765 CopyFile(msifile, msifile2, FALSE);
3767 r = MsiOpenDatabase(msifile2, MSIDBOPEN_TRANSACT, &hdb1);
3768 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3770 r = MsiDatabaseCommit(hdb1);
3771 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
3773 r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb2);
3774 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3776 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
3777 r = run_query(hdb1, 0, query);
3778 ok(r == ERROR_SUCCESS, "failed to add property\n");
3780 /* database needs to be committed */
3781 MsiDatabaseCommit(hdb1);
3783 r = MsiDatabaseGenerateTransform(hdb1, hdb2, mstfile, 0, 0);
3784 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3786 #if 0 /* not implemented in wine yet */
3787 r = MsiCreateTransformSummaryInfo(hdb2, hdb2, mstfile, 0, 0);
3788 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3789 #endif
3791 MsiCloseHandle(hdb1);
3792 MsiCloseHandle(hdb2);
3795 /* data for generating a transform */
3797 /* tables transform names - encoded as they would be in an msi database file */
3798 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
3799 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
3800 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
3802 /* data in each table */
3803 static const char data1[] = /* _StringData */
3804 "propval"; /* all the strings squashed together */
3806 static const WCHAR data2[] = { /* _StringPool */
3807 /* len, refs */
3808 0, 0, /* string 0 '' */
3809 4, 1, /* string 1 'prop' */
3810 3, 1, /* string 2 'val' */
3813 static const WCHAR data3[] = { /* Property */
3814 0x0201, 0x0001, 0x0002,
3817 static const struct {
3818 LPCWSTR name;
3819 const void *data;
3820 DWORD size;
3821 } table_transform_data[] =
3823 { name1, data1, sizeof data1 - 1 },
3824 { name2, data2, sizeof data2 },
3825 { name3, data3, sizeof data3 },
3828 #define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
3830 static void generate_transform_manual(void)
3832 IStorage *stg = NULL;
3833 IStream *stm;
3834 WCHAR name[0x20];
3835 HRESULT r;
3836 DWORD i, count;
3837 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
3839 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
3841 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
3843 r = StgCreateDocfile(name, mode, 0, &stg);
3844 ok(r == S_OK, "failed to create storage\n");
3845 if (!stg)
3846 return;
3848 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
3849 ok(r == S_OK, "failed to set storage type\n");
3851 for (i=0; i<NUM_TRANSFORM_TABLES; i++)
3853 r = IStorage_CreateStream(stg, table_transform_data[i].name,
3854 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3855 if (FAILED(r))
3857 ok(0, "failed to create stream %08x\n", r);
3858 continue;
3861 r = IStream_Write(stm, table_transform_data[i].data,
3862 table_transform_data[i].size, &count);
3863 if (FAILED(r) || count != table_transform_data[i].size)
3864 ok(0, "failed to write stream\n");
3865 IStream_Release(stm);
3868 IStorage_Release(stg);
3870 set_transform_summary_info();
3873 static void test_transformprop(void)
3875 UINT r;
3877 CreateDirectoryA("msitest", NULL);
3878 create_file("msitest\\augustus", 500);
3880 create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
3882 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3884 r = MsiInstallProductA(msifile, NULL);
3885 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3886 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3887 ok(!delete_pf("msitest", FALSE), "File installed\n");
3889 if (0)
3890 generate_transform();
3891 else
3892 generate_transform_manual();
3894 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
3895 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3896 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3897 ok(delete_pf("msitest", FALSE), "File not installed\n");
3899 /* Delete the files in the temp (current) folder */
3900 DeleteFile(msifile);
3901 DeleteFile(msifile2);
3902 DeleteFile(mstfile);
3903 DeleteFile("msitest\\augustus");
3904 RemoveDirectory("msitest");
3907 static void test_currentworkingdir(void)
3909 UINT r;
3910 CHAR path[MAX_PATH];
3911 LPSTR ptr, ptr2;
3913 CreateDirectoryA("msitest", NULL);
3914 create_file("msitest\\augustus", 500);
3916 create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
3918 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3920 CreateDirectoryA("diffdir", NULL);
3921 SetCurrentDirectoryA("diffdir");
3923 sprintf(path, "..\\%s", msifile);
3924 r = MsiInstallProductA(path, NULL);
3925 todo_wine
3927 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
3928 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3929 ok(!delete_pf("msitest", FALSE), "File installed\n");
3932 sprintf(path, "%s\\%s", CURR_DIR, msifile);
3933 r = MsiInstallProductA(path, NULL);
3934 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3935 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3936 ok(delete_pf("msitest", FALSE), "File not installed\n");
3938 lstrcpyA(path, CURR_DIR);
3939 if (path[lstrlenA(path) - 1] != '\\')
3940 lstrcatA(path, "\\");
3941 lstrcatA(path, "msitest.msi");
3943 ptr2 = strrchr(path, '\\');
3944 *ptr2 = '\0';
3945 ptr = strrchr(path, '\\');
3946 *ptr2 = '\\';
3947 *(ptr++) = '\0';
3949 SetCurrentDirectoryA(path);
3951 r = MsiInstallProductA(ptr, NULL);
3952 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3953 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3954 ok(delete_pf("msitest", FALSE), "File not installed\n");
3956 SetCurrentDirectoryA(CURR_DIR);
3958 DeleteFile(msifile);
3959 DeleteFile("msitest\\augustus");
3960 RemoveDirectory("msitest");
3961 RemoveDirectory("diffdir");
3964 static void set_admin_summary_info(const CHAR *name)
3966 MSIHANDLE db, summary;
3967 UINT r;
3969 r = MsiOpenDatabaseA(name, MSIDBOPEN_DIRECT, &db);
3970 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3972 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
3973 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3975 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
3976 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3978 /* write the summary changes back to the stream */
3979 r = MsiSummaryInfoPersist(summary);
3980 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3982 MsiCloseHandle(summary);
3984 r = MsiDatabaseCommit(db);
3985 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3987 MsiCloseHandle(db);
3990 static void test_admin(void)
3992 UINT r;
3994 CreateDirectoryA("msitest", NULL);
3995 create_file("msitest\\augustus", 500);
3997 create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
3998 set_admin_summary_info(msifile);
4000 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4002 r = MsiInstallProductA(msifile, NULL);
4003 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4004 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4005 ok(!delete_pf("msitest", FALSE), "File installed\n");
4006 ok(!DeleteFile("c:\\msitest\\augustus"), "File installed\n");
4007 ok(!RemoveDirectory("c:\\msitest"), "File installed\n");
4009 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
4010 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4011 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4012 ok(!delete_pf("msitest", FALSE), "File installed\n");
4013 todo_wine
4015 ok(DeleteFile("c:\\msitest\\augustus"), "File not installed\n");
4016 ok(RemoveDirectory("c:\\msitest"), "File not installed\n");
4019 DeleteFile(msifile);
4020 DeleteFile("msitest\\augustus");
4021 RemoveDirectory("msitest");
4024 static void set_admin_property_stream(LPCSTR file)
4026 IStorage *stg;
4027 IStream *stm;
4028 WCHAR fileW[MAX_PATH];
4029 HRESULT hr;
4030 DWORD count;
4031 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
4033 /* AdminProperties */
4034 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
4035 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',0};
4037 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
4039 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
4040 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4041 if (!stg)
4042 return;
4044 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
4045 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4047 hr = IStream_Write(stm, data, sizeof(data), &count);
4048 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4050 IStream_Release(stm);
4051 IStorage_Release(stg);
4054 static void test_adminprops(void)
4056 UINT r;
4058 CreateDirectoryA("msitest", NULL);
4059 create_file("msitest\\augustus", 500);
4061 create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
4062 set_admin_summary_info(msifile);
4063 set_admin_property_stream(msifile);
4065 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4067 r = MsiInstallProductA(msifile, NULL);
4068 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4069 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4070 ok(delete_pf("msitest", FALSE), "File installed\n");
4072 DeleteFile(msifile);
4073 DeleteFile("msitest\\augustus");
4074 RemoveDirectory("msitest");
4077 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
4079 CHAR path[MAX_PATH];
4081 lstrcpyA(path, PROG_FILES_DIR);
4082 lstrcatA(path, "\\");
4083 lstrcatA(path, file);
4085 if (is_file)
4086 create_file_data(path, data, 500);
4087 else
4088 CreateDirectoryA(path, NULL);
4091 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
4093 static void test_removefiles(void)
4095 UINT r;
4097 CreateDirectoryA("msitest", NULL);
4098 create_file("msitest\\hydrogen", 500);
4099 create_file("msitest\\helium", 500);
4100 create_file("msitest\\lithium", 500);
4102 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
4104 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4106 r = MsiInstallProductA(msifile, NULL);
4107 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4108 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4109 ok(!pf_exists("msitest\\helium"), "File installed\n");
4110 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4111 ok(pf_exists("msitest"), "File not installed\n");
4113 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4114 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4115 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
4116 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4117 todo_wine
4119 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4120 ok(delete_pf("msitest", FALSE), "File deleted\n");
4123 create_pf("msitest", FALSE);
4124 create_pf("msitest\\hydrogen", TRUE);
4125 create_pf("msitest\\helium", TRUE);
4126 create_pf("msitest\\lithium", TRUE);
4128 r = MsiInstallProductA(msifile, NULL);
4129 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4130 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4131 ok(pf_exists("msitest\\helium"), "File not installed\n");
4132 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4133 ok(pf_exists("msitest"), "File not installed\n");
4135 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4136 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4137 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
4138 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4139 todo_wine
4141 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4142 ok(delete_pf("msitest", FALSE), "File deleted\n");
4145 create_pf("msitest", FALSE);
4146 create_pf("msitest\\furlong", TRUE);
4147 create_pf("msitest\\firkin", TRUE);
4148 create_pf("msitest\\fortnight", TRUE);
4149 create_pf("msitest\\becquerel", TRUE);
4150 create_pf("msitest\\dioptre", TRUE);
4151 create_pf("msitest\\attoparsec", TRUE);
4152 create_pf("msitest\\storeys", TRUE);
4153 create_pf("msitest\\block", TRUE);
4154 create_pf("msitest\\siriometer", TRUE);
4156 r = MsiInstallProductA(msifile, NULL);
4157 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4158 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4159 ok(!pf_exists("msitest\\helium"), "File installed\n");
4160 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4161 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
4162 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
4163 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
4164 ok(pf_exists("msitest"), "File not installed\n");
4165 todo_wine
4167 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
4168 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
4169 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
4170 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
4171 ok(!pf_exists("msitest\\block"), "File not deleted\n");
4172 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
4175 create_pf("msitest\\furlong", TRUE);
4176 create_pf("msitest\\firkin", TRUE);
4177 create_pf("msitest\\fortnight", TRUE);
4178 create_pf("msitest\\storeys", TRUE);
4179 create_pf("msitest\\block", TRUE);
4180 create_pf("msitest\\siriometer", TRUE);
4182 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4183 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4184 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
4185 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4186 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
4187 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
4188 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
4189 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
4190 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
4191 todo_wine
4193 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
4194 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
4195 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
4196 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
4197 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
4199 ok(delete_pf("msitest", FALSE), "File deleted\n");
4201 DeleteFile(msifile);
4202 DeleteFile("msitest\\hydrogen");
4203 DeleteFile("msitest\\helium");
4204 DeleteFile("msitest\\lithium");
4205 RemoveDirectory("msitest");
4208 static void test_movefiles(void)
4210 UINT r;
4211 char props[MAX_PATH];
4213 CreateDirectoryA("msitest", NULL);
4214 create_file("msitest\\augustus", 100);
4215 create_file("cameroon", 100);
4216 create_file("djibouti", 100);
4217 create_file("egypt", 100);
4218 create_file("finland", 100);
4219 create_file("gambai", 100);
4220 create_file("honduras", 100);
4221 create_file("msitest\\india", 100);
4222 create_file("japan", 100);
4223 create_file("kenya", 100);
4224 CreateDirectoryA("latvia", NULL);
4225 create_file("nauru", 100);
4226 create_file("apple", 100);
4227 create_file("application", 100);
4228 create_file("ape", 100);
4229 create_file("foo", 100);
4230 create_file("fao", 100);
4231 create_file("fbod", 100);
4232 create_file("budding", 100);
4233 create_file("buddy", 100);
4234 create_file("bud", 100);
4235 create_file("bar", 100);
4236 create_file("bur", 100);
4237 create_file("bird", 100);
4239 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
4241 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4243 /* if the source or dest property is not a full path,
4244 * windows tries to access it as a network resource
4247 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
4248 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
4249 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
4251 r = MsiInstallProductA(msifile, props);
4252 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4253 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4254 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
4255 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
4256 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
4257 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
4258 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
4259 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
4260 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
4261 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
4262 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
4263 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
4264 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
4265 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
4266 /* either apple or application will be moved depending on directory order */
4267 if (!delete_pf("msitest\\apple", TRUE))
4268 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
4269 else
4270 ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
4271 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
4272 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
4273 /* either fao or foo will be moved depending on directory order */
4274 if (delete_pf("msitest\\foo", TRUE))
4275 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
4276 else
4277 ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
4278 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
4279 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
4280 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
4281 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
4282 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
4283 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
4284 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
4285 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
4286 ok(delete_pf("msitest", FALSE), "File not installed\n");
4287 ok(DeleteFileA("cameroon"), "File moved\n");
4288 ok(!DeleteFileA("djibouti"), "File not moved\n");
4289 ok(DeleteFileA("egypt"), "File moved\n");
4290 ok(DeleteFileA("finland"), "File moved\n");
4291 ok(DeleteFileA("gambai"), "File moved\n");
4292 ok(!DeleteFileA("honduras"), "File not moved\n");
4293 ok(DeleteFileA("msitest\\india"), "File moved\n");
4294 ok(DeleteFileA("japan"), "File moved\n");
4295 ok(!DeleteFileA("kenya"), "File not moved\n");
4296 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
4297 ok(!DeleteFileA("nauru"), "File not moved\n");
4298 ok(!DeleteFileA("apple"), "File not moved\n");
4299 ok(!DeleteFileA("application"), "File not moved\n");
4300 ok(DeleteFileA("ape"), "File moved\n");
4301 ok(!DeleteFileA("foo"), "File not moved\n");
4302 ok(!DeleteFileA("fao"), "File not moved\n");
4303 ok(DeleteFileA("fbod"), "File moved\n");
4304 ok(!DeleteFileA("budding"), "File not moved\n");
4305 ok(!DeleteFileA("buddy"), "File not moved\n");
4306 ok(DeleteFileA("bud"), "File moved\n");
4307 ok(!DeleteFileA("bar"), "File not moved\n");
4308 ok(!DeleteFileA("bur"), "File not moved\n");
4309 ok(DeleteFileA("bird"), "File moved\n");
4311 DeleteFile("msitest\\augustus");
4312 RemoveDirectory("msitest");
4313 DeleteFile(msifile);
4316 static void test_missingcab(void)
4318 UINT r;
4320 CreateDirectoryA("msitest", NULL);
4321 create_file("msitest\\augustus", 500);
4322 create_file("maximus", 500);
4324 create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
4326 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4328 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
4330 create_pf("msitest", FALSE);
4331 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
4333 r = MsiInstallProductA(msifile, NULL);
4334 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4335 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4336 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
4337 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4338 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
4339 ok(delete_pf("msitest", FALSE), "File not installed\n");
4341 create_pf("msitest", FALSE);
4342 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
4343 create_pf("msitest\\gaius", TRUE);
4345 r = MsiInstallProductA(msifile, "GAIUS=1");
4346 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4347 todo_wine
4349 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
4350 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4352 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
4353 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
4354 ok(delete_pf("msitest", FALSE), "File not installed\n");
4356 DeleteFile("msitest\\augustus");
4357 RemoveDirectory("msitest");
4358 DeleteFile("maximus");
4359 DeleteFile("test1.cab");
4360 DeleteFile(msifile);
4363 static void test_duplicatefiles(void)
4365 UINT r;
4367 CreateDirectoryA("msitest", NULL);
4368 create_file("msitest\\maximus", 500);
4369 create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
4371 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4373 /* fails if the destination folder is not a valid property */
4375 r = MsiInstallProductA(msifile, NULL);
4376 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4377 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4378 ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
4379 ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
4380 ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "File not duplicated\n");
4381 ok(delete_pf("msitest\\this\\doesnot", FALSE), "File not duplicated\n");
4382 ok(delete_pf("msitest\\this", FALSE), "File not duplicated\n");
4383 ok(delete_pf("msitest", FALSE), "File not installed\n");
4385 DeleteFile("msitest\\maximus");
4386 RemoveDirectory("msitest");
4387 DeleteFile(msifile);
4390 static void test_writeregistryvalues(void)
4392 UINT r;
4393 LONG res;
4394 HKEY hkey;
4395 DWORD type, size;
4396 CHAR path[MAX_PATH];
4398 CreateDirectoryA("msitest", NULL);
4399 create_file("msitest\\augustus", 500);
4401 create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
4403 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4405 r = MsiInstallProductA(msifile, NULL);
4406 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4407 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4408 ok(delete_pf("msitest", FALSE), "File installed\n");
4410 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
4411 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4413 size = MAX_PATH;
4414 type = REG_MULTI_SZ;
4415 memset(path, 'a', MAX_PATH);
4416 res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size);
4417 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4418 ok(!memcmp(path, "one\0two\0three\0\0", size), "Wrong multi-sz data\n");
4419 ok(size == 15, "Expected 15, got %d\n", size);
4420 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4422 DeleteFile(msifile);
4423 DeleteFile("msitest\\augustus");
4424 RemoveDirectory("msitest");
4426 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
4427 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine");
4430 static void test_sourcefolder(void)
4432 UINT r;
4434 CreateDirectoryA("msitest", NULL);
4435 create_file("augustus", 500);
4437 create_database(msifile, sf_tables, sizeof(sf_tables) / sizeof(msi_table));
4439 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4441 r = MsiInstallProductA(msifile, NULL);
4442 ok(r == ERROR_INSTALL_FAILURE,
4443 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4444 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4445 todo_wine
4447 ok(!delete_pf("msitest", FALSE), "File installed\n");
4450 RemoveDirectoryA("msitest");
4452 r = MsiInstallProductA(msifile, NULL);
4453 ok(r == ERROR_INSTALL_FAILURE,
4454 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4455 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4456 todo_wine
4458 ok(!delete_pf("msitest", FALSE), "File installed\n");
4461 DeleteFile(msifile);
4462 DeleteFile("augustus");
4465 static void test_customaction51(void)
4467 UINT r;
4469 CreateDirectoryA("msitest", NULL);
4470 create_file("msitest\\augustus", 500);
4472 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
4474 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4476 r = MsiInstallProductA(msifile, NULL);
4477 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4478 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4479 ok(delete_pf("msitest", FALSE), "File installed\n");
4481 DeleteFile(msifile);
4482 DeleteFile("msitest\\augustus");
4483 RemoveDirectory("msitest");
4486 static void test_installstate(void)
4488 UINT r;
4490 CreateDirectoryA("msitest", NULL);
4491 create_file("msitest\\alpha", 500);
4492 create_file("msitest\\beta", 500);
4493 create_file("msitest\\gamma", 500);
4494 create_file("msitest\\theta", 500);
4495 create_file("msitest\\delta", 500);
4496 create_file("msitest\\epsilon", 500);
4497 create_file("msitest\\zeta", 500);
4498 create_file("msitest\\iota", 500);
4499 create_file("msitest\\eta", 500);
4500 create_file("msitest\\kappa", 500);
4501 create_file("msitest\\lambda", 500);
4502 create_file("msitest\\mu", 500);
4504 create_database(msifile, is_tables, sizeof(is_tables) / sizeof(msi_table));
4506 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4508 r = MsiInstallProductA(msifile, NULL);
4509 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4510 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4511 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4512 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4513 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4514 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4515 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4516 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4517 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4518 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4519 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4520 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4521 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4522 ok(delete_pf("msitest", FALSE), "File not installed\n");
4524 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
4525 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4526 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4527 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4528 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4529 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4530 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4531 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
4532 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4533 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4534 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
4535 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4536 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4537 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4538 ok(delete_pf("msitest", FALSE), "File not installed\n");
4540 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
4541 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4542 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4543 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4544 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4545 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4546 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4547 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4548 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4549 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4550 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4551 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4552 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4553 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4554 ok(delete_pf("msitest", FALSE), "File not installed\n");
4556 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
4557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4558 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
4559 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4560 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4561 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
4562 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4563 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4564 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4565 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4566 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4567 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4568 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4569 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4570 ok(!delete_pf("msitest", FALSE), "File installed\n");
4572 DeleteFile(msifile);
4573 DeleteFile("msitest\\alpha");
4574 DeleteFile("msitest\\beta");
4575 DeleteFile("msitest\\gamma");
4576 DeleteFile("msitest\\theta");
4577 DeleteFile("msitest\\delta");
4578 DeleteFile("msitest\\epsilon");
4579 DeleteFile("msitest\\zeta");
4580 DeleteFile("msitest\\iota");
4581 DeleteFile("msitest\\eta");
4582 DeleteFile("msitest\\kappa");
4583 DeleteFile("msitest\\lambda");
4584 DeleteFile("msitest\\mu");
4585 RemoveDirectory("msitest");
4588 struct sourcepathmap
4590 BOOL sost; /* shortone\shorttwo */
4591 BOOL solt; /* shortone\longtwo */
4592 BOOL lost; /* longone\shorttwo */
4593 BOOL lolt; /* longone\longtwo */
4594 BOOL soste; /* shortone\shorttwo source exists */
4595 BOOL solte; /* shortone\longtwo source exists */
4596 BOOL loste; /* longone\shorttwo source exists */
4597 BOOL lolte; /* longone\longtwo source exists */
4598 UINT err;
4599 DWORD size;
4600 } spmap[256] =
4602 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4603 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4604 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4605 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4606 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4607 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4608 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4609 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4610 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4611 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4612 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4613 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4614 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4615 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4616 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4617 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4618 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4619 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4620 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4621 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4622 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4623 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4624 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4625 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4626 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4627 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4628 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4629 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4630 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4631 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4632 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4633 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4634 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4635 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4636 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4637 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4638 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4639 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4640 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4641 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4642 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4643 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4644 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4645 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4646 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4647 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4648 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4649 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4650 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4651 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4652 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4653 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4654 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4655 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4656 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4657 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4658 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4659 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4660 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4661 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4662 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4663 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4664 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4665 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4666 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4667 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4668 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4669 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4670 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4671 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4672 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4673 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4674 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4675 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4676 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4677 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4678 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4679 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4680 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4681 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4682 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4683 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4684 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4685 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4686 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4687 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4688 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4689 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4690 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4691 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4692 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4693 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4694 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4695 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4696 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4697 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4698 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4699 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4700 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4701 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4702 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4703 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4704 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4705 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4706 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4707 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4708 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4709 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4710 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4711 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4712 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4713 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4714 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4715 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4716 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4717 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4718 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4719 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4720 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4721 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4722 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4723 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4724 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4725 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4726 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4727 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4728 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4729 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4730 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4731 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4732 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4733 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4734 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4735 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4736 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4737 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4738 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4739 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4740 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4741 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4742 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4743 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4744 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4745 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4746 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4747 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4748 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4749 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4750 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4751 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4752 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4753 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4754 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4755 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4756 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4757 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4758 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4759 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4760 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4761 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4762 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4763 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4764 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4765 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4766 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4767 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4768 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4769 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4770 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4771 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4772 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4773 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4774 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4775 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4776 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4777 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4778 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4779 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4780 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4781 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4782 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4783 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4784 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4785 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4786 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4787 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4788 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4789 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4790 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4791 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4792 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4793 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4794 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4795 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4796 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4797 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4798 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4799 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4800 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4801 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4802 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4803 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4804 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4805 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4806 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4807 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4808 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4809 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4810 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4811 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4812 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4813 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4814 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4815 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4816 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4817 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4818 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4819 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4820 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4821 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4822 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4823 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4824 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4825 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4826 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4827 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4828 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4829 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4830 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4831 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4832 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4833 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4834 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4835 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4836 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4837 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4838 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4839 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4840 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4841 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4842 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4843 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4844 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4845 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4846 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4847 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4848 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4849 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4850 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4851 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4852 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4853 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4854 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4855 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4856 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4857 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4860 static DWORD get_pf_file_size(LPCSTR file)
4862 CHAR path[MAX_PATH];
4863 HANDLE hfile;
4864 DWORD size;
4866 lstrcpyA(path, PROG_FILES_DIR);
4867 lstrcatA(path, "\\");
4868 lstrcatA(path, file);
4870 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
4871 if (hfile == INVALID_HANDLE_VALUE)
4872 return 0;
4874 size = GetFileSize(hfile, NULL);
4875 CloseHandle(hfile);
4876 return size;
4879 static void test_sourcepath(void)
4881 UINT r, i;
4883 create_database(msifile, sp_tables, sizeof(sp_tables) / sizeof(msi_table));
4885 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4887 for (i = 0; i < sizeof(spmap) / sizeof(spmap[0]); i++)
4889 if (spmap[i].sost)
4891 CreateDirectoryA("shortone", NULL);
4892 CreateDirectoryA("shortone\\shorttwo", NULL);
4895 if (spmap[i].solt)
4897 CreateDirectoryA("shortone", NULL);
4898 CreateDirectoryA("shortone\\longtwo", NULL);
4901 if (spmap[i].lost)
4903 CreateDirectoryA("longone", NULL);
4904 CreateDirectoryA("longone\\shorttwo", NULL);
4907 if (spmap[i].lolt)
4909 CreateDirectoryA("longone", NULL);
4910 CreateDirectoryA("longone\\longtwo", NULL);
4913 if (spmap[i].soste)
4914 create_file("shortone\\shorttwo\\augustus", 50);
4915 if (spmap[i].solte)
4916 create_file("shortone\\longtwo\\augustus", 100);
4917 if (spmap[i].loste)
4918 create_file("longone\\shorttwo\\augustus", 150);
4919 if (spmap[i].lolte)
4920 create_file("longone\\longtwo\\augustus", 200);
4922 r = MsiInstallProductA(msifile, NULL);
4923 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
4924 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
4925 "%d: Expected %d, got %d\n", i, spmap[i].size,
4926 get_pf_file_size("msitest\\augustus"));
4928 if (r == ERROR_SUCCESS)
4930 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
4931 ok(delete_pf("msitest", FALSE), "%d: File not installed\n", i);
4933 else
4935 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
4936 todo_wine ok(!delete_pf("msitest", FALSE), "%d: File installed\n", i);
4939 DeleteFileA("shortone\\shorttwo\\augustus");
4940 DeleteFileA("shortone\\longtwo\\augustus");
4941 DeleteFileA("longone\\shorttwo\\augustus");
4942 DeleteFileA("longone\\longtwo\\augustus");
4943 RemoveDirectoryA("shortone\\shorttwo");
4944 RemoveDirectoryA("shortone\\longtwo");
4945 RemoveDirectoryA("longone\\shorttwo");
4946 RemoveDirectoryA("longone\\longtwo");
4947 RemoveDirectoryA("shortone");
4948 RemoveDirectoryA("longone");
4951 DeleteFileA(msifile);
4954 START_TEST(install)
4956 DWORD len;
4957 char temp_path[MAX_PATH], prev_path[MAX_PATH];
4959 init_functionpointers();
4961 GetCurrentDirectoryA(MAX_PATH, prev_path);
4962 GetTempPath(MAX_PATH, temp_path);
4963 SetCurrentDirectoryA(temp_path);
4965 lstrcpyA(CURR_DIR, temp_path);
4966 len = lstrlenA(CURR_DIR);
4968 if(len && (CURR_DIR[len - 1] == '\\'))
4969 CURR_DIR[len - 1] = 0;
4971 get_program_files_dir(PROG_FILES_DIR, COMMON_FILES_DIR);
4973 test_MsiInstallProduct();
4974 test_MsiSetComponentState();
4975 test_packagecoltypes();
4976 test_continuouscabs();
4977 test_caborder();
4978 test_mixedmedia();
4979 test_samesequence();
4980 test_uiLevelFlags();
4981 test_readonlyfile();
4982 test_setdirproperty();
4983 test_cabisextracted();
4984 test_concurrentinstall();
4985 test_setpropertyfolder();
4986 test_publish_registerproduct();
4987 test_publish_publishproduct();
4988 test_publish_publishfeatures();
4989 test_publish_registeruser();
4990 test_publish_processcomponents();
4991 test_publish();
4992 test_publishsourcelist();
4993 test_transformprop();
4994 test_currentworkingdir();
4995 test_admin();
4996 test_adminprops();
4997 test_removefiles();
4998 test_movefiles();
4999 test_missingcab();
5000 test_duplicatefiles();
5001 test_writeregistryvalues();
5002 test_sourcefolder();
5003 test_customaction51();
5004 test_installstate();
5005 test_sourcepath();
5007 SetCurrentDirectoryA(prev_path);