push 553a83299288f61678d62ade87a3a2a5489a8ad8
[wine/hacks.git] / dlls / msi / tests / install.c
blobadfe28eb26b1c70994a1d868558c71e6827b014c
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>
32 #include <srrestoreptapi.h>
34 #include "wine/test.h"
36 static UINT (WINAPI *pMsiQueryComponentStateA)
37 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*);
38 static UINT (WINAPI *pMsiSourceListEnumSourcesA)
39 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
40 static UINT (WINAPI *pMsiSourceListGetInfoA)
41 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD);
43 static HMODULE hsrclient = 0;
44 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
45 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
47 static const char *msifile = "msitest.msi";
48 static const char *msifile2 = "winetest2.msi";
49 static const char *mstfile = "winetest.mst";
50 static CHAR CURR_DIR[MAX_PATH];
51 static CHAR PROG_FILES_DIR[MAX_PATH];
52 static CHAR COMMON_FILES_DIR[MAX_PATH];
54 /* msi database data */
56 static const CHAR component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
57 "s72\tS38\ts72\ti2\tS255\tS72\n"
58 "Component\tComponent\n"
59 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
60 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
61 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\t\tone.txt\n"
62 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
63 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
64 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
65 "component\t\tMSITESTDIR\t0\t1\tfile\n"
66 "service_comp\t\tMSITESTDIR\t0\t1\tservice_file";
68 static const CHAR directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
69 "s72\tS72\tl255\n"
70 "Directory\tDirectory\n"
71 "CABOUTDIR\tMSITESTDIR\tcabout\n"
72 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
73 "FIRSTDIR\tMSITESTDIR\tfirst\n"
74 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
75 "NEWDIR\tCABOUTDIR\tnew\n"
76 "ProgramFilesFolder\tTARGETDIR\t.\n"
77 "TARGETDIR\t\tSourceDir";
79 static const CHAR feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
80 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
81 "Feature\tFeature\n"
82 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
83 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
84 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
85 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
86 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
87 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
88 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
90 static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
91 "s38\ts72\n"
92 "FeatureComponents\tFeature_\tComponent_\n"
93 "Five\tFive\n"
94 "Four\tFour\n"
95 "One\tOne\n"
96 "Three\tThree\n"
97 "Two\tTwo\n"
98 "feature\tcomponent\n"
99 "service_feature\tservice_comp\n";
101 static const CHAR file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
102 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
103 "File\tFile\n"
104 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
105 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
106 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
107 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
108 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
109 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
110 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
112 static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
113 "s72\tS255\tI2\n"
114 "InstallExecuteSequence\tAction\n"
115 "AllocateRegistrySpace\tNOT Installed\t1550\n"
116 "CostFinalize\t\t1000\n"
117 "CostInitialize\t\t800\n"
118 "FileCost\t\t900\n"
119 "ResolveSource\t\t950\n"
120 "MoveFiles\t\t1700\n"
121 "InstallFiles\t\t4000\n"
122 "DuplicateFiles\t\t4500\n"
123 "InstallServices\t\t5000\n"
124 "InstallFinalize\t\t6600\n"
125 "InstallInitialize\t\t1500\n"
126 "InstallValidate\t\t1400\n"
127 "LaunchConditions\t\t100\n"
128 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
130 static const CHAR media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
131 "i2\ti4\tL64\tS255\tS32\tS72\n"
132 "Media\tDiskId\n"
133 "1\t3\t\t\tDISK1\t\n"
134 "2\t5\t\tmsitest.cab\tDISK2\t\n";
136 static const CHAR property_dat[] = "Property\tValue\n"
137 "s72\tl0\n"
138 "Property\tProperty\n"
139 "DefaultUIFont\tDlgFont8\n"
140 "HASUIRUN\t0\n"
141 "INSTALLLEVEL\t3\n"
142 "InstallMode\tTypical\n"
143 "Manufacturer\tWine\n"
144 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
145 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
146 "ProductID\tnone\n"
147 "ProductLanguage\t1033\n"
148 "ProductName\tMSITEST\n"
149 "ProductVersion\t1.1.1\n"
150 "PROMPTROLLBACKCOST\tP\n"
151 "Setup\tSetup\n"
152 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
153 "AdminProperties\tPOSTADMIN\n"
154 "ROOTDRIVE\tC:\\\n"
155 "SERVNAME\tTestService\n"
156 "SERVDISP\tTestServiceDisp\n";
158 static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
159 "s72\ti2\tl255\tL255\tL0\ts72\n"
160 "Registry\tRegistry\n"
161 "Apples\t2\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
162 "Oranges\t2\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
163 "regdata\t2\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
164 "OrderTest\t2\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
166 static const CHAR service_install_dat[] = "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
167 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
168 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
169 "ServiceInstall\tServiceInstall\n"
170 "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\t";
172 static const CHAR service_control_dat[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
173 "s72\tl255\ti2\tL255\tI2\ts72\n"
174 "ServiceControl\tServiceControl\n"
175 "ServiceControl\tTestService\t8\t\t0\tservice_comp";
177 /* tables for test_continuouscabs */
178 static const CHAR cc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
179 "s72\tS38\ts72\ti2\tS255\tS72\n"
180 "Component\tComponent\n"
181 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
182 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
183 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
185 static const CHAR cc2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
186 "s72\tS38\ts72\ti2\tS255\tS72\n"
187 "Component\tComponent\n"
188 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
189 "augustus\t\tMSITESTDIR\t0\t0\taugustus\n"
190 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
192 static const CHAR cc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
193 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
194 "Feature\tFeature\n"
195 "feature\t\t\t\t2\t1\tTARGETDIR\t0";
197 static const CHAR cc_feature_comp_dat[] = "Feature_\tComponent_\n"
198 "s38\ts72\n"
199 "FeatureComponents\tFeature_\tComponent_\n"
200 "feature\tmaximus\n"
201 "feature\taugustus\n"
202 "feature\tcaesar";
204 static const CHAR cc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
205 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
206 "File\tFile\n"
207 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
208 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
209 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
211 static const CHAR cc2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
212 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
213 "File\tFile\n"
214 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
215 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
216 "tiberius\tmaximus\ttiberius\t500\t\t\t16384\t3\n"
217 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
219 static const CHAR cc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
220 "i2\ti4\tL64\tS255\tS32\tS72\n"
221 "Media\tDiskId\n"
222 "1\t10\t\ttest1.cab\tDISK1\t\n"
223 "2\t2\t\ttest2.cab\tDISK2\t\n"
224 "3\t12\t\ttest3.cab\tDISK3\t\n";
226 static const CHAR co_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
227 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
228 "File\tFile\n"
229 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
230 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
231 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
233 static const CHAR co_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
234 "i2\ti4\tL64\tS255\tS32\tS72\n"
235 "Media\tDiskId\n"
236 "1\t10\t\ttest1.cab\tDISK1\t\n"
237 "2\t2\t\ttest2.cab\tDISK2\t\n"
238 "3\t3\t\ttest3.cab\tDISK3\t\n";
240 static const CHAR co2_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
241 "i2\ti4\tL64\tS255\tS32\tS72\n"
242 "Media\tDiskId\n"
243 "1\t10\t\ttest1.cab\tDISK1\t\n"
244 "2\t12\t\ttest3.cab\tDISK3\t\n"
245 "3\t2\t\ttest2.cab\tDISK2\t\n";
247 static const CHAR mm_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
248 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
249 "File\tFile\n"
250 "maximus\tmaximus\tmaximus\t500\t\t\t512\t1\n"
251 "augustus\taugustus\taugustus\t500\t\t\t512\t2\n"
252 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
254 static const CHAR mm_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
255 "i2\ti4\tL64\tS255\tS32\tS72\n"
256 "Media\tDiskId\n"
257 "1\t3\t\ttest1.cab\tDISK1\t\n";
259 static const CHAR ss_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
260 "i2\ti4\tL64\tS255\tS32\tS72\n"
261 "Media\tDiskId\n"
262 "1\t2\t\ttest1.cab\tDISK1\t\n"
263 "2\t2\t\ttest2.cab\tDISK2\t\n"
264 "3\t12\t\ttest3.cab\tDISK3\t\n";
266 /* tables for test_uiLevelFlags */
267 static const CHAR ui_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
268 "s72\tS38\ts72\ti2\tS255\tS72\n"
269 "Component\tComponent\n"
270 "maximus\t\tMSITESTDIR\t0\tHASUIRUN=1\tmaximus\n"
271 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
272 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
274 static const CHAR ui_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
275 "s72\tS255\tI2\n"
276 "InstallUISequence\tAction\n"
277 "SetUIProperty\t\t5\n"
278 "ExecuteAction\t\t1100\n";
280 static const CHAR ui_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
281 "s72\ti2\tS64\tS0\tS255\n"
282 "CustomAction\tAction\n"
283 "SetUIProperty\t51\tHASUIRUN\t1\t\n";
285 static const CHAR rof_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
286 "s72\tS38\ts72\ti2\tS255\tS72\n"
287 "Component\tComponent\n"
288 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
290 static const CHAR rof_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
291 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
292 "Feature\tFeature\n"
293 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
294 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
296 static const CHAR rof_feature_comp_dat[] = "Feature_\tComponent_\n"
297 "s38\ts72\n"
298 "FeatureComponents\tFeature_\tComponent_\n"
299 "feature\tmaximus\n"
300 "montecristo\tmaximus";
302 static const CHAR rof_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
303 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
304 "File\tFile\n"
305 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
307 static const CHAR rof_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
308 "i2\ti4\tL64\tS255\tS32\tS72\n"
309 "Media\tDiskId\n"
310 "1\t1\t\t\tDISK1\t\n";
312 static const CHAR sdp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
313 "s72\tS255\tI2\n"
314 "InstallExecuteSequence\tAction\n"
315 "AllocateRegistrySpace\tNOT Installed\t1550\n"
316 "CostFinalize\t\t1000\n"
317 "CostInitialize\t\t800\n"
318 "FileCost\t\t900\n"
319 "InstallFiles\t\t4000\n"
320 "InstallFinalize\t\t6600\n"
321 "InstallInitialize\t\t1500\n"
322 "InstallValidate\t\t1400\n"
323 "LaunchConditions\t\t100\n"
324 "SetDirProperty\t\t950";
326 static const CHAR sdp_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
327 "s72\ti2\tS64\tS0\tS255\n"
328 "CustomAction\tAction\n"
329 "SetDirProperty\t51\tMSITESTDIR\t[CommonFilesFolder]msitest\\\t\n";
331 static const CHAR cie_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
332 "s72\tS38\ts72\ti2\tS255\tS72\n"
333 "Component\tComponent\n"
334 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
335 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
336 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
337 "gaius\t\tMSITESTDIR\t0\t1\tgaius\n";
339 static const CHAR cie_feature_comp_dat[] = "Feature_\tComponent_\n"
340 "s38\ts72\n"
341 "FeatureComponents\tFeature_\tComponent_\n"
342 "feature\tmaximus\n"
343 "feature\taugustus\n"
344 "feature\tcaesar\n"
345 "feature\tgaius";
347 static const CHAR cie_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
348 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
349 "File\tFile\n"
350 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
351 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
352 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12\n"
353 "gaius\tgaius\tgaius\t500\t\t\t8192\t11";
355 static const CHAR cie_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
356 "i2\ti4\tL64\tS255\tS32\tS72\n"
357 "Media\tDiskId\n"
358 "1\t1\t\ttest1.cab\tDISK1\t\n"
359 "2\t2\t\ttest2.cab\tDISK2\t\n"
360 "3\t12\t\ttest3.cab\tDISK3\t\n";
362 static const CHAR ci_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
363 "s72\tS255\tI2\n"
364 "InstallExecuteSequence\tAction\n"
365 "CostFinalize\t\t1000\n"
366 "CostInitialize\t\t800\n"
367 "FileCost\t\t900\n"
368 "InstallFiles\t\t4000\n"
369 "InstallServices\t\t5000\n"
370 "InstallFinalize\t\t6600\n"
371 "InstallInitialize\t\t1500\n"
372 "RunInstall\t\t1600\n"
373 "InstallValidate\t\t1400\n"
374 "LaunchConditions\t\t100";
376 static const CHAR ci_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
377 "s72\ti2\tS64\tS0\tS255\n"
378 "CustomAction\tAction\n"
379 "RunInstall\t87\tmsitest\\concurrent.msi\tMYPROP=[UILevel]\t\n";
381 static const CHAR ci_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
382 "s72\tS38\ts72\ti2\tS255\tS72\n"
383 "Component\tComponent\n"
384 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n";
386 static const CHAR ci2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
387 "s72\tS38\ts72\ti2\tS255\tS72\n"
388 "Component\tComponent\n"
389 "augustus\t\tMSITESTDIR\t0\tUILevel=3 AND MYPROP=5\taugustus\n";
391 static const CHAR ci2_feature_comp_dat[] = "Feature_\tComponent_\n"
392 "s38\ts72\n"
393 "FeatureComponents\tFeature_\tComponent_\n"
394 "feature\taugustus";
396 static const CHAR ci2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
397 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
398 "File\tFile\n"
399 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
401 static const CHAR spf_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
402 "s72\ti2\tS64\tS0\tS255\n"
403 "CustomAction\tAction\n"
404 "SetFolderProp\t51\tMSITESTDIR\t[ProgramFilesFolder]\\msitest\\added\t\n";
406 static const CHAR spf_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
407 "s72\tS255\tI2\n"
408 "InstallExecuteSequence\tAction\n"
409 "CostFinalize\t\t1000\n"
410 "CostInitialize\t\t800\n"
411 "FileCost\t\t900\n"
412 "SetFolderProp\t\t950\n"
413 "InstallFiles\t\t4000\n"
414 "InstallServices\t\t5000\n"
415 "InstallFinalize\t\t6600\n"
416 "InstallInitialize\t\t1500\n"
417 "InstallValidate\t\t1400\n"
418 "LaunchConditions\t\t100";
420 static const CHAR spf_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
421 "s72\tS255\tI2\n"
422 "InstallUISequence\tAction\n"
423 "CostInitialize\t\t800\n"
424 "FileCost\t\t900\n"
425 "CostFinalize\t\t1000\n"
426 "ExecuteAction\t\t1100\n";
428 static const CHAR pp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
429 "s72\tS255\tI2\n"
430 "InstallExecuteSequence\tAction\n"
431 "ValidateProductID\t\t700\n"
432 "CostInitialize\t\t800\n"
433 "FileCost\t\t900\n"
434 "CostFinalize\t\t1000\n"
435 "InstallValidate\t\t1400\n"
436 "InstallInitialize\t\t1500\n"
437 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
438 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
439 "RemoveFiles\t\t3500\n"
440 "InstallFiles\t\t4000\n"
441 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
442 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
443 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
444 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
445 "InstallFinalize\t\t6600";
447 static const CHAR ppc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
448 "s72\tS38\ts72\ti2\tS255\tS72\n"
449 "Component\tComponent\n"
450 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n"
451 "augustus\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\taugustus\n";
453 static const CHAR ppc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
454 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
455 "File\tFile\n"
456 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1\n"
457 "augustus\taugustus\taugustus\t500\t\t\t8192\t2";
459 static const CHAR ppc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
460 "i2\ti4\tL64\tS255\tS32\tS72\n"
461 "Media\tDiskId\n"
462 "1\t2\t\t\tDISK1\t\n";
464 static const CHAR ppc_feature_comp_dat[] = "Feature_\tComponent_\n"
465 "s38\ts72\n"
466 "FeatureComponents\tFeature_\tComponent_\n"
467 "feature\tmaximus\n"
468 "feature\taugustus\n"
469 "montecristo\tmaximus";
471 static const CHAR tp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
472 "s72\tS38\ts72\ti2\tS255\tS72\n"
473 "Component\tComponent\n"
474 "augustus\t\tMSITESTDIR\t0\tprop=\"val\"\taugustus\n";
476 static const CHAR cwd_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
477 "s72\tS38\ts72\ti2\tS255\tS72\n"
478 "Component\tComponent\n"
479 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
481 static const CHAR adm_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
482 "s72\tS38\ts72\ti2\tS255\tS72\n"
483 "Component\tComponent\n"
484 "augustus\t\tMSITESTDIR\t0\tPOSTADMIN=1\taugustus";
486 static const CHAR adm_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
487 "s72\ti2\tS64\tS0\tS255\n"
488 "CustomAction\tAction\n"
489 "SetPOSTADMIN\t51\tPOSTADMIN\t1\t\n";
491 static const CHAR adm_admin_exec_seq_dat[] = "Action\tCondition\tSequence\n"
492 "s72\tS255\tI2\n"
493 "AdminExecuteSequence\tAction\n"
494 "CostFinalize\t\t1000\n"
495 "CostInitialize\t\t800\n"
496 "FileCost\t\t900\n"
497 "SetPOSTADMIN\t\t950\n"
498 "InstallFiles\t\t4000\n"
499 "InstallFinalize\t\t6600\n"
500 "InstallInitialize\t\t1500\n"
501 "InstallValidate\t\t1400\n"
502 "LaunchConditions\t\t100";
504 static const CHAR amp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
505 "s72\tS38\ts72\ti2\tS255\tS72\n"
506 "Component\tComponent\n"
507 "augustus\t\tMSITESTDIR\t0\tMYPROP=2718\taugustus\n";
509 static const CHAR rem_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
510 "s72\tS38\ts72\ti2\tS255\tS72\n"
511 "Component\tComponent\n"
512 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t0\t\thydrogen\n"
513 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\thelium\n"
514 "lithium\t\tMSITESTDIR\t2\t\tlithium\n";
516 static const CHAR rem_feature_comp_dat[] = "Feature_\tComponent_\n"
517 "s38\ts72\n"
518 "FeatureComponents\tFeature_\tComponent_\n"
519 "feature\thydrogen\n"
520 "feature\thelium\n"
521 "feature\tlithium";
523 static const CHAR rem_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
524 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
525 "File\tFile\n"
526 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
527 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
528 "lithium\tlithium\tlithium\t0\t\t\t8192\t1";
530 static const CHAR rem_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
531 "s72\tS255\tI2\n"
532 "InstallExecuteSequence\tAction\n"
533 "ValidateProductID\t\t700\n"
534 "CostInitialize\t\t800\n"
535 "FileCost\t\t900\n"
536 "CostFinalize\t\t1000\n"
537 "InstallValidate\t\t1400\n"
538 "InstallInitialize\t\t1500\n"
539 "ProcessComponents\t\t1600\n"
540 "UnpublishFeatures\t\t1800\n"
541 "RemoveFiles\t\t3500\n"
542 "InstallFiles\t\t4000\n"
543 "RegisterProduct\t\t6100\n"
544 "PublishFeatures\t\t6300\n"
545 "PublishProduct\t\t6400\n"
546 "InstallFinalize\t\t6600";
548 static const CHAR rem_remove_files_dat[] = "FileKey\tComponent_\tFileName\tDirProperty\tInstallMode\n"
549 "s72\ts72\tS255\ts72\tI2\n"
550 "RemoveFile\tFileKey\n"
551 "furlong\thydrogen\tfurlong\tMSITESTDIR\t1\n"
552 "firkin\thelium\tfirkin\tMSITESTDIR\t1\n"
553 "fortnight\tlithium\tfortnight\tMSITESTDIR\t1\n"
554 "becquerel\thydrogen\tbecquerel\tMSITESTDIR\t2\n"
555 "dioptre\thelium\tdioptre\tMSITESTDIR\t2\n"
556 "attoparsec\tlithium\tattoparsec\tMSITESTDIR\t2\n"
557 "storeys\thydrogen\tstoreys\tMSITESTDIR\t3\n"
558 "block\thelium\tblock\tMSITESTDIR\t3\n"
559 "siriometer\tlithium\tsiriometer\tMSITESTDIR\t3\n"
560 "nanoacre\thydrogen\t\tCABOUTDIR\t3\n";
562 static const CHAR mov_move_file_dat[] = "FileKey\tComponent_\tSourceName\tDestName\tSourceFolder\tDestFolder\tOptions\n"
563 "s72\ts72\tS255\tS255\tS72\ts72\ti2\n"
564 "MoveFile\tFileKey\n"
565 "abkhazia\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t0\n"
566 "bahamas\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t1\n"
567 "cambodia\taugustus\tcameroon\tcanada\tSourceDir\tMSITESTDIR\t0\n"
568 "denmark\taugustus\tdjibouti\tdominica\tSourceDir\tMSITESTDIR\t1\n"
569 "ecuador\taugustus\tegypt\telsalvador\tNotAProp\tMSITESTDIR\t1\n"
570 "fiji\taugustus\tfinland\tfrance\tSourceDir\tNotAProp\t1\n"
571 "gabon\taugustus\tgambia\tgeorgia\tSOURCEFULL\tMSITESTDIR\t1\n"
572 "haiti\taugustus\thonduras\thungary\tSourceDir\tDESTFULL\t1\n"
573 "iceland\taugustus\tindia\tindonesia\tMSITESTDIR\tMSITESTDIR\t1\n"
574 "jamaica\taugustus\tjapan\tjordan\tFILEPATHBAD\tMSITESTDIR\t1\n"
575 "kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n"
576 "laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n"
577 "namibia\taugustus\tnauru\tkiribati\tSourceDir\tMSITESTDIR\t1\n"
578 "wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
579 "single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
580 "wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
581 "singlenodest\taugustus\tb?r\t\tSourceDir\tMSITESTDIR\t1\n";
583 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
584 "s72\tS38\ts72\ti2\tS255\tS72\n"
585 "Component\tComponent\n"
586 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
587 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
588 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
589 "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n";
591 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
592 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
593 "File\tFile\n"
594 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
595 "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
596 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
597 "gaius\tgaius\tgaius\t500\t\t\t16384\t4";
599 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
600 "i2\ti4\tL64\tS255\tS32\tS72\n"
601 "Media\tDiskId\n"
602 "1\t1\t\ttest1.cab\tDISK1\t\n"
603 "2\t2\t\ttest2.cab\tDISK2\t\n"
604 "3\t3\t\ttest3.cab\tDISK3\t\n"
605 "4\t4\t\ttest3.cab\tDISK3\t\n";
607 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
608 "s72\ti2\ti4\ti4\ti4\ti4\n"
609 "MsiFileHash\tFile_\n"
610 "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
612 static const CHAR df_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
613 "s72\tS72\tl255\n"
614 "Directory\tDirectory\n"
615 "THIS\tMSITESTDIR\tthis\n"
616 "DOESNOT\tTHIS\tdoesnot\n"
617 "NONEXISTENT\tDOESNOT\texist\n"
618 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
619 "ProgramFilesFolder\tTARGETDIR\t.\n"
620 "TARGETDIR\t\tSourceDir";
622 static const CHAR df_duplicate_file_dat[] = "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
623 "s72\ts72\ts72\tS255\tS72\n"
624 "DuplicateFile\tFileKey\n"
625 "maximus\tmaximus\tmaximus\taugustus\t\n"
626 "caesar\tmaximus\tmaximus\t\tNONEXISTENT\n";
628 static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
629 "s72\tS38\ts72\ti2\tS255\tS72\n"
630 "Component\tComponent\n"
631 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
633 static const CHAR wrv_registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
634 "s72\ti2\tl255\tL255\tL0\ts72\n"
635 "Registry\tRegistry\n"
636 "regdata\t2\tSOFTWARE\\Wine\\msitest\tValue\t[~]one[~]two[~]three\taugustus";
638 static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
639 "s72\tS38\ts72\ti2\tS255\tS72\n"
640 "Component\tComponent\n"
641 "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
643 static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
644 "s72\tS255\tI2\n"
645 "InstallExecuteSequence\tAction\n"
646 "ValidateProductID\t\t700\n"
647 "GoodSetProperty\t\t725\n"
648 "BadSetProperty\t\t750\n"
649 "CostInitialize\t\t800\n"
650 "FileCost\t\t900\n"
651 "CostFinalize\t\t1000\n"
652 "InstallValidate\t\t1400\n"
653 "InstallInitialize\t\t1500\n"
654 "InstallFiles\t\t4000\n"
655 "InstallFinalize\t\t6600";
657 static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
658 "s72\ti2\tS64\tS0\n"
659 "CustomAction\tAction\n"
660 "GoodSetProperty\t51\tMYPROP\t42\n"
661 "BadSetProperty\t51\t\tMYPROP\n";
663 static const CHAR is_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
664 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
665 "Feature\tFeature\n"
666 "one\t\t\t\t2\t1\t\t0\n" /* favorLocal */
667 "two\t\t\t\t2\t1\t\t1\n" /* favorSource */
668 "three\t\t\t\t2\t1\t\t4\n" /* favorAdvertise */
669 "four\t\t\t\t2\t0\t\t0"; /* disabled */
671 static const CHAR is_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
672 "s72\tS38\ts72\ti2\tS255\tS72\n"
673 "Component\tComponent\n"
674 "alpha\t\tMSITESTDIR\t0\t\talpha_file\n" /* favorLocal:Local */
675 "beta\t\tMSITESTDIR\t1\t\tbeta_file\n" /* favorLocal:Source */
676 "gamma\t\tMSITESTDIR\t2\t\tgamma_file\n" /* favorLocal:Optional */
677 "theta\t\tMSITESTDIR\t0\t\ttheta_file\n" /* favorSource:Local */
678 "delta\t\tMSITESTDIR\t1\t\tdelta_file\n" /* favorSource:Source */
679 "epsilon\t\tMSITESTDIR\t2\t\tepsilon_file\n" /* favorSource:Optional */
680 "zeta\t\tMSITESTDIR\t0\t\tzeta_file\n" /* favorAdvertise:Local */
681 "iota\t\tMSITESTDIR\t1\t\tiota_file\n" /* favorAdvertise:Source */
682 "eta\t\tMSITESTDIR\t2\t\teta_file\n" /* favorAdvertise:Optional */
683 "kappa\t\tMSITESTDIR\t0\t\tkappa_file\n" /* disabled:Local */
684 "lambda\t\tMSITESTDIR\t1\t\tlambda_file\n" /* disabled:Source */
685 "mu\t\tMSITESTDIR\t2\t\tmu_file\n"; /* disabled:Optional */
687 static const CHAR is_feature_comp_dat[] = "Feature_\tComponent_\n"
688 "s38\ts72\n"
689 "FeatureComponents\tFeature_\tComponent_\n"
690 "one\talpha\n"
691 "one\tbeta\n"
692 "one\tgamma\n"
693 "two\ttheta\n"
694 "two\tdelta\n"
695 "two\tepsilon\n"
696 "three\tzeta\n"
697 "three\tiota\n"
698 "three\teta\n"
699 "four\tkappa\n"
700 "four\tlambda\n"
701 "four\tmu";
703 static const CHAR is_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
704 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
705 "File\tFile\n"
706 "alpha_file\talpha\talpha\t500\t\t\t8192\t1\n"
707 "beta_file\tbeta\tbeta\t500\t\t\t8291\t2\n"
708 "gamma_file\tgamma\tgamma\t500\t\t\t8192\t3\n"
709 "theta_file\ttheta\ttheta\t500\t\t\t8192\t4\n"
710 "delta_file\tdelta\tdelta\t500\t\t\t8192\t5\n"
711 "epsilon_file\tepsilon\tepsilon\t500\t\t\t8192\t6\n"
712 "zeta_file\tzeta\tzeta\t500\t\t\t8192\t7\n"
713 "iota_file\tiota\tiota\t500\t\t\t8192\t8\n"
714 "eta_file\teta\teta\t500\t\t\t8192\t9\n"
715 "kappa_file\tkappa\tkappa\t500\t\t\t8192\t10\n"
716 "lambda_file\tlambda\tlambda\t500\t\t\t8192\t11\n"
717 "mu_file\tmu\tmu\t500\t\t\t8192\t12";
719 static const CHAR is_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
720 "i2\ti4\tL64\tS255\tS32\tS72\n"
721 "Media\tDiskId\n"
722 "1\t12\t\t\tDISK1\t\n";
724 static const CHAR sp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
725 "s72\tS38\ts72\ti2\tS255\tS72\n"
726 "Component\tComponent\n"
727 "augustus\t\tTWODIR\t0\t\taugustus\n";
729 static const CHAR sp_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
730 "s72\tS72\tl255\n"
731 "Directory\tDirectory\n"
732 "TARGETDIR\t\tSourceDir\n"
733 "ProgramFilesFolder\tTARGETDIR\t.\n"
734 "MSITESTDIR\tProgramFilesFolder\tmsitest:.\n"
735 "ONEDIR\tMSITESTDIR\t.:shortone|longone\n"
736 "TWODIR\tONEDIR\t.:shorttwo|longtwo";
738 static const CHAR mcp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
739 "s72\tS38\ts72\ti2\tS255\tS72\n"
740 "Component\tComponent\n"
741 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t2\t\thydrogen\n"
742 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t2\t\thelium\n"
743 "lithium\t{4AF28FFC-71C7-4307-BDE4-B77C5338F56F}\tMSITESTDIR\t2\tPROPVAR=42\tlithium\n";
745 static const CHAR mcp_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
746 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
747 "Feature\tFeature\n"
748 "hydroxyl\t\thydroxyl\thydroxyl\t2\t1\tTARGETDIR\t0\n"
749 "heliox\t\theliox\theliox\t2\t5\tTARGETDIR\t0\n"
750 "lithia\t\tlithia\tlithia\t2\t10\tTARGETDIR\t0";
752 static const CHAR mcp_feature_comp_dat[] = "Feature_\tComponent_\n"
753 "s38\ts72\n"
754 "FeatureComponents\tFeature_\tComponent_\n"
755 "hydroxyl\thydrogen\n"
756 "heliox\thelium\n"
757 "lithia\tlithium";
759 static const CHAR mcomp_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
760 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
761 "File\tFile\n"
762 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
763 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
764 "lithium\tlithium\tlithium\t0\t\t\t8192\t1\n"
765 "beryllium\tmissingcomp\tberyllium\t0\t\t\t8192\t1";
767 typedef struct _msi_table
769 const CHAR *filename;
770 const CHAR *data;
771 int size;
772 } msi_table;
774 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
776 static const msi_table tables[] =
778 ADD_TABLE(component),
779 ADD_TABLE(directory),
780 ADD_TABLE(feature),
781 ADD_TABLE(feature_comp),
782 ADD_TABLE(file),
783 ADD_TABLE(install_exec_seq),
784 ADD_TABLE(media),
785 ADD_TABLE(property),
786 ADD_TABLE(registry),
787 ADD_TABLE(service_install),
788 ADD_TABLE(service_control)
791 static const msi_table cc_tables[] =
793 ADD_TABLE(cc_component),
794 ADD_TABLE(directory),
795 ADD_TABLE(cc_feature),
796 ADD_TABLE(cc_feature_comp),
797 ADD_TABLE(cc_file),
798 ADD_TABLE(install_exec_seq),
799 ADD_TABLE(cc_media),
800 ADD_TABLE(property),
803 static const msi_table cc2_tables[] =
805 ADD_TABLE(cc2_component),
806 ADD_TABLE(directory),
807 ADD_TABLE(cc_feature),
808 ADD_TABLE(cc_feature_comp),
809 ADD_TABLE(cc2_file),
810 ADD_TABLE(install_exec_seq),
811 ADD_TABLE(cc_media),
812 ADD_TABLE(property),
815 static const msi_table co_tables[] =
817 ADD_TABLE(cc_component),
818 ADD_TABLE(directory),
819 ADD_TABLE(cc_feature),
820 ADD_TABLE(cc_feature_comp),
821 ADD_TABLE(co_file),
822 ADD_TABLE(install_exec_seq),
823 ADD_TABLE(co_media),
824 ADD_TABLE(property),
827 static const msi_table co2_tables[] =
829 ADD_TABLE(cc_component),
830 ADD_TABLE(directory),
831 ADD_TABLE(cc_feature),
832 ADD_TABLE(cc_feature_comp),
833 ADD_TABLE(cc_file),
834 ADD_TABLE(install_exec_seq),
835 ADD_TABLE(co2_media),
836 ADD_TABLE(property),
839 static const msi_table mm_tables[] =
841 ADD_TABLE(cc_component),
842 ADD_TABLE(directory),
843 ADD_TABLE(cc_feature),
844 ADD_TABLE(cc_feature_comp),
845 ADD_TABLE(mm_file),
846 ADD_TABLE(install_exec_seq),
847 ADD_TABLE(mm_media),
848 ADD_TABLE(property),
851 static const msi_table ss_tables[] =
853 ADD_TABLE(cc_component),
854 ADD_TABLE(directory),
855 ADD_TABLE(cc_feature),
856 ADD_TABLE(cc_feature_comp),
857 ADD_TABLE(cc_file),
858 ADD_TABLE(install_exec_seq),
859 ADD_TABLE(ss_media),
860 ADD_TABLE(property),
863 static const msi_table ui_tables[] =
865 ADD_TABLE(ui_component),
866 ADD_TABLE(directory),
867 ADD_TABLE(cc_feature),
868 ADD_TABLE(cc_feature_comp),
869 ADD_TABLE(cc_file),
870 ADD_TABLE(install_exec_seq),
871 ADD_TABLE(ui_install_ui_seq),
872 ADD_TABLE(ui_custom_action),
873 ADD_TABLE(cc_media),
874 ADD_TABLE(property),
877 static const msi_table rof_tables[] =
879 ADD_TABLE(rof_component),
880 ADD_TABLE(directory),
881 ADD_TABLE(rof_feature),
882 ADD_TABLE(rof_feature_comp),
883 ADD_TABLE(rof_file),
884 ADD_TABLE(install_exec_seq),
885 ADD_TABLE(rof_media),
886 ADD_TABLE(property),
889 static const msi_table sdp_tables[] =
891 ADD_TABLE(rof_component),
892 ADD_TABLE(directory),
893 ADD_TABLE(rof_feature),
894 ADD_TABLE(rof_feature_comp),
895 ADD_TABLE(rof_file),
896 ADD_TABLE(sdp_install_exec_seq),
897 ADD_TABLE(sdp_custom_action),
898 ADD_TABLE(rof_media),
899 ADD_TABLE(property),
902 static const msi_table cie_tables[] =
904 ADD_TABLE(cie_component),
905 ADD_TABLE(directory),
906 ADD_TABLE(cc_feature),
907 ADD_TABLE(cie_feature_comp),
908 ADD_TABLE(cie_file),
909 ADD_TABLE(install_exec_seq),
910 ADD_TABLE(cie_media),
911 ADD_TABLE(property),
914 static const msi_table ci_tables[] =
916 ADD_TABLE(ci_component),
917 ADD_TABLE(directory),
918 ADD_TABLE(rof_feature),
919 ADD_TABLE(rof_feature_comp),
920 ADD_TABLE(rof_file),
921 ADD_TABLE(ci_install_exec_seq),
922 ADD_TABLE(rof_media),
923 ADD_TABLE(property),
924 ADD_TABLE(ci_custom_action),
927 static const msi_table ci2_tables[] =
929 ADD_TABLE(ci2_component),
930 ADD_TABLE(directory),
931 ADD_TABLE(rof_feature),
932 ADD_TABLE(ci2_feature_comp),
933 ADD_TABLE(ci2_file),
934 ADD_TABLE(install_exec_seq),
935 ADD_TABLE(rof_media),
936 ADD_TABLE(property),
939 static const msi_table spf_tables[] =
941 ADD_TABLE(ci_component),
942 ADD_TABLE(directory),
943 ADD_TABLE(rof_feature),
944 ADD_TABLE(rof_feature_comp),
945 ADD_TABLE(rof_file),
946 ADD_TABLE(spf_install_exec_seq),
947 ADD_TABLE(rof_media),
948 ADD_TABLE(property),
949 ADD_TABLE(spf_custom_action),
950 ADD_TABLE(spf_install_ui_seq),
953 static const msi_table pp_tables[] =
955 ADD_TABLE(ci_component),
956 ADD_TABLE(directory),
957 ADD_TABLE(rof_feature),
958 ADD_TABLE(rof_feature_comp),
959 ADD_TABLE(rof_file),
960 ADD_TABLE(pp_install_exec_seq),
961 ADD_TABLE(rof_media),
962 ADD_TABLE(property),
965 static const msi_table ppc_tables[] =
967 ADD_TABLE(ppc_component),
968 ADD_TABLE(directory),
969 ADD_TABLE(rof_feature),
970 ADD_TABLE(ppc_feature_comp),
971 ADD_TABLE(ppc_file),
972 ADD_TABLE(pp_install_exec_seq),
973 ADD_TABLE(ppc_media),
974 ADD_TABLE(property),
977 static const msi_table tp_tables[] =
979 ADD_TABLE(tp_component),
980 ADD_TABLE(directory),
981 ADD_TABLE(rof_feature),
982 ADD_TABLE(ci2_feature_comp),
983 ADD_TABLE(ci2_file),
984 ADD_TABLE(install_exec_seq),
985 ADD_TABLE(rof_media),
986 ADD_TABLE(property),
989 static const msi_table cwd_tables[] =
991 ADD_TABLE(cwd_component),
992 ADD_TABLE(directory),
993 ADD_TABLE(rof_feature),
994 ADD_TABLE(ci2_feature_comp),
995 ADD_TABLE(ci2_file),
996 ADD_TABLE(install_exec_seq),
997 ADD_TABLE(rof_media),
998 ADD_TABLE(property),
1001 static const msi_table adm_tables[] =
1003 ADD_TABLE(adm_component),
1004 ADD_TABLE(directory),
1005 ADD_TABLE(rof_feature),
1006 ADD_TABLE(ci2_feature_comp),
1007 ADD_TABLE(ci2_file),
1008 ADD_TABLE(install_exec_seq),
1009 ADD_TABLE(rof_media),
1010 ADD_TABLE(property),
1011 ADD_TABLE(adm_custom_action),
1012 ADD_TABLE(adm_admin_exec_seq),
1015 static const msi_table amp_tables[] =
1017 ADD_TABLE(amp_component),
1018 ADD_TABLE(directory),
1019 ADD_TABLE(rof_feature),
1020 ADD_TABLE(ci2_feature_comp),
1021 ADD_TABLE(ci2_file),
1022 ADD_TABLE(install_exec_seq),
1023 ADD_TABLE(rof_media),
1024 ADD_TABLE(property),
1027 static const msi_table rem_tables[] =
1029 ADD_TABLE(rem_component),
1030 ADD_TABLE(directory),
1031 ADD_TABLE(rof_feature),
1032 ADD_TABLE(rem_feature_comp),
1033 ADD_TABLE(rem_file),
1034 ADD_TABLE(rem_install_exec_seq),
1035 ADD_TABLE(rof_media),
1036 ADD_TABLE(property),
1037 ADD_TABLE(rem_remove_files),
1040 static const msi_table mov_tables[] =
1042 ADD_TABLE(cwd_component),
1043 ADD_TABLE(directory),
1044 ADD_TABLE(rof_feature),
1045 ADD_TABLE(ci2_feature_comp),
1046 ADD_TABLE(ci2_file),
1047 ADD_TABLE(install_exec_seq),
1048 ADD_TABLE(rof_media),
1049 ADD_TABLE(property),
1050 ADD_TABLE(mov_move_file),
1053 static const msi_table mc_tables[] =
1055 ADD_TABLE(mc_component),
1056 ADD_TABLE(directory),
1057 ADD_TABLE(cc_feature),
1058 ADD_TABLE(cie_feature_comp),
1059 ADD_TABLE(mc_file),
1060 ADD_TABLE(install_exec_seq),
1061 ADD_TABLE(mc_media),
1062 ADD_TABLE(property),
1063 ADD_TABLE(mc_file_hash),
1066 static const msi_table df_tables[] =
1068 ADD_TABLE(rof_component),
1069 ADD_TABLE(df_directory),
1070 ADD_TABLE(rof_feature),
1071 ADD_TABLE(rof_feature_comp),
1072 ADD_TABLE(rof_file),
1073 ADD_TABLE(install_exec_seq),
1074 ADD_TABLE(rof_media),
1075 ADD_TABLE(property),
1076 ADD_TABLE(df_duplicate_file),
1079 static const msi_table wrv_tables[] =
1081 ADD_TABLE(wrv_component),
1082 ADD_TABLE(directory),
1083 ADD_TABLE(rof_feature),
1084 ADD_TABLE(ci2_feature_comp),
1085 ADD_TABLE(ci2_file),
1086 ADD_TABLE(install_exec_seq),
1087 ADD_TABLE(rof_media),
1088 ADD_TABLE(property),
1089 ADD_TABLE(wrv_registry),
1092 static const msi_table sf_tables[] =
1094 ADD_TABLE(wrv_component),
1095 ADD_TABLE(directory),
1096 ADD_TABLE(rof_feature),
1097 ADD_TABLE(ci2_feature_comp),
1098 ADD_TABLE(ci2_file),
1099 ADD_TABLE(install_exec_seq),
1100 ADD_TABLE(rof_media),
1101 ADD_TABLE(property),
1104 static const msi_table ca51_tables[] =
1106 ADD_TABLE(ca51_component),
1107 ADD_TABLE(directory),
1108 ADD_TABLE(rof_feature),
1109 ADD_TABLE(ci2_feature_comp),
1110 ADD_TABLE(ci2_file),
1111 ADD_TABLE(ca51_install_exec_seq),
1112 ADD_TABLE(rof_media),
1113 ADD_TABLE(property),
1114 ADD_TABLE(ca51_custom_action),
1117 static const msi_table is_tables[] =
1119 ADD_TABLE(is_component),
1120 ADD_TABLE(directory),
1121 ADD_TABLE(is_feature),
1122 ADD_TABLE(is_feature_comp),
1123 ADD_TABLE(is_file),
1124 ADD_TABLE(install_exec_seq),
1125 ADD_TABLE(is_media),
1126 ADD_TABLE(property),
1129 static const msi_table sp_tables[] =
1131 ADD_TABLE(sp_component),
1132 ADD_TABLE(sp_directory),
1133 ADD_TABLE(rof_feature),
1134 ADD_TABLE(ci2_feature_comp),
1135 ADD_TABLE(ci2_file),
1136 ADD_TABLE(install_exec_seq),
1137 ADD_TABLE(rof_media),
1138 ADD_TABLE(property),
1141 static const msi_table mcp_tables[] =
1143 ADD_TABLE(mcp_component),
1144 ADD_TABLE(directory),
1145 ADD_TABLE(mcp_feature),
1146 ADD_TABLE(mcp_feature_comp),
1147 ADD_TABLE(rem_file),
1148 ADD_TABLE(rem_install_exec_seq),
1149 ADD_TABLE(rof_media),
1150 ADD_TABLE(property),
1153 static const msi_table mcomp_tables[] =
1155 ADD_TABLE(mcp_component),
1156 ADD_TABLE(directory),
1157 ADD_TABLE(mcp_feature),
1158 ADD_TABLE(mcp_feature_comp),
1159 ADD_TABLE(mcomp_file),
1160 ADD_TABLE(rem_install_exec_seq),
1161 ADD_TABLE(rof_media),
1162 ADD_TABLE(property),
1165 /* cabinet definitions */
1167 /* make the max size large so there is only one cab file */
1168 #define MEDIA_SIZE 0x7FFFFFFF
1169 #define FOLDER_THRESHOLD 900000
1171 /* the FCI callbacks */
1173 static void *mem_alloc(ULONG cb)
1175 return HeapAlloc(GetProcessHeap(), 0, cb);
1178 static void mem_free(void *memory)
1180 HeapFree(GetProcessHeap(), 0, memory);
1183 static BOOL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
1185 sprintf(pccab->szCab, pv, pccab->iCab);
1186 return TRUE;
1189 static long progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
1191 return 0;
1194 static int file_placed(PCCAB pccab, char *pszFile, long cbFile,
1195 BOOL fContinuation, void *pv)
1197 return 0;
1200 static INT_PTR fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
1202 HANDLE handle;
1203 DWORD dwAccess = 0;
1204 DWORD dwShareMode = 0;
1205 DWORD dwCreateDisposition = OPEN_EXISTING;
1207 dwAccess = GENERIC_READ | GENERIC_WRITE;
1208 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
1209 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
1211 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
1212 dwCreateDisposition = OPEN_EXISTING;
1213 else
1214 dwCreateDisposition = CREATE_NEW;
1216 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
1217 dwCreateDisposition, 0, NULL);
1219 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
1221 return (INT_PTR)handle;
1224 static UINT fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1226 HANDLE handle = (HANDLE)hf;
1227 DWORD dwRead;
1228 BOOL res;
1230 res = ReadFile(handle, memory, cb, &dwRead, NULL);
1231 ok(res, "Failed to ReadFile\n");
1233 return dwRead;
1236 static UINT fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1238 HANDLE handle = (HANDLE)hf;
1239 DWORD dwWritten;
1240 BOOL res;
1242 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
1243 ok(res, "Failed to WriteFile\n");
1245 return dwWritten;
1248 static int fci_close(INT_PTR hf, int *err, void *pv)
1250 HANDLE handle = (HANDLE)hf;
1251 ok(CloseHandle(handle), "Failed to CloseHandle\n");
1253 return 0;
1256 static long fci_seek(INT_PTR hf, long dist, int seektype, int *err, void *pv)
1258 HANDLE handle = (HANDLE)hf;
1259 DWORD ret;
1261 ret = SetFilePointer(handle, dist, NULL, seektype);
1262 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
1264 return ret;
1267 static int fci_delete(char *pszFile, int *err, void *pv)
1269 BOOL ret = DeleteFileA(pszFile);
1270 ok(ret, "Failed to DeleteFile %s\n", pszFile);
1272 return 0;
1275 static void init_functionpointers(void)
1277 HMODULE hmsi = GetModuleHandleA("msi.dll");
1279 #define GET_PROC(mod, func) \
1280 p ## func = (void*)GetProcAddress(mod, #func); \
1281 if(!p ## func) \
1282 trace("GetProcAddress(%s) failed\n", #func);
1284 GET_PROC(hmsi, MsiQueryComponentStateA);
1285 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
1286 GET_PROC(hmsi, MsiSourceListGetInfoA);
1288 hsrclient = LoadLibraryA("srclient.dll");
1289 GET_PROC(hsrclient, SRRemoveRestorePoint);
1290 GET_PROC(hsrclient, SRSetRestorePointA);
1292 #undef GET_PROC
1295 static void get_user_sid(LPSTR *usersid)
1297 HANDLE token;
1298 BYTE buf[1024];
1299 DWORD size;
1300 PTOKEN_USER user;
1301 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
1302 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
1304 *usersid = NULL;
1305 pConvertSidToStringSidA = (void *)GetProcAddress(hadvapi32, "ConvertSidToStringSidA");
1306 if (!pConvertSidToStringSidA)
1307 return;
1309 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
1310 size = sizeof(buf);
1311 GetTokenInformation(token, TokenUser, (void *)buf, size, &size);
1312 user = (PTOKEN_USER)buf;
1313 pConvertSidToStringSidA(user->User.Sid, usersid);
1316 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
1318 CHAR buffer[0x20];
1319 UINT r;
1320 DWORD sz;
1322 sz = sizeof buffer;
1323 r = MsiRecordGetString(rec, field, buffer, &sz);
1324 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
1327 static BOOL get_temp_file(char *pszTempName, int cbTempName, void *pv)
1329 LPSTR tempname;
1331 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
1332 GetTempFileNameA(".", "xx", 0, tempname);
1334 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
1336 lstrcpyA(pszTempName, tempname);
1337 HeapFree(GetProcessHeap(), 0, tempname);
1338 return TRUE;
1341 HeapFree(GetProcessHeap(), 0, tempname);
1343 return FALSE;
1346 static INT_PTR get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
1347 USHORT *pattribs, int *err, void *pv)
1349 BY_HANDLE_FILE_INFORMATION finfo;
1350 FILETIME filetime;
1351 HANDLE handle;
1352 DWORD attrs;
1353 BOOL res;
1355 handle = CreateFile(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
1356 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
1358 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
1360 res = GetFileInformationByHandle(handle, &finfo);
1361 ok(res, "Expected GetFileInformationByHandle to succeed\n");
1363 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
1364 FileTimeToDosDateTime(&filetime, pdate, ptime);
1366 attrs = GetFileAttributes(pszName);
1367 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
1369 return (INT_PTR)handle;
1372 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
1374 char path[MAX_PATH];
1375 char filename[MAX_PATH];
1377 lstrcpyA(path, CURR_DIR);
1378 lstrcatA(path, "\\");
1379 lstrcatA(path, file);
1381 lstrcpyA(filename, file);
1383 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
1384 progress, get_open_info, compress);
1387 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
1389 ZeroMemory(pCabParams, sizeof(CCAB));
1391 pCabParams->cb = max_size;
1392 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
1393 pCabParams->setID = 0xbeef;
1394 pCabParams->iCab = 1;
1395 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
1396 lstrcatA(pCabParams->szCabPath, "\\");
1397 lstrcpyA(pCabParams->szCab, name);
1400 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
1402 CCAB cabParams;
1403 LPCSTR ptr;
1404 HFCI hfci;
1405 ERF erf;
1406 BOOL res;
1408 set_cab_parameters(&cabParams, name, max_size);
1410 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
1411 fci_read, fci_write, fci_close, fci_seek, fci_delete,
1412 get_temp_file, &cabParams, NULL);
1414 ok(hfci != NULL, "Failed to create an FCI context\n");
1416 ptr = files;
1417 while (*ptr)
1419 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
1420 ok(res, "Failed to add file: %s\n", ptr);
1421 ptr += lstrlen(ptr) + 1;
1424 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
1425 ok(res, "Failed to flush the cabinet\n");
1427 res = FCIDestroy(hfci);
1428 ok(res, "Failed to destroy the cabinet\n");
1431 static BOOL get_program_files_dir(LPSTR buf, LPSTR buf2)
1433 HKEY hkey;
1434 DWORD type, size;
1436 if (RegOpenKey(HKEY_LOCAL_MACHINE,
1437 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
1438 return FALSE;
1440 size = MAX_PATH;
1441 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) {
1442 RegCloseKey(hkey);
1443 return FALSE;
1446 size = MAX_PATH;
1447 if (RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size)) {
1448 RegCloseKey(hkey);
1449 return FALSE;
1452 RegCloseKey(hkey);
1453 return TRUE;
1456 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
1458 HANDLE file;
1459 DWORD written;
1461 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
1462 if (file == INVALID_HANDLE_VALUE)
1463 return;
1465 WriteFile(file, data, strlen(data), &written, NULL);
1467 if (size)
1469 SetFilePointer(file, size, NULL, FILE_BEGIN);
1470 SetEndOfFile(file);
1473 CloseHandle(file);
1476 #define create_file(name, size) create_file_data(name, name, size)
1478 static void create_test_files(void)
1480 CreateDirectoryA("msitest", NULL);
1481 create_file("msitest\\one.txt", 100);
1482 CreateDirectoryA("msitest\\first", NULL);
1483 create_file("msitest\\first\\two.txt", 100);
1484 CreateDirectoryA("msitest\\second", NULL);
1485 create_file("msitest\\second\\three.txt", 100);
1487 create_file("four.txt", 100);
1488 create_file("five.txt", 100);
1489 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
1491 create_file("msitest\\filename", 100);
1492 create_file("msitest\\service.exe", 100);
1494 DeleteFileA("four.txt");
1495 DeleteFileA("five.txt");
1498 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
1500 CHAR path[MAX_PATH];
1502 lstrcpyA(path, PROG_FILES_DIR);
1503 lstrcatA(path, "\\");
1504 lstrcatA(path, rel_path);
1506 if (is_file)
1507 return DeleteFileA(path);
1508 else
1509 return RemoveDirectoryA(path);
1512 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
1514 CHAR path[MAX_PATH];
1516 lstrcpyA(path, COMMON_FILES_DIR);
1517 lstrcatA(path, "\\");
1518 lstrcatA(path, rel_path);
1520 if (is_file)
1521 return DeleteFileA(path);
1522 else
1523 return RemoveDirectoryA(path);
1526 static void delete_test_files(void)
1528 DeleteFileA("msitest.msi");
1529 DeleteFileA("msitest.cab");
1530 DeleteFileA("msitest\\second\\three.txt");
1531 DeleteFileA("msitest\\first\\two.txt");
1532 DeleteFileA("msitest\\one.txt");
1533 DeleteFileA("msitest\\service.exe");
1534 DeleteFileA("msitest\\filename");
1535 RemoveDirectoryA("msitest\\second");
1536 RemoveDirectoryA("msitest\\first");
1537 RemoveDirectoryA("msitest");
1540 static void write_file(const CHAR *filename, const char *data, int data_size)
1542 DWORD size;
1544 HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
1545 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
1547 WriteFile(hf, data, data_size, &size, NULL);
1548 CloseHandle(hf);
1551 static void write_msi_summary_info(MSIHANDLE db)
1553 MSIHANDLE summary;
1554 UINT r;
1556 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
1557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1559 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, ";1033");
1560 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1562 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
1563 "{004757CA-5092-49c2-AD20-28E1CE0DF5F2}");
1564 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1566 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
1567 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1569 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 0, NULL, NULL);
1570 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1572 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
1573 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1575 /* write the summary changes back to the stream */
1576 r = MsiSummaryInfoPersist(summary);
1577 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1579 MsiCloseHandle(summary);
1582 static void create_database(const CHAR *name, const msi_table *tables, int num_tables)
1584 MSIHANDLE db;
1585 UINT r;
1586 int j;
1588 r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db);
1589 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1591 /* import the tables into the database */
1592 for (j = 0; j < num_tables; j++)
1594 const msi_table *table = &tables[j];
1596 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
1598 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
1599 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1601 DeleteFileA(table->filename);
1604 write_msi_summary_info(db);
1606 r = MsiDatabaseCommit(db);
1607 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1609 MsiCloseHandle(db);
1612 static void check_service_is_installed(void)
1614 SC_HANDLE scm, service;
1615 BOOL res;
1617 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
1618 ok(scm != NULL, "Failed to open the SC Manager\n");
1620 service = OpenService(scm, "TestService", SC_MANAGER_ALL_ACCESS);
1621 ok(service != NULL, "Failed to open TestService\n");
1623 res = DeleteService(service);
1624 ok(res, "Failed to delete TestService\n");
1626 CloseServiceHandle(service);
1627 CloseServiceHandle(scm);
1630 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
1632 RESTOREPOINTINFOA spec;
1634 spec.dwEventType = event_type;
1635 spec.dwRestorePtType = APPLICATION_INSTALL;
1636 spec.llSequenceNumber = status->llSequenceNumber;
1637 lstrcpyA(spec.szDescription, "msitest restore point");
1639 return pSRSetRestorePointA(&spec, status);
1642 static void remove_restore_point(DWORD seq_number)
1644 DWORD res;
1646 res = pSRRemoveRestorePoint(seq_number);
1647 if (res != ERROR_SUCCESS)
1648 trace("Failed to remove the restore point : %08x\n", res);
1651 static void test_MsiInstallProduct(void)
1653 UINT r;
1654 CHAR path[MAX_PATH];
1655 LONG res;
1656 HKEY hkey;
1657 DWORD num, size, type;
1658 SC_HANDLE scm;
1660 scm = OpenSCManager(NULL, NULL, GENERIC_ALL);
1661 if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
1663 skip("Services are not implemented, we are most likely on win9x\n");
1664 return;
1666 CloseServiceHandle(scm);
1668 create_test_files();
1669 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1671 r = MsiInstallProductA(msifile, NULL);
1672 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1674 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
1675 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
1676 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
1677 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
1678 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
1679 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
1680 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
1681 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
1682 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
1683 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
1684 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
1685 ok(delete_pf("msitest", FALSE), "File not installed\n");
1687 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
1688 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1690 size = MAX_PATH;
1691 type = REG_SZ;
1692 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
1693 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1694 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
1696 size = MAX_PATH;
1697 type = REG_SZ;
1698 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
1699 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
1701 size = sizeof(num);
1702 type = REG_DWORD;
1703 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
1704 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1705 ok(num == 314, "Expected 314, got %d\n", num);
1707 size = MAX_PATH;
1708 type = REG_SZ;
1709 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
1710 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1711 ok(!lstrcmpA(path, "OrderTestValue"), "Expected imaname, got %s\n", path);
1713 check_service_is_installed();
1715 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
1717 delete_test_files();
1720 static void test_MsiSetComponentState(void)
1722 INSTALLSTATE installed, action;
1723 MSIHANDLE package;
1724 char path[MAX_PATH];
1725 UINT r;
1727 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1729 CoInitialize(NULL);
1731 lstrcpy(path, CURR_DIR);
1732 lstrcat(path, "\\");
1733 lstrcat(path, msifile);
1735 r = MsiOpenPackage(path, &package);
1736 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1738 r = MsiDoAction(package, "CostInitialize");
1739 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1741 r = MsiDoAction(package, "FileCost");
1742 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1744 r = MsiDoAction(package, "CostFinalize");
1745 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1747 r = MsiGetComponentState(package, "dangler", &installed, &action);
1748 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1749 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
1750 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
1752 r = MsiSetComponentState(package, "dangler", INSTALLSTATE_SOURCE);
1753 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1755 MsiCloseHandle(package);
1756 CoUninitialize();
1758 DeleteFileA(msifile);
1761 static void test_packagecoltypes(void)
1763 MSIHANDLE hdb, view, rec;
1764 char path[MAX_PATH];
1765 LPCSTR query;
1766 UINT r, count;
1768 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1770 CoInitialize(NULL);
1772 lstrcpy(path, CURR_DIR);
1773 lstrcat(path, "\\");
1774 lstrcat(path, msifile);
1776 r = MsiOpenDatabase(path, MSIDBOPEN_READONLY, &hdb);
1777 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1779 query = "SELECT * FROM `Media`";
1780 r = MsiDatabaseOpenView( hdb, query, &view );
1781 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
1783 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
1784 count = MsiRecordGetFieldCount( rec );
1785 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
1786 ok(count == 6, "Expected 6, got %d\n", count);
1787 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
1788 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
1789 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
1790 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
1791 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
1792 ok(check_record(rec, 6, "Source"), "wrong column label\n");
1793 MsiCloseHandle(rec);
1795 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
1796 count = MsiRecordGetFieldCount( rec );
1797 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
1798 ok(count == 6, "Expected 6, got %d\n", count);
1799 ok(check_record(rec, 1, "i2"), "wrong column label\n");
1800 ok(check_record(rec, 2, "i4"), "wrong column label\n");
1801 ok(check_record(rec, 3, "L64"), "wrong column label\n");
1802 ok(check_record(rec, 4, "S255"), "wrong column label\n");
1803 ok(check_record(rec, 5, "S32"), "wrong column label\n");
1804 ok(check_record(rec, 6, "S72"), "wrong column label\n");
1806 MsiCloseHandle(rec);
1807 MsiCloseHandle(view);
1808 MsiCloseHandle(hdb);
1809 CoUninitialize();
1811 DeleteFile(msifile);
1814 static void create_cc_test_files(void)
1816 CCAB cabParams;
1817 HFCI hfci;
1818 ERF erf;
1819 static CHAR cab_context[] = "test%d.cab";
1820 BOOL res;
1822 create_file("maximus", 500);
1823 create_file("augustus", 50000);
1824 create_file("tiberius", 500);
1825 create_file("caesar", 500);
1827 set_cab_parameters(&cabParams, "test1.cab", 40000);
1829 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
1830 fci_read, fci_write, fci_close, fci_seek, fci_delete,
1831 get_temp_file, &cabParams, cab_context);
1832 ok(hfci != NULL, "Failed to create an FCI context\n");
1834 res = add_file(hfci, "maximus", tcompTYPE_NONE);
1835 ok(res, "Failed to add file maximus\n");
1837 res = add_file(hfci, "augustus", tcompTYPE_NONE);
1838 ok(res, "Failed to add file augustus\n");
1840 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
1841 ok(res, "Failed to add file tiberius\n");
1843 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
1844 ok(res, "Failed to flush the cabinet\n");
1846 res = FCIDestroy(hfci);
1847 ok(res, "Failed to destroy the cabinet\n");
1849 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1851 DeleteFile("maximus");
1852 DeleteFile("augustus");
1853 DeleteFile("tiberius");
1854 DeleteFile("caesar");
1857 static void delete_cab_files(void)
1859 SHFILEOPSTRUCT shfl;
1860 CHAR path[MAX_PATH+10];
1862 lstrcpyA(path, CURR_DIR);
1863 lstrcatA(path, "\\*.cab");
1864 path[strlen(path) + 1] = '\0';
1866 shfl.hwnd = NULL;
1867 shfl.wFunc = FO_DELETE;
1868 shfl.pFrom = path;
1869 shfl.pTo = NULL;
1870 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
1872 SHFileOperation(&shfl);
1875 static void test_continuouscabs(void)
1877 UINT r;
1879 create_cc_test_files();
1880 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
1882 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1884 r = MsiInstallProductA(msifile, NULL);
1885 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
1887 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1888 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
1889 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1890 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1891 ok(delete_pf("msitest", FALSE), "File not installed\n");
1894 delete_cab_files();
1895 DeleteFile(msifile);
1897 create_cc_test_files();
1898 create_database(msifile, cc2_tables, sizeof(cc2_tables) / sizeof(msi_table));
1900 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1902 r = MsiInstallProductA(msifile, NULL);
1903 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1904 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1905 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
1906 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
1907 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1908 ok(delete_pf("msitest", FALSE), "File not installed\n");
1910 delete_cab_files();
1911 DeleteFile(msifile);
1914 static void test_caborder(void)
1916 UINT r;
1918 create_file("imperator", 100);
1919 create_file("maximus", 500);
1920 create_file("augustus", 50000);
1921 create_file("caesar", 500);
1923 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
1925 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1927 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
1928 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
1929 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1931 r = MsiInstallProductA(msifile, NULL);
1932 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1933 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1934 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1935 todo_wine
1937 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1938 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1941 delete_cab_files();
1943 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
1944 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
1945 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1947 r = MsiInstallProductA(msifile, NULL);
1948 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1949 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1950 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1951 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1952 todo_wine
1954 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1957 delete_cab_files();
1958 DeleteFile(msifile);
1960 create_cc_test_files();
1961 create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
1963 r = MsiInstallProductA(msifile, NULL);
1964 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1965 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1966 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1967 todo_wine
1969 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1970 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1973 delete_cab_files();
1974 DeleteFile(msifile);
1976 create_cc_test_files();
1977 create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
1979 r = MsiInstallProductA(msifile, NULL);
1980 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1981 todo_wine
1983 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1984 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1985 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1986 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1989 delete_cab_files();
1990 DeleteFile("imperator");
1991 DeleteFile("maximus");
1992 DeleteFile("augustus");
1993 DeleteFile("caesar");
1994 DeleteFile(msifile);
1997 static void test_mixedmedia(void)
1999 UINT r;
2001 CreateDirectoryA("msitest", NULL);
2002 create_file("msitest\\maximus", 500);
2003 create_file("msitest\\augustus", 500);
2004 create_file("caesar", 500);
2006 create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
2008 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2010 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
2012 r = MsiInstallProductA(msifile, NULL);
2013 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2014 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2015 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2016 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2017 ok(delete_pf("msitest", FALSE), "File not installed\n");
2019 /* Delete the files in the temp (current) folder */
2020 DeleteFile("msitest\\maximus");
2021 DeleteFile("msitest\\augustus");
2022 RemoveDirectory("msitest");
2023 DeleteFile("caesar");
2024 DeleteFile("test1.cab");
2025 DeleteFile(msifile);
2028 static void test_samesequence(void)
2030 UINT r;
2032 create_cc_test_files();
2033 create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
2035 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2037 r = MsiInstallProductA(msifile, NULL);
2038 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
2040 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2041 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2042 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2043 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2044 ok(delete_pf("msitest", FALSE), "File not installed\n");
2047 delete_cab_files();
2048 DeleteFile(msifile);
2051 static void test_uiLevelFlags(void)
2053 UINT r;
2055 create_cc_test_files();
2056 create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
2058 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
2060 r = MsiInstallProductA(msifile, NULL);
2061 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
2063 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2064 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
2065 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2066 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2067 ok(delete_pf("msitest", FALSE), "File not installed\n");
2070 delete_cab_files();
2071 DeleteFile(msifile);
2074 static BOOL file_matches(LPSTR path)
2076 CHAR buf[MAX_PATH];
2077 HANDLE file;
2078 DWORD size;
2080 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
2081 NULL, OPEN_EXISTING, 0, NULL);
2083 ZeroMemory(buf, MAX_PATH);
2084 ReadFile(file, buf, 15, &size, NULL);
2085 CloseHandle(file);
2087 return !lstrcmp(buf, "msitest\\maximus");
2090 static void test_readonlyfile(void)
2092 UINT r;
2093 DWORD size;
2094 HANDLE file;
2095 CHAR path[MAX_PATH];
2097 CreateDirectoryA("msitest", NULL);
2098 create_file("msitest\\maximus", 500);
2099 create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
2101 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2103 lstrcpy(path, PROG_FILES_DIR);
2104 lstrcat(path, "\\msitest");
2105 CreateDirectory(path, NULL);
2107 lstrcat(path, "\\maximus");
2108 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
2109 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
2111 WriteFile(file, "readonlyfile", 20, &size, NULL);
2112 CloseHandle(file);
2114 r = MsiInstallProductA(msifile, NULL);
2115 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2116 ok(file_matches(path), "Expected file to be overwritten\n");
2117 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2118 ok(delete_pf("msitest", FALSE), "File not installed\n");
2120 /* Delete the files in the temp (current) folder */
2121 DeleteFile("msitest\\maximus");
2122 RemoveDirectory("msitest");
2123 DeleteFile(msifile);
2126 static void test_setdirproperty(void)
2128 UINT r;
2130 CreateDirectoryA("msitest", NULL);
2131 create_file("msitest\\maximus", 500);
2132 create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
2134 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2136 r = MsiInstallProductA(msifile, NULL);
2137 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2138 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
2139 ok(delete_cf("msitest", FALSE), "File not installed\n");
2141 /* Delete the files in the temp (current) folder */
2142 DeleteFile(msifile);
2143 DeleteFile("msitest\\maximus");
2144 RemoveDirectory("msitest");
2147 static void test_cabisextracted(void)
2149 UINT r;
2151 CreateDirectoryA("msitest", NULL);
2152 create_file("msitest\\gaius", 500);
2153 create_file("maximus", 500);
2154 create_file("augustus", 500);
2155 create_file("caesar", 500);
2157 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
2158 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
2159 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2161 create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
2163 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2165 r = MsiInstallProductA(msifile, NULL);
2166 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2167 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2168 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2169 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2170 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
2171 ok(delete_pf("msitest", FALSE), "File not installed\n");
2173 /* Delete the files in the temp (current) folder */
2174 delete_cab_files();
2175 DeleteFile(msifile);
2176 DeleteFile("maximus");
2177 DeleteFile("augustus");
2178 DeleteFile("caesar");
2179 DeleteFile("msitest\\gaius");
2180 RemoveDirectory("msitest");
2183 static void test_concurrentinstall(void)
2185 UINT r;
2186 CHAR path[MAX_PATH];
2188 CreateDirectoryA("msitest", NULL);
2189 CreateDirectoryA("msitest\\msitest", NULL);
2190 create_file("msitest\\maximus", 500);
2191 create_file("msitest\\msitest\\augustus", 500);
2193 create_database(msifile, ci_tables, sizeof(ci_tables) / sizeof(msi_table));
2195 lstrcpyA(path, CURR_DIR);
2196 lstrcatA(path, "\\msitest\\concurrent.msi");
2197 create_database(path, ci2_tables, sizeof(ci2_tables) / sizeof(msi_table));
2199 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2201 r = MsiInstallProductA(msifile, NULL);
2202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2203 if (!delete_pf("msitest\\augustus", TRUE))
2204 trace("concurrent installs not supported\n");
2205 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2206 ok(delete_pf("msitest", FALSE), "File not installed\n");
2208 DeleteFile(path);
2210 r = MsiInstallProductA(msifile, NULL);
2211 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2212 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2213 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
2214 ok(delete_pf("msitest", FALSE), "File not installed\n");
2216 DeleteFile(msifile);
2217 DeleteFile("msitest\\msitest\\augustus");
2218 DeleteFile("msitest\\maximus");
2219 RemoveDirectory("msitest\\msitest");
2220 RemoveDirectory("msitest");
2223 static void test_setpropertyfolder(void)
2225 UINT r;
2226 CHAR path[MAX_PATH];
2228 lstrcpyA(path, PROG_FILES_DIR);
2229 lstrcatA(path, "\\msitest\\added");
2231 CreateDirectoryA("msitest", NULL);
2232 create_file("msitest\\maximus", 500);
2234 create_database(msifile, spf_tables, sizeof(spf_tables) / sizeof(msi_table));
2236 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2238 r = MsiInstallProductA(msifile, NULL);
2239 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2240 if (GetFileAttributesA(path) == FILE_ATTRIBUTE_DIRECTORY)
2242 ok(delete_pf("msitest\\added\\maximus", TRUE), "File not installed\n");
2243 ok(delete_pf("msitest\\added", FALSE), "File not installed\n");
2244 ok(delete_pf("msitest", FALSE), "File not installed\n");
2246 else
2248 trace("changing folder property not supported\n");
2249 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2250 ok(delete_pf("msitest", FALSE), "File not installed\n");
2253 /* Delete the files in the temp (current) folder */
2254 DeleteFile(msifile);
2255 DeleteFile("msitest\\maximus");
2256 RemoveDirectory("msitest");
2259 static BOOL file_exists(LPCSTR file)
2261 return GetFileAttributes(file) != INVALID_FILE_ATTRIBUTES;
2264 static BOOL pf_exists(LPCSTR file)
2266 CHAR path[MAX_PATH];
2268 lstrcpyA(path, PROG_FILES_DIR);
2269 lstrcatA(path, "\\");
2270 lstrcatA(path, file);
2272 return file_exists(path);
2275 static void delete_pfmsitest_files(void)
2277 SHFILEOPSTRUCT shfl;
2278 CHAR path[MAX_PATH+11];
2280 lstrcpyA(path, PROG_FILES_DIR);
2281 lstrcatA(path, "\\msitest\\*");
2282 path[strlen(path) + 1] = '\0';
2284 shfl.hwnd = NULL;
2285 shfl.wFunc = FO_DELETE;
2286 shfl.pFrom = path;
2287 shfl.pTo = NULL;
2288 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
2290 SHFileOperation(&shfl);
2292 lstrcpyA(path, PROG_FILES_DIR);
2293 lstrcatA(path, "\\msitest");
2294 RemoveDirectoryA(path);
2297 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
2299 char val[MAX_PATH];
2300 DWORD size, type;
2301 LONG res;
2303 size = MAX_PATH;
2304 val[0] = '\0';
2305 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
2307 if (res != ERROR_SUCCESS ||
2308 (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
2310 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2311 return;
2314 if (!expected)
2315 ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val);
2316 else
2318 if (bcase)
2319 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
2320 else
2321 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
2325 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
2327 DWORD val, size, type;
2328 LONG res;
2330 size = sizeof(DWORD);
2331 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2333 if (res != ERROR_SUCCESS || type != REG_DWORD)
2335 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2336 return;
2339 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
2342 #define CHECK_REG_STR(prodkey, name, expected) \
2343 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
2345 #define CHECK_DEL_REG_STR(prodkey, name, expected) \
2346 check_reg_str(prodkey, name, expected, TRUE, __LINE__); \
2347 RegDeleteValueA(prodkey, name);
2349 #define CHECK_REG_ISTR(prodkey, name, expected) \
2350 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
2352 #define CHECK_DEL_REG_ISTR(prodkey, name, expected) \
2353 check_reg_str(prodkey, name, expected, FALSE, __LINE__); \
2354 RegDeleteValueA(prodkey, name);
2356 #define CHECK_REG_DWORD(prodkey, name, expected) \
2357 check_reg_dword(prodkey, name, expected, __LINE__);
2359 #define CHECK_DEL_REG_DWORD(prodkey, name, expected) \
2360 check_reg_dword(prodkey, name, expected, __LINE__); \
2361 RegDeleteValueA(prodkey, name);
2363 static void get_date_str(LPSTR date)
2365 SYSTEMTIME systime;
2367 static const char date_fmt[] = "%d%02d%02d";
2368 GetLocalTime(&systime);
2369 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
2372 static void test_publish_registerproduct(void)
2374 UINT r;
2375 LONG res;
2376 HKEY hkey;
2377 HKEY props, usage;
2378 LPSTR usersid;
2379 char date[MAX_PATH];
2380 char temp[MAX_PATH];
2381 char keypath[MAX_PATH];
2383 static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2384 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2385 static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2386 "\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2387 static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2388 "\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2389 static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2390 "\\51AAE0C44620A5E4788506E91F249BD2";
2392 get_user_sid(&usersid);
2393 if (!usersid)
2395 skip("ConvertSidToStringSidA is not available\n");
2396 return;
2399 get_date_str(date);
2400 GetTempPath(MAX_PATH, temp);
2402 CreateDirectoryA("msitest", NULL);
2403 create_file("msitest\\maximus", 500);
2405 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2407 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2409 /* RegisterProduct */
2410 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
2411 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2412 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2413 ok(delete_pf("msitest", FALSE), "File not installed\n");
2415 res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
2416 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2418 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
2419 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2421 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2422 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2423 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2424 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2425 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2426 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2427 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2428 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2429 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2430 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2431 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2432 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2433 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2434 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2435 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2436 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2437 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2438 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2439 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2440 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2441 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2442 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2443 todo_wine
2445 CHECK_DEL_REG_DWORD(hkey, "EstimatedSize", 12);
2448 RegDeleteKeyA(hkey, "");
2449 RegCloseKey(hkey);
2451 sprintf(keypath, userdata, usersid);
2452 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2453 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2455 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2456 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2458 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2459 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2460 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2461 CHECK_DEL_REG_STR(props, "InstallDate", date);
2462 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2463 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2464 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2465 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2466 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2467 CHECK_DEL_REG_STR(props, "Comments", NULL);
2468 CHECK_DEL_REG_STR(props, "Contact", NULL);
2469 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2470 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2471 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2472 CHECK_DEL_REG_STR(props, "Readme", NULL);
2473 CHECK_DEL_REG_STR(props, "Size", NULL);
2474 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2475 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2476 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2477 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2478 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2479 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2480 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2481 todo_wine
2483 CHECK_DEL_REG_DWORD(props, "EstimatedSize", 12);
2486 RegDeleteKeyA(props, "");
2487 RegCloseKey(props);
2489 res = RegOpenKeyA(hkey, "Usage", &usage);
2490 todo_wine
2492 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2495 RegDeleteKeyA(usage, "");
2496 RegCloseKey(usage);
2497 RegDeleteKeyA(hkey, "");
2498 RegCloseKey(hkey);
2500 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
2501 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2503 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2505 RegDeleteKeyA(hkey, "");
2506 RegCloseKey(hkey);
2508 /* RegisterProduct, machine */
2509 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 ALLUSERS=1");
2510 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2511 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2512 ok(delete_pf("msitest", FALSE), "File not installed\n");
2514 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, userugkey, &hkey);
2515 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2517 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
2518 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2520 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2521 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2522 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2523 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2524 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2525 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2526 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2527 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2528 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2529 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2530 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2531 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2532 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2533 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2534 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2535 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2536 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2537 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2538 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2539 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2540 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2541 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2542 todo_wine
2544 CHECK_DEL_REG_DWORD(hkey, "EstimatedSize", 12);
2547 RegDeleteKeyA(hkey, "");
2548 RegCloseKey(hkey);
2550 sprintf(keypath, userdata, "S-1-5-18");
2551 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2552 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2554 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2555 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2557 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2558 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2559 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2560 CHECK_DEL_REG_STR(props, "InstallDate", date);
2561 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2562 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2563 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2564 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2565 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2566 CHECK_DEL_REG_STR(props, "Comments", NULL);
2567 CHECK_DEL_REG_STR(props, "Contact", NULL);
2568 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2569 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2570 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2571 CHECK_DEL_REG_STR(props, "Readme", NULL);
2572 CHECK_DEL_REG_STR(props, "Size", NULL);
2573 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2574 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2575 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2576 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2577 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2578 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2579 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2580 todo_wine
2582 CHECK_DEL_REG_DWORD(props, "EstimatedSize", 12);
2585 RegDeleteKeyA(props, "");
2586 RegCloseKey(props);
2588 res = RegOpenKeyA(hkey, "Usage", &usage);
2589 todo_wine
2591 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2594 RegDeleteKeyA(usage, "");
2595 RegCloseKey(usage);
2596 RegDeleteKeyA(hkey, "");
2597 RegCloseKey(hkey);
2599 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
2600 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2602 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2604 RegDeleteKeyA(hkey, "");
2605 RegCloseKey(hkey);
2607 DeleteFile(msifile);
2608 DeleteFile("msitest\\maximus");
2609 RemoveDirectory("msitest");
2610 HeapFree(GetProcessHeap(), 0, usersid);
2613 static void test_publish_publishproduct(void)
2615 UINT r;
2616 LONG res;
2617 LPSTR usersid;
2618 HKEY sourcelist, net, props;
2619 HKEY hkey, patches, media;
2620 CHAR keypath[MAX_PATH];
2621 CHAR temp[MAX_PATH];
2622 CHAR path[MAX_PATH];
2624 static const CHAR prodpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2625 "\\Installer\\UserData\\%s\\Products"
2626 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2627 static const CHAR cuprodpath[] = "Software\\Microsoft\\Installer\\Products"
2628 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2629 static const CHAR cuupgrades[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2630 "\\51AAE0C44620A5E4788506E91F249BD2";
2631 static const CHAR badprod[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2632 "\\Installer\\Products"
2633 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2634 static const CHAR machprod[] = "Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2635 static const CHAR machup[] = "Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2637 get_user_sid(&usersid);
2638 if (!usersid)
2640 skip("ConvertSidToStringSidA is not available\n");
2641 return;
2644 GetTempPath(MAX_PATH, temp);
2646 CreateDirectoryA("msitest", NULL);
2647 create_file("msitest\\maximus", 500);
2649 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2651 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2653 /* PublishProduct, current user */
2654 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2655 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2656 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2657 ok(delete_pf("msitest", FALSE), "File not installed\n");
2659 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
2660 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2662 sprintf(keypath, prodpath, usersid);
2663 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2664 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2666 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2667 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2669 res = RegOpenKeyA(hkey, "Patches", &patches);
2670 todo_wine
2672 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2674 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
2677 RegDeleteKeyA(patches, "");
2678 RegCloseKey(patches);
2679 RegDeleteKeyA(hkey, "");
2680 RegCloseKey(hkey);
2682 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
2683 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2685 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
2686 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
2687 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2688 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2689 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
2690 CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
2691 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
2692 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
2693 CHECK_DEL_REG_STR(hkey, "Clients", ":");
2695 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
2696 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2698 lstrcpyA(path, "n;1;");
2699 lstrcatA(path, temp);
2700 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
2701 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
2703 res = RegOpenKeyA(sourcelist, "Net", &net);
2704 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2706 CHECK_DEL_REG_STR(net, "1", temp);
2708 RegDeleteKeyA(net, "");
2709 RegCloseKey(net);
2711 res = RegOpenKeyA(sourcelist, "Media", &media);
2712 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2714 CHECK_DEL_REG_STR(media, "1", "DISK1;");
2716 RegDeleteKeyA(media, "");
2717 RegCloseKey(media);
2718 RegDeleteKeyA(sourcelist, "");
2719 RegCloseKey(sourcelist);
2720 RegDeleteKeyA(hkey, "");
2721 RegCloseKey(hkey);
2723 res = RegOpenKeyA(HKEY_CURRENT_USER, cuupgrades, &hkey);
2724 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2726 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2728 RegDeleteKeyA(hkey, "");
2729 RegCloseKey(hkey);
2731 /* PublishProduct, machine */
2732 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
2733 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2734 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2735 ok(delete_pf("msitest", FALSE), "File not installed\n");
2737 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
2738 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2740 sprintf(keypath, prodpath, "S-1-5-18");
2741 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2742 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2744 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2745 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2747 res = RegOpenKeyA(hkey, "Patches", &patches);
2748 todo_wine
2750 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2752 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
2755 RegDeleteKeyA(patches, "");
2756 RegCloseKey(patches);
2757 RegDeleteKeyA(hkey, "");
2758 RegCloseKey(hkey);
2760 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machprod, &hkey);
2761 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2763 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
2764 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
2765 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2766 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2767 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
2768 todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
2769 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
2770 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
2771 CHECK_DEL_REG_STR(hkey, "Clients", ":");
2773 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
2774 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2776 lstrcpyA(path, "n;1;");
2777 lstrcatA(path, temp);
2778 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
2779 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
2781 res = RegOpenKeyA(sourcelist, "Net", &net);
2782 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2784 CHECK_DEL_REG_STR(net, "1", temp);
2786 RegDeleteKeyA(net, "");
2787 RegCloseKey(net);
2789 res = RegOpenKeyA(sourcelist, "Media", &media);
2790 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2792 CHECK_DEL_REG_STR(media, "1", "DISK1;");
2794 RegDeleteKeyA(media, "");
2795 RegCloseKey(media);
2796 RegDeleteKeyA(sourcelist, "");
2797 RegCloseKey(sourcelist);
2798 RegDeleteKeyA(hkey, "");
2799 RegCloseKey(hkey);
2801 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machup, &hkey);
2802 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2804 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2806 RegDeleteKeyA(hkey, "");
2807 RegCloseKey(hkey);
2809 DeleteFile(msifile);
2810 DeleteFile("msitest\\maximus");
2811 RemoveDirectory("msitest");
2812 HeapFree(GetProcessHeap(), 0, usersid);
2815 static void test_publish_publishfeatures(void)
2817 UINT r;
2818 LONG res;
2819 HKEY hkey;
2820 LPSTR usersid;
2821 CHAR keypath[MAX_PATH];
2823 static const CHAR cupath[] = "Software\\Microsoft\\Installer\\Features"
2824 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2825 static const CHAR udpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2826 "\\Installer\\UserData\\%s\\Products"
2827 "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
2828 static const CHAR featkey[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2829 "\\Installer\\Features";
2830 static const CHAR classfeat[] = "Software\\Classes\\Installer\\Features"
2831 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2833 get_user_sid(&usersid);
2834 if (!usersid)
2836 skip("ConvertSidToStringSidA is not available\n");
2837 return;
2840 CreateDirectoryA("msitest", NULL);
2841 create_file("msitest\\maximus", 500);
2843 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2845 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2847 /* PublishFeatures, current user */
2848 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
2849 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2850 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2851 ok(delete_pf("msitest", FALSE), "File not installed\n");
2853 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
2854 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2856 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
2857 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2859 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
2860 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2862 CHECK_REG_STR(hkey, "feature", "");
2863 CHECK_REG_STR(hkey, "montecristo", "");
2865 RegDeleteValueA(hkey, "feature");
2866 RegDeleteValueA(hkey, "montecristo");
2867 RegDeleteKeyA(hkey, "");
2868 RegCloseKey(hkey);
2870 sprintf(keypath, udpath, usersid);
2871 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2872 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2874 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
2875 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
2877 RegDeleteValueA(hkey, "feature");
2878 RegDeleteValueA(hkey, "montecristo");
2879 RegDeleteKeyA(hkey, "");
2880 RegCloseKey(hkey);
2882 /* PublishFeatures, machine */
2883 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
2884 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2885 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2886 ok(delete_pf("msitest", FALSE), "File not installed\n");
2888 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
2889 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2891 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
2892 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2894 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
2895 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2897 CHECK_REG_STR(hkey, "feature", "");
2898 CHECK_REG_STR(hkey, "montecristo", "");
2900 RegDeleteValueA(hkey, "feature");
2901 RegDeleteValueA(hkey, "montecristo");
2902 RegDeleteKeyA(hkey, "");
2903 RegCloseKey(hkey);
2905 sprintf(keypath, udpath, "S-1-5-18");
2906 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2907 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2909 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
2910 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
2912 RegDeleteValueA(hkey, "feature");
2913 RegDeleteValueA(hkey, "montecristo");
2914 RegDeleteKeyA(hkey, "");
2915 RegCloseKey(hkey);
2917 DeleteFile(msifile);
2918 DeleteFile("msitest\\maximus");
2919 RemoveDirectory("msitest");
2920 HeapFree(GetProcessHeap(), 0, usersid);
2923 static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
2925 DWORD len = 0;
2926 LPSTR val;
2927 LONG r;
2929 r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
2930 if (r != ERROR_SUCCESS)
2931 return NULL;
2933 len += sizeof (WCHAR);
2934 val = HeapAlloc(GetProcessHeap(), 0, len);
2935 if (!val) return NULL;
2936 val[0] = 0;
2937 RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
2938 return val;
2941 static void get_owner_company(LPSTR *owner, LPSTR *company)
2943 LONG res;
2944 HKEY hkey;
2946 *owner = *company = NULL;
2948 res = RegOpenKeyA(HKEY_CURRENT_USER,
2949 "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
2950 if (res == ERROR_SUCCESS)
2952 *owner = reg_get_val_str(hkey, "DefName");
2953 *company = reg_get_val_str(hkey, "DefCompany");
2954 RegCloseKey(hkey);
2957 if (!*owner || !*company)
2959 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
2960 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey);
2961 if (res == ERROR_SUCCESS)
2963 *owner = reg_get_val_str(hkey, "RegisteredOwner");
2964 *company = reg_get_val_str(hkey, "RegisteredOrganization");
2965 RegCloseKey(hkey);
2969 if (!*owner || !*company)
2971 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
2972 "Software\\Microsoft\\Windows NT\\CurrentVersion", &hkey);
2973 if (res == ERROR_SUCCESS)
2975 *owner = reg_get_val_str(hkey, "RegisteredOwner");
2976 *company = reg_get_val_str(hkey, "RegisteredOrganization");
2977 RegCloseKey(hkey);
2982 static void test_publish_registeruser(void)
2984 UINT r;
2985 LONG res;
2986 HKEY props;
2987 LPSTR usersid;
2988 LPSTR owner, company;
2989 CHAR keypath[MAX_PATH];
2991 static const CHAR keyfmt[] =
2992 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
2993 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
2995 get_user_sid(&usersid);
2996 if (!usersid)
2998 skip("ConvertSidToStringSidA is not available\n");
2999 return;
3002 get_owner_company(&owner, &company);
3004 CreateDirectoryA("msitest", NULL);
3005 create_file("msitest\\maximus", 500);
3007 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3009 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3011 /* RegisterUser, per-user */
3012 r = MsiInstallProductA(msifile, "REGISTER_USER=1");
3013 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3014 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3015 ok(delete_pf("msitest", FALSE), "File not installed\n");
3017 sprintf(keypath, keyfmt, usersid);
3019 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
3020 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3022 CHECK_REG_STR(props, "ProductID", "none");
3023 CHECK_REG_STR(props, "RegCompany", company);
3024 CHECK_REG_STR(props, "RegOwner", owner);
3026 RegDeleteValueA(props, "ProductID");
3027 RegDeleteValueA(props, "RegCompany");
3028 RegDeleteValueA(props, "RegOwner");
3029 RegDeleteKeyA(props, "");
3030 RegCloseKey(props);
3032 /* RegisterUser, machine */
3033 r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
3034 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3035 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3036 ok(delete_pf("msitest", FALSE), "File not installed\n");
3038 sprintf(keypath, keyfmt, "S-1-5-18");
3040 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
3041 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3043 CHECK_REG_STR(props, "ProductID", "none");
3044 CHECK_REG_STR(props, "RegCompany", company);
3045 CHECK_REG_STR(props, "RegOwner", owner);
3047 RegDeleteValueA(props, "ProductID");
3048 RegDeleteValueA(props, "RegCompany");
3049 RegDeleteValueA(props, "RegOwner");
3050 RegDeleteKeyA(props, "");
3051 RegCloseKey(props);
3053 HeapFree(GetProcessHeap(), 0, company);
3054 HeapFree(GetProcessHeap(), 0, owner);
3056 DeleteFile(msifile);
3057 DeleteFile("msitest\\maximus");
3058 RemoveDirectory("msitest");
3061 static void test_publish_processcomponents(void)
3063 UINT r;
3064 LONG res;
3065 DWORD size;
3066 HKEY comp, hkey;
3067 LPSTR usersid;
3068 CHAR val[MAX_PATH];
3069 CHAR keypath[MAX_PATH];
3071 static const CHAR keyfmt[] =
3072 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3073 "UserData\\%s\\Components\\%s";
3074 static const CHAR compkey[] =
3075 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
3077 get_user_sid(&usersid);
3078 if (!usersid)
3080 skip("ConvertSidToStringSidA is not available\n");
3081 return;
3084 CreateDirectoryA("msitest", NULL);
3085 create_file("msitest\\maximus", 500);
3087 create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table));
3089 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3091 /* ProcessComponents, per-user */
3092 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3093 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3094 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3095 ok(delete_pf("msitest", FALSE), "File not installed\n");
3097 sprintf(keypath, keyfmt, usersid, "CBABC2FDCCB35E749A8944D8C1C098B5");
3099 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
3100 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3102 size = MAX_PATH;
3103 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3104 NULL, NULL, (LPBYTE)val, &size);
3105 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3106 ok(!lstrcmpA(val, "C:\\Program Files\\msitest\\maximus"),
3107 "Expected \"%s\", got \"%s\"\n", "C:\\Program Files\\msitest\\maximus", val);
3109 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
3110 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3112 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3113 RegDeleteKeyA(comp, "");
3114 RegCloseKey(comp);
3116 sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
3118 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
3119 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3121 size = MAX_PATH;
3122 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3123 NULL, NULL, (LPBYTE)val, &size);
3124 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3125 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3126 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3128 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
3129 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3131 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3132 RegDeleteKeyA(comp, "");
3133 RegCloseKey(comp);
3135 /* ProcessComponents, machine */
3136 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
3137 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3138 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3139 ok(delete_pf("msitest", FALSE), "File not installed\n");
3141 sprintf(keypath, keyfmt, "S-1-5-18", "CBABC2FDCCB35E749A8944D8C1C098B5");
3143 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
3144 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3146 size = MAX_PATH;
3147 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3148 NULL, NULL, (LPBYTE)val, &size);
3149 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3150 ok(!lstrcmpA(val, "C:\\Program Files\\msitest\\maximus"),
3151 "Expected \"%s\", got \"%s\"\n", "C:\\Program Files\\msitest\\maximus", val);
3153 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
3154 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3156 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3157 RegDeleteKeyA(comp, "");
3158 RegCloseKey(comp);
3160 sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
3162 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
3163 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3165 size = MAX_PATH;
3166 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3167 NULL, NULL, (LPBYTE)val, &size);
3168 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3169 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3170 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3172 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
3173 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3175 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3176 RegDeleteKeyA(comp, "");
3177 RegCloseKey(comp);
3179 DeleteFile(msifile);
3180 DeleteFile("msitest\\maximus");
3181 RemoveDirectory("msitest");
3184 static void test_publish(void)
3186 UINT r;
3187 LONG res;
3188 HKEY uninstall, prodkey;
3189 INSTALLSTATE state;
3190 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3191 char date[MAX_PATH];
3192 char temp[MAX_PATH];
3194 static const CHAR subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3196 if (!pMsiQueryComponentStateA)
3198 skip("MsiQueryComponentStateA is not available\n");
3199 return;
3202 get_date_str(date);
3203 GetTempPath(MAX_PATH, temp);
3205 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, subkey, &uninstall);
3206 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3208 CreateDirectoryA("msitest", NULL);
3209 create_file("msitest\\maximus", 500);
3211 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3213 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3215 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3216 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3218 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3219 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3221 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3222 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3224 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3225 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3226 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3227 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3229 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3230 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3232 /* nothing published */
3233 r = MsiInstallProductA(msifile, NULL);
3234 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3235 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3236 ok(pf_exists("msitest"), "File not installed\n");
3238 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3239 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3241 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3242 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3244 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3245 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3247 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3248 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3249 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3250 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3252 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3253 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3255 /* PublishProduct and RegisterProduct */
3256 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
3257 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3258 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3259 ok(pf_exists("msitest"), "File not installed\n");
3261 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3262 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3264 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3265 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3267 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3268 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3270 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3271 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3272 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
3273 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3275 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3276 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3278 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3279 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3280 CHECK_REG_STR(prodkey, "InstallDate", date);
3281 CHECK_REG_STR(prodkey, "InstallSource", temp);
3282 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3283 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3284 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3285 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3286 CHECK_REG_STR(prodkey, "Comments", NULL);
3287 CHECK_REG_STR(prodkey, "Contact", NULL);
3288 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3289 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3290 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3291 CHECK_REG_STR(prodkey, "Readme", NULL);
3292 CHECK_REG_STR(prodkey, "Size", NULL);
3293 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3294 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3295 CHECK_REG_DWORD(prodkey, "Language", 1033);
3296 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3297 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3298 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3299 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3300 todo_wine
3302 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3305 RegCloseKey(prodkey);
3307 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3308 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3309 ok(pf_exists("msitest\\maximus"), "File deleted\n");
3310 ok(pf_exists("msitest"), "File deleted\n");
3312 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3313 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3315 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3316 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3318 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3319 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3321 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3322 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3323 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3324 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3326 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3327 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3329 /* complete install */
3330 r = MsiInstallProductA(msifile, "FULL=1");
3331 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3332 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3333 ok(pf_exists("msitest"), "File not installed\n");
3335 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3336 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3338 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3339 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3341 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3342 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3344 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3345 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3346 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3347 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3349 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3350 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3352 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3353 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3354 CHECK_REG_STR(prodkey, "InstallDate", date);
3355 CHECK_REG_STR(prodkey, "InstallSource", temp);
3356 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3357 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3358 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3359 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3360 CHECK_REG_STR(prodkey, "Comments", NULL);
3361 CHECK_REG_STR(prodkey, "Contact", NULL);
3362 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3363 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3364 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3365 CHECK_REG_STR(prodkey, "Readme", NULL);
3366 CHECK_REG_STR(prodkey, "Size", NULL);
3367 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3368 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3369 CHECK_REG_DWORD(prodkey, "Language", 1033);
3370 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3371 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3372 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3373 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3374 todo_wine
3376 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3379 RegCloseKey(prodkey);
3381 /* no UnpublishFeatures */
3382 r = MsiInstallProductA(msifile, "REMOVE=ALL");
3383 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3384 ok(!pf_exists("msitest\\maximus"), "File deleted\n");
3385 todo_wine
3387 ok(!pf_exists("msitest"), "File deleted\n");
3390 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3391 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3393 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3394 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3396 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3397 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3399 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3400 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3401 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3402 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3404 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3405 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3407 /* complete install */
3408 r = MsiInstallProductA(msifile, "FULL=1");
3409 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3410 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3411 ok(pf_exists("msitest"), "File not installed\n");
3413 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3414 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3416 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3417 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3419 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3420 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3422 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3423 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3424 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3425 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3427 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3428 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3430 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3431 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3432 CHECK_REG_STR(prodkey, "InstallDate", date);
3433 CHECK_REG_STR(prodkey, "InstallSource", temp);
3434 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3435 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3436 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3437 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3438 CHECK_REG_STR(prodkey, "Comments", NULL);
3439 CHECK_REG_STR(prodkey, "Contact", NULL);
3440 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3441 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3442 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3443 CHECK_REG_STR(prodkey, "Readme", NULL);
3444 CHECK_REG_STR(prodkey, "Size", NULL);
3445 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3446 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3447 CHECK_REG_DWORD(prodkey, "Language", 1033);
3448 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3449 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3450 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3451 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3452 todo_wine
3454 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3457 RegCloseKey(prodkey);
3459 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
3460 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
3461 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3462 todo_wine ok(pf_exists("msitest\\maximus"), "File deleted\n");
3463 ok(pf_exists("msitest"), "File deleted\n");
3465 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3466 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3468 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3469 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3471 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3472 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3474 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3475 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3476 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3477 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3479 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3480 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3482 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3483 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3484 CHECK_REG_STR(prodkey, "InstallDate", date);
3485 CHECK_REG_STR(prodkey, "InstallSource", temp);
3486 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3487 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3488 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3489 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3490 CHECK_REG_STR(prodkey, "Comments", NULL);
3491 CHECK_REG_STR(prodkey, "Contact", NULL);
3492 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3493 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3494 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3495 CHECK_REG_STR(prodkey, "Readme", NULL);
3496 CHECK_REG_STR(prodkey, "Size", NULL);
3497 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3498 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3499 CHECK_REG_DWORD(prodkey, "Language", 1033);
3500 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3501 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3502 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3503 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3504 todo_wine
3506 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3509 RegCloseKey(prodkey);
3511 /* complete install */
3512 r = MsiInstallProductA(msifile, "FULL=1");
3513 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3514 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3515 ok(pf_exists("msitest"), "File not installed\n");
3517 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3518 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3520 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3521 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3523 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3524 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3526 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3527 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3528 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3529 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3531 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3532 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3534 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3535 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3536 CHECK_REG_STR(prodkey, "InstallDate", date);
3537 CHECK_REG_STR(prodkey, "InstallSource", temp);
3538 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3539 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3540 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3541 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3542 CHECK_REG_STR(prodkey, "Comments", NULL);
3543 CHECK_REG_STR(prodkey, "Contact", NULL);
3544 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3545 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3546 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3547 CHECK_REG_STR(prodkey, "Readme", NULL);
3548 CHECK_REG_STR(prodkey, "Size", NULL);
3549 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3550 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3551 CHECK_REG_DWORD(prodkey, "Language", 1033);
3552 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3553 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3554 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3555 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3556 todo_wine
3558 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3561 RegCloseKey(prodkey);
3563 /* UnpublishFeatures, both features removed */
3564 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
3565 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3566 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3567 todo_wine
3569 ok(!pf_exists("msitest"), "File not deleted\n");
3572 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3573 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3575 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3576 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3578 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3579 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3581 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3582 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3583 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3584 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3586 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3587 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3589 /* complete install */
3590 r = MsiInstallProductA(msifile, "FULL=1");
3591 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3592 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3593 ok(pf_exists("msitest"), "File not installed\n");
3595 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3596 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3598 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3599 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3601 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3602 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3604 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3605 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3606 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3607 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3609 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3610 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3612 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3613 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3614 CHECK_REG_STR(prodkey, "InstallDate", date);
3615 CHECK_REG_STR(prodkey, "InstallSource", temp);
3616 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3617 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3618 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3619 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3620 CHECK_REG_STR(prodkey, "Comments", NULL);
3621 CHECK_REG_STR(prodkey, "Contact", NULL);
3622 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3623 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3624 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3625 CHECK_REG_STR(prodkey, "Readme", NULL);
3626 CHECK_REG_STR(prodkey, "Size", NULL);
3627 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3628 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3629 CHECK_REG_DWORD(prodkey, "Language", 1033);
3630 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3631 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3632 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3633 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3634 todo_wine
3636 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3639 RegCloseKey(prodkey);
3641 /* complete uninstall */
3642 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3643 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3644 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3645 todo_wine
3647 ok(!pf_exists("msitest"), "File not deleted\n");
3650 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3651 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3653 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3654 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3656 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3657 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3659 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3660 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3661 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3662 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3664 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3665 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3667 /* make sure 'Program Files\msitest' is removed */
3668 delete_pfmsitest_files();
3670 RegCloseKey(uninstall);
3671 DeleteFile(msifile);
3672 DeleteFile("msitest\\maximus");
3673 RemoveDirectory("msitest");
3676 static void test_publishsourcelist(void)
3678 UINT r;
3679 DWORD size;
3680 CHAR value[MAX_PATH];
3681 CHAR path[MAX_PATH];
3682 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3684 if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
3686 skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
3687 return;
3690 CreateDirectoryA("msitest", NULL);
3691 create_file("msitest\\maximus", 500);
3693 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3695 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3697 r = MsiInstallProductA(msifile, NULL);
3698 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3699 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3700 ok(pf_exists("msitest"), "File not installed\n");
3702 /* nothing published */
3703 size = 0xdeadbeef;
3704 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3705 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3706 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3707 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3709 size = 0xdeadbeef;
3710 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3711 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3712 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3713 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3715 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
3716 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3717 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3718 ok(pf_exists("msitest"), "File not installed\n");
3720 /* after RegisterProduct */
3721 size = 0xdeadbeef;
3722 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3723 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3724 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3725 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3727 size = 0xdeadbeef;
3728 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3729 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3730 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3731 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3733 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3734 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3735 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3736 ok(pf_exists("msitest"), "File not installed\n");
3738 /* after ProcessComponents */
3739 size = 0xdeadbeef;
3740 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3741 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3742 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3743 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3745 size = 0xdeadbeef;
3746 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3747 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3748 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3749 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3751 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
3752 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3753 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3754 ok(pf_exists("msitest"), "File not installed\n");
3756 /* after PublishFeatures */
3757 size = 0xdeadbeef;
3758 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3759 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3760 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3761 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3763 size = 0xdeadbeef;
3764 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3765 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3766 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3767 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3769 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
3770 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3771 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3772 ok(pf_exists("msitest"), "File not installed\n");
3774 /* after PublishProduct */
3775 size = MAX_PATH;
3776 lstrcpyA(value, "aaa");
3777 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3778 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
3779 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3780 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
3781 ok(size == 11, "Expected 11, got %d\n", size);
3783 size = MAX_PATH;
3784 lstrcpyA(value, "aaa");
3785 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3786 MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATH, value, &size);
3787 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3788 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
3789 ok(size == 0, "Expected 0, got %d\n", size);
3791 size = MAX_PATH;
3792 lstrcpyA(value, "aaa");
3793 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3794 MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPT, value, &size);
3795 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3796 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
3797 ok(size == 0, "Expected 0, got %d\n", size);
3799 lstrcpyA(path, CURR_DIR);
3800 lstrcatA(path, "\\");
3802 size = MAX_PATH;
3803 lstrcpyA(value, "aaa");
3804 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3805 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3806 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3807 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3808 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3810 size = MAX_PATH;
3811 lstrcpyA(value, "aaa");
3812 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3813 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE, value, &size);
3814 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3815 ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
3816 ok(size == 1, "Expected 1, got %d\n", size);
3818 size = MAX_PATH;
3819 lstrcpyA(value, "aaa");
3820 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3821 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
3822 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
3823 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
3824 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
3826 size = MAX_PATH;
3827 lstrcpyA(value, "aaa");
3828 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3829 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
3830 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3831 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3832 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3834 size = MAX_PATH;
3835 lstrcpyA(value, "aaa");
3836 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3837 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
3838 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
3839 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
3840 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
3842 /* complete uninstall */
3843 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3844 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3845 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3846 todo_wine
3848 ok(!pf_exists("msitest"), "File not deleted\n");
3851 /* make sure 'Program Files\msitest' is removed */
3852 delete_pfmsitest_files();
3854 DeleteFile(msifile);
3855 DeleteFile("msitest\\maximus");
3856 RemoveDirectory("msitest");
3859 static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
3861 MSIHANDLE hview = 0;
3862 UINT r;
3864 r = MsiDatabaseOpenView(hdb, query, &hview);
3865 if(r != ERROR_SUCCESS)
3866 return r;
3868 r = MsiViewExecute(hview, hrec);
3869 if(r == ERROR_SUCCESS)
3870 r = MsiViewClose(hview);
3871 MsiCloseHandle(hview);
3872 return r;
3875 static void set_transform_summary_info(void)
3877 UINT r;
3878 MSIHANDLE suminfo = 0;
3880 /* build summary info */
3881 r = MsiGetSummaryInformation(0, mstfile, 3, &suminfo);
3882 todo_wine
3884 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
3887 r = MsiSummaryInfoSetProperty(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
3888 todo_wine
3890 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3893 r = MsiSummaryInfoSetProperty(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
3894 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3895 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3896 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
3897 todo_wine
3899 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
3902 r = MsiSummaryInfoSetProperty(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
3903 todo_wine
3905 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3908 r = MsiSummaryInfoPersist(suminfo);
3909 todo_wine
3911 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
3914 r = MsiCloseHandle(suminfo);
3915 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
3918 static void generate_transform(void)
3920 MSIHANDLE hdb1, hdb2;
3921 LPCSTR query;
3922 UINT r;
3924 /* start with two identical databases */
3925 CopyFile(msifile, msifile2, FALSE);
3927 r = MsiOpenDatabase(msifile2, MSIDBOPEN_TRANSACT, &hdb1);
3928 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3930 r = MsiDatabaseCommit(hdb1);
3931 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
3933 r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb2);
3934 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3936 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
3937 r = run_query(hdb1, 0, query);
3938 ok(r == ERROR_SUCCESS, "failed to add property\n");
3940 /* database needs to be committed */
3941 MsiDatabaseCommit(hdb1);
3943 r = MsiDatabaseGenerateTransform(hdb1, hdb2, mstfile, 0, 0);
3944 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3946 #if 0 /* not implemented in wine yet */
3947 r = MsiCreateTransformSummaryInfo(hdb2, hdb2, mstfile, 0, 0);
3948 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3949 #endif
3951 MsiCloseHandle(hdb1);
3952 MsiCloseHandle(hdb2);
3955 /* data for generating a transform */
3957 /* tables transform names - encoded as they would be in an msi database file */
3958 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
3959 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
3960 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
3962 /* data in each table */
3963 static const char data1[] = /* _StringData */
3964 "propval"; /* all the strings squashed together */
3966 static const WCHAR data2[] = { /* _StringPool */
3967 /* len, refs */
3968 0, 0, /* string 0 '' */
3969 4, 1, /* string 1 'prop' */
3970 3, 1, /* string 2 'val' */
3973 static const WCHAR data3[] = { /* Property */
3974 0x0201, 0x0001, 0x0002,
3977 static const struct {
3978 LPCWSTR name;
3979 const void *data;
3980 DWORD size;
3981 } table_transform_data[] =
3983 { name1, data1, sizeof data1 - 1 },
3984 { name2, data2, sizeof data2 },
3985 { name3, data3, sizeof data3 },
3988 #define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
3990 static void generate_transform_manual(void)
3992 IStorage *stg = NULL;
3993 IStream *stm;
3994 WCHAR name[0x20];
3995 HRESULT r;
3996 DWORD i, count;
3997 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
3999 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
4001 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
4003 r = StgCreateDocfile(name, mode, 0, &stg);
4004 ok(r == S_OK, "failed to create storage\n");
4005 if (!stg)
4006 return;
4008 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
4009 ok(r == S_OK, "failed to set storage type\n");
4011 for (i=0; i<NUM_TRANSFORM_TABLES; i++)
4013 r = IStorage_CreateStream(stg, table_transform_data[i].name,
4014 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
4015 if (FAILED(r))
4017 ok(0, "failed to create stream %08x\n", r);
4018 continue;
4021 r = IStream_Write(stm, table_transform_data[i].data,
4022 table_transform_data[i].size, &count);
4023 if (FAILED(r) || count != table_transform_data[i].size)
4024 ok(0, "failed to write stream\n");
4025 IStream_Release(stm);
4028 IStorage_Release(stg);
4030 set_transform_summary_info();
4033 static void test_transformprop(void)
4035 UINT r;
4037 CreateDirectoryA("msitest", NULL);
4038 create_file("msitest\\augustus", 500);
4040 create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
4042 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4044 r = MsiInstallProductA(msifile, NULL);
4045 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4046 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4047 ok(!delete_pf("msitest", FALSE), "File installed\n");
4049 if (0)
4050 generate_transform();
4051 else
4052 generate_transform_manual();
4054 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
4055 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4056 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4057 ok(delete_pf("msitest", FALSE), "File not installed\n");
4059 /* Delete the files in the temp (current) folder */
4060 DeleteFile(msifile);
4061 DeleteFile(msifile2);
4062 DeleteFile(mstfile);
4063 DeleteFile("msitest\\augustus");
4064 RemoveDirectory("msitest");
4067 static void test_currentworkingdir(void)
4069 UINT r;
4070 CHAR path[MAX_PATH];
4071 LPSTR ptr, ptr2;
4073 CreateDirectoryA("msitest", NULL);
4074 create_file("msitest\\augustus", 500);
4076 create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
4078 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4080 CreateDirectoryA("diffdir", NULL);
4081 SetCurrentDirectoryA("diffdir");
4083 sprintf(path, "..\\%s", msifile);
4084 r = MsiInstallProductA(path, NULL);
4085 todo_wine
4087 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
4088 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4089 ok(!delete_pf("msitest", FALSE), "File installed\n");
4092 sprintf(path, "%s\\%s", CURR_DIR, msifile);
4093 r = MsiInstallProductA(path, NULL);
4094 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4095 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4096 ok(delete_pf("msitest", FALSE), "File not installed\n");
4098 lstrcpyA(path, CURR_DIR);
4099 if (path[lstrlenA(path) - 1] != '\\')
4100 lstrcatA(path, "\\");
4101 lstrcatA(path, "msitest.msi");
4103 ptr2 = strrchr(path, '\\');
4104 *ptr2 = '\0';
4105 ptr = strrchr(path, '\\');
4106 *ptr2 = '\\';
4107 *(ptr++) = '\0';
4109 SetCurrentDirectoryA(path);
4111 r = MsiInstallProductA(ptr, NULL);
4112 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4113 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4114 ok(delete_pf("msitest", FALSE), "File not installed\n");
4116 SetCurrentDirectoryA(CURR_DIR);
4118 DeleteFile(msifile);
4119 DeleteFile("msitest\\augustus");
4120 RemoveDirectory("msitest");
4121 RemoveDirectory("diffdir");
4124 static void set_admin_summary_info(const CHAR *name)
4126 MSIHANDLE db, summary;
4127 UINT r;
4129 r = MsiOpenDatabaseA(name, MSIDBOPEN_DIRECT, &db);
4130 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4132 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
4133 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4135 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
4136 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4138 /* write the summary changes back to the stream */
4139 r = MsiSummaryInfoPersist(summary);
4140 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4142 MsiCloseHandle(summary);
4144 r = MsiDatabaseCommit(db);
4145 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4147 MsiCloseHandle(db);
4150 static void test_admin(void)
4152 UINT r;
4154 CreateDirectoryA("msitest", NULL);
4155 create_file("msitest\\augustus", 500);
4157 create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
4158 set_admin_summary_info(msifile);
4160 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4162 r = MsiInstallProductA(msifile, NULL);
4163 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4164 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4165 ok(!delete_pf("msitest", FALSE), "File installed\n");
4166 ok(!DeleteFile("c:\\msitest\\augustus"), "File installed\n");
4167 ok(!RemoveDirectory("c:\\msitest"), "File installed\n");
4169 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
4170 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4171 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4172 ok(!delete_pf("msitest", FALSE), "File installed\n");
4173 todo_wine
4175 ok(DeleteFile("c:\\msitest\\augustus"), "File not installed\n");
4176 ok(RemoveDirectory("c:\\msitest"), "File not installed\n");
4179 DeleteFile(msifile);
4180 DeleteFile("msitest\\augustus");
4181 RemoveDirectory("msitest");
4184 static void set_admin_property_stream(LPCSTR file)
4186 IStorage *stg;
4187 IStream *stm;
4188 WCHAR fileW[MAX_PATH];
4189 HRESULT hr;
4190 DWORD count;
4191 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
4193 /* AdminProperties */
4194 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
4195 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',0};
4197 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
4199 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
4200 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4201 if (!stg)
4202 return;
4204 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
4205 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4207 hr = IStream_Write(stm, data, sizeof(data), &count);
4208 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4210 IStream_Release(stm);
4211 IStorage_Release(stg);
4214 static void test_adminprops(void)
4216 UINT r;
4218 CreateDirectoryA("msitest", NULL);
4219 create_file("msitest\\augustus", 500);
4221 create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
4222 set_admin_summary_info(msifile);
4223 set_admin_property_stream(msifile);
4225 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4227 r = MsiInstallProductA(msifile, NULL);
4228 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4229 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4230 ok(delete_pf("msitest", FALSE), "File installed\n");
4232 DeleteFile(msifile);
4233 DeleteFile("msitest\\augustus");
4234 RemoveDirectory("msitest");
4237 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
4239 CHAR path[MAX_PATH];
4241 lstrcpyA(path, PROG_FILES_DIR);
4242 lstrcatA(path, "\\");
4243 lstrcatA(path, file);
4245 if (is_file)
4246 create_file_data(path, data, 500);
4247 else
4248 CreateDirectoryA(path, NULL);
4251 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
4253 static void test_removefiles(void)
4255 UINT r;
4257 CreateDirectoryA("msitest", NULL);
4258 create_file("msitest\\hydrogen", 500);
4259 create_file("msitest\\helium", 500);
4260 create_file("msitest\\lithium", 500);
4262 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
4264 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4266 r = MsiInstallProductA(msifile, NULL);
4267 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4268 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4269 ok(!pf_exists("msitest\\helium"), "File installed\n");
4270 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4271 ok(pf_exists("msitest"), "File not installed\n");
4273 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4274 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4275 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4276 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
4277 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4278 ok(delete_pf("msitest", FALSE), "File deleted\n");
4280 create_pf("msitest", FALSE);
4281 create_pf("msitest\\hydrogen", TRUE);
4282 create_pf("msitest\\helium", TRUE);
4283 create_pf("msitest\\lithium", TRUE);
4285 r = MsiInstallProductA(msifile, NULL);
4286 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4287 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4288 ok(pf_exists("msitest\\helium"), "File not installed\n");
4289 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4290 ok(pf_exists("msitest"), "File not installed\n");
4292 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4293 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4294 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4295 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
4296 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4297 ok(delete_pf("msitest", FALSE), "File deleted\n");
4299 create_pf("msitest", FALSE);
4300 create_pf("msitest\\furlong", TRUE);
4301 create_pf("msitest\\firkin", TRUE);
4302 create_pf("msitest\\fortnight", TRUE);
4303 create_pf("msitest\\becquerel", TRUE);
4304 create_pf("msitest\\dioptre", TRUE);
4305 create_pf("msitest\\attoparsec", TRUE);
4306 create_pf("msitest\\storeys", TRUE);
4307 create_pf("msitest\\block", TRUE);
4308 create_pf("msitest\\siriometer", TRUE);
4309 create_pf("msitest\\cabout", FALSE);
4310 create_pf("msitest\\cabout\\blocker", TRUE);
4312 r = MsiInstallProductA(msifile, NULL);
4313 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4314 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4315 ok(!pf_exists("msitest\\helium"), "File installed\n");
4316 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4317 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
4318 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
4319 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
4320 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
4321 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
4322 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
4323 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
4324 ok(!pf_exists("msitest\\block"), "File not deleted\n");
4325 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
4326 ok(pf_exists("msitest\\cabout"), "Directory removed\n");
4327 ok(pf_exists("msitest"), "File not installed\n");
4329 create_pf("msitest\\furlong", TRUE);
4330 create_pf("msitest\\firkin", TRUE);
4331 create_pf("msitest\\fortnight", TRUE);
4332 create_pf("msitest\\storeys", TRUE);
4333 create_pf("msitest\\block", TRUE);
4334 create_pf("msitest\\siriometer", TRUE);
4336 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4337 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4338 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
4339 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
4340 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4341 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
4342 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
4343 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
4344 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
4345 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
4346 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
4347 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
4348 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
4349 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
4350 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4351 ok(pf_exists("msitest"), "Directory deleted\n");
4353 r = MsiInstallProductA(msifile, NULL);
4354 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4355 ok(delete_pf("msitest\\hydrogen", TRUE), "File not installed\n");
4356 ok(!delete_pf("msitest\\helium", TRUE), "File installed\n");
4357 ok(delete_pf("msitest\\lithium", TRUE), "File not installed\n");
4358 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4359 ok(pf_exists("msitest"), "Directory deleted\n");
4361 delete_pf("msitest\\cabout\\blocker", TRUE);
4363 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4364 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4365 ok(!delete_pf("msitest\\cabout", FALSE), "Directory not deleted\n");
4366 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4368 DeleteFile(msifile);
4369 DeleteFile("msitest\\hydrogen");
4370 DeleteFile("msitest\\helium");
4371 DeleteFile("msitest\\lithium");
4372 RemoveDirectory("msitest");
4375 static void test_movefiles(void)
4377 UINT r;
4378 char props[MAX_PATH];
4380 CreateDirectoryA("msitest", NULL);
4381 create_file("msitest\\augustus", 100);
4382 create_file("cameroon", 100);
4383 create_file("djibouti", 100);
4384 create_file("egypt", 100);
4385 create_file("finland", 100);
4386 create_file("gambai", 100);
4387 create_file("honduras", 100);
4388 create_file("msitest\\india", 100);
4389 create_file("japan", 100);
4390 create_file("kenya", 100);
4391 CreateDirectoryA("latvia", NULL);
4392 create_file("nauru", 100);
4393 create_file("apple", 100);
4394 create_file("application", 100);
4395 create_file("ape", 100);
4396 create_file("foo", 100);
4397 create_file("fao", 100);
4398 create_file("fbod", 100);
4399 create_file("budding", 100);
4400 create_file("buddy", 100);
4401 create_file("bud", 100);
4402 create_file("bar", 100);
4403 create_file("bur", 100);
4404 create_file("bird", 100);
4406 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
4408 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4410 /* if the source or dest property is not a full path,
4411 * windows tries to access it as a network resource
4414 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
4415 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
4416 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
4418 r = MsiInstallProductA(msifile, props);
4419 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4420 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4421 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
4422 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
4423 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
4424 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
4425 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
4426 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
4427 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
4428 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
4429 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
4430 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
4431 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
4432 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
4433 /* either apple or application will be moved depending on directory order */
4434 if (!delete_pf("msitest\\apple", TRUE))
4435 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
4436 else
4437 ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
4438 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
4439 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
4440 /* either fao or foo will be moved depending on directory order */
4441 if (delete_pf("msitest\\foo", TRUE))
4442 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
4443 else
4444 ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
4445 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
4446 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
4447 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
4448 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
4449 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
4450 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
4451 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
4452 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
4453 ok(delete_pf("msitest", FALSE), "File not installed\n");
4454 ok(DeleteFileA("cameroon"), "File moved\n");
4455 ok(!DeleteFileA("djibouti"), "File not moved\n");
4456 ok(DeleteFileA("egypt"), "File moved\n");
4457 ok(DeleteFileA("finland"), "File moved\n");
4458 ok(DeleteFileA("gambai"), "File moved\n");
4459 ok(!DeleteFileA("honduras"), "File not moved\n");
4460 ok(DeleteFileA("msitest\\india"), "File moved\n");
4461 ok(DeleteFileA("japan"), "File moved\n");
4462 ok(!DeleteFileA("kenya"), "File not moved\n");
4463 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
4464 ok(!DeleteFileA("nauru"), "File not moved\n");
4465 ok(!DeleteFileA("apple"), "File not moved\n");
4466 ok(!DeleteFileA("application"), "File not moved\n");
4467 ok(DeleteFileA("ape"), "File moved\n");
4468 ok(!DeleteFileA("foo"), "File not moved\n");
4469 ok(!DeleteFileA("fao"), "File not moved\n");
4470 ok(DeleteFileA("fbod"), "File moved\n");
4471 ok(!DeleteFileA("budding"), "File not moved\n");
4472 ok(!DeleteFileA("buddy"), "File not moved\n");
4473 ok(DeleteFileA("bud"), "File moved\n");
4474 ok(!DeleteFileA("bar"), "File not moved\n");
4475 ok(!DeleteFileA("bur"), "File not moved\n");
4476 ok(DeleteFileA("bird"), "File moved\n");
4478 DeleteFile("msitest\\augustus");
4479 RemoveDirectory("msitest");
4480 DeleteFile(msifile);
4483 static void test_missingcab(void)
4485 UINT r;
4487 CreateDirectoryA("msitest", NULL);
4488 create_file("msitest\\augustus", 500);
4489 create_file("maximus", 500);
4491 create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
4493 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4495 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
4497 create_pf("msitest", FALSE);
4498 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
4500 r = MsiInstallProductA(msifile, NULL);
4501 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4502 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4503 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
4504 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4505 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
4506 ok(delete_pf("msitest", FALSE), "File not installed\n");
4508 create_pf("msitest", FALSE);
4509 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
4510 create_pf("msitest\\gaius", TRUE);
4512 r = MsiInstallProductA(msifile, "GAIUS=1");
4513 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4514 todo_wine
4516 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
4517 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4519 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
4520 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
4521 ok(delete_pf("msitest", FALSE), "File not installed\n");
4523 DeleteFile("msitest\\augustus");
4524 RemoveDirectory("msitest");
4525 DeleteFile("maximus");
4526 DeleteFile("test1.cab");
4527 DeleteFile(msifile);
4530 static void test_duplicatefiles(void)
4532 UINT r;
4534 CreateDirectoryA("msitest", NULL);
4535 create_file("msitest\\maximus", 500);
4536 create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
4538 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4540 /* fails if the destination folder is not a valid property */
4542 r = MsiInstallProductA(msifile, NULL);
4543 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4544 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4545 ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
4546 ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
4547 ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "File not duplicated\n");
4548 ok(delete_pf("msitest\\this\\doesnot", FALSE), "File not duplicated\n");
4549 ok(delete_pf("msitest\\this", FALSE), "File not duplicated\n");
4550 ok(delete_pf("msitest", FALSE), "File not installed\n");
4552 DeleteFile("msitest\\maximus");
4553 RemoveDirectory("msitest");
4554 DeleteFile(msifile);
4557 static void test_writeregistryvalues(void)
4559 UINT r;
4560 LONG res;
4561 HKEY hkey;
4562 DWORD type, size;
4563 CHAR path[MAX_PATH];
4565 CreateDirectoryA("msitest", NULL);
4566 create_file("msitest\\augustus", 500);
4568 create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
4570 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4572 r = MsiInstallProductA(msifile, NULL);
4573 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4574 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4575 ok(delete_pf("msitest", FALSE), "File installed\n");
4577 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
4578 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4580 size = MAX_PATH;
4581 type = REG_MULTI_SZ;
4582 memset(path, 'a', MAX_PATH);
4583 res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size);
4584 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4585 ok(!memcmp(path, "one\0two\0three\0\0", size), "Wrong multi-sz data\n");
4586 ok(size == 15, "Expected 15, got %d\n", size);
4587 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4589 DeleteFile(msifile);
4590 DeleteFile("msitest\\augustus");
4591 RemoveDirectory("msitest");
4593 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
4594 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine");
4597 static void test_sourcefolder(void)
4599 UINT r;
4601 CreateDirectoryA("msitest", NULL);
4602 create_file("augustus", 500);
4604 create_database(msifile, sf_tables, sizeof(sf_tables) / sizeof(msi_table));
4606 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4608 r = MsiInstallProductA(msifile, NULL);
4609 ok(r == ERROR_INSTALL_FAILURE,
4610 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4611 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4612 todo_wine
4614 ok(!delete_pf("msitest", FALSE), "File installed\n");
4617 RemoveDirectoryA("msitest");
4619 r = MsiInstallProductA(msifile, NULL);
4620 ok(r == ERROR_INSTALL_FAILURE,
4621 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4622 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4623 todo_wine
4625 ok(!delete_pf("msitest", FALSE), "File installed\n");
4628 DeleteFile(msifile);
4629 DeleteFile("augustus");
4632 static void test_customaction51(void)
4634 UINT r;
4636 CreateDirectoryA("msitest", NULL);
4637 create_file("msitest\\augustus", 500);
4639 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
4641 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4643 r = MsiInstallProductA(msifile, NULL);
4644 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4645 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4646 ok(delete_pf("msitest", FALSE), "File installed\n");
4648 DeleteFile(msifile);
4649 DeleteFile("msitest\\augustus");
4650 RemoveDirectory("msitest");
4653 static void test_installstate(void)
4655 UINT r;
4657 CreateDirectoryA("msitest", NULL);
4658 create_file("msitest\\alpha", 500);
4659 create_file("msitest\\beta", 500);
4660 create_file("msitest\\gamma", 500);
4661 create_file("msitest\\theta", 500);
4662 create_file("msitest\\delta", 500);
4663 create_file("msitest\\epsilon", 500);
4664 create_file("msitest\\zeta", 500);
4665 create_file("msitest\\iota", 500);
4666 create_file("msitest\\eta", 500);
4667 create_file("msitest\\kappa", 500);
4668 create_file("msitest\\lambda", 500);
4669 create_file("msitest\\mu", 500);
4671 create_database(msifile, is_tables, sizeof(is_tables) / sizeof(msi_table));
4673 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4675 r = MsiInstallProductA(msifile, NULL);
4676 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4677 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4678 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4679 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4680 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4681 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4682 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4683 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4684 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4685 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4686 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4687 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4688 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4689 ok(delete_pf("msitest", FALSE), "File not installed\n");
4691 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
4692 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4693 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4694 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4695 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4696 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4697 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4698 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
4699 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4700 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4701 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
4702 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4703 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4704 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4705 ok(delete_pf("msitest", FALSE), "File not installed\n");
4707 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
4708 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4709 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4710 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4711 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4712 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4713 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4714 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4715 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4716 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4717 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4718 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4719 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4720 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4721 ok(delete_pf("msitest", FALSE), "File not installed\n");
4723 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
4724 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4725 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
4726 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4727 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4728 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
4729 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4730 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4731 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4732 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4733 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4734 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4735 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4736 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4737 ok(!delete_pf("msitest", FALSE), "File installed\n");
4739 DeleteFile(msifile);
4740 DeleteFile("msitest\\alpha");
4741 DeleteFile("msitest\\beta");
4742 DeleteFile("msitest\\gamma");
4743 DeleteFile("msitest\\theta");
4744 DeleteFile("msitest\\delta");
4745 DeleteFile("msitest\\epsilon");
4746 DeleteFile("msitest\\zeta");
4747 DeleteFile("msitest\\iota");
4748 DeleteFile("msitest\\eta");
4749 DeleteFile("msitest\\kappa");
4750 DeleteFile("msitest\\lambda");
4751 DeleteFile("msitest\\mu");
4752 RemoveDirectory("msitest");
4755 struct sourcepathmap
4757 BOOL sost; /* shortone\shorttwo */
4758 BOOL solt; /* shortone\longtwo */
4759 BOOL lost; /* longone\shorttwo */
4760 BOOL lolt; /* longone\longtwo */
4761 BOOL soste; /* shortone\shorttwo source exists */
4762 BOOL solte; /* shortone\longtwo source exists */
4763 BOOL loste; /* longone\shorttwo source exists */
4764 BOOL lolte; /* longone\longtwo source exists */
4765 UINT err;
4766 DWORD size;
4767 } spmap[256] =
4769 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4770 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4771 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4772 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4773 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4774 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4775 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4776 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4777 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4778 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4779 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4780 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4781 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4782 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4783 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4784 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4785 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4786 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4787 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4788 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4789 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4790 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4791 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4792 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4793 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4794 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4795 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4796 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4797 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4798 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4799 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4800 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4801 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4802 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4803 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4804 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4805 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4806 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4807 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4808 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4809 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4810 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4811 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4812 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4813 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4814 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4815 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4816 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4817 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4818 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4819 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4820 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4821 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4822 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4823 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4824 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4825 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4826 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4827 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4828 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4829 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4830 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4831 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4832 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4833 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4834 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4835 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4836 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4837 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4838 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4839 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4840 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4841 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4842 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4843 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4844 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4845 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4846 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4847 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4848 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4849 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4850 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4851 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4852 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4853 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4854 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4855 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4856 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4857 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4858 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4859 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4860 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4861 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4862 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4863 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4864 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4865 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4866 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4867 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4868 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4869 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4870 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4871 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4872 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4873 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4874 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4875 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4876 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4877 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4878 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4879 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4880 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4881 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4882 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4883 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4884 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4885 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4886 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4887 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4888 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4889 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4890 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4891 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4892 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4893 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4894 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4895 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4896 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4897 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4898 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4899 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4900 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4901 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4902 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4903 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4904 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4905 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4906 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4907 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4908 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4909 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4910 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4911 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4912 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4913 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4914 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4915 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4916 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4917 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4918 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4919 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4920 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4921 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4922 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4923 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4924 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4925 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4926 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4927 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4928 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4929 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4930 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4931 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4932 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4933 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4934 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4935 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4936 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4937 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4938 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4939 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4940 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4941 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4942 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4943 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4944 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4945 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4946 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4947 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4948 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4949 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4950 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4951 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4952 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4953 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4954 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4955 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4956 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4957 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4958 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4959 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4960 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4961 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4962 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4963 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4964 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4965 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4966 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4967 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4968 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4969 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4970 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4971 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4972 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4973 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4974 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4975 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4976 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4977 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4978 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4979 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4980 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4981 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4982 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4983 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4984 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4985 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4986 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4987 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4988 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4989 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4990 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4991 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4992 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4993 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4994 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4995 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4996 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4997 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4998 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4999 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5000 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5001 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5002 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5003 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5004 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5005 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5006 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5007 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5008 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5009 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5010 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5011 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5012 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5013 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5014 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5015 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5016 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5017 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5018 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5019 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5020 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5021 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5022 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5023 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5024 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5027 static DWORD get_pf_file_size(LPCSTR file)
5029 CHAR path[MAX_PATH];
5030 HANDLE hfile;
5031 DWORD size;
5033 lstrcpyA(path, PROG_FILES_DIR);
5034 lstrcatA(path, "\\");
5035 lstrcatA(path, file);
5037 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
5038 if (hfile == INVALID_HANDLE_VALUE)
5039 return 0;
5041 size = GetFileSize(hfile, NULL);
5042 CloseHandle(hfile);
5043 return size;
5046 static void test_sourcepath(void)
5048 UINT r, i;
5050 create_database(msifile, sp_tables, sizeof(sp_tables) / sizeof(msi_table));
5052 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5054 for (i = 0; i < sizeof(spmap) / sizeof(spmap[0]); i++)
5056 if (spmap[i].sost)
5058 CreateDirectoryA("shortone", NULL);
5059 CreateDirectoryA("shortone\\shorttwo", NULL);
5062 if (spmap[i].solt)
5064 CreateDirectoryA("shortone", NULL);
5065 CreateDirectoryA("shortone\\longtwo", NULL);
5068 if (spmap[i].lost)
5070 CreateDirectoryA("longone", NULL);
5071 CreateDirectoryA("longone\\shorttwo", NULL);
5074 if (spmap[i].lolt)
5076 CreateDirectoryA("longone", NULL);
5077 CreateDirectoryA("longone\\longtwo", NULL);
5080 if (spmap[i].soste)
5081 create_file("shortone\\shorttwo\\augustus", 50);
5082 if (spmap[i].solte)
5083 create_file("shortone\\longtwo\\augustus", 100);
5084 if (spmap[i].loste)
5085 create_file("longone\\shorttwo\\augustus", 150);
5086 if (spmap[i].lolte)
5087 create_file("longone\\longtwo\\augustus", 200);
5089 r = MsiInstallProductA(msifile, NULL);
5090 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
5091 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
5092 "%d: Expected %d, got %d\n", i, spmap[i].size,
5093 get_pf_file_size("msitest\\augustus"));
5095 if (r == ERROR_SUCCESS)
5097 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
5098 ok(delete_pf("msitest", FALSE), "%d: File not installed\n", i);
5100 else
5102 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
5103 todo_wine ok(!delete_pf("msitest", FALSE), "%d: File installed\n", i);
5106 DeleteFileA("shortone\\shorttwo\\augustus");
5107 DeleteFileA("shortone\\longtwo\\augustus");
5108 DeleteFileA("longone\\shorttwo\\augustus");
5109 DeleteFileA("longone\\longtwo\\augustus");
5110 RemoveDirectoryA("shortone\\shorttwo");
5111 RemoveDirectoryA("shortone\\longtwo");
5112 RemoveDirectoryA("longone\\shorttwo");
5113 RemoveDirectoryA("longone\\longtwo");
5114 RemoveDirectoryA("shortone");
5115 RemoveDirectoryA("longone");
5118 DeleteFileA(msifile);
5121 static void test_MsiConfigureProductEx(void)
5123 UINT r;
5124 LONG res;
5125 DWORD type, size;
5126 HKEY props, source;
5127 CHAR keypath[MAX_PATH * 2];
5128 CHAR localpack[MAX_PATH];
5130 CreateDirectoryA("msitest", NULL);
5131 create_file("msitest\\hydrogen", 500);
5132 create_file("msitest\\helium", 500);
5133 create_file("msitest\\lithium", 500);
5135 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
5137 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5139 /* NULL szProduct */
5140 r = MsiConfigureProductExA(NULL, INSTALLLEVEL_DEFAULT,
5141 INSTALLSTATE_DEFAULT, "PROPVAR=42");
5142 ok(r == ERROR_INVALID_PARAMETER,
5143 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5145 /* empty szProduct */
5146 r = MsiConfigureProductExA("", INSTALLLEVEL_DEFAULT,
5147 INSTALLSTATE_DEFAULT, "PROPVAR=42");
5148 ok(r == ERROR_INVALID_PARAMETER,
5149 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5151 /* garbage szProduct */
5152 r = MsiConfigureProductExA("garbage", INSTALLLEVEL_DEFAULT,
5153 INSTALLSTATE_DEFAULT, "PROPVAR=42");
5154 ok(r == ERROR_INVALID_PARAMETER,
5155 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5157 /* guid without brackets */
5158 r = MsiConfigureProductExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
5159 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5160 "PROPVAR=42");
5161 ok(r == ERROR_INVALID_PARAMETER,
5162 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5164 /* guid with brackets */
5165 r = MsiConfigureProductExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
5166 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5167 "PROPVAR=42");
5168 ok(r == ERROR_UNKNOWN_PRODUCT,
5169 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5171 /* same length as guid, but random */
5172 r = MsiConfigureProductExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93",
5173 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5174 "PROPVAR=42");
5175 ok(r == ERROR_UNKNOWN_PRODUCT,
5176 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5178 /* product not installed yet */
5179 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5180 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5181 "PROPVAR=42");
5182 ok(r == ERROR_UNKNOWN_PRODUCT,
5183 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5185 /* install the product, per-user unmanaged */
5186 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
5187 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5188 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5189 ok(pf_exists("msitest\\helium"), "File not installed\n");
5190 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5191 ok(pf_exists("msitest"), "File not installed\n");
5193 /* product is installed per-user managed, remove it */
5194 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5195 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5196 "PROPVAR=42");
5197 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5198 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5199 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5200 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5201 todo_wine
5203 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5206 /* product has been removed */
5207 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5208 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5209 "PROPVAR=42");
5210 ok(r == ERROR_UNKNOWN_PRODUCT,
5211 "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
5213 /* install the product, machine */
5214 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
5215 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5216 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5217 ok(pf_exists("msitest\\helium"), "File not installed\n");
5218 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5219 ok(pf_exists("msitest"), "File not installed\n");
5221 /* product is installed machine, remove it */
5222 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5223 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5224 "PROPVAR=42");
5225 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5226 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5227 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5228 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5229 todo_wine
5231 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5234 /* product has been removed */
5235 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5236 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5237 "PROPVAR=42");
5238 ok(r == ERROR_UNKNOWN_PRODUCT,
5239 "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
5241 /* install the product, machine */
5242 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
5243 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5244 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5245 ok(pf_exists("msitest\\helium"), "File not installed\n");
5246 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5247 ok(pf_exists("msitest"), "File not installed\n");
5249 DeleteFileA(msifile);
5251 /* local msifile is removed */
5252 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5253 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5254 "PROPVAR=42");
5255 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5256 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5257 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5258 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5259 todo_wine
5261 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5264 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
5266 /* install the product, machine */
5267 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
5268 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5269 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5270 ok(pf_exists("msitest\\helium"), "File not installed\n");
5271 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5272 ok(pf_exists("msitest"), "File not installed\n");
5274 DeleteFileA(msifile);
5276 lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
5277 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
5278 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties");
5280 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
5281 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5283 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
5284 (const BYTE *)"C:\\idontexist.msi", 18);
5285 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5287 /* LocalPackage is used to find the cached msi package */
5288 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5289 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5290 "PROPVAR=42");
5291 ok(r == ERROR_INSTALL_SOURCE_ABSENT,
5292 "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
5293 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5294 ok(pf_exists("msitest\\helium"), "File not installed\n");
5295 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5296 ok(pf_exists("msitest"), "File not installed\n");
5298 RegCloseKey(props);
5299 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
5301 /* LastUsedSource (local msi package) can be used as a last resort */
5302 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5303 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5304 "PROPVAR=42");
5305 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5306 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5307 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5308 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5309 todo_wine
5311 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5314 /* install the product, machine */
5315 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
5316 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5317 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5318 ok(pf_exists("msitest\\helium"), "File not installed\n");
5319 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5320 ok(pf_exists("msitest"), "File not installed\n");
5322 lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
5323 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
5324 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties");
5326 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
5327 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5329 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
5330 (const BYTE *)"C:\\idontexist.msi", 18);
5331 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5333 lstrcpyA(keypath, "SOFTWARE\\Classes\\Installer\\Products\\");
5334 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\SourceList");
5336 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &source);
5337 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5339 type = REG_SZ;
5340 size = MAX_PATH;
5341 res = RegQueryValueExA(source, "PackageName", NULL, &type,
5342 (LPBYTE)localpack, &size);
5343 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5345 res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
5346 (const BYTE *)"idontexist.msi", 15);
5347 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5349 /* SourceList is altered */
5350 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5351 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5352 "PROPVAR=42");
5353 ok(r == ERROR_INSTALL_SOURCE_ABSENT,
5354 "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
5355 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5356 ok(pf_exists("msitest\\helium"), "File not installed\n");
5357 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5358 ok(pf_exists("msitest"), "File not installed\n");
5360 /* restore the SourceList */
5361 res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
5362 (const BYTE *)localpack, lstrlenA(localpack) + 1);
5363 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5365 /* finally remove the product */
5366 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5367 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5368 "PROPVAR=42");
5369 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5370 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5371 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5372 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5373 todo_wine
5375 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5378 DeleteFileA(msifile);
5379 RegCloseKey(source);
5380 RegCloseKey(props);
5381 DeleteFileA("msitest\\hydrogen");
5382 DeleteFileA("msitest\\helium");
5383 DeleteFileA("msitest\\lithium");
5384 RemoveDirectoryA("msitest");
5387 static void test_missingcomponent(void)
5389 UINT r;
5391 CreateDirectoryA("msitest", NULL);
5392 create_file("msitest\\hydrogen", 500);
5393 create_file("msitest\\helium", 500);
5394 create_file("msitest\\lithium", 500);
5395 create_file("beryllium", 500);
5397 create_database(msifile, mcomp_tables, sizeof(mcomp_tables) / sizeof(msi_table));
5399 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5401 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
5402 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5403 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5404 ok(pf_exists("msitest\\helium"), "File not installed\n");
5405 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5406 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
5407 ok(pf_exists("msitest"), "File not installed\n");
5409 r = MsiInstallProductA(msifile, "REMOVE=ALL INSTALLLEVEL=10 PROPVAR=42");
5410 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5411 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5412 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5413 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5414 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
5415 todo_wine
5417 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5420 DeleteFileA(msifile);
5421 DeleteFileA("msitest\\hydrogen");
5422 DeleteFileA("msitest\\helium");
5423 DeleteFileA("msitest\\lithium");
5424 DeleteFileA("beryllium");
5425 RemoveDirectoryA("msitest");
5428 START_TEST(install)
5430 DWORD len;
5431 char temp_path[MAX_PATH], prev_path[MAX_PATH];
5432 STATEMGRSTATUS status;
5433 BOOL ret = FALSE;
5435 init_functionpointers();
5437 GetCurrentDirectoryA(MAX_PATH, prev_path);
5438 GetTempPath(MAX_PATH, temp_path);
5439 SetCurrentDirectoryA(temp_path);
5441 lstrcpyA(CURR_DIR, temp_path);
5442 len = lstrlenA(CURR_DIR);
5444 if(len && (CURR_DIR[len - 1] == '\\'))
5445 CURR_DIR[len - 1] = 0;
5447 get_program_files_dir(PROG_FILES_DIR, COMMON_FILES_DIR);
5449 /* Create a restore point ourselves so we circumvent the multitude of restore points
5450 * that would have been created by all the installation and removal tests.
5452 if (pSRSetRestorePointA)
5454 memset(&status, 0, sizeof(status));
5455 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
5458 test_MsiInstallProduct();
5459 test_MsiSetComponentState();
5460 test_packagecoltypes();
5461 test_continuouscabs();
5462 test_caborder();
5463 test_mixedmedia();
5464 test_samesequence();
5465 test_uiLevelFlags();
5466 test_readonlyfile();
5467 test_setdirproperty();
5468 test_cabisextracted();
5469 test_concurrentinstall();
5470 test_setpropertyfolder();
5471 test_publish_registerproduct();
5472 test_publish_publishproduct();
5473 test_publish_publishfeatures();
5474 test_publish_registeruser();
5475 test_publish_processcomponents();
5476 test_publish();
5477 test_publishsourcelist();
5478 test_transformprop();
5479 test_currentworkingdir();
5480 test_admin();
5481 test_adminprops();
5482 test_removefiles();
5483 test_movefiles();
5484 test_missingcab();
5485 test_duplicatefiles();
5486 test_writeregistryvalues();
5487 test_sourcefolder();
5488 test_customaction51();
5489 test_installstate();
5490 test_sourcepath();
5491 test_MsiConfigureProductEx();
5492 test_missingcomponent();
5494 if (pSRSetRestorePointA && ret)
5496 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
5497 if (ret)
5498 remove_restore_point(status.llSequenceNumber);
5500 FreeLibrary(hsrclient);
5502 SetCurrentDirectoryA(prev_path);