msi: Resolve file source paths dynamically, as the source directory can be changed.
[wine/wine-kai.git] / dlls / msi / tests / install.c
blob7f40e32c9721ad11692278e286d40fc0aa51f44c
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 "pakistan\taugustus\tperu\tsfn|poland\tSourceDir\tMSITESTDIR\t1\n"
579 "wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
580 "single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
581 "wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
582 "singlenodest\taugustus\tb?r\t\tSourceDir\tMSITESTDIR\t1\n";
584 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
585 "s72\tS38\ts72\ti2\tS255\tS72\n"
586 "Component\tComponent\n"
587 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
588 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
589 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
590 "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n";
592 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
593 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
594 "File\tFile\n"
595 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
596 "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
597 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
598 "gaius\tgaius\tgaius\t500\t\t\t16384\t4";
600 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
601 "i2\ti4\tL64\tS255\tS32\tS72\n"
602 "Media\tDiskId\n"
603 "1\t1\t\ttest1.cab\tDISK1\t\n"
604 "2\t2\t\ttest2.cab\tDISK2\t\n"
605 "3\t3\t\ttest3.cab\tDISK3\t\n"
606 "4\t4\t\ttest3.cab\tDISK3\t\n";
608 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
609 "s72\ti2\ti4\ti4\ti4\ti4\n"
610 "MsiFileHash\tFile_\n"
611 "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
613 static const CHAR df_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
614 "s72\tS72\tl255\n"
615 "Directory\tDirectory\n"
616 "THIS\tMSITESTDIR\tthis\n"
617 "DOESNOT\tTHIS\tdoesnot\n"
618 "NONEXISTENT\tDOESNOT\texist\n"
619 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
620 "ProgramFilesFolder\tTARGETDIR\t.\n"
621 "TARGETDIR\t\tSourceDir";
623 static const CHAR df_duplicate_file_dat[] = "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
624 "s72\ts72\ts72\tS255\tS72\n"
625 "DuplicateFile\tFileKey\n"
626 "maximus\tmaximus\tmaximus\taugustus\t\n"
627 "caesar\tmaximus\tmaximus\t\tNONEXISTENT\n";
629 static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
630 "s72\tS38\ts72\ti2\tS255\tS72\n"
631 "Component\tComponent\n"
632 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
634 static const CHAR wrv_registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
635 "s72\ti2\tl255\tL255\tL0\ts72\n"
636 "Registry\tRegistry\n"
637 "regdata\t2\tSOFTWARE\\Wine\\msitest\tValue\t[~]one[~]two[~]three\taugustus";
639 static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
640 "s72\tS38\ts72\ti2\tS255\tS72\n"
641 "Component\tComponent\n"
642 "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
644 static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
645 "s72\tS255\tI2\n"
646 "InstallExecuteSequence\tAction\n"
647 "ValidateProductID\t\t700\n"
648 "GoodSetProperty\t\t725\n"
649 "BadSetProperty\t\t750\n"
650 "CostInitialize\t\t800\n"
651 "ResolveSource\t\t810\n"
652 "FileCost\t\t900\n"
653 "SetSourceDir\tSRCDIR\t910\n"
654 "CostFinalize\t\t1000\n"
655 "InstallValidate\t\t1400\n"
656 "InstallInitialize\t\t1500\n"
657 "InstallFiles\t\t4000\n"
658 "InstallFinalize\t\t6600";
660 static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
661 "s72\ti2\tS64\tS0\n"
662 "CustomAction\tAction\n"
663 "GoodSetProperty\t51\tMYPROP\t42\n"
664 "BadSetProperty\t51\t\tMYPROP\n"
665 "SetSourceDir\t51\tSourceDir\t[SRCDIR]\n";
667 static const CHAR is_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
668 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
669 "Feature\tFeature\n"
670 "one\t\t\t\t2\t1\t\t0\n" /* favorLocal */
671 "two\t\t\t\t2\t1\t\t1\n" /* favorSource */
672 "three\t\t\t\t2\t1\t\t4\n" /* favorAdvertise */
673 "four\t\t\t\t2\t0\t\t0"; /* disabled */
675 static const CHAR is_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
676 "s72\tS38\ts72\ti2\tS255\tS72\n"
677 "Component\tComponent\n"
678 "alpha\t\tMSITESTDIR\t0\t\talpha_file\n" /* favorLocal:Local */
679 "beta\t\tMSITESTDIR\t1\t\tbeta_file\n" /* favorLocal:Source */
680 "gamma\t\tMSITESTDIR\t2\t\tgamma_file\n" /* favorLocal:Optional */
681 "theta\t\tMSITESTDIR\t0\t\ttheta_file\n" /* favorSource:Local */
682 "delta\t\tMSITESTDIR\t1\t\tdelta_file\n" /* favorSource:Source */
683 "epsilon\t\tMSITESTDIR\t2\t\tepsilon_file\n" /* favorSource:Optional */
684 "zeta\t\tMSITESTDIR\t0\t\tzeta_file\n" /* favorAdvertise:Local */
685 "iota\t\tMSITESTDIR\t1\t\tiota_file\n" /* favorAdvertise:Source */
686 "eta\t\tMSITESTDIR\t2\t\teta_file\n" /* favorAdvertise:Optional */
687 "kappa\t\tMSITESTDIR\t0\t\tkappa_file\n" /* disabled:Local */
688 "lambda\t\tMSITESTDIR\t1\t\tlambda_file\n" /* disabled:Source */
689 "mu\t\tMSITESTDIR\t2\t\tmu_file\n"; /* disabled:Optional */
691 static const CHAR is_feature_comp_dat[] = "Feature_\tComponent_\n"
692 "s38\ts72\n"
693 "FeatureComponents\tFeature_\tComponent_\n"
694 "one\talpha\n"
695 "one\tbeta\n"
696 "one\tgamma\n"
697 "two\ttheta\n"
698 "two\tdelta\n"
699 "two\tepsilon\n"
700 "three\tzeta\n"
701 "three\tiota\n"
702 "three\teta\n"
703 "four\tkappa\n"
704 "four\tlambda\n"
705 "four\tmu";
707 static const CHAR is_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
708 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
709 "File\tFile\n"
710 "alpha_file\talpha\talpha\t500\t\t\t8192\t1\n"
711 "beta_file\tbeta\tbeta\t500\t\t\t8291\t2\n"
712 "gamma_file\tgamma\tgamma\t500\t\t\t8192\t3\n"
713 "theta_file\ttheta\ttheta\t500\t\t\t8192\t4\n"
714 "delta_file\tdelta\tdelta\t500\t\t\t8192\t5\n"
715 "epsilon_file\tepsilon\tepsilon\t500\t\t\t8192\t6\n"
716 "zeta_file\tzeta\tzeta\t500\t\t\t8192\t7\n"
717 "iota_file\tiota\tiota\t500\t\t\t8192\t8\n"
718 "eta_file\teta\teta\t500\t\t\t8192\t9\n"
719 "kappa_file\tkappa\tkappa\t500\t\t\t8192\t10\n"
720 "lambda_file\tlambda\tlambda\t500\t\t\t8192\t11\n"
721 "mu_file\tmu\tmu\t500\t\t\t8192\t12";
723 static const CHAR is_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
724 "i2\ti4\tL64\tS255\tS32\tS72\n"
725 "Media\tDiskId\n"
726 "1\t12\t\t\tDISK1\t\n";
728 static const CHAR sp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
729 "s72\tS38\ts72\ti2\tS255\tS72\n"
730 "Component\tComponent\n"
731 "augustus\t\tTWODIR\t0\t\taugustus\n";
733 static const CHAR sp_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
734 "s72\tS72\tl255\n"
735 "Directory\tDirectory\n"
736 "TARGETDIR\t\tSourceDir\n"
737 "ProgramFilesFolder\tTARGETDIR\t.\n"
738 "MSITESTDIR\tProgramFilesFolder\tmsitest:.\n"
739 "ONEDIR\tMSITESTDIR\t.:shortone|longone\n"
740 "TWODIR\tONEDIR\t.:shorttwo|longtwo";
742 static const CHAR mcp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
743 "s72\tS38\ts72\ti2\tS255\tS72\n"
744 "Component\tComponent\n"
745 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t2\t\thydrogen\n"
746 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t2\t\thelium\n"
747 "lithium\t{4AF28FFC-71C7-4307-BDE4-B77C5338F56F}\tMSITESTDIR\t2\tPROPVAR=42\tlithium\n";
749 static const CHAR mcp_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
750 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
751 "Feature\tFeature\n"
752 "hydroxyl\t\thydroxyl\thydroxyl\t2\t1\tTARGETDIR\t0\n"
753 "heliox\t\theliox\theliox\t2\t5\tTARGETDIR\t0\n"
754 "lithia\t\tlithia\tlithia\t2\t10\tTARGETDIR\t0";
756 static const CHAR mcp_feature_comp_dat[] = "Feature_\tComponent_\n"
757 "s38\ts72\n"
758 "FeatureComponents\tFeature_\tComponent_\n"
759 "hydroxyl\thydrogen\n"
760 "heliox\thelium\n"
761 "lithia\tlithium";
763 static const CHAR mcomp_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
764 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
765 "File\tFile\n"
766 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
767 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
768 "lithium\tlithium\tlithium\t0\t\t\t8192\t1\n"
769 "beryllium\tmissingcomp\tberyllium\t0\t\t\t8192\t1";
771 typedef struct _msi_table
773 const CHAR *filename;
774 const CHAR *data;
775 int size;
776 } msi_table;
778 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
780 static const msi_table tables[] =
782 ADD_TABLE(component),
783 ADD_TABLE(directory),
784 ADD_TABLE(feature),
785 ADD_TABLE(feature_comp),
786 ADD_TABLE(file),
787 ADD_TABLE(install_exec_seq),
788 ADD_TABLE(media),
789 ADD_TABLE(property),
790 ADD_TABLE(registry),
791 ADD_TABLE(service_install),
792 ADD_TABLE(service_control)
795 static const msi_table cc_tables[] =
797 ADD_TABLE(cc_component),
798 ADD_TABLE(directory),
799 ADD_TABLE(cc_feature),
800 ADD_TABLE(cc_feature_comp),
801 ADD_TABLE(cc_file),
802 ADD_TABLE(install_exec_seq),
803 ADD_TABLE(cc_media),
804 ADD_TABLE(property),
807 static const msi_table cc2_tables[] =
809 ADD_TABLE(cc2_component),
810 ADD_TABLE(directory),
811 ADD_TABLE(cc_feature),
812 ADD_TABLE(cc_feature_comp),
813 ADD_TABLE(cc2_file),
814 ADD_TABLE(install_exec_seq),
815 ADD_TABLE(cc_media),
816 ADD_TABLE(property),
819 static const msi_table co_tables[] =
821 ADD_TABLE(cc_component),
822 ADD_TABLE(directory),
823 ADD_TABLE(cc_feature),
824 ADD_TABLE(cc_feature_comp),
825 ADD_TABLE(co_file),
826 ADD_TABLE(install_exec_seq),
827 ADD_TABLE(co_media),
828 ADD_TABLE(property),
831 static const msi_table co2_tables[] =
833 ADD_TABLE(cc_component),
834 ADD_TABLE(directory),
835 ADD_TABLE(cc_feature),
836 ADD_TABLE(cc_feature_comp),
837 ADD_TABLE(cc_file),
838 ADD_TABLE(install_exec_seq),
839 ADD_TABLE(co2_media),
840 ADD_TABLE(property),
843 static const msi_table mm_tables[] =
845 ADD_TABLE(cc_component),
846 ADD_TABLE(directory),
847 ADD_TABLE(cc_feature),
848 ADD_TABLE(cc_feature_comp),
849 ADD_TABLE(mm_file),
850 ADD_TABLE(install_exec_seq),
851 ADD_TABLE(mm_media),
852 ADD_TABLE(property),
855 static const msi_table ss_tables[] =
857 ADD_TABLE(cc_component),
858 ADD_TABLE(directory),
859 ADD_TABLE(cc_feature),
860 ADD_TABLE(cc_feature_comp),
861 ADD_TABLE(cc_file),
862 ADD_TABLE(install_exec_seq),
863 ADD_TABLE(ss_media),
864 ADD_TABLE(property),
867 static const msi_table ui_tables[] =
869 ADD_TABLE(ui_component),
870 ADD_TABLE(directory),
871 ADD_TABLE(cc_feature),
872 ADD_TABLE(cc_feature_comp),
873 ADD_TABLE(cc_file),
874 ADD_TABLE(install_exec_seq),
875 ADD_TABLE(ui_install_ui_seq),
876 ADD_TABLE(ui_custom_action),
877 ADD_TABLE(cc_media),
878 ADD_TABLE(property),
881 static const msi_table rof_tables[] =
883 ADD_TABLE(rof_component),
884 ADD_TABLE(directory),
885 ADD_TABLE(rof_feature),
886 ADD_TABLE(rof_feature_comp),
887 ADD_TABLE(rof_file),
888 ADD_TABLE(install_exec_seq),
889 ADD_TABLE(rof_media),
890 ADD_TABLE(property),
893 static const msi_table sdp_tables[] =
895 ADD_TABLE(rof_component),
896 ADD_TABLE(directory),
897 ADD_TABLE(rof_feature),
898 ADD_TABLE(rof_feature_comp),
899 ADD_TABLE(rof_file),
900 ADD_TABLE(sdp_install_exec_seq),
901 ADD_TABLE(sdp_custom_action),
902 ADD_TABLE(rof_media),
903 ADD_TABLE(property),
906 static const msi_table cie_tables[] =
908 ADD_TABLE(cie_component),
909 ADD_TABLE(directory),
910 ADD_TABLE(cc_feature),
911 ADD_TABLE(cie_feature_comp),
912 ADD_TABLE(cie_file),
913 ADD_TABLE(install_exec_seq),
914 ADD_TABLE(cie_media),
915 ADD_TABLE(property),
918 static const msi_table ci_tables[] =
920 ADD_TABLE(ci_component),
921 ADD_TABLE(directory),
922 ADD_TABLE(rof_feature),
923 ADD_TABLE(rof_feature_comp),
924 ADD_TABLE(rof_file),
925 ADD_TABLE(ci_install_exec_seq),
926 ADD_TABLE(rof_media),
927 ADD_TABLE(property),
928 ADD_TABLE(ci_custom_action),
931 static const msi_table ci2_tables[] =
933 ADD_TABLE(ci2_component),
934 ADD_TABLE(directory),
935 ADD_TABLE(rof_feature),
936 ADD_TABLE(ci2_feature_comp),
937 ADD_TABLE(ci2_file),
938 ADD_TABLE(install_exec_seq),
939 ADD_TABLE(rof_media),
940 ADD_TABLE(property),
943 static const msi_table spf_tables[] =
945 ADD_TABLE(ci_component),
946 ADD_TABLE(directory),
947 ADD_TABLE(rof_feature),
948 ADD_TABLE(rof_feature_comp),
949 ADD_TABLE(rof_file),
950 ADD_TABLE(spf_install_exec_seq),
951 ADD_TABLE(rof_media),
952 ADD_TABLE(property),
953 ADD_TABLE(spf_custom_action),
954 ADD_TABLE(spf_install_ui_seq),
957 static const msi_table pp_tables[] =
959 ADD_TABLE(ci_component),
960 ADD_TABLE(directory),
961 ADD_TABLE(rof_feature),
962 ADD_TABLE(rof_feature_comp),
963 ADD_TABLE(rof_file),
964 ADD_TABLE(pp_install_exec_seq),
965 ADD_TABLE(rof_media),
966 ADD_TABLE(property),
969 static const msi_table ppc_tables[] =
971 ADD_TABLE(ppc_component),
972 ADD_TABLE(directory),
973 ADD_TABLE(rof_feature),
974 ADD_TABLE(ppc_feature_comp),
975 ADD_TABLE(ppc_file),
976 ADD_TABLE(pp_install_exec_seq),
977 ADD_TABLE(ppc_media),
978 ADD_TABLE(property),
981 static const msi_table tp_tables[] =
983 ADD_TABLE(tp_component),
984 ADD_TABLE(directory),
985 ADD_TABLE(rof_feature),
986 ADD_TABLE(ci2_feature_comp),
987 ADD_TABLE(ci2_file),
988 ADD_TABLE(install_exec_seq),
989 ADD_TABLE(rof_media),
990 ADD_TABLE(property),
993 static const msi_table cwd_tables[] =
995 ADD_TABLE(cwd_component),
996 ADD_TABLE(directory),
997 ADD_TABLE(rof_feature),
998 ADD_TABLE(ci2_feature_comp),
999 ADD_TABLE(ci2_file),
1000 ADD_TABLE(install_exec_seq),
1001 ADD_TABLE(rof_media),
1002 ADD_TABLE(property),
1005 static const msi_table adm_tables[] =
1007 ADD_TABLE(adm_component),
1008 ADD_TABLE(directory),
1009 ADD_TABLE(rof_feature),
1010 ADD_TABLE(ci2_feature_comp),
1011 ADD_TABLE(ci2_file),
1012 ADD_TABLE(install_exec_seq),
1013 ADD_TABLE(rof_media),
1014 ADD_TABLE(property),
1015 ADD_TABLE(adm_custom_action),
1016 ADD_TABLE(adm_admin_exec_seq),
1019 static const msi_table amp_tables[] =
1021 ADD_TABLE(amp_component),
1022 ADD_TABLE(directory),
1023 ADD_TABLE(rof_feature),
1024 ADD_TABLE(ci2_feature_comp),
1025 ADD_TABLE(ci2_file),
1026 ADD_TABLE(install_exec_seq),
1027 ADD_TABLE(rof_media),
1028 ADD_TABLE(property),
1031 static const msi_table rem_tables[] =
1033 ADD_TABLE(rem_component),
1034 ADD_TABLE(directory),
1035 ADD_TABLE(rof_feature),
1036 ADD_TABLE(rem_feature_comp),
1037 ADD_TABLE(rem_file),
1038 ADD_TABLE(rem_install_exec_seq),
1039 ADD_TABLE(rof_media),
1040 ADD_TABLE(property),
1041 ADD_TABLE(rem_remove_files),
1044 static const msi_table mov_tables[] =
1046 ADD_TABLE(cwd_component),
1047 ADD_TABLE(directory),
1048 ADD_TABLE(rof_feature),
1049 ADD_TABLE(ci2_feature_comp),
1050 ADD_TABLE(ci2_file),
1051 ADD_TABLE(install_exec_seq),
1052 ADD_TABLE(rof_media),
1053 ADD_TABLE(property),
1054 ADD_TABLE(mov_move_file),
1057 static const msi_table mc_tables[] =
1059 ADD_TABLE(mc_component),
1060 ADD_TABLE(directory),
1061 ADD_TABLE(cc_feature),
1062 ADD_TABLE(cie_feature_comp),
1063 ADD_TABLE(mc_file),
1064 ADD_TABLE(install_exec_seq),
1065 ADD_TABLE(mc_media),
1066 ADD_TABLE(property),
1067 ADD_TABLE(mc_file_hash),
1070 static const msi_table df_tables[] =
1072 ADD_TABLE(rof_component),
1073 ADD_TABLE(df_directory),
1074 ADD_TABLE(rof_feature),
1075 ADD_TABLE(rof_feature_comp),
1076 ADD_TABLE(rof_file),
1077 ADD_TABLE(install_exec_seq),
1078 ADD_TABLE(rof_media),
1079 ADD_TABLE(property),
1080 ADD_TABLE(df_duplicate_file),
1083 static const msi_table wrv_tables[] =
1085 ADD_TABLE(wrv_component),
1086 ADD_TABLE(directory),
1087 ADD_TABLE(rof_feature),
1088 ADD_TABLE(ci2_feature_comp),
1089 ADD_TABLE(ci2_file),
1090 ADD_TABLE(install_exec_seq),
1091 ADD_TABLE(rof_media),
1092 ADD_TABLE(property),
1093 ADD_TABLE(wrv_registry),
1096 static const msi_table sf_tables[] =
1098 ADD_TABLE(wrv_component),
1099 ADD_TABLE(directory),
1100 ADD_TABLE(rof_feature),
1101 ADD_TABLE(ci2_feature_comp),
1102 ADD_TABLE(ci2_file),
1103 ADD_TABLE(install_exec_seq),
1104 ADD_TABLE(rof_media),
1105 ADD_TABLE(property),
1108 static const msi_table ca51_tables[] =
1110 ADD_TABLE(ca51_component),
1111 ADD_TABLE(directory),
1112 ADD_TABLE(rof_feature),
1113 ADD_TABLE(ci2_feature_comp),
1114 ADD_TABLE(ci2_file),
1115 ADD_TABLE(ca51_install_exec_seq),
1116 ADD_TABLE(rof_media),
1117 ADD_TABLE(property),
1118 ADD_TABLE(ca51_custom_action),
1121 static const msi_table is_tables[] =
1123 ADD_TABLE(is_component),
1124 ADD_TABLE(directory),
1125 ADD_TABLE(is_feature),
1126 ADD_TABLE(is_feature_comp),
1127 ADD_TABLE(is_file),
1128 ADD_TABLE(install_exec_seq),
1129 ADD_TABLE(is_media),
1130 ADD_TABLE(property),
1133 static const msi_table sp_tables[] =
1135 ADD_TABLE(sp_component),
1136 ADD_TABLE(sp_directory),
1137 ADD_TABLE(rof_feature),
1138 ADD_TABLE(ci2_feature_comp),
1139 ADD_TABLE(ci2_file),
1140 ADD_TABLE(install_exec_seq),
1141 ADD_TABLE(rof_media),
1142 ADD_TABLE(property),
1145 static const msi_table mcp_tables[] =
1147 ADD_TABLE(mcp_component),
1148 ADD_TABLE(directory),
1149 ADD_TABLE(mcp_feature),
1150 ADD_TABLE(mcp_feature_comp),
1151 ADD_TABLE(rem_file),
1152 ADD_TABLE(rem_install_exec_seq),
1153 ADD_TABLE(rof_media),
1154 ADD_TABLE(property),
1157 static const msi_table mcomp_tables[] =
1159 ADD_TABLE(mcp_component),
1160 ADD_TABLE(directory),
1161 ADD_TABLE(mcp_feature),
1162 ADD_TABLE(mcp_feature_comp),
1163 ADD_TABLE(mcomp_file),
1164 ADD_TABLE(rem_install_exec_seq),
1165 ADD_TABLE(rof_media),
1166 ADD_TABLE(property),
1169 /* cabinet definitions */
1171 /* make the max size large so there is only one cab file */
1172 #define MEDIA_SIZE 0x7FFFFFFF
1173 #define FOLDER_THRESHOLD 900000
1175 /* the FCI callbacks */
1177 static void *mem_alloc(ULONG cb)
1179 return HeapAlloc(GetProcessHeap(), 0, cb);
1182 static void mem_free(void *memory)
1184 HeapFree(GetProcessHeap(), 0, memory);
1187 static BOOL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
1189 sprintf(pccab->szCab, pv, pccab->iCab);
1190 return TRUE;
1193 static long progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
1195 return 0;
1198 static int file_placed(PCCAB pccab, char *pszFile, long cbFile,
1199 BOOL fContinuation, void *pv)
1201 return 0;
1204 static INT_PTR fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
1206 HANDLE handle;
1207 DWORD dwAccess = 0;
1208 DWORD dwShareMode = 0;
1209 DWORD dwCreateDisposition = OPEN_EXISTING;
1211 dwAccess = GENERIC_READ | GENERIC_WRITE;
1212 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
1213 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
1215 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
1216 dwCreateDisposition = OPEN_EXISTING;
1217 else
1218 dwCreateDisposition = CREATE_NEW;
1220 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
1221 dwCreateDisposition, 0, NULL);
1223 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
1225 return (INT_PTR)handle;
1228 static UINT fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1230 HANDLE handle = (HANDLE)hf;
1231 DWORD dwRead;
1232 BOOL res;
1234 res = ReadFile(handle, memory, cb, &dwRead, NULL);
1235 ok(res, "Failed to ReadFile\n");
1237 return dwRead;
1240 static UINT fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1242 HANDLE handle = (HANDLE)hf;
1243 DWORD dwWritten;
1244 BOOL res;
1246 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
1247 ok(res, "Failed to WriteFile\n");
1249 return dwWritten;
1252 static int fci_close(INT_PTR hf, int *err, void *pv)
1254 HANDLE handle = (HANDLE)hf;
1255 ok(CloseHandle(handle), "Failed to CloseHandle\n");
1257 return 0;
1260 static long fci_seek(INT_PTR hf, long dist, int seektype, int *err, void *pv)
1262 HANDLE handle = (HANDLE)hf;
1263 DWORD ret;
1265 ret = SetFilePointer(handle, dist, NULL, seektype);
1266 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
1268 return ret;
1271 static int fci_delete(char *pszFile, int *err, void *pv)
1273 BOOL ret = DeleteFileA(pszFile);
1274 ok(ret, "Failed to DeleteFile %s\n", pszFile);
1276 return 0;
1279 static void init_functionpointers(void)
1281 HMODULE hmsi = GetModuleHandleA("msi.dll");
1283 #define GET_PROC(mod, func) \
1284 p ## func = (void*)GetProcAddress(mod, #func); \
1285 if(!p ## func) \
1286 trace("GetProcAddress(%s) failed\n", #func);
1288 GET_PROC(hmsi, MsiQueryComponentStateA);
1289 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
1290 GET_PROC(hmsi, MsiSourceListGetInfoA);
1292 hsrclient = LoadLibraryA("srclient.dll");
1293 GET_PROC(hsrclient, SRRemoveRestorePoint);
1294 GET_PROC(hsrclient, SRSetRestorePointA);
1296 #undef GET_PROC
1299 static void get_user_sid(LPSTR *usersid)
1301 HANDLE token;
1302 BYTE buf[1024];
1303 DWORD size;
1304 PTOKEN_USER user;
1305 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
1306 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
1308 *usersid = NULL;
1309 pConvertSidToStringSidA = (void *)GetProcAddress(hadvapi32, "ConvertSidToStringSidA");
1310 if (!pConvertSidToStringSidA)
1311 return;
1313 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
1314 size = sizeof(buf);
1315 GetTokenInformation(token, TokenUser, (void *)buf, size, &size);
1316 user = (PTOKEN_USER)buf;
1317 pConvertSidToStringSidA(user->User.Sid, usersid);
1320 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
1322 CHAR buffer[0x20];
1323 UINT r;
1324 DWORD sz;
1326 sz = sizeof buffer;
1327 r = MsiRecordGetString(rec, field, buffer, &sz);
1328 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
1331 static BOOL get_temp_file(char *pszTempName, int cbTempName, void *pv)
1333 LPSTR tempname;
1335 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
1336 GetTempFileNameA(".", "xx", 0, tempname);
1338 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
1340 lstrcpyA(pszTempName, tempname);
1341 HeapFree(GetProcessHeap(), 0, tempname);
1342 return TRUE;
1345 HeapFree(GetProcessHeap(), 0, tempname);
1347 return FALSE;
1350 static INT_PTR get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
1351 USHORT *pattribs, int *err, void *pv)
1353 BY_HANDLE_FILE_INFORMATION finfo;
1354 FILETIME filetime;
1355 HANDLE handle;
1356 DWORD attrs;
1357 BOOL res;
1359 handle = CreateFile(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
1360 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
1362 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
1364 res = GetFileInformationByHandle(handle, &finfo);
1365 ok(res, "Expected GetFileInformationByHandle to succeed\n");
1367 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
1368 FileTimeToDosDateTime(&filetime, pdate, ptime);
1370 attrs = GetFileAttributes(pszName);
1371 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
1373 return (INT_PTR)handle;
1376 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
1378 char path[MAX_PATH];
1379 char filename[MAX_PATH];
1381 lstrcpyA(path, CURR_DIR);
1382 lstrcatA(path, "\\");
1383 lstrcatA(path, file);
1385 lstrcpyA(filename, file);
1387 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
1388 progress, get_open_info, compress);
1391 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
1393 ZeroMemory(pCabParams, sizeof(CCAB));
1395 pCabParams->cb = max_size;
1396 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
1397 pCabParams->setID = 0xbeef;
1398 pCabParams->iCab = 1;
1399 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
1400 lstrcatA(pCabParams->szCabPath, "\\");
1401 lstrcpyA(pCabParams->szCab, name);
1404 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
1406 CCAB cabParams;
1407 LPCSTR ptr;
1408 HFCI hfci;
1409 ERF erf;
1410 BOOL res;
1412 set_cab_parameters(&cabParams, name, max_size);
1414 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
1415 fci_read, fci_write, fci_close, fci_seek, fci_delete,
1416 get_temp_file, &cabParams, NULL);
1418 ok(hfci != NULL, "Failed to create an FCI context\n");
1420 ptr = files;
1421 while (*ptr)
1423 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
1424 ok(res, "Failed to add file: %s\n", ptr);
1425 ptr += lstrlen(ptr) + 1;
1428 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
1429 ok(res, "Failed to flush the cabinet\n");
1431 res = FCIDestroy(hfci);
1432 ok(res, "Failed to destroy the cabinet\n");
1435 static BOOL get_program_files_dir(LPSTR buf, LPSTR buf2)
1437 HKEY hkey;
1438 DWORD type, size;
1440 if (RegOpenKey(HKEY_LOCAL_MACHINE,
1441 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
1442 return FALSE;
1444 size = MAX_PATH;
1445 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) {
1446 RegCloseKey(hkey);
1447 return FALSE;
1450 size = MAX_PATH;
1451 if (RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size)) {
1452 RegCloseKey(hkey);
1453 return FALSE;
1456 RegCloseKey(hkey);
1457 return TRUE;
1460 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
1462 HANDLE file;
1463 DWORD written;
1465 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
1466 if (file == INVALID_HANDLE_VALUE)
1467 return;
1469 WriteFile(file, data, strlen(data), &written, NULL);
1471 if (size)
1473 SetFilePointer(file, size, NULL, FILE_BEGIN);
1474 SetEndOfFile(file);
1477 CloseHandle(file);
1480 #define create_file(name, size) create_file_data(name, name, size)
1482 static void create_test_files(void)
1484 CreateDirectoryA("msitest", NULL);
1485 create_file("msitest\\one.txt", 100);
1486 CreateDirectoryA("msitest\\first", NULL);
1487 create_file("msitest\\first\\two.txt", 100);
1488 CreateDirectoryA("msitest\\second", NULL);
1489 create_file("msitest\\second\\three.txt", 100);
1491 create_file("four.txt", 100);
1492 create_file("five.txt", 100);
1493 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
1495 create_file("msitest\\filename", 100);
1496 create_file("msitest\\service.exe", 100);
1498 DeleteFileA("four.txt");
1499 DeleteFileA("five.txt");
1502 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
1504 CHAR path[MAX_PATH];
1506 lstrcpyA(path, PROG_FILES_DIR);
1507 lstrcatA(path, "\\");
1508 lstrcatA(path, rel_path);
1510 if (is_file)
1511 return DeleteFileA(path);
1512 else
1513 return RemoveDirectoryA(path);
1516 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
1518 CHAR path[MAX_PATH];
1520 lstrcpyA(path, COMMON_FILES_DIR);
1521 lstrcatA(path, "\\");
1522 lstrcatA(path, rel_path);
1524 if (is_file)
1525 return DeleteFileA(path);
1526 else
1527 return RemoveDirectoryA(path);
1530 static void delete_test_files(void)
1532 DeleteFileA("msitest.msi");
1533 DeleteFileA("msitest.cab");
1534 DeleteFileA("msitest\\second\\three.txt");
1535 DeleteFileA("msitest\\first\\two.txt");
1536 DeleteFileA("msitest\\one.txt");
1537 DeleteFileA("msitest\\service.exe");
1538 DeleteFileA("msitest\\filename");
1539 RemoveDirectoryA("msitest\\second");
1540 RemoveDirectoryA("msitest\\first");
1541 RemoveDirectoryA("msitest");
1544 static void write_file(const CHAR *filename, const char *data, int data_size)
1546 DWORD size;
1548 HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
1549 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
1551 WriteFile(hf, data, data_size, &size, NULL);
1552 CloseHandle(hf);
1555 static void write_msi_summary_info(MSIHANDLE db)
1557 MSIHANDLE summary;
1558 UINT r;
1560 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
1561 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1563 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, ";1033");
1564 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1566 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
1567 "{004757CA-5092-49c2-AD20-28E1CE0DF5F2}");
1568 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1570 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
1571 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1573 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 0, NULL, NULL);
1574 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1576 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
1577 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1579 /* write the summary changes back to the stream */
1580 r = MsiSummaryInfoPersist(summary);
1581 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1583 MsiCloseHandle(summary);
1586 static void create_database(const CHAR *name, const msi_table *tables, int num_tables)
1588 MSIHANDLE db;
1589 UINT r;
1590 int j;
1592 r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db);
1593 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1595 /* import the tables into the database */
1596 for (j = 0; j < num_tables; j++)
1598 const msi_table *table = &tables[j];
1600 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
1602 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
1603 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1605 DeleteFileA(table->filename);
1608 write_msi_summary_info(db);
1610 r = MsiDatabaseCommit(db);
1611 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1613 MsiCloseHandle(db);
1616 static void check_service_is_installed(void)
1618 SC_HANDLE scm, service;
1619 BOOL res;
1621 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
1622 ok(scm != NULL, "Failed to open the SC Manager\n");
1624 service = OpenService(scm, "TestService", SC_MANAGER_ALL_ACCESS);
1625 ok(service != NULL, "Failed to open TestService\n");
1627 res = DeleteService(service);
1628 ok(res, "Failed to delete TestService\n");
1630 CloseServiceHandle(service);
1631 CloseServiceHandle(scm);
1634 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
1636 RESTOREPOINTINFOA spec;
1638 spec.dwEventType = event_type;
1639 spec.dwRestorePtType = APPLICATION_INSTALL;
1640 spec.llSequenceNumber = status->llSequenceNumber;
1641 lstrcpyA(spec.szDescription, "msitest restore point");
1643 return pSRSetRestorePointA(&spec, status);
1646 static void remove_restore_point(DWORD seq_number)
1648 DWORD res;
1650 res = pSRRemoveRestorePoint(seq_number);
1651 if (res != ERROR_SUCCESS)
1652 trace("Failed to remove the restore point : %08x\n", res);
1655 static void test_MsiInstallProduct(void)
1657 UINT r;
1658 CHAR path[MAX_PATH];
1659 LONG res;
1660 HKEY hkey;
1661 DWORD num, size, type;
1662 SC_HANDLE scm;
1664 scm = OpenSCManager(NULL, NULL, GENERIC_ALL);
1665 if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
1667 skip("Services are not implemented, we are most likely on win9x\n");
1668 return;
1670 CloseServiceHandle(scm);
1672 create_test_files();
1673 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1675 r = MsiInstallProductA(msifile, NULL);
1676 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1678 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
1679 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
1680 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
1681 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
1682 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
1683 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
1684 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
1685 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
1686 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
1687 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
1688 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
1689 ok(delete_pf("msitest", FALSE), "File not installed\n");
1691 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
1692 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1694 size = MAX_PATH;
1695 type = REG_SZ;
1696 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
1697 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1698 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
1700 size = MAX_PATH;
1701 type = REG_SZ;
1702 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
1703 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
1705 size = sizeof(num);
1706 type = REG_DWORD;
1707 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
1708 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1709 ok(num == 314, "Expected 314, got %d\n", num);
1711 size = MAX_PATH;
1712 type = REG_SZ;
1713 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
1714 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
1715 ok(!lstrcmpA(path, "OrderTestValue"), "Expected imaname, got %s\n", path);
1717 check_service_is_installed();
1719 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
1721 delete_test_files();
1724 static void test_MsiSetComponentState(void)
1726 INSTALLSTATE installed, action;
1727 MSIHANDLE package;
1728 char path[MAX_PATH];
1729 UINT r;
1731 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1733 CoInitialize(NULL);
1735 lstrcpy(path, CURR_DIR);
1736 lstrcat(path, "\\");
1737 lstrcat(path, msifile);
1739 r = MsiOpenPackage(path, &package);
1740 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1742 r = MsiDoAction(package, "CostInitialize");
1743 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1745 r = MsiDoAction(package, "FileCost");
1746 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1748 r = MsiDoAction(package, "CostFinalize");
1749 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1751 r = MsiGetComponentState(package, "dangler", &installed, &action);
1752 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1753 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
1754 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
1756 r = MsiSetComponentState(package, "dangler", INSTALLSTATE_SOURCE);
1757 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1759 MsiCloseHandle(package);
1760 CoUninitialize();
1762 DeleteFileA(msifile);
1765 static void test_packagecoltypes(void)
1767 MSIHANDLE hdb, view, rec;
1768 char path[MAX_PATH];
1769 LPCSTR query;
1770 UINT r, count;
1772 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
1774 CoInitialize(NULL);
1776 lstrcpy(path, CURR_DIR);
1777 lstrcat(path, "\\");
1778 lstrcat(path, msifile);
1780 r = MsiOpenDatabase(path, MSIDBOPEN_READONLY, &hdb);
1781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1783 query = "SELECT * FROM `Media`";
1784 r = MsiDatabaseOpenView( hdb, query, &view );
1785 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
1787 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
1788 count = MsiRecordGetFieldCount( rec );
1789 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
1790 ok(count == 6, "Expected 6, got %d\n", count);
1791 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
1792 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
1793 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
1794 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
1795 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
1796 ok(check_record(rec, 6, "Source"), "wrong column label\n");
1797 MsiCloseHandle(rec);
1799 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
1800 count = MsiRecordGetFieldCount( rec );
1801 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
1802 ok(count == 6, "Expected 6, got %d\n", count);
1803 ok(check_record(rec, 1, "i2"), "wrong column label\n");
1804 ok(check_record(rec, 2, "i4"), "wrong column label\n");
1805 ok(check_record(rec, 3, "L64"), "wrong column label\n");
1806 ok(check_record(rec, 4, "S255"), "wrong column label\n");
1807 ok(check_record(rec, 5, "S32"), "wrong column label\n");
1808 ok(check_record(rec, 6, "S72"), "wrong column label\n");
1810 MsiCloseHandle(rec);
1811 MsiCloseHandle(view);
1812 MsiCloseHandle(hdb);
1813 CoUninitialize();
1815 DeleteFile(msifile);
1818 static void create_cc_test_files(void)
1820 CCAB cabParams;
1821 HFCI hfci;
1822 ERF erf;
1823 static CHAR cab_context[] = "test%d.cab";
1824 BOOL res;
1826 create_file("maximus", 500);
1827 create_file("augustus", 50000);
1828 create_file("tiberius", 500);
1829 create_file("caesar", 500);
1831 set_cab_parameters(&cabParams, "test1.cab", 40000);
1833 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
1834 fci_read, fci_write, fci_close, fci_seek, fci_delete,
1835 get_temp_file, &cabParams, cab_context);
1836 ok(hfci != NULL, "Failed to create an FCI context\n");
1838 res = add_file(hfci, "maximus", tcompTYPE_NONE);
1839 ok(res, "Failed to add file maximus\n");
1841 res = add_file(hfci, "augustus", tcompTYPE_NONE);
1842 ok(res, "Failed to add file augustus\n");
1844 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
1845 ok(res, "Failed to add file tiberius\n");
1847 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
1848 ok(res, "Failed to flush the cabinet\n");
1850 res = FCIDestroy(hfci);
1851 ok(res, "Failed to destroy the cabinet\n");
1853 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1855 DeleteFile("maximus");
1856 DeleteFile("augustus");
1857 DeleteFile("tiberius");
1858 DeleteFile("caesar");
1861 static void delete_cab_files(void)
1863 SHFILEOPSTRUCT shfl;
1864 CHAR path[MAX_PATH+10];
1866 lstrcpyA(path, CURR_DIR);
1867 lstrcatA(path, "\\*.cab");
1868 path[strlen(path) + 1] = '\0';
1870 shfl.hwnd = NULL;
1871 shfl.wFunc = FO_DELETE;
1872 shfl.pFrom = path;
1873 shfl.pTo = NULL;
1874 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
1876 SHFileOperation(&shfl);
1879 static void test_continuouscabs(void)
1881 UINT r;
1883 create_cc_test_files();
1884 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
1886 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1888 r = MsiInstallProductA(msifile, NULL);
1889 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
1891 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1892 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
1893 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1894 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1895 ok(delete_pf("msitest", FALSE), "File not installed\n");
1898 delete_cab_files();
1899 DeleteFile(msifile);
1901 create_cc_test_files();
1902 create_database(msifile, cc2_tables, sizeof(cc2_tables) / sizeof(msi_table));
1904 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1906 r = MsiInstallProductA(msifile, NULL);
1907 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
1908 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
1909 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
1910 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
1911 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
1912 ok(delete_pf("msitest", FALSE), "File not installed\n");
1914 delete_cab_files();
1915 DeleteFile(msifile);
1918 static void test_caborder(void)
1920 UINT r;
1922 create_file("imperator", 100);
1923 create_file("maximus", 500);
1924 create_file("augustus", 50000);
1925 create_file("caesar", 500);
1927 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
1929 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
1931 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
1932 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
1933 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1935 r = MsiInstallProductA(msifile, NULL);
1936 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1937 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1938 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1939 todo_wine
1941 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1942 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1945 delete_cab_files();
1947 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
1948 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
1949 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
1951 r = MsiInstallProductA(msifile, NULL);
1952 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1953 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1954 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1955 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1956 todo_wine
1958 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1961 delete_cab_files();
1962 DeleteFile(msifile);
1964 create_cc_test_files();
1965 create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
1967 r = MsiInstallProductA(msifile, NULL);
1968 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1969 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1970 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1971 todo_wine
1973 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1974 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1977 delete_cab_files();
1978 DeleteFile(msifile);
1980 create_cc_test_files();
1981 create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
1983 r = MsiInstallProductA(msifile, NULL);
1984 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
1985 todo_wine
1987 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
1988 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
1989 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
1990 ok(!delete_pf("msitest", FALSE), "File is installed\n");
1993 delete_cab_files();
1994 DeleteFile("imperator");
1995 DeleteFile("maximus");
1996 DeleteFile("augustus");
1997 DeleteFile("caesar");
1998 DeleteFile(msifile);
2001 static void test_mixedmedia(void)
2003 UINT r;
2005 CreateDirectoryA("msitest", NULL);
2006 create_file("msitest\\maximus", 500);
2007 create_file("msitest\\augustus", 500);
2008 create_file("caesar", 500);
2010 create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
2012 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2014 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
2016 r = MsiInstallProductA(msifile, NULL);
2017 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2018 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2019 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2020 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2021 ok(delete_pf("msitest", FALSE), "File not installed\n");
2023 /* Delete the files in the temp (current) folder */
2024 DeleteFile("msitest\\maximus");
2025 DeleteFile("msitest\\augustus");
2026 RemoveDirectory("msitest");
2027 DeleteFile("caesar");
2028 DeleteFile("test1.cab");
2029 DeleteFile(msifile);
2032 static void test_samesequence(void)
2034 UINT r;
2036 create_cc_test_files();
2037 create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
2039 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2041 r = MsiInstallProductA(msifile, NULL);
2042 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
2044 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2045 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2046 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2047 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2048 ok(delete_pf("msitest", FALSE), "File not installed\n");
2051 delete_cab_files();
2052 DeleteFile(msifile);
2055 static void test_uiLevelFlags(void)
2057 UINT r;
2059 create_cc_test_files();
2060 create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
2062 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
2064 r = MsiInstallProductA(msifile, NULL);
2065 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
2067 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2068 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
2069 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2070 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2071 ok(delete_pf("msitest", FALSE), "File not installed\n");
2074 delete_cab_files();
2075 DeleteFile(msifile);
2078 static BOOL file_matches(LPSTR path)
2080 CHAR buf[MAX_PATH];
2081 HANDLE file;
2082 DWORD size;
2084 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
2085 NULL, OPEN_EXISTING, 0, NULL);
2087 ZeroMemory(buf, MAX_PATH);
2088 ReadFile(file, buf, 15, &size, NULL);
2089 CloseHandle(file);
2091 return !lstrcmp(buf, "msitest\\maximus");
2094 static void test_readonlyfile(void)
2096 UINT r;
2097 DWORD size;
2098 HANDLE file;
2099 CHAR path[MAX_PATH];
2101 CreateDirectoryA("msitest", NULL);
2102 create_file("msitest\\maximus", 500);
2103 create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
2105 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2107 lstrcpy(path, PROG_FILES_DIR);
2108 lstrcat(path, "\\msitest");
2109 CreateDirectory(path, NULL);
2111 lstrcat(path, "\\maximus");
2112 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
2113 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
2115 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
2116 CloseHandle(file);
2118 r = MsiInstallProductA(msifile, NULL);
2119 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2120 ok(file_matches(path), "Expected file to be overwritten\n");
2121 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2122 ok(delete_pf("msitest", FALSE), "File not installed\n");
2124 /* Delete the files in the temp (current) folder */
2125 DeleteFile("msitest\\maximus");
2126 RemoveDirectory("msitest");
2127 DeleteFile(msifile);
2130 static void test_setdirproperty(void)
2132 UINT r;
2134 CreateDirectoryA("msitest", NULL);
2135 create_file("msitest\\maximus", 500);
2136 create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
2138 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2140 r = MsiInstallProductA(msifile, NULL);
2141 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2142 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
2143 ok(delete_cf("msitest", FALSE), "File not installed\n");
2145 /* Delete the files in the temp (current) folder */
2146 DeleteFile(msifile);
2147 DeleteFile("msitest\\maximus");
2148 RemoveDirectory("msitest");
2151 static void test_cabisextracted(void)
2153 UINT r;
2155 CreateDirectoryA("msitest", NULL);
2156 create_file("msitest\\gaius", 500);
2157 create_file("maximus", 500);
2158 create_file("augustus", 500);
2159 create_file("caesar", 500);
2161 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
2162 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
2163 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2165 create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
2167 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2169 r = MsiInstallProductA(msifile, NULL);
2170 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2171 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2172 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2173 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2174 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
2175 ok(delete_pf("msitest", FALSE), "File not installed\n");
2177 /* Delete the files in the temp (current) folder */
2178 delete_cab_files();
2179 DeleteFile(msifile);
2180 DeleteFile("maximus");
2181 DeleteFile("augustus");
2182 DeleteFile("caesar");
2183 DeleteFile("msitest\\gaius");
2184 RemoveDirectory("msitest");
2187 static void test_concurrentinstall(void)
2189 UINT r;
2190 CHAR path[MAX_PATH];
2192 CreateDirectoryA("msitest", NULL);
2193 CreateDirectoryA("msitest\\msitest", NULL);
2194 create_file("msitest\\maximus", 500);
2195 create_file("msitest\\msitest\\augustus", 500);
2197 create_database(msifile, ci_tables, sizeof(ci_tables) / sizeof(msi_table));
2199 lstrcpyA(path, CURR_DIR);
2200 lstrcatA(path, "\\msitest\\concurrent.msi");
2201 create_database(path, ci2_tables, sizeof(ci2_tables) / sizeof(msi_table));
2203 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2205 r = MsiInstallProductA(msifile, NULL);
2206 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2207 if (!delete_pf("msitest\\augustus", TRUE))
2208 trace("concurrent installs not supported\n");
2209 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2210 ok(delete_pf("msitest", FALSE), "File not installed\n");
2212 DeleteFile(path);
2214 r = MsiInstallProductA(msifile, NULL);
2215 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2216 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2217 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
2218 ok(delete_pf("msitest", FALSE), "File not installed\n");
2220 DeleteFile(msifile);
2221 DeleteFile("msitest\\msitest\\augustus");
2222 DeleteFile("msitest\\maximus");
2223 RemoveDirectory("msitest\\msitest");
2224 RemoveDirectory("msitest");
2227 static void test_setpropertyfolder(void)
2229 UINT r;
2230 CHAR path[MAX_PATH];
2232 lstrcpyA(path, PROG_FILES_DIR);
2233 lstrcatA(path, "\\msitest\\added");
2235 CreateDirectoryA("msitest", NULL);
2236 create_file("msitest\\maximus", 500);
2238 create_database(msifile, spf_tables, sizeof(spf_tables) / sizeof(msi_table));
2240 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2242 r = MsiInstallProductA(msifile, NULL);
2243 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2244 if (GetFileAttributesA(path) == FILE_ATTRIBUTE_DIRECTORY)
2246 ok(delete_pf("msitest\\added\\maximus", TRUE), "File not installed\n");
2247 ok(delete_pf("msitest\\added", FALSE), "File not installed\n");
2248 ok(delete_pf("msitest", FALSE), "File not installed\n");
2250 else
2252 trace("changing folder property not supported\n");
2253 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2254 ok(delete_pf("msitest", FALSE), "File not installed\n");
2257 /* Delete the files in the temp (current) folder */
2258 DeleteFile(msifile);
2259 DeleteFile("msitest\\maximus");
2260 RemoveDirectory("msitest");
2263 static BOOL file_exists(LPCSTR file)
2265 return GetFileAttributes(file) != INVALID_FILE_ATTRIBUTES;
2268 static BOOL pf_exists(LPCSTR file)
2270 CHAR path[MAX_PATH];
2272 lstrcpyA(path, PROG_FILES_DIR);
2273 lstrcatA(path, "\\");
2274 lstrcatA(path, file);
2276 return file_exists(path);
2279 static void delete_pfmsitest_files(void)
2281 SHFILEOPSTRUCT shfl;
2282 CHAR path[MAX_PATH+11];
2284 lstrcpyA(path, PROG_FILES_DIR);
2285 lstrcatA(path, "\\msitest\\*");
2286 path[strlen(path) + 1] = '\0';
2288 shfl.hwnd = NULL;
2289 shfl.wFunc = FO_DELETE;
2290 shfl.pFrom = path;
2291 shfl.pTo = NULL;
2292 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
2294 SHFileOperation(&shfl);
2296 lstrcpyA(path, PROG_FILES_DIR);
2297 lstrcatA(path, "\\msitest");
2298 RemoveDirectoryA(path);
2301 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
2303 char val[MAX_PATH];
2304 DWORD size, type;
2305 LONG res;
2307 size = MAX_PATH;
2308 val[0] = '\0';
2309 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
2311 if (res != ERROR_SUCCESS ||
2312 (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
2314 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2315 return;
2318 if (!expected)
2319 ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val);
2320 else
2322 if (bcase)
2323 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
2324 else
2325 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
2329 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
2331 DWORD val, size, type;
2332 LONG res;
2334 size = sizeof(DWORD);
2335 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2337 if (res != ERROR_SUCCESS || type != REG_DWORD)
2339 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2340 return;
2343 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
2346 #define CHECK_REG_STR(prodkey, name, expected) \
2347 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
2349 #define CHECK_DEL_REG_STR(prodkey, name, expected) \
2350 check_reg_str(prodkey, name, expected, TRUE, __LINE__); \
2351 RegDeleteValueA(prodkey, name);
2353 #define CHECK_REG_ISTR(prodkey, name, expected) \
2354 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
2356 #define CHECK_DEL_REG_ISTR(prodkey, name, expected) \
2357 check_reg_str(prodkey, name, expected, FALSE, __LINE__); \
2358 RegDeleteValueA(prodkey, name);
2360 #define CHECK_REG_DWORD(prodkey, name, expected) \
2361 check_reg_dword(prodkey, name, expected, __LINE__);
2363 #define CHECK_DEL_REG_DWORD(prodkey, name, expected) \
2364 check_reg_dword(prodkey, name, expected, __LINE__); \
2365 RegDeleteValueA(prodkey, name);
2367 static void get_date_str(LPSTR date)
2369 SYSTEMTIME systime;
2371 static const char date_fmt[] = "%d%02d%02d";
2372 GetLocalTime(&systime);
2373 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
2376 static void test_publish_registerproduct(void)
2378 UINT r;
2379 LONG res;
2380 HKEY hkey;
2381 HKEY props, usage;
2382 LPSTR usersid;
2383 char date[MAX_PATH];
2384 char temp[MAX_PATH];
2385 char keypath[MAX_PATH];
2387 static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2388 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2389 static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2390 "\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2391 static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2392 "\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2393 static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2394 "\\51AAE0C44620A5E4788506E91F249BD2";
2396 get_user_sid(&usersid);
2397 if (!usersid)
2399 skip("ConvertSidToStringSidA is not available\n");
2400 return;
2403 get_date_str(date);
2404 GetTempPath(MAX_PATH, temp);
2406 CreateDirectoryA("msitest", NULL);
2407 create_file("msitest\\maximus", 500);
2409 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2411 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2413 /* RegisterProduct */
2414 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
2415 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2416 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2417 ok(delete_pf("msitest", FALSE), "File not installed\n");
2419 res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
2420 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2422 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
2423 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2425 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2426 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2427 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2428 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2429 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2430 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2431 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2432 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2433 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2434 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2435 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2436 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2437 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2438 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2439 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2440 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2441 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2442 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2443 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2444 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2445 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2446 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2447 todo_wine
2449 CHECK_DEL_REG_DWORD(hkey, "EstimatedSize", 12);
2452 RegDeleteKeyA(hkey, "");
2453 RegCloseKey(hkey);
2455 sprintf(keypath, userdata, usersid);
2456 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2457 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2459 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2460 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2462 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2463 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2464 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2465 CHECK_DEL_REG_STR(props, "InstallDate", date);
2466 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2467 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2468 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2469 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2470 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2471 CHECK_DEL_REG_STR(props, "Comments", NULL);
2472 CHECK_DEL_REG_STR(props, "Contact", NULL);
2473 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2474 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2475 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2476 CHECK_DEL_REG_STR(props, "Readme", NULL);
2477 CHECK_DEL_REG_STR(props, "Size", NULL);
2478 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2479 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2480 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2481 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2482 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2483 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2484 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2485 todo_wine
2487 CHECK_DEL_REG_DWORD(props, "EstimatedSize", 12);
2490 RegDeleteKeyA(props, "");
2491 RegCloseKey(props);
2493 res = RegOpenKeyA(hkey, "Usage", &usage);
2494 todo_wine
2496 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2499 RegDeleteKeyA(usage, "");
2500 RegCloseKey(usage);
2501 RegDeleteKeyA(hkey, "");
2502 RegCloseKey(hkey);
2504 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
2505 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2507 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2509 RegDeleteKeyA(hkey, "");
2510 RegCloseKey(hkey);
2512 /* RegisterProduct, machine */
2513 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 ALLUSERS=1");
2514 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2515 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2516 ok(delete_pf("msitest", FALSE), "File not installed\n");
2518 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, userugkey, &hkey);
2519 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2521 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
2522 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2524 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2525 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2526 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2527 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2528 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2529 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2530 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2531 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2532 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2533 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2534 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2535 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2536 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2537 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2538 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2539 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2540 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2541 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2542 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2543 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2544 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2545 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2546 todo_wine
2548 CHECK_DEL_REG_DWORD(hkey, "EstimatedSize", 12);
2551 RegDeleteKeyA(hkey, "");
2552 RegCloseKey(hkey);
2554 sprintf(keypath, userdata, "S-1-5-18");
2555 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2556 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2558 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2559 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2561 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2562 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2563 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2564 CHECK_DEL_REG_STR(props, "InstallDate", date);
2565 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2566 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2567 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2568 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2569 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2570 CHECK_DEL_REG_STR(props, "Comments", NULL);
2571 CHECK_DEL_REG_STR(props, "Contact", NULL);
2572 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2573 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2574 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2575 CHECK_DEL_REG_STR(props, "Readme", NULL);
2576 CHECK_DEL_REG_STR(props, "Size", NULL);
2577 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2578 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2579 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2580 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2581 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2582 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2583 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2584 todo_wine
2586 CHECK_DEL_REG_DWORD(props, "EstimatedSize", 12);
2589 RegDeleteKeyA(props, "");
2590 RegCloseKey(props);
2592 res = RegOpenKeyA(hkey, "Usage", &usage);
2593 todo_wine
2595 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2598 RegDeleteKeyA(usage, "");
2599 RegCloseKey(usage);
2600 RegDeleteKeyA(hkey, "");
2601 RegCloseKey(hkey);
2603 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
2604 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2606 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2608 RegDeleteKeyA(hkey, "");
2609 RegCloseKey(hkey);
2611 DeleteFile(msifile);
2612 DeleteFile("msitest\\maximus");
2613 RemoveDirectory("msitest");
2614 HeapFree(GetProcessHeap(), 0, usersid);
2617 static void test_publish_publishproduct(void)
2619 UINT r;
2620 LONG res;
2621 LPSTR usersid;
2622 HKEY sourcelist, net, props;
2623 HKEY hkey, patches, media;
2624 CHAR keypath[MAX_PATH];
2625 CHAR temp[MAX_PATH];
2626 CHAR path[MAX_PATH];
2628 static const CHAR prodpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2629 "\\Installer\\UserData\\%s\\Products"
2630 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2631 static const CHAR cuprodpath[] = "Software\\Microsoft\\Installer\\Products"
2632 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2633 static const CHAR cuupgrades[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2634 "\\51AAE0C44620A5E4788506E91F249BD2";
2635 static const CHAR badprod[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2636 "\\Installer\\Products"
2637 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2638 static const CHAR machprod[] = "Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2639 static const CHAR machup[] = "Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2641 get_user_sid(&usersid);
2642 if (!usersid)
2644 skip("ConvertSidToStringSidA is not available\n");
2645 return;
2648 GetTempPath(MAX_PATH, temp);
2650 CreateDirectoryA("msitest", NULL);
2651 create_file("msitest\\maximus", 500);
2653 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2655 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2657 /* PublishProduct, current user */
2658 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2659 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2660 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2661 ok(delete_pf("msitest", FALSE), "File not installed\n");
2663 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
2664 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2666 sprintf(keypath, prodpath, usersid);
2667 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2668 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2670 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2671 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2673 res = RegOpenKeyA(hkey, "Patches", &patches);
2674 todo_wine
2676 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2678 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
2681 RegDeleteKeyA(patches, "");
2682 RegCloseKey(patches);
2683 RegDeleteKeyA(hkey, "");
2684 RegCloseKey(hkey);
2686 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
2687 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2689 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
2690 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
2691 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2692 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2693 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
2694 CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
2695 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
2696 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
2697 CHECK_DEL_REG_STR(hkey, "Clients", ":");
2699 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
2700 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2702 lstrcpyA(path, "n;1;");
2703 lstrcatA(path, temp);
2704 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
2705 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
2707 res = RegOpenKeyA(sourcelist, "Net", &net);
2708 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2710 CHECK_DEL_REG_STR(net, "1", temp);
2712 RegDeleteKeyA(net, "");
2713 RegCloseKey(net);
2715 res = RegOpenKeyA(sourcelist, "Media", &media);
2716 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2718 CHECK_DEL_REG_STR(media, "1", "DISK1;");
2720 RegDeleteKeyA(media, "");
2721 RegCloseKey(media);
2722 RegDeleteKeyA(sourcelist, "");
2723 RegCloseKey(sourcelist);
2724 RegDeleteKeyA(hkey, "");
2725 RegCloseKey(hkey);
2727 res = RegOpenKeyA(HKEY_CURRENT_USER, cuupgrades, &hkey);
2728 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2730 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2732 RegDeleteKeyA(hkey, "");
2733 RegCloseKey(hkey);
2735 /* PublishProduct, machine */
2736 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
2737 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2738 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2739 ok(delete_pf("msitest", FALSE), "File not installed\n");
2741 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
2742 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2744 sprintf(keypath, prodpath, "S-1-5-18");
2745 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2746 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2748 res = RegOpenKeyA(hkey, "InstallProperties", &props);
2749 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2751 res = RegOpenKeyA(hkey, "Patches", &patches);
2752 todo_wine
2754 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2756 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
2759 RegDeleteKeyA(patches, "");
2760 RegCloseKey(patches);
2761 RegDeleteKeyA(hkey, "");
2762 RegCloseKey(hkey);
2764 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machprod, &hkey);
2765 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2767 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
2768 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
2769 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2770 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2771 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
2772 todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
2773 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
2774 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
2775 CHECK_DEL_REG_STR(hkey, "Clients", ":");
2777 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
2778 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2780 lstrcpyA(path, "n;1;");
2781 lstrcatA(path, temp);
2782 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
2783 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
2785 res = RegOpenKeyA(sourcelist, "Net", &net);
2786 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2788 CHECK_DEL_REG_STR(net, "1", temp);
2790 RegDeleteKeyA(net, "");
2791 RegCloseKey(net);
2793 res = RegOpenKeyA(sourcelist, "Media", &media);
2794 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2796 CHECK_DEL_REG_STR(media, "1", "DISK1;");
2798 RegDeleteKeyA(media, "");
2799 RegCloseKey(media);
2800 RegDeleteKeyA(sourcelist, "");
2801 RegCloseKey(sourcelist);
2802 RegDeleteKeyA(hkey, "");
2803 RegCloseKey(hkey);
2805 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machup, &hkey);
2806 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2808 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2810 RegDeleteKeyA(hkey, "");
2811 RegCloseKey(hkey);
2813 DeleteFile(msifile);
2814 DeleteFile("msitest\\maximus");
2815 RemoveDirectory("msitest");
2816 HeapFree(GetProcessHeap(), 0, usersid);
2819 static void test_publish_publishfeatures(void)
2821 UINT r;
2822 LONG res;
2823 HKEY hkey;
2824 LPSTR usersid;
2825 CHAR keypath[MAX_PATH];
2827 static const CHAR cupath[] = "Software\\Microsoft\\Installer\\Features"
2828 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2829 static const CHAR udpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2830 "\\Installer\\UserData\\%s\\Products"
2831 "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
2832 static const CHAR featkey[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2833 "\\Installer\\Features";
2834 static const CHAR classfeat[] = "Software\\Classes\\Installer\\Features"
2835 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2837 get_user_sid(&usersid);
2838 if (!usersid)
2840 skip("ConvertSidToStringSidA is not available\n");
2841 return;
2844 CreateDirectoryA("msitest", NULL);
2845 create_file("msitest\\maximus", 500);
2847 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2849 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2851 /* PublishFeatures, current user */
2852 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
2853 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2854 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2855 ok(delete_pf("msitest", FALSE), "File not installed\n");
2857 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
2858 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2860 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
2861 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2863 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
2864 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2866 CHECK_REG_STR(hkey, "feature", "");
2867 CHECK_REG_STR(hkey, "montecristo", "");
2869 RegDeleteValueA(hkey, "feature");
2870 RegDeleteValueA(hkey, "montecristo");
2871 RegDeleteKeyA(hkey, "");
2872 RegCloseKey(hkey);
2874 sprintf(keypath, udpath, usersid);
2875 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2876 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2878 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
2879 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
2881 RegDeleteValueA(hkey, "feature");
2882 RegDeleteValueA(hkey, "montecristo");
2883 RegDeleteKeyA(hkey, "");
2884 RegCloseKey(hkey);
2886 /* PublishFeatures, machine */
2887 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
2888 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2889 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2890 ok(delete_pf("msitest", FALSE), "File not installed\n");
2892 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
2893 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2895 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
2896 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2898 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
2899 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2901 CHECK_REG_STR(hkey, "feature", "");
2902 CHECK_REG_STR(hkey, "montecristo", "");
2904 RegDeleteValueA(hkey, "feature");
2905 RegDeleteValueA(hkey, "montecristo");
2906 RegDeleteKeyA(hkey, "");
2907 RegCloseKey(hkey);
2909 sprintf(keypath, udpath, "S-1-5-18");
2910 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
2911 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2913 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
2914 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
2916 RegDeleteValueA(hkey, "feature");
2917 RegDeleteValueA(hkey, "montecristo");
2918 RegDeleteKeyA(hkey, "");
2919 RegCloseKey(hkey);
2921 DeleteFile(msifile);
2922 DeleteFile("msitest\\maximus");
2923 RemoveDirectory("msitest");
2924 HeapFree(GetProcessHeap(), 0, usersid);
2927 static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
2929 DWORD len = 0;
2930 LPSTR val;
2931 LONG r;
2933 r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
2934 if (r != ERROR_SUCCESS)
2935 return NULL;
2937 len += sizeof (WCHAR);
2938 val = HeapAlloc(GetProcessHeap(), 0, len);
2939 if (!val) return NULL;
2940 val[0] = 0;
2941 RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
2942 return val;
2945 static void get_owner_company(LPSTR *owner, LPSTR *company)
2947 LONG res;
2948 HKEY hkey;
2950 *owner = *company = NULL;
2952 res = RegOpenKeyA(HKEY_CURRENT_USER,
2953 "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
2954 if (res == ERROR_SUCCESS)
2956 *owner = reg_get_val_str(hkey, "DefName");
2957 *company = reg_get_val_str(hkey, "DefCompany");
2958 RegCloseKey(hkey);
2961 if (!*owner || !*company)
2963 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
2964 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey);
2965 if (res == ERROR_SUCCESS)
2967 *owner = reg_get_val_str(hkey, "RegisteredOwner");
2968 *company = reg_get_val_str(hkey, "RegisteredOrganization");
2969 RegCloseKey(hkey);
2973 if (!*owner || !*company)
2975 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
2976 "Software\\Microsoft\\Windows NT\\CurrentVersion", &hkey);
2977 if (res == ERROR_SUCCESS)
2979 *owner = reg_get_val_str(hkey, "RegisteredOwner");
2980 *company = reg_get_val_str(hkey, "RegisteredOrganization");
2981 RegCloseKey(hkey);
2986 static void test_publish_registeruser(void)
2988 UINT r;
2989 LONG res;
2990 HKEY props;
2991 LPSTR usersid;
2992 LPSTR owner, company;
2993 CHAR keypath[MAX_PATH];
2995 static const CHAR keyfmt[] =
2996 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
2997 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
2999 get_user_sid(&usersid);
3000 if (!usersid)
3002 skip("ConvertSidToStringSidA is not available\n");
3003 return;
3006 get_owner_company(&owner, &company);
3008 CreateDirectoryA("msitest", NULL);
3009 create_file("msitest\\maximus", 500);
3011 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3013 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3015 /* RegisterUser, per-user */
3016 r = MsiInstallProductA(msifile, "REGISTER_USER=1");
3017 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3018 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3019 ok(delete_pf("msitest", FALSE), "File not installed\n");
3021 sprintf(keypath, keyfmt, usersid);
3023 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
3024 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3026 CHECK_REG_STR(props, "ProductID", "none");
3027 CHECK_REG_STR(props, "RegCompany", company);
3028 CHECK_REG_STR(props, "RegOwner", owner);
3030 RegDeleteValueA(props, "ProductID");
3031 RegDeleteValueA(props, "RegCompany");
3032 RegDeleteValueA(props, "RegOwner");
3033 RegDeleteKeyA(props, "");
3034 RegCloseKey(props);
3036 /* RegisterUser, machine */
3037 r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
3038 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3039 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3040 ok(delete_pf("msitest", FALSE), "File not installed\n");
3042 sprintf(keypath, keyfmt, "S-1-5-18");
3044 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
3045 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3047 CHECK_REG_STR(props, "ProductID", "none");
3048 CHECK_REG_STR(props, "RegCompany", company);
3049 CHECK_REG_STR(props, "RegOwner", owner);
3051 RegDeleteValueA(props, "ProductID");
3052 RegDeleteValueA(props, "RegCompany");
3053 RegDeleteValueA(props, "RegOwner");
3054 RegDeleteKeyA(props, "");
3055 RegCloseKey(props);
3057 HeapFree(GetProcessHeap(), 0, company);
3058 HeapFree(GetProcessHeap(), 0, owner);
3060 DeleteFile(msifile);
3061 DeleteFile("msitest\\maximus");
3062 RemoveDirectory("msitest");
3065 static void test_publish_processcomponents(void)
3067 UINT r;
3068 LONG res;
3069 DWORD size;
3070 HKEY comp, hkey;
3071 LPSTR usersid;
3072 CHAR val[MAX_PATH];
3073 CHAR keypath[MAX_PATH];
3074 CHAR program_files_maximus[MAX_PATH];
3076 static const CHAR keyfmt[] =
3077 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3078 "UserData\\%s\\Components\\%s";
3079 static const CHAR compkey[] =
3080 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
3082 get_user_sid(&usersid);
3083 if (!usersid)
3085 skip("ConvertSidToStringSidA is not available\n");
3086 return;
3089 CreateDirectoryA("msitest", NULL);
3090 create_file("msitest\\maximus", 500);
3092 create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table));
3094 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3096 /* ProcessComponents, per-user */
3097 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3098 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3099 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3100 ok(delete_pf("msitest", FALSE), "File not installed\n");
3102 sprintf(keypath, keyfmt, usersid, "CBABC2FDCCB35E749A8944D8C1C098B5");
3104 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
3105 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3107 size = MAX_PATH;
3108 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3109 NULL, NULL, (LPBYTE)val, &size);
3110 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3112 lstrcpyA(program_files_maximus,PROG_FILES_DIR);
3113 lstrcatA(program_files_maximus,"\\msitest\\maximus");
3115 ok(!lstrcmpA(val, program_files_maximus),
3116 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3118 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
3119 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3121 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3122 RegDeleteKeyA(comp, "");
3123 RegCloseKey(comp);
3125 sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
3127 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
3128 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3130 size = MAX_PATH;
3131 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3132 NULL, NULL, (LPBYTE)val, &size);
3133 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3134 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3135 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3137 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
3138 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3140 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3141 RegDeleteKeyA(comp, "");
3142 RegCloseKey(comp);
3144 /* ProcessComponents, machine */
3145 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
3146 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3147 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3148 ok(delete_pf("msitest", FALSE), "File not installed\n");
3150 sprintf(keypath, keyfmt, "S-1-5-18", "CBABC2FDCCB35E749A8944D8C1C098B5");
3152 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
3153 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3155 size = MAX_PATH;
3156 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3157 NULL, NULL, (LPBYTE)val, &size);
3158 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3159 ok(!lstrcmpA(val, program_files_maximus),
3160 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3162 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
3163 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3165 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3166 RegDeleteKeyA(comp, "");
3167 RegCloseKey(comp);
3169 sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
3171 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
3172 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3174 size = MAX_PATH;
3175 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3176 NULL, NULL, (LPBYTE)val, &size);
3177 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3178 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3179 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3181 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
3182 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3184 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3185 RegDeleteKeyA(comp, "");
3186 RegCloseKey(comp);
3188 DeleteFile(msifile);
3189 DeleteFile("msitest\\maximus");
3190 RemoveDirectory("msitest");
3193 static void test_publish(void)
3195 UINT r;
3196 LONG res;
3197 HKEY uninstall, prodkey;
3198 INSTALLSTATE state;
3199 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3200 char date[MAX_PATH];
3201 char temp[MAX_PATH];
3203 static const CHAR subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3205 if (!pMsiQueryComponentStateA)
3207 skip("MsiQueryComponentStateA is not available\n");
3208 return;
3211 get_date_str(date);
3212 GetTempPath(MAX_PATH, temp);
3214 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, subkey, &uninstall);
3215 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3217 CreateDirectoryA("msitest", NULL);
3218 create_file("msitest\\maximus", 500);
3220 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3222 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3224 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3225 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3227 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3228 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3230 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3231 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3233 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3234 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3235 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3236 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3238 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3239 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3241 /* nothing published */
3242 r = MsiInstallProductA(msifile, NULL);
3243 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3244 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3245 ok(pf_exists("msitest"), "File not installed\n");
3247 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3248 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3250 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3251 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3253 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3254 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3256 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3257 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3258 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3259 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3261 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3262 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3264 /* PublishProduct and RegisterProduct */
3265 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
3266 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3267 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3268 ok(pf_exists("msitest"), "File not installed\n");
3270 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3271 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3273 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3274 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3276 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3277 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3279 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3280 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3281 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
3282 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3284 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3285 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3287 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3288 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3289 CHECK_REG_STR(prodkey, "InstallDate", date);
3290 CHECK_REG_STR(prodkey, "InstallSource", temp);
3291 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3292 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3293 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3294 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3295 CHECK_REG_STR(prodkey, "Comments", NULL);
3296 CHECK_REG_STR(prodkey, "Contact", NULL);
3297 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3298 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3299 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3300 CHECK_REG_STR(prodkey, "Readme", NULL);
3301 CHECK_REG_STR(prodkey, "Size", NULL);
3302 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3303 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3304 CHECK_REG_DWORD(prodkey, "Language", 1033);
3305 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3306 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3307 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3308 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3309 todo_wine
3311 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3314 RegCloseKey(prodkey);
3316 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3317 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3318 ok(pf_exists("msitest\\maximus"), "File deleted\n");
3319 ok(pf_exists("msitest"), "File deleted\n");
3321 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3322 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3324 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3325 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3327 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3328 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3330 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3331 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3332 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3333 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3335 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3336 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3338 /* complete install */
3339 r = MsiInstallProductA(msifile, "FULL=1");
3340 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3341 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3342 ok(pf_exists("msitest"), "File not installed\n");
3344 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3345 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3347 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3348 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3350 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3351 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3353 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3354 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3355 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3356 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3358 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3359 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3361 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3362 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3363 CHECK_REG_STR(prodkey, "InstallDate", date);
3364 CHECK_REG_STR(prodkey, "InstallSource", temp);
3365 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3366 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3367 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3368 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3369 CHECK_REG_STR(prodkey, "Comments", NULL);
3370 CHECK_REG_STR(prodkey, "Contact", NULL);
3371 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3372 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3373 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3374 CHECK_REG_STR(prodkey, "Readme", NULL);
3375 CHECK_REG_STR(prodkey, "Size", NULL);
3376 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3377 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3378 CHECK_REG_DWORD(prodkey, "Language", 1033);
3379 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3380 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3381 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3382 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3383 todo_wine
3385 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3388 RegCloseKey(prodkey);
3390 /* no UnpublishFeatures */
3391 r = MsiInstallProductA(msifile, "REMOVE=ALL");
3392 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3393 ok(!pf_exists("msitest\\maximus"), "File deleted\n");
3394 todo_wine
3396 ok(!pf_exists("msitest"), "File deleted\n");
3399 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3400 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3402 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3403 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3405 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3406 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3408 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3409 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3410 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3411 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3413 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3414 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3416 /* complete install */
3417 r = MsiInstallProductA(msifile, "FULL=1");
3418 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3419 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3420 ok(pf_exists("msitest"), "File not installed\n");
3422 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3423 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3425 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3426 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3428 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3429 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3431 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3432 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3433 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3434 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3436 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3437 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3439 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3440 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3441 CHECK_REG_STR(prodkey, "InstallDate", date);
3442 CHECK_REG_STR(prodkey, "InstallSource", temp);
3443 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3444 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3445 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3446 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3447 CHECK_REG_STR(prodkey, "Comments", NULL);
3448 CHECK_REG_STR(prodkey, "Contact", NULL);
3449 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3450 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3451 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3452 CHECK_REG_STR(prodkey, "Readme", NULL);
3453 CHECK_REG_STR(prodkey, "Size", NULL);
3454 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3455 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3456 CHECK_REG_DWORD(prodkey, "Language", 1033);
3457 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3458 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3459 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3460 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3461 todo_wine
3463 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3466 RegCloseKey(prodkey);
3468 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
3469 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
3470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3471 todo_wine ok(pf_exists("msitest\\maximus"), "File deleted\n");
3472 ok(pf_exists("msitest"), "File deleted\n");
3474 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3475 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3477 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3478 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3480 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3481 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3483 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3484 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3485 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3486 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3488 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3489 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3491 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3492 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3493 CHECK_REG_STR(prodkey, "InstallDate", date);
3494 CHECK_REG_STR(prodkey, "InstallSource", temp);
3495 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3496 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3497 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3498 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3499 CHECK_REG_STR(prodkey, "Comments", NULL);
3500 CHECK_REG_STR(prodkey, "Contact", NULL);
3501 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3502 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3503 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3504 CHECK_REG_STR(prodkey, "Readme", NULL);
3505 CHECK_REG_STR(prodkey, "Size", NULL);
3506 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3507 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3508 CHECK_REG_DWORD(prodkey, "Language", 1033);
3509 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3510 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3511 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3512 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3513 todo_wine
3515 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3518 RegCloseKey(prodkey);
3520 /* complete install */
3521 r = MsiInstallProductA(msifile, "FULL=1");
3522 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3523 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3524 ok(pf_exists("msitest"), "File not installed\n");
3526 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3527 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3529 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3530 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3532 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3533 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3535 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3536 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3537 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3538 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3540 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3541 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3543 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3544 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3545 CHECK_REG_STR(prodkey, "InstallDate", date);
3546 CHECK_REG_STR(prodkey, "InstallSource", temp);
3547 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3548 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3549 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3550 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3551 CHECK_REG_STR(prodkey, "Comments", NULL);
3552 CHECK_REG_STR(prodkey, "Contact", NULL);
3553 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3554 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3555 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3556 CHECK_REG_STR(prodkey, "Readme", NULL);
3557 CHECK_REG_STR(prodkey, "Size", NULL);
3558 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3559 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3560 CHECK_REG_DWORD(prodkey, "Language", 1033);
3561 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3562 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3563 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3564 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3565 todo_wine
3567 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3570 RegCloseKey(prodkey);
3572 /* UnpublishFeatures, both features removed */
3573 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
3574 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3575 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3576 todo_wine
3578 ok(!pf_exists("msitest"), "File not deleted\n");
3581 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3582 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3584 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3585 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3587 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3588 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3590 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3591 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3592 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3593 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3595 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3596 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3598 /* complete install */
3599 r = MsiInstallProductA(msifile, "FULL=1");
3600 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3601 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3602 ok(pf_exists("msitest"), "File not installed\n");
3604 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3605 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3607 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3608 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3610 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3611 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3613 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3614 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3615 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3616 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3618 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3619 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3621 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3622 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3623 CHECK_REG_STR(prodkey, "InstallDate", date);
3624 CHECK_REG_STR(prodkey, "InstallSource", temp);
3625 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3626 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3627 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3628 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3629 CHECK_REG_STR(prodkey, "Comments", NULL);
3630 CHECK_REG_STR(prodkey, "Contact", NULL);
3631 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3632 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3633 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3634 CHECK_REG_STR(prodkey, "Readme", NULL);
3635 CHECK_REG_STR(prodkey, "Size", NULL);
3636 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3637 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3638 CHECK_REG_DWORD(prodkey, "Language", 1033);
3639 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3640 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3641 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3642 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3643 todo_wine
3645 CHECK_REG_DWORD(prodkey, "EstimatedSize", 12);
3648 RegCloseKey(prodkey);
3650 /* complete uninstall */
3651 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3652 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3653 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3654 todo_wine
3656 ok(!pf_exists("msitest"), "File not deleted\n");
3659 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3660 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3662 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3663 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3665 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3666 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3668 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3669 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3670 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3671 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3673 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
3674 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3676 /* make sure 'Program Files\msitest' is removed */
3677 delete_pfmsitest_files();
3679 RegCloseKey(uninstall);
3680 DeleteFile(msifile);
3681 DeleteFile("msitest\\maximus");
3682 RemoveDirectory("msitest");
3685 static void test_publishsourcelist(void)
3687 UINT r;
3688 DWORD size;
3689 CHAR value[MAX_PATH];
3690 CHAR path[MAX_PATH];
3691 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3693 if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
3695 skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
3696 return;
3699 CreateDirectoryA("msitest", NULL);
3700 create_file("msitest\\maximus", 500);
3702 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3704 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3706 r = MsiInstallProductA(msifile, NULL);
3707 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3708 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3709 ok(pf_exists("msitest"), "File not installed\n");
3711 /* nothing published */
3712 size = 0xdeadbeef;
3713 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3714 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3715 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3716 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3718 size = 0xdeadbeef;
3719 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3720 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3721 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3722 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3724 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
3725 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3726 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3727 ok(pf_exists("msitest"), "File not installed\n");
3729 /* after RegisterProduct */
3730 size = 0xdeadbeef;
3731 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3732 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3733 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3734 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3736 size = 0xdeadbeef;
3737 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3738 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3739 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3740 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3742 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3743 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3744 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3745 ok(pf_exists("msitest"), "File not installed\n");
3747 /* after ProcessComponents */
3748 size = 0xdeadbeef;
3749 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3750 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3751 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3752 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3754 size = 0xdeadbeef;
3755 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3756 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3757 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3758 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3760 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
3761 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3762 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3763 ok(pf_exists("msitest"), "File not installed\n");
3765 /* after PublishFeatures */
3766 size = 0xdeadbeef;
3767 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3768 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, NULL, &size);
3769 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3770 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3772 size = 0xdeadbeef;
3773 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3774 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, NULL, &size);
3775 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3776 ok(size == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", size);
3778 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
3779 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3780 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3781 ok(pf_exists("msitest"), "File not installed\n");
3783 /* after PublishProduct */
3784 size = MAX_PATH;
3785 lstrcpyA(value, "aaa");
3786 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3787 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
3788 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3789 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
3790 ok(size == 11, "Expected 11, got %d\n", size);
3792 size = MAX_PATH;
3793 lstrcpyA(value, "aaa");
3794 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3795 MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATH, value, &size);
3796 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3797 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
3798 ok(size == 0, "Expected 0, got %d\n", size);
3800 size = MAX_PATH;
3801 lstrcpyA(value, "aaa");
3802 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3803 MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPT, value, &size);
3804 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3805 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
3806 ok(size == 0, "Expected 0, got %d\n", size);
3808 lstrcpyA(path, CURR_DIR);
3809 lstrcatA(path, "\\");
3811 size = MAX_PATH;
3812 lstrcpyA(value, "aaa");
3813 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3814 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3815 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3816 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3817 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3819 size = MAX_PATH;
3820 lstrcpyA(value, "aaa");
3821 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3822 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE, value, &size);
3823 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3824 ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
3825 ok(size == 1, "Expected 1, got %d\n", size);
3827 size = MAX_PATH;
3828 lstrcpyA(value, "aaa");
3829 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3830 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
3831 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
3832 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
3833 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
3835 size = MAX_PATH;
3836 lstrcpyA(value, "aaa");
3837 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3838 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
3839 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3840 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3841 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3843 size = MAX_PATH;
3844 lstrcpyA(value, "aaa");
3845 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3846 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
3847 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
3848 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
3849 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
3851 /* complete uninstall */
3852 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3853 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3854 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3855 todo_wine
3857 ok(!pf_exists("msitest"), "File not deleted\n");
3860 /* make sure 'Program Files\msitest' is removed */
3861 delete_pfmsitest_files();
3863 DeleteFile(msifile);
3864 DeleteFile("msitest\\maximus");
3865 RemoveDirectory("msitest");
3868 static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
3870 MSIHANDLE hview = 0;
3871 UINT r;
3873 r = MsiDatabaseOpenView(hdb, query, &hview);
3874 if(r != ERROR_SUCCESS)
3875 return r;
3877 r = MsiViewExecute(hview, hrec);
3878 if(r == ERROR_SUCCESS)
3879 r = MsiViewClose(hview);
3880 MsiCloseHandle(hview);
3881 return r;
3884 static void set_transform_summary_info(void)
3886 UINT r;
3887 MSIHANDLE suminfo = 0;
3889 /* build summary info */
3890 r = MsiGetSummaryInformation(0, mstfile, 3, &suminfo);
3891 todo_wine
3893 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
3896 r = MsiSummaryInfoSetProperty(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
3897 todo_wine
3899 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3902 r = MsiSummaryInfoSetProperty(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
3903 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3904 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
3905 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
3906 todo_wine
3908 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
3911 r = MsiSummaryInfoSetProperty(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
3912 todo_wine
3914 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
3917 r = MsiSummaryInfoPersist(suminfo);
3918 todo_wine
3920 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
3923 r = MsiCloseHandle(suminfo);
3924 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
3927 static void generate_transform(void)
3929 MSIHANDLE hdb1, hdb2;
3930 LPCSTR query;
3931 UINT r;
3933 /* start with two identical databases */
3934 CopyFile(msifile, msifile2, FALSE);
3936 r = MsiOpenDatabase(msifile2, MSIDBOPEN_TRANSACT, &hdb1);
3937 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3939 r = MsiDatabaseCommit(hdb1);
3940 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
3942 r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb2);
3943 ok(r == ERROR_SUCCESS , "Failed to create database\n");
3945 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
3946 r = run_query(hdb1, 0, query);
3947 ok(r == ERROR_SUCCESS, "failed to add property\n");
3949 /* database needs to be committed */
3950 MsiDatabaseCommit(hdb1);
3952 r = MsiDatabaseGenerateTransform(hdb1, hdb2, mstfile, 0, 0);
3953 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
3955 #if 0 /* not implemented in wine yet */
3956 r = MsiCreateTransformSummaryInfo(hdb2, hdb2, mstfile, 0, 0);
3957 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3958 #endif
3960 MsiCloseHandle(hdb1);
3961 MsiCloseHandle(hdb2);
3964 /* data for generating a transform */
3966 /* tables transform names - encoded as they would be in an msi database file */
3967 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
3968 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
3969 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
3971 /* data in each table */
3972 static const char data1[] = /* _StringData */
3973 "propval"; /* all the strings squashed together */
3975 static const WCHAR data2[] = { /* _StringPool */
3976 /* len, refs */
3977 0, 0, /* string 0 '' */
3978 4, 1, /* string 1 'prop' */
3979 3, 1, /* string 2 'val' */
3982 static const WCHAR data3[] = { /* Property */
3983 0x0201, 0x0001, 0x0002,
3986 static const struct {
3987 LPCWSTR name;
3988 const void *data;
3989 DWORD size;
3990 } table_transform_data[] =
3992 { name1, data1, sizeof data1 - 1 },
3993 { name2, data2, sizeof data2 },
3994 { name3, data3, sizeof data3 },
3997 #define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
3999 static void generate_transform_manual(void)
4001 IStorage *stg = NULL;
4002 IStream *stm;
4003 WCHAR name[0x20];
4004 HRESULT r;
4005 DWORD i, count;
4006 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
4008 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
4010 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
4012 r = StgCreateDocfile(name, mode, 0, &stg);
4013 ok(r == S_OK, "failed to create storage\n");
4014 if (!stg)
4015 return;
4017 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
4018 ok(r == S_OK, "failed to set storage type\n");
4020 for (i=0; i<NUM_TRANSFORM_TABLES; i++)
4022 r = IStorage_CreateStream(stg, table_transform_data[i].name,
4023 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
4024 if (FAILED(r))
4026 ok(0, "failed to create stream %08x\n", r);
4027 continue;
4030 r = IStream_Write(stm, table_transform_data[i].data,
4031 table_transform_data[i].size, &count);
4032 if (FAILED(r) || count != table_transform_data[i].size)
4033 ok(0, "failed to write stream\n");
4034 IStream_Release(stm);
4037 IStorage_Release(stg);
4039 set_transform_summary_info();
4042 static void test_transformprop(void)
4044 UINT r;
4046 CreateDirectoryA("msitest", NULL);
4047 create_file("msitest\\augustus", 500);
4049 create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
4051 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4053 r = MsiInstallProductA(msifile, NULL);
4054 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4055 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4056 ok(!delete_pf("msitest", FALSE), "File installed\n");
4058 if (0)
4059 generate_transform();
4060 else
4061 generate_transform_manual();
4063 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
4064 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4065 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4066 ok(delete_pf("msitest", FALSE), "File not installed\n");
4068 /* Delete the files in the temp (current) folder */
4069 DeleteFile(msifile);
4070 DeleteFile(msifile2);
4071 DeleteFile(mstfile);
4072 DeleteFile("msitest\\augustus");
4073 RemoveDirectory("msitest");
4076 static void test_currentworkingdir(void)
4078 UINT r;
4079 CHAR path[MAX_PATH];
4080 LPSTR ptr, ptr2;
4082 CreateDirectoryA("msitest", NULL);
4083 create_file("msitest\\augustus", 500);
4085 create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
4087 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4089 CreateDirectoryA("diffdir", NULL);
4090 SetCurrentDirectoryA("diffdir");
4092 sprintf(path, "..\\%s", msifile);
4093 r = MsiInstallProductA(path, NULL);
4094 todo_wine
4096 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
4097 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4098 ok(!delete_pf("msitest", FALSE), "File installed\n");
4101 sprintf(path, "%s\\%s", CURR_DIR, msifile);
4102 r = MsiInstallProductA(path, NULL);
4103 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4104 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4105 ok(delete_pf("msitest", FALSE), "File not installed\n");
4107 lstrcpyA(path, CURR_DIR);
4108 if (path[lstrlenA(path) - 1] != '\\')
4109 lstrcatA(path, "\\");
4110 lstrcatA(path, "msitest.msi");
4112 ptr2 = strrchr(path, '\\');
4113 *ptr2 = '\0';
4114 ptr = strrchr(path, '\\');
4115 *ptr2 = '\\';
4116 *(ptr++) = '\0';
4118 SetCurrentDirectoryA(path);
4120 r = MsiInstallProductA(ptr, NULL);
4121 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4122 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4123 ok(delete_pf("msitest", FALSE), "File not installed\n");
4125 SetCurrentDirectoryA(CURR_DIR);
4127 DeleteFile(msifile);
4128 DeleteFile("msitest\\augustus");
4129 RemoveDirectory("msitest");
4130 RemoveDirectory("diffdir");
4133 static void set_admin_summary_info(const CHAR *name)
4135 MSIHANDLE db, summary;
4136 UINT r;
4138 r = MsiOpenDatabaseA(name, MSIDBOPEN_DIRECT, &db);
4139 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4141 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
4142 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4144 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
4145 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4147 /* write the summary changes back to the stream */
4148 r = MsiSummaryInfoPersist(summary);
4149 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4151 MsiCloseHandle(summary);
4153 r = MsiDatabaseCommit(db);
4154 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4156 MsiCloseHandle(db);
4159 static void test_admin(void)
4161 UINT r;
4163 CreateDirectoryA("msitest", NULL);
4164 create_file("msitest\\augustus", 500);
4166 create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
4167 set_admin_summary_info(msifile);
4169 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4171 r = MsiInstallProductA(msifile, NULL);
4172 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4173 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4174 ok(!delete_pf("msitest", FALSE), "File installed\n");
4175 ok(!DeleteFile("c:\\msitest\\augustus"), "File installed\n");
4176 ok(!RemoveDirectory("c:\\msitest"), "File installed\n");
4178 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
4179 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4180 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4181 ok(!delete_pf("msitest", FALSE), "File installed\n");
4182 todo_wine
4184 ok(DeleteFile("c:\\msitest\\augustus"), "File not installed\n");
4185 ok(RemoveDirectory("c:\\msitest"), "File not installed\n");
4188 DeleteFile(msifile);
4189 DeleteFile("msitest\\augustus");
4190 RemoveDirectory("msitest");
4193 static void set_admin_property_stream(LPCSTR file)
4195 IStorage *stg;
4196 IStream *stm;
4197 WCHAR fileW[MAX_PATH];
4198 HRESULT hr;
4199 DWORD count;
4200 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
4202 /* AdminProperties */
4203 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
4204 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',0};
4206 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
4208 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
4209 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4210 if (!stg)
4211 return;
4213 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
4214 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4216 hr = IStream_Write(stm, data, sizeof(data), &count);
4217 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
4219 IStream_Release(stm);
4220 IStorage_Release(stg);
4223 static void test_adminprops(void)
4225 UINT r;
4227 CreateDirectoryA("msitest", NULL);
4228 create_file("msitest\\augustus", 500);
4230 create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
4231 set_admin_summary_info(msifile);
4232 set_admin_property_stream(msifile);
4234 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4236 r = MsiInstallProductA(msifile, NULL);
4237 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4238 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4239 ok(delete_pf("msitest", FALSE), "File installed\n");
4241 DeleteFile(msifile);
4242 DeleteFile("msitest\\augustus");
4243 RemoveDirectory("msitest");
4246 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
4248 CHAR path[MAX_PATH];
4250 lstrcpyA(path, PROG_FILES_DIR);
4251 lstrcatA(path, "\\");
4252 lstrcatA(path, file);
4254 if (is_file)
4255 create_file_data(path, data, 500);
4256 else
4257 CreateDirectoryA(path, NULL);
4260 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
4262 static void test_removefiles(void)
4264 UINT r;
4266 CreateDirectoryA("msitest", NULL);
4267 create_file("msitest\\hydrogen", 500);
4268 create_file("msitest\\helium", 500);
4269 create_file("msitest\\lithium", 500);
4271 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
4273 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4275 r = MsiInstallProductA(msifile, NULL);
4276 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4277 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4278 ok(!pf_exists("msitest\\helium"), "File installed\n");
4279 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4280 ok(pf_exists("msitest"), "File not installed\n");
4282 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4283 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4284 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4285 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
4286 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4287 ok(delete_pf("msitest", FALSE), "File deleted\n");
4289 create_pf("msitest", FALSE);
4290 create_pf("msitest\\hydrogen", TRUE);
4291 create_pf("msitest\\helium", TRUE);
4292 create_pf("msitest\\lithium", TRUE);
4294 r = MsiInstallProductA(msifile, NULL);
4295 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4296 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4297 ok(pf_exists("msitest\\helium"), "File not installed\n");
4298 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4299 ok(pf_exists("msitest"), "File not installed\n");
4301 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4302 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4303 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4304 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
4305 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4306 ok(delete_pf("msitest", FALSE), "File deleted\n");
4308 create_pf("msitest", FALSE);
4309 create_pf("msitest\\furlong", TRUE);
4310 create_pf("msitest\\firkin", TRUE);
4311 create_pf("msitest\\fortnight", TRUE);
4312 create_pf("msitest\\becquerel", TRUE);
4313 create_pf("msitest\\dioptre", TRUE);
4314 create_pf("msitest\\attoparsec", TRUE);
4315 create_pf("msitest\\storeys", TRUE);
4316 create_pf("msitest\\block", TRUE);
4317 create_pf("msitest\\siriometer", TRUE);
4318 create_pf("msitest\\cabout", FALSE);
4319 create_pf("msitest\\cabout\\blocker", TRUE);
4321 r = MsiInstallProductA(msifile, NULL);
4322 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4323 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4324 ok(!pf_exists("msitest\\helium"), "File installed\n");
4325 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4326 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
4327 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
4328 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
4329 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
4330 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
4331 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
4332 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
4333 ok(!pf_exists("msitest\\block"), "File not deleted\n");
4334 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
4335 ok(pf_exists("msitest\\cabout"), "Directory removed\n");
4336 ok(pf_exists("msitest"), "File not installed\n");
4338 create_pf("msitest\\furlong", TRUE);
4339 create_pf("msitest\\firkin", TRUE);
4340 create_pf("msitest\\fortnight", TRUE);
4341 create_pf("msitest\\storeys", TRUE);
4342 create_pf("msitest\\block", TRUE);
4343 create_pf("msitest\\siriometer", TRUE);
4345 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4346 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4347 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
4348 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
4349 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4350 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
4351 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
4352 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
4353 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
4354 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
4355 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
4356 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
4357 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
4358 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
4359 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4360 ok(pf_exists("msitest"), "Directory deleted\n");
4362 r = MsiInstallProductA(msifile, NULL);
4363 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4364 ok(delete_pf("msitest\\hydrogen", TRUE), "File not installed\n");
4365 ok(!delete_pf("msitest\\helium", TRUE), "File installed\n");
4366 ok(delete_pf("msitest\\lithium", TRUE), "File not installed\n");
4367 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4368 ok(pf_exists("msitest"), "Directory deleted\n");
4370 delete_pf("msitest\\cabout\\blocker", TRUE);
4372 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4373 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4374 ok(!delete_pf("msitest\\cabout", FALSE), "Directory not deleted\n");
4375 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4377 DeleteFile(msifile);
4378 DeleteFile("msitest\\hydrogen");
4379 DeleteFile("msitest\\helium");
4380 DeleteFile("msitest\\lithium");
4381 RemoveDirectory("msitest");
4384 static void test_movefiles(void)
4386 UINT r;
4387 char props[MAX_PATH];
4389 CreateDirectoryA("msitest", NULL);
4390 create_file("msitest\\augustus", 100);
4391 create_file("cameroon", 100);
4392 create_file("djibouti", 100);
4393 create_file("egypt", 100);
4394 create_file("finland", 100);
4395 create_file("gambai", 100);
4396 create_file("honduras", 100);
4397 create_file("msitest\\india", 100);
4398 create_file("japan", 100);
4399 create_file("kenya", 100);
4400 CreateDirectoryA("latvia", NULL);
4401 create_file("nauru", 100);
4402 create_file("peru", 100);
4403 create_file("apple", 100);
4404 create_file("application", 100);
4405 create_file("ape", 100);
4406 create_file("foo", 100);
4407 create_file("fao", 100);
4408 create_file("fbod", 100);
4409 create_file("budding", 100);
4410 create_file("buddy", 100);
4411 create_file("bud", 100);
4412 create_file("bar", 100);
4413 create_file("bur", 100);
4414 create_file("bird", 100);
4416 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
4418 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4420 /* if the source or dest property is not a full path,
4421 * windows tries to access it as a network resource
4424 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
4425 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
4426 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
4428 r = MsiInstallProductA(msifile, props);
4429 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4430 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4431 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
4432 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
4433 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
4434 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
4435 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
4436 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
4437 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
4438 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
4439 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
4440 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
4441 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
4442 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
4443 ok(delete_pf("msitest\\poland", TRUE), "File not moved\n");
4444 /* either apple or application will be moved depending on directory order */
4445 if (!delete_pf("msitest\\apple", TRUE))
4446 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
4447 else
4448 ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
4449 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
4450 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
4451 /* either fao or foo will be moved depending on directory order */
4452 if (delete_pf("msitest\\foo", TRUE))
4453 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
4454 else
4455 ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
4456 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
4457 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
4458 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
4459 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
4460 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
4461 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
4462 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
4463 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
4464 ok(delete_pf("msitest", FALSE), "File not installed\n");
4465 ok(DeleteFileA("cameroon"), "File moved\n");
4466 ok(!DeleteFileA("djibouti"), "File not moved\n");
4467 ok(DeleteFileA("egypt"), "File moved\n");
4468 ok(DeleteFileA("finland"), "File moved\n");
4469 ok(DeleteFileA("gambai"), "File moved\n");
4470 ok(!DeleteFileA("honduras"), "File not moved\n");
4471 ok(DeleteFileA("msitest\\india"), "File moved\n");
4472 ok(DeleteFileA("japan"), "File moved\n");
4473 ok(!DeleteFileA("kenya"), "File not moved\n");
4474 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
4475 ok(!DeleteFileA("nauru"), "File not moved\n");
4476 ok(!DeleteFileA("peru"), "File not moved\n");
4477 ok(!DeleteFileA("apple"), "File not moved\n");
4478 ok(!DeleteFileA("application"), "File not moved\n");
4479 ok(DeleteFileA("ape"), "File moved\n");
4480 ok(!DeleteFileA("foo"), "File not moved\n");
4481 ok(!DeleteFileA("fao"), "File not moved\n");
4482 ok(DeleteFileA("fbod"), "File moved\n");
4483 ok(!DeleteFileA("budding"), "File not moved\n");
4484 ok(!DeleteFileA("buddy"), "File not moved\n");
4485 ok(DeleteFileA("bud"), "File moved\n");
4486 ok(!DeleteFileA("bar"), "File not moved\n");
4487 ok(!DeleteFileA("bur"), "File not moved\n");
4488 ok(DeleteFileA("bird"), "File moved\n");
4490 DeleteFile("msitest\\augustus");
4491 RemoveDirectory("msitest");
4492 DeleteFile(msifile);
4495 static void test_missingcab(void)
4497 UINT r;
4499 CreateDirectoryA("msitest", NULL);
4500 create_file("msitest\\augustus", 500);
4501 create_file("maximus", 500);
4503 create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
4505 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4507 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
4509 create_pf("msitest", FALSE);
4510 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
4512 r = MsiInstallProductA(msifile, NULL);
4513 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4514 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4515 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
4516 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4517 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
4518 ok(delete_pf("msitest", FALSE), "File not installed\n");
4520 create_pf("msitest", FALSE);
4521 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
4522 create_pf("msitest\\gaius", TRUE);
4524 r = MsiInstallProductA(msifile, "GAIUS=1");
4525 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4526 todo_wine
4528 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
4529 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4531 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
4532 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
4533 ok(delete_pf("msitest", FALSE), "File not installed\n");
4535 DeleteFile("msitest\\augustus");
4536 RemoveDirectory("msitest");
4537 DeleteFile("maximus");
4538 DeleteFile("test1.cab");
4539 DeleteFile(msifile);
4542 static void test_duplicatefiles(void)
4544 UINT r;
4546 CreateDirectoryA("msitest", NULL);
4547 create_file("msitest\\maximus", 500);
4548 create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
4550 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4552 /* fails if the destination folder is not a valid property */
4554 r = MsiInstallProductA(msifile, NULL);
4555 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4556 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4557 ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
4558 ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
4559 ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "File not duplicated\n");
4560 ok(delete_pf("msitest\\this\\doesnot", FALSE), "File not duplicated\n");
4561 ok(delete_pf("msitest\\this", FALSE), "File not duplicated\n");
4562 ok(delete_pf("msitest", FALSE), "File not installed\n");
4564 DeleteFile("msitest\\maximus");
4565 RemoveDirectory("msitest");
4566 DeleteFile(msifile);
4569 static void test_writeregistryvalues(void)
4571 UINT r;
4572 LONG res;
4573 HKEY hkey;
4574 DWORD type, size;
4575 CHAR path[MAX_PATH];
4577 CreateDirectoryA("msitest", NULL);
4578 create_file("msitest\\augustus", 500);
4580 create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
4582 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4584 r = MsiInstallProductA(msifile, NULL);
4585 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4586 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4587 ok(delete_pf("msitest", FALSE), "File installed\n");
4589 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
4590 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4592 size = MAX_PATH;
4593 type = REG_MULTI_SZ;
4594 memset(path, 'a', MAX_PATH);
4595 res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size);
4596 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4597 ok(!memcmp(path, "one\0two\0three\0\0", size), "Wrong multi-sz data\n");
4598 ok(size == 15, "Expected 15, got %d\n", size);
4599 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4601 DeleteFile(msifile);
4602 DeleteFile("msitest\\augustus");
4603 RemoveDirectory("msitest");
4605 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
4606 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine");
4609 static void test_sourcefolder(void)
4611 UINT r;
4613 CreateDirectoryA("msitest", NULL);
4614 create_file("augustus", 500);
4616 create_database(msifile, sf_tables, sizeof(sf_tables) / sizeof(msi_table));
4618 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4620 r = MsiInstallProductA(msifile, NULL);
4621 ok(r == ERROR_INSTALL_FAILURE,
4622 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4623 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4624 todo_wine
4626 ok(!delete_pf("msitest", FALSE), "File installed\n");
4629 RemoveDirectoryA("msitest");
4631 r = MsiInstallProductA(msifile, NULL);
4632 ok(r == ERROR_INSTALL_FAILURE,
4633 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
4634 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
4635 todo_wine
4637 ok(!delete_pf("msitest", FALSE), "File installed\n");
4640 DeleteFile(msifile);
4641 DeleteFile("augustus");
4644 static void test_customaction51(void)
4646 UINT r;
4648 CreateDirectoryA("msitest", NULL);
4649 create_file("msitest\\augustus", 500);
4651 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
4653 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4655 r = MsiInstallProductA(msifile, NULL);
4656 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4657 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4658 ok(delete_pf("msitest", FALSE), "File installed\n");
4660 DeleteFile(msifile);
4661 DeleteFile("msitest\\augustus");
4662 RemoveDirectory("msitest");
4665 static void test_installstate(void)
4667 UINT r;
4669 CreateDirectoryA("msitest", NULL);
4670 create_file("msitest\\alpha", 500);
4671 create_file("msitest\\beta", 500);
4672 create_file("msitest\\gamma", 500);
4673 create_file("msitest\\theta", 500);
4674 create_file("msitest\\delta", 500);
4675 create_file("msitest\\epsilon", 500);
4676 create_file("msitest\\zeta", 500);
4677 create_file("msitest\\iota", 500);
4678 create_file("msitest\\eta", 500);
4679 create_file("msitest\\kappa", 500);
4680 create_file("msitest\\lambda", 500);
4681 create_file("msitest\\mu", 500);
4683 create_database(msifile, is_tables, sizeof(is_tables) / sizeof(msi_table));
4685 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4687 r = MsiInstallProductA(msifile, NULL);
4688 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4689 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4690 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4691 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4692 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4693 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4694 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4695 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4696 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4697 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4698 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4699 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4700 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4701 ok(delete_pf("msitest", FALSE), "File not installed\n");
4703 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
4704 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4705 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4706 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4707 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
4708 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4709 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4710 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
4711 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4712 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4713 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
4714 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4715 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4716 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4717 ok(delete_pf("msitest", FALSE), "File not installed\n");
4719 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
4720 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4721 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
4722 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4723 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4724 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
4725 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4726 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4727 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
4728 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4729 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4730 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4731 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4732 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4733 ok(delete_pf("msitest", FALSE), "File not installed\n");
4735 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
4736 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4737 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
4738 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
4739 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
4740 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
4741 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
4742 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
4743 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
4744 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
4745 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
4746 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
4747 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
4748 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
4749 ok(!delete_pf("msitest", FALSE), "File installed\n");
4751 DeleteFile(msifile);
4752 DeleteFile("msitest\\alpha");
4753 DeleteFile("msitest\\beta");
4754 DeleteFile("msitest\\gamma");
4755 DeleteFile("msitest\\theta");
4756 DeleteFile("msitest\\delta");
4757 DeleteFile("msitest\\epsilon");
4758 DeleteFile("msitest\\zeta");
4759 DeleteFile("msitest\\iota");
4760 DeleteFile("msitest\\eta");
4761 DeleteFile("msitest\\kappa");
4762 DeleteFile("msitest\\lambda");
4763 DeleteFile("msitest\\mu");
4764 RemoveDirectory("msitest");
4767 struct sourcepathmap
4769 BOOL sost; /* shortone\shorttwo */
4770 BOOL solt; /* shortone\longtwo */
4771 BOOL lost; /* longone\shorttwo */
4772 BOOL lolt; /* longone\longtwo */
4773 BOOL soste; /* shortone\shorttwo source exists */
4774 BOOL solte; /* shortone\longtwo source exists */
4775 BOOL loste; /* longone\shorttwo source exists */
4776 BOOL lolte; /* longone\longtwo source exists */
4777 UINT err;
4778 DWORD size;
4779 } spmap[256] =
4781 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4782 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4783 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4784 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4785 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4786 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4787 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4788 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4789 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4790 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4791 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4792 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4793 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4794 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4795 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4796 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4797 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4798 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4799 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4800 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4801 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4802 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4803 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4804 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4805 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4806 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4807 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4808 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4809 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4810 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4811 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4812 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4813 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4814 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4815 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4816 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4817 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4818 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4819 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4820 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4821 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4822 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4823 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4824 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4825 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4826 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4827 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4828 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4829 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4830 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4831 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4832 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4833 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4834 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4835 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4836 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4837 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4838 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4839 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4840 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4841 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4842 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4843 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4844 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4845 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4846 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4847 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4848 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4849 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4850 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4851 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4852 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4853 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4854 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4855 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4856 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4857 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4858 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4859 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4860 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4861 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4862 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4863 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4864 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4865 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4866 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4867 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4868 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4869 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4870 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4871 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4872 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4873 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4874 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4875 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4876 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4877 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4878 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4879 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4880 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4881 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4882 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4883 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4884 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4885 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4886 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4887 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4888 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4889 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4890 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4891 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4892 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4893 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4894 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4895 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4896 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4897 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4898 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4899 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4900 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4901 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4902 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4903 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4904 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4905 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4906 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4907 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4908 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4909 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4910 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4911 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4912 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4913 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4914 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4915 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4916 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4917 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4918 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4919 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4920 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4921 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4922 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4923 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4924 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4925 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4926 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4927 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4928 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4929 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4930 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4931 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4932 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4933 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4934 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4935 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4936 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4937 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4938 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4939 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4940 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4941 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4942 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4943 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4944 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4945 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4946 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4947 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4948 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4949 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4950 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4951 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4952 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4953 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4954 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4955 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4956 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4957 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4958 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4959 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4960 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4961 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4962 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4963 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4964 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4965 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4966 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4967 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4968 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4969 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4970 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4971 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4972 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4973 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4974 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4975 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4976 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4977 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4978 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4979 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4980 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4981 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
4982 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4983 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
4984 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4985 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
4986 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4987 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
4988 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4989 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4990 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4991 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4992 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4993 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4994 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4995 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
4996 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
4997 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
4998 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
4999 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5000 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5001 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5002 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5003 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5004 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5005 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5006 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5007 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5008 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5009 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5010 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5011 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5012 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5013 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
5014 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5015 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
5016 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5017 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
5018 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5019 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
5020 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5021 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5022 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5023 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5024 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5025 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5026 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5027 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5028 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5029 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5030 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5031 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5032 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5033 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
5034 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
5035 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
5036 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
5039 static DWORD get_pf_file_size(LPCSTR file)
5041 CHAR path[MAX_PATH];
5042 HANDLE hfile;
5043 DWORD size;
5045 lstrcpyA(path, PROG_FILES_DIR);
5046 lstrcatA(path, "\\");
5047 lstrcatA(path, file);
5049 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
5050 if (hfile == INVALID_HANDLE_VALUE)
5051 return 0;
5053 size = GetFileSize(hfile, NULL);
5054 CloseHandle(hfile);
5055 return size;
5058 static void test_sourcepath(void)
5060 UINT r, i;
5062 create_database(msifile, sp_tables, sizeof(sp_tables) / sizeof(msi_table));
5064 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5066 for (i = 0; i < sizeof(spmap) / sizeof(spmap[0]); i++)
5068 if (spmap[i].sost)
5070 CreateDirectoryA("shortone", NULL);
5071 CreateDirectoryA("shortone\\shorttwo", NULL);
5074 if (spmap[i].solt)
5076 CreateDirectoryA("shortone", NULL);
5077 CreateDirectoryA("shortone\\longtwo", NULL);
5080 if (spmap[i].lost)
5082 CreateDirectoryA("longone", NULL);
5083 CreateDirectoryA("longone\\shorttwo", NULL);
5086 if (spmap[i].lolt)
5088 CreateDirectoryA("longone", NULL);
5089 CreateDirectoryA("longone\\longtwo", NULL);
5092 if (spmap[i].soste)
5093 create_file("shortone\\shorttwo\\augustus", 50);
5094 if (spmap[i].solte)
5095 create_file("shortone\\longtwo\\augustus", 100);
5096 if (spmap[i].loste)
5097 create_file("longone\\shorttwo\\augustus", 150);
5098 if (spmap[i].lolte)
5099 create_file("longone\\longtwo\\augustus", 200);
5101 r = MsiInstallProductA(msifile, NULL);
5102 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
5103 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
5104 "%d: Expected %d, got %d\n", i, spmap[i].size,
5105 get_pf_file_size("msitest\\augustus"));
5107 if (r == ERROR_SUCCESS)
5109 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
5110 ok(delete_pf("msitest", FALSE), "%d: File not installed\n", i);
5112 else
5114 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
5115 todo_wine ok(!delete_pf("msitest", FALSE), "%d: File installed\n", i);
5118 DeleteFileA("shortone\\shorttwo\\augustus");
5119 DeleteFileA("shortone\\longtwo\\augustus");
5120 DeleteFileA("longone\\shorttwo\\augustus");
5121 DeleteFileA("longone\\longtwo\\augustus");
5122 RemoveDirectoryA("shortone\\shorttwo");
5123 RemoveDirectoryA("shortone\\longtwo");
5124 RemoveDirectoryA("longone\\shorttwo");
5125 RemoveDirectoryA("longone\\longtwo");
5126 RemoveDirectoryA("shortone");
5127 RemoveDirectoryA("longone");
5130 DeleteFileA(msifile);
5133 static void test_MsiConfigureProductEx(void)
5135 UINT r;
5136 LONG res;
5137 DWORD type, size;
5138 HKEY props, source;
5139 CHAR keypath[MAX_PATH * 2];
5140 CHAR localpack[MAX_PATH];
5142 CreateDirectoryA("msitest", NULL);
5143 create_file("msitest\\hydrogen", 500);
5144 create_file("msitest\\helium", 500);
5145 create_file("msitest\\lithium", 500);
5147 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
5149 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5151 /* NULL szProduct */
5152 r = MsiConfigureProductExA(NULL, INSTALLLEVEL_DEFAULT,
5153 INSTALLSTATE_DEFAULT, "PROPVAR=42");
5154 ok(r == ERROR_INVALID_PARAMETER,
5155 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5157 /* empty szProduct */
5158 r = MsiConfigureProductExA("", INSTALLLEVEL_DEFAULT,
5159 INSTALLSTATE_DEFAULT, "PROPVAR=42");
5160 ok(r == ERROR_INVALID_PARAMETER,
5161 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5163 /* garbage szProduct */
5164 r = MsiConfigureProductExA("garbage", INSTALLLEVEL_DEFAULT,
5165 INSTALLSTATE_DEFAULT, "PROPVAR=42");
5166 ok(r == ERROR_INVALID_PARAMETER,
5167 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5169 /* guid without brackets */
5170 r = MsiConfigureProductExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
5171 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5172 "PROPVAR=42");
5173 ok(r == ERROR_INVALID_PARAMETER,
5174 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
5176 /* guid with brackets */
5177 r = MsiConfigureProductExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
5178 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5179 "PROPVAR=42");
5180 ok(r == ERROR_UNKNOWN_PRODUCT,
5181 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5183 /* same length as guid, but random */
5184 r = MsiConfigureProductExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93",
5185 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5186 "PROPVAR=42");
5187 ok(r == ERROR_UNKNOWN_PRODUCT,
5188 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5190 /* product not installed yet */
5191 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5192 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5193 "PROPVAR=42");
5194 ok(r == ERROR_UNKNOWN_PRODUCT,
5195 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5197 /* install the product, per-user unmanaged */
5198 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
5199 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5200 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5201 ok(pf_exists("msitest\\helium"), "File not installed\n");
5202 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5203 ok(pf_exists("msitest"), "File not installed\n");
5205 /* product is installed per-user managed, remove it */
5206 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5207 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5208 "PROPVAR=42");
5209 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5210 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5211 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5212 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5213 todo_wine
5215 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5218 /* product has been removed */
5219 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5220 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5221 "PROPVAR=42");
5222 ok(r == ERROR_UNKNOWN_PRODUCT,
5223 "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
5225 /* install the product, machine */
5226 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
5227 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5228 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5229 ok(pf_exists("msitest\\helium"), "File not installed\n");
5230 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5231 ok(pf_exists("msitest"), "File not installed\n");
5233 /* product is installed machine, remove it */
5234 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5235 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5236 "PROPVAR=42");
5237 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5238 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5239 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5240 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5241 todo_wine
5243 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5246 /* product has been removed */
5247 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5248 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
5249 "PROPVAR=42");
5250 ok(r == ERROR_UNKNOWN_PRODUCT,
5251 "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
5253 /* install the product, machine */
5254 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
5255 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5256 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5257 ok(pf_exists("msitest\\helium"), "File not installed\n");
5258 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5259 ok(pf_exists("msitest"), "File not installed\n");
5261 DeleteFileA(msifile);
5263 /* local msifile is removed */
5264 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5265 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5266 "PROPVAR=42");
5267 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5268 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5269 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5270 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5271 todo_wine
5273 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5276 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
5278 /* install the product, machine */
5279 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
5280 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5281 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5282 ok(pf_exists("msitest\\helium"), "File not installed\n");
5283 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5284 ok(pf_exists("msitest"), "File not installed\n");
5286 DeleteFileA(msifile);
5288 lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
5289 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
5290 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties");
5292 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
5293 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5295 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
5296 (const BYTE *)"C:\\idontexist.msi", 18);
5297 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5299 /* LocalPackage is used to find the cached msi package */
5300 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5301 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5302 "PROPVAR=42");
5303 ok(r == ERROR_INSTALL_SOURCE_ABSENT,
5304 "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
5305 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5306 ok(pf_exists("msitest\\helium"), "File not installed\n");
5307 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5308 ok(pf_exists("msitest"), "File not installed\n");
5310 RegCloseKey(props);
5311 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
5313 /* LastUsedSource (local msi package) can be used as a last resort */
5314 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5315 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5316 "PROPVAR=42");
5317 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5318 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5319 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5320 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5321 todo_wine
5323 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5326 /* install the product, machine */
5327 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
5328 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5329 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5330 ok(pf_exists("msitest\\helium"), "File not installed\n");
5331 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5332 ok(pf_exists("msitest"), "File not installed\n");
5334 lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
5335 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
5336 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties");
5338 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
5339 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5341 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
5342 (const BYTE *)"C:\\idontexist.msi", 18);
5343 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5345 lstrcpyA(keypath, "SOFTWARE\\Classes\\Installer\\Products\\");
5346 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\SourceList");
5348 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &source);
5349 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5351 type = REG_SZ;
5352 size = MAX_PATH;
5353 res = RegQueryValueExA(source, "PackageName", NULL, &type,
5354 (LPBYTE)localpack, &size);
5355 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5357 res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
5358 (const BYTE *)"idontexist.msi", 15);
5359 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5361 /* SourceList is altered */
5362 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5363 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5364 "PROPVAR=42");
5365 ok(r == ERROR_INSTALL_SOURCE_ABSENT,
5366 "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
5367 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5368 ok(pf_exists("msitest\\helium"), "File not installed\n");
5369 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5370 ok(pf_exists("msitest"), "File not installed\n");
5372 /* restore the SourceList */
5373 res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
5374 (const BYTE *)localpack, lstrlenA(localpack) + 1);
5375 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5377 /* finally remove the product */
5378 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
5379 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
5380 "PROPVAR=42");
5381 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5382 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5383 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5384 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5385 todo_wine
5387 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5390 DeleteFileA(msifile);
5391 RegCloseKey(source);
5392 RegCloseKey(props);
5393 DeleteFileA("msitest\\hydrogen");
5394 DeleteFileA("msitest\\helium");
5395 DeleteFileA("msitest\\lithium");
5396 RemoveDirectoryA("msitest");
5399 static void test_missingcomponent(void)
5401 UINT r;
5403 CreateDirectoryA("msitest", NULL);
5404 create_file("msitest\\hydrogen", 500);
5405 create_file("msitest\\helium", 500);
5406 create_file("msitest\\lithium", 500);
5407 create_file("beryllium", 500);
5409 create_database(msifile, mcomp_tables, sizeof(mcomp_tables) / sizeof(msi_table));
5411 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5413 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
5414 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5415 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5416 ok(pf_exists("msitest\\helium"), "File not installed\n");
5417 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5418 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
5419 ok(pf_exists("msitest"), "File not installed\n");
5421 r = MsiInstallProductA(msifile, "REMOVE=ALL INSTALLLEVEL=10 PROPVAR=42");
5422 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5423 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
5424 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
5425 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
5426 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
5427 todo_wine
5429 ok(!delete_pf("msitest", FALSE), "File not removed\n");
5432 DeleteFileA(msifile);
5433 DeleteFileA("msitest\\hydrogen");
5434 DeleteFileA("msitest\\helium");
5435 DeleteFileA("msitest\\lithium");
5436 DeleteFileA("beryllium");
5437 RemoveDirectoryA("msitest");
5440 static void test_sourcedirprop(void)
5442 UINT r;
5443 CHAR props[MAX_PATH];
5445 CreateDirectoryA("msitest", NULL);
5446 create_file("msitest\\augustus", 500);
5448 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
5450 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5452 r = MsiInstallProductA(msifile, NULL);
5453 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5454 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
5455 ok(delete_pf("msitest", FALSE), "File installed\n");
5457 DeleteFile("msitest\\augustus");
5458 RemoveDirectory("msitest");
5460 CreateDirectoryA("altsource", NULL);
5461 CreateDirectoryA("altsource\\msitest", NULL);
5462 create_file("altsource\\msitest\\augustus", 500);
5464 sprintf(props, "SRCDIR=%s\\altsource\\", CURR_DIR);
5466 r = MsiInstallProductA(msifile, props);
5467 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5468 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
5469 ok(delete_pf("msitest", FALSE), "File installed\n");
5471 DeleteFile(msifile);
5472 DeleteFile("altsource\\msitest\\augustus");
5473 RemoveDirectory("altsource\\msitest");
5474 RemoveDirectory("altsource");
5477 START_TEST(install)
5479 DWORD len;
5480 char temp_path[MAX_PATH], prev_path[MAX_PATH];
5481 STATEMGRSTATUS status;
5482 BOOL ret = FALSE;
5484 init_functionpointers();
5486 GetCurrentDirectoryA(MAX_PATH, prev_path);
5487 GetTempPath(MAX_PATH, temp_path);
5488 SetCurrentDirectoryA(temp_path);
5490 lstrcpyA(CURR_DIR, temp_path);
5491 len = lstrlenA(CURR_DIR);
5493 if(len && (CURR_DIR[len - 1] == '\\'))
5494 CURR_DIR[len - 1] = 0;
5496 get_program_files_dir(PROG_FILES_DIR, COMMON_FILES_DIR);
5498 /* Create a restore point ourselves so we circumvent the multitude of restore points
5499 * that would have been created by all the installation and removal tests.
5501 if (pSRSetRestorePointA)
5503 memset(&status, 0, sizeof(status));
5504 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
5507 /* Create only one log file and don't append. We have to pass something
5508 * for the log mode for this to work.
5510 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, "msitest.log", 0);
5512 test_MsiInstallProduct();
5513 test_MsiSetComponentState();
5514 test_packagecoltypes();
5515 test_continuouscabs();
5516 test_caborder();
5517 test_mixedmedia();
5518 test_samesequence();
5519 test_uiLevelFlags();
5520 test_readonlyfile();
5521 test_setdirproperty();
5522 test_cabisextracted();
5523 test_concurrentinstall();
5524 test_setpropertyfolder();
5525 test_publish_registerproduct();
5526 test_publish_publishproduct();
5527 test_publish_publishfeatures();
5528 test_publish_registeruser();
5529 test_publish_processcomponents();
5530 test_publish();
5531 test_publishsourcelist();
5532 test_transformprop();
5533 test_currentworkingdir();
5534 test_admin();
5535 test_adminprops();
5536 test_removefiles();
5537 test_movefiles();
5538 test_missingcab();
5539 test_duplicatefiles();
5540 test_writeregistryvalues();
5541 test_sourcefolder();
5542 test_customaction51();
5543 test_installstate();
5544 test_sourcepath();
5545 test_MsiConfigureProductEx();
5546 test_missingcomponent();
5547 test_sourcedirprop();
5549 DeleteFileA("msitest.log");
5551 if (pSRSetRestorePointA && ret)
5553 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
5554 if (ret)
5555 remove_restore_point(status.llSequenceNumber);
5557 FreeLibrary(hsrclient);
5559 SetCurrentDirectoryA(prev_path);