msi: Implement the RemoveFolders standard action.
[wine/multimedia.git] / dlls / msi / tests / install.c
blobe3f61a03851f5a9ebaeac162403198c9fd9bd5da
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 *pMsiSetExternalUIRecord)
39 (INSTALLUI_HANDLER_RECORD, DWORD, LPVOID, PINSTALLUI_HANDLER_RECORD);
40 static UINT (WINAPI *pMsiSourceListEnumSourcesA)
41 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
42 static UINT (WINAPI *pMsiSourceListGetInfoA)
43 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD);
45 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*);
47 static HMODULE hsrclient = 0;
48 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
49 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA*, STATEMGRSTATUS*);
51 static BOOL on_win9x = FALSE;
53 static const char *msifile = "msitest.msi";
54 static const char *msifile2 = "winetest2.msi";
55 static const char *mstfile = "winetest.mst";
56 static CHAR CURR_DIR[MAX_PATH];
57 static CHAR PROG_FILES_DIR[MAX_PATH];
58 static CHAR COMMON_FILES_DIR[MAX_PATH];
60 /* msi database data */
62 static const CHAR component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
63 "s72\tS38\ts72\ti2\tS255\tS72\n"
64 "Component\tComponent\n"
65 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
66 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
67 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n"
68 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
69 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
70 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
71 "component\t\tMSITESTDIR\t0\t1\tfile\n"
72 "service_comp\t\tMSITESTDIR\t0\t1\tservice_file";
74 static const CHAR directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
75 "s72\tS72\tl255\n"
76 "Directory\tDirectory\n"
77 "CABOUTDIR\tMSITESTDIR\tcabout\n"
78 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
79 "FIRSTDIR\tMSITESTDIR\tfirst\n"
80 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
81 "NEWDIR\tCABOUTDIR\tnew\n"
82 "ProgramFilesFolder\tTARGETDIR\t.\n"
83 "TARGETDIR\t\tSourceDir";
85 static const CHAR feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
86 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
87 "Feature\tFeature\n"
88 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
89 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
90 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
91 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
92 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
93 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
94 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
96 static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
97 "s38\ts72\n"
98 "FeatureComponents\tFeature_\tComponent_\n"
99 "Five\tFive\n"
100 "Four\tFour\n"
101 "One\tOne\n"
102 "Three\tThree\n"
103 "Two\tTwo\n"
104 "feature\tcomponent\n"
105 "service_feature\tservice_comp\n";
107 static const CHAR file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
108 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
109 "File\tFile\n"
110 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
111 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
112 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
113 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
114 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
115 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
116 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
118 static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
119 "s72\tS255\tI2\n"
120 "InstallExecuteSequence\tAction\n"
121 "AllocateRegistrySpace\tNOT Installed\t1550\n"
122 "CostFinalize\t\t1000\n"
123 "CostInitialize\t\t800\n"
124 "FileCost\t\t900\n"
125 "ResolveSource\t\t950\n"
126 "MoveFiles\t\t1700\n"
127 "InstallFiles\t\t4000\n"
128 "DuplicateFiles\t\t4500\n"
129 "WriteEnvironmentStrings\t\t4550\n"
130 "CreateShortcuts\t\t4600\n"
131 "InstallServices\t\t5000\n"
132 "InstallFinalize\t\t6600\n"
133 "InstallInitialize\t\t1500\n"
134 "InstallValidate\t\t1400\n"
135 "LaunchConditions\t\t100\n"
136 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
138 static const CHAR media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
139 "i2\ti4\tL64\tS255\tS32\tS72\n"
140 "Media\tDiskId\n"
141 "1\t3\t\t\tDISK1\t\n"
142 "2\t5\t\tmsitest.cab\tDISK2\t\n";
144 static const CHAR property_dat[] = "Property\tValue\n"
145 "s72\tl0\n"
146 "Property\tProperty\n"
147 "DefaultUIFont\tDlgFont8\n"
148 "HASUIRUN\t0\n"
149 "INSTALLLEVEL\t3\n"
150 "InstallMode\tTypical\n"
151 "Manufacturer\tWine\n"
152 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
153 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
154 "ProductID\tnone\n"
155 "ProductLanguage\t1033\n"
156 "ProductName\tMSITEST\n"
157 "ProductVersion\t1.1.1\n"
158 "PROMPTROLLBACKCOST\tP\n"
159 "Setup\tSetup\n"
160 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
161 "AdminProperties\tPOSTADMIN\n"
162 "ROOTDRIVE\tC:\\\n"
163 "SERVNAME\tTestService\n"
164 "SERVDISP\tTestServiceDisp\n";
166 static const CHAR aup_property_dat[] = "Property\tValue\n"
167 "s72\tl0\n"
168 "Property\tProperty\n"
169 "DefaultUIFont\tDlgFont8\n"
170 "HASUIRUN\t0\n"
171 "ALLUSERS\t1\n"
172 "INSTALLLEVEL\t3\n"
173 "InstallMode\tTypical\n"
174 "Manufacturer\tWine\n"
175 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
176 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
177 "ProductID\tnone\n"
178 "ProductLanguage\t1033\n"
179 "ProductName\tMSITEST\n"
180 "ProductVersion\t1.1.1\n"
181 "PROMPTROLLBACKCOST\tP\n"
182 "Setup\tSetup\n"
183 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
184 "AdminProperties\tPOSTADMIN\n"
185 "ROOTDRIVE\tC:\\\n"
186 "SERVNAME\tTestService\n"
187 "SERVDISP\tTestServiceDisp\n";
189 static const CHAR aup2_property_dat[] = "Property\tValue\n"
190 "s72\tl0\n"
191 "Property\tProperty\n"
192 "DefaultUIFont\tDlgFont8\n"
193 "HASUIRUN\t0\n"
194 "ALLUSERS\t2\n"
195 "INSTALLLEVEL\t3\n"
196 "InstallMode\tTypical\n"
197 "Manufacturer\tWine\n"
198 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
199 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
200 "ProductID\tnone\n"
201 "ProductLanguage\t1033\n"
202 "ProductName\tMSITEST\n"
203 "ProductVersion\t1.1.1\n"
204 "PROMPTROLLBACKCOST\tP\n"
205 "Setup\tSetup\n"
206 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
207 "AdminProperties\tPOSTADMIN\n"
208 "ROOTDRIVE\tC:\\\n"
209 "SERVNAME\tTestService\n"
210 "SERVDISP\tTestServiceDisp\n";
212 static const CHAR shortcut_dat[] = "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
213 "s72\ts72\tl128\ts72\ts72\tS255\tL255\tI2\tS72\tI2\tI2\tS72\n"
214 "Shortcut\tShortcut\n"
215 "Shortcut\tMSITESTDIR\tShortcut\tcomponent\tShortcut\t\tShortcut\t\t\t\t\t\n";
217 static const CHAR environment_dat[] = "Environment\tName\tValue\tComponent_\n"
218 "s72\tl255\tL255\ts72\n"
219 "Environment\tEnvironment\n"
220 "Var1\t=-MSITESTVAR1\t1\tOne\n"
221 "Var2\tMSITESTVAR2\t1\tOne\n"
222 "Var3\t=-MSITESTVAR3\t1\tOne\n"
223 "Var4\tMSITESTVAR4\t1\tOne\n"
224 "Var5\t-MSITESTVAR5\t\tOne\n"
225 "Var6\tMSITESTVAR6\t\tOne\n"
226 "Var7\t!-MSITESTVAR7\t\tOne\n"
227 "Var8\t!-*MSITESTVAR8\t\tOne\n"
228 "Var9\t=-MSITESTVAR9\t\tOne\n"
229 "Var10\t=MSITESTVAR10\t\tOne\n"
230 "Var11\t+-MSITESTVAR11\t[~];1\tOne\n"
231 "Var12\t+-MSITESTVAR11\t[~];2\tOne\n"
232 "Var13\t+-MSITESTVAR12\t[~];1\tOne\n"
233 "Var14\t=MSITESTVAR13\t[~];1\tOne\n"
234 "Var15\t=MSITESTVAR13\t[~];2\tOne\n"
235 "Var16\t=MSITESTVAR14\t;1;\tOne\n"
236 "Var17\t=MSITESTVAR15\t;;1;;\tOne\n"
237 "Var18\t=MSITESTVAR16\t 1 \tOne\n"
238 "Var19\t+-MSITESTVAR17\t1\tOne\n"
239 "Var20\t+-MSITESTVAR17\t;;2;;[~]\tOne\n"
240 "Var21\t+-MSITESTVAR18\t1\tOne\n"
241 "Var22\t+-MSITESTVAR18\t[~];;2;;\tOne\n"
242 "Var23\t+-MSITESTVAR19\t1\tOne\n"
243 "Var24\t+-MSITESTVAR19\t[~]2\tOne\n"
244 "Var25\t+-MSITESTVAR20\t1\tOne\n"
245 "Var26\t+-MSITESTVAR20\t2[~]\tOne\n";
247 /* Expected results, starting from MSITESTVAR11 onwards */
248 static const CHAR *environment_dat_results[] = {"1;2", /*MSITESTVAR11*/
249 "1", /*MSITESTVAR12*/
250 "1;2", /*MSITESTVAR13*/
251 ";1;", /*MSITESTVAR14*/
252 ";;1;;", /*MSITESTVAR15*/
253 " 1 ", /*MSITESTVAR16*/
254 ";;2;;1", /*MSITESTVAR17*/
255 "1;;2;;", /*MSITESTVAR18*/
256 "1", /*MSITESTVAR19*/
257 "1", /*MSITESTVAR20*/
258 NULL};
260 static const CHAR condition_dat[] = "Feature_\tLevel\tCondition\n"
261 "s38\ti2\tS255\n"
262 "Condition\tFeature_\tLevel\n"
263 "One\t4\t1\n";
265 static const CHAR up_property_dat[] = "Property\tValue\n"
266 "s72\tl0\n"
267 "Property\tProperty\n"
268 "DefaultUIFont\tDlgFont8\n"
269 "HASUIRUN\t0\n"
270 "INSTALLLEVEL\t3\n"
271 "InstallMode\tTypical\n"
272 "Manufacturer\tWine\n"
273 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
274 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
275 "ProductID\tnone\n"
276 "ProductLanguage\t1033\n"
277 "ProductName\tMSITEST\n"
278 "ProductVersion\t1.1.1\n"
279 "PROMPTROLLBACKCOST\tP\n"
280 "Setup\tSetup\n"
281 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
282 "AdminProperties\tPOSTADMIN\n"
283 "ROOTDRIVE\tC:\\\n"
284 "SERVNAME\tTestService\n"
285 "SERVDISP\tTestServiceDisp\n"
286 "RemovePreviousVersions\t1\n";
288 static const CHAR up2_property_dat[] = "Property\tValue\n"
289 "s72\tl0\n"
290 "Property\tProperty\n"
291 "DefaultUIFont\tDlgFont8\n"
292 "HASUIRUN\t0\n"
293 "INSTALLLEVEL\t3\n"
294 "InstallMode\tTypical\n"
295 "Manufacturer\tWine\n"
296 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
297 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
298 "ProductID\tnone\n"
299 "ProductLanguage\t1033\n"
300 "ProductName\tMSITEST\n"
301 "ProductVersion\t1.1.2\n"
302 "PROMPTROLLBACKCOST\tP\n"
303 "Setup\tSetup\n"
304 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
305 "AdminProperties\tPOSTADMIN\n"
306 "ROOTDRIVE\tC:\\\n"
307 "SERVNAME\tTestService\n"
308 "SERVDISP\tTestServiceDisp\n";
310 static const CHAR up3_property_dat[] = "Property\tValue\n"
311 "s72\tl0\n"
312 "Property\tProperty\n"
313 "DefaultUIFont\tDlgFont8\n"
314 "HASUIRUN\t0\n"
315 "INSTALLLEVEL\t3\n"
316 "InstallMode\tTypical\n"
317 "Manufacturer\tWine\n"
318 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
319 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
320 "ProductID\tnone\n"
321 "ProductLanguage\t1033\n"
322 "ProductName\tMSITEST\n"
323 "ProductVersion\t1.1.2\n"
324 "PROMPTROLLBACKCOST\tP\n"
325 "Setup\tSetup\n"
326 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
327 "AdminProperties\tPOSTADMIN\n"
328 "ROOTDRIVE\tC:\\\n"
329 "SERVNAME\tTestService\n"
330 "SERVDISP\tTestServiceDisp\n"
331 "RemovePreviousVersions\t1\n";
333 static const CHAR registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
334 "s72\ti2\tl255\tL255\tL0\ts72\n"
335 "Registry\tRegistry\n"
336 "Apples\t2\tSOFTWARE\\Wine\\msitest\tName\timaname\tOne\n"
337 "Oranges\t2\tSOFTWARE\\Wine\\msitest\tnumber\t#314\tTwo\n"
338 "regdata\t2\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
339 "OrderTest\t2\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
341 static const CHAR service_install_dat[] = "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
342 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
343 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
344 "ServiceInstall\tServiceInstall\n"
345 "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\t";
347 static const CHAR service_control_dat[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
348 "s72\tl255\ti2\tL255\tI2\ts72\n"
349 "ServiceControl\tServiceControl\n"
350 "ServiceControl\tTestService\t8\t\t0\tservice_comp";
352 static const CHAR sss_service_control_dat[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
353 "s72\tl255\ti2\tL255\tI2\ts72\n"
354 "ServiceControl\tServiceControl\n"
355 "ServiceControl\tSpooler\t1\t\t0\tservice_comp";
357 static const CHAR sss_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
358 "s72\tS255\tI2\n"
359 "InstallExecuteSequence\tAction\n"
360 "CostFinalize\t\t1000\n"
361 "CostInitialize\t\t800\n"
362 "FileCost\t\t900\n"
363 "ResolveSource\t\t950\n"
364 "MoveFiles\t\t1700\n"
365 "InstallFiles\t\t4000\n"
366 "DuplicateFiles\t\t4500\n"
367 "WriteEnvironmentStrings\t\t4550\n"
368 "CreateShortcuts\t\t4600\n"
369 "StartServices\t\t5000\n"
370 "DeleteServices\t\t5500\n"
371 "InstallFinalize\t\t6600\n"
372 "InstallInitialize\t\t1500\n"
373 "InstallValidate\t\t1400\n"
374 "LaunchConditions\t\t100\n";
376 /* tables for test_continuouscabs */
377 static const CHAR cc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
378 "s72\tS38\ts72\ti2\tS255\tS72\n"
379 "Component\tComponent\n"
380 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
381 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
382 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
384 static const CHAR cc2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
385 "s72\tS38\ts72\ti2\tS255\tS72\n"
386 "Component\tComponent\n"
387 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
388 "augustus\t\tMSITESTDIR\t0\t0\taugustus\n"
389 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
391 static const CHAR cc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
392 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
393 "Feature\tFeature\n"
394 "feature\t\t\t\t2\t1\tTARGETDIR\t0";
396 static const CHAR cc_feature_comp_dat[] = "Feature_\tComponent_\n"
397 "s38\ts72\n"
398 "FeatureComponents\tFeature_\tComponent_\n"
399 "feature\tmaximus\n"
400 "feature\taugustus\n"
401 "feature\tcaesar";
403 static const CHAR cc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
404 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
405 "File\tFile\n"
406 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
407 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
408 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
410 static const CHAR cc2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
411 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
412 "File\tFile\n"
413 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
414 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
415 "tiberius\tmaximus\ttiberius\t500\t\t\t16384\t3\n"
416 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12";
418 static const CHAR cc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
419 "i2\ti4\tL64\tS255\tS32\tS72\n"
420 "Media\tDiskId\n"
421 "1\t10\t\ttest1.cab\tDISK1\t\n"
422 "2\t2\t\ttest2.cab\tDISK2\t\n"
423 "3\t12\t\ttest3.cab\tDISK3\t\n";
425 static const CHAR co_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
426 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
427 "File\tFile\n"
428 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
429 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
430 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
432 static const CHAR co_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
433 "i2\ti4\tL64\tS255\tS32\tS72\n"
434 "Media\tDiskId\n"
435 "1\t10\t\ttest1.cab\tDISK1\t\n"
436 "2\t2\t\ttest2.cab\tDISK2\t\n"
437 "3\t3\t\ttest3.cab\tDISK3\t\n";
439 static const CHAR co2_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
440 "i2\ti4\tL64\tS255\tS32\tS72\n"
441 "Media\tDiskId\n"
442 "1\t10\t\ttest1.cab\tDISK1\t\n"
443 "2\t12\t\ttest3.cab\tDISK3\t\n"
444 "3\t2\t\ttest2.cab\tDISK2\t\n";
446 static const CHAR mm_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
447 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
448 "File\tFile\n"
449 "maximus\tmaximus\tmaximus\t500\t\t\t512\t1\n"
450 "augustus\taugustus\taugustus\t500\t\t\t512\t2\n"
451 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3";
453 static const CHAR mm_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
454 "i2\ti4\tL64\tS255\tS32\tS72\n"
455 "Media\tDiskId\n"
456 "1\t3\t\ttest1.cab\tDISK1\t\n";
458 static const CHAR ss_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
459 "i2\ti4\tL64\tS255\tS32\tS72\n"
460 "Media\tDiskId\n"
461 "1\t2\t\ttest1.cab\tDISK1\t\n"
462 "2\t2\t\ttest2.cab\tDISK2\t\n"
463 "3\t12\t\ttest3.cab\tDISK3\t\n";
465 /* tables for test_uiLevelFlags */
466 static const CHAR ui_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
467 "s72\tS38\ts72\ti2\tS255\tS72\n"
468 "Component\tComponent\n"
469 "maximus\t\tMSITESTDIR\t0\tHASUIRUN=1\tmaximus\n"
470 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
471 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n";
473 static const CHAR ui_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
474 "s72\tS255\tI2\n"
475 "InstallUISequence\tAction\n"
476 "SetUIProperty\t\t5\n"
477 "ExecuteAction\t\t1100\n";
479 static const CHAR ui_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
480 "s72\ti2\tS64\tS0\tS255\n"
481 "CustomAction\tAction\n"
482 "SetUIProperty\t51\tHASUIRUN\t1\t\n";
484 static const CHAR rof_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
485 "s72\tS38\ts72\ti2\tS255\tS72\n"
486 "Component\tComponent\n"
487 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
489 static const CHAR rof_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
490 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
491 "Feature\tFeature\n"
492 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
493 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
495 static const CHAR rof_feature_comp_dat[] = "Feature_\tComponent_\n"
496 "s38\ts72\n"
497 "FeatureComponents\tFeature_\tComponent_\n"
498 "feature\tmaximus\n"
499 "montecristo\tmaximus";
501 static const CHAR rof_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
502 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
503 "File\tFile\n"
504 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
506 static const CHAR rof_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
507 "i2\ti4\tL64\tS255\tS32\tS72\n"
508 "Media\tDiskId\n"
509 "1\t1\t\t\tDISK1\t\n";
511 static const CHAR rofc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
512 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
513 "File\tFile\n"
514 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1";
516 static const CHAR rofc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
517 "i2\ti4\tL64\tS255\tS32\tS72\n"
518 "Media\tDiskId\n"
519 "1\t1\t\ttest1.cab\tDISK1\t\n";
521 static const CHAR lus2_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
522 "i2\ti4\tL64\tS255\tS32\tS72\n"
523 "Media\tDiskId\n"
524 "1\t1\t\t#test1.cab\tDISK1\t\n";
526 static const CHAR sdp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
527 "s72\tS255\tI2\n"
528 "InstallExecuteSequence\tAction\n"
529 "AllocateRegistrySpace\tNOT Installed\t1550\n"
530 "CostFinalize\t\t1000\n"
531 "CostInitialize\t\t800\n"
532 "FileCost\t\t900\n"
533 "InstallFiles\t\t4000\n"
534 "InstallFinalize\t\t6600\n"
535 "InstallInitialize\t\t1500\n"
536 "InstallValidate\t\t1400\n"
537 "LaunchConditions\t\t100\n"
538 "SetDirProperty\t\t950";
540 static const CHAR sdp_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
541 "s72\ti2\tS64\tS0\tS255\n"
542 "CustomAction\tAction\n"
543 "SetDirProperty\t51\tMSITESTDIR\t[CommonFilesFolder]msitest\\\t\n";
545 static const CHAR cie_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
546 "s72\tS38\ts72\ti2\tS255\tS72\n"
547 "Component\tComponent\n"
548 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
549 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
550 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
551 "gaius\t\tMSITESTDIR\t0\t1\tgaius\n";
553 static const CHAR cie_feature_comp_dat[] = "Feature_\tComponent_\n"
554 "s38\ts72\n"
555 "FeatureComponents\tFeature_\tComponent_\n"
556 "feature\tmaximus\n"
557 "feature\taugustus\n"
558 "feature\tcaesar\n"
559 "feature\tgaius";
561 static const CHAR cie_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
562 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
563 "File\tFile\n"
564 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
565 "augustus\taugustus\taugustus\t50000\t\t\t16384\t2\n"
566 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t12\n"
567 "gaius\tgaius\tgaius\t500\t\t\t8192\t11";
569 static const CHAR cie_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
570 "i2\ti4\tL64\tS255\tS32\tS72\n"
571 "Media\tDiskId\n"
572 "1\t1\t\ttest1.cab\tDISK1\t\n"
573 "2\t2\t\ttest2.cab\tDISK2\t\n"
574 "3\t12\t\ttest3.cab\tDISK3\t\n";
576 static const CHAR ci_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
577 "s72\tS255\tI2\n"
578 "InstallExecuteSequence\tAction\n"
579 "CostFinalize\t\t1000\n"
580 "CostInitialize\t\t800\n"
581 "FileCost\t\t900\n"
582 "InstallFiles\t\t4000\n"
583 "InstallServices\t\t5000\n"
584 "InstallFinalize\t\t6600\n"
585 "InstallInitialize\t\t1500\n"
586 "RunInstall\t\t1600\n"
587 "InstallValidate\t\t1400\n"
588 "LaunchConditions\t\t100";
590 static const CHAR ci_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
591 "s72\ti2\tS64\tS0\tS255\n"
592 "CustomAction\tAction\n"
593 "RunInstall\t87\tmsitest\\concurrent.msi\tMYPROP=[UILevel]\t\n";
595 static const CHAR ci_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
596 "s72\tS38\ts72\ti2\tS255\tS72\n"
597 "Component\tComponent\n"
598 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n";
600 static const CHAR ci2_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
601 "s72\tS38\ts72\ti2\tS255\tS72\n"
602 "Component\tComponent\n"
603 "augustus\t\tMSITESTDIR\t0\tUILevel=3 AND MYPROP=5\taugustus\n";
605 static const CHAR ci2_feature_comp_dat[] = "Feature_\tComponent_\n"
606 "s38\ts72\n"
607 "FeatureComponents\tFeature_\tComponent_\n"
608 "feature\taugustus";
610 static const CHAR ci2_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
611 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
612 "File\tFile\n"
613 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
615 static const CHAR spf_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
616 "s72\ti2\tS64\tS0\tS255\n"
617 "CustomAction\tAction\n"
618 "SetFolderProp\t51\tMSITESTDIR\t[ProgramFilesFolder]\\msitest\\added\t\n";
620 static const CHAR spf_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
621 "s72\tS255\tI2\n"
622 "InstallExecuteSequence\tAction\n"
623 "CostFinalize\t\t1000\n"
624 "CostInitialize\t\t800\n"
625 "FileCost\t\t900\n"
626 "SetFolderProp\t\t950\n"
627 "InstallFiles\t\t4000\n"
628 "InstallServices\t\t5000\n"
629 "InstallFinalize\t\t6600\n"
630 "InstallInitialize\t\t1500\n"
631 "InstallValidate\t\t1400\n"
632 "LaunchConditions\t\t100";
634 static const CHAR spf_install_ui_seq_dat[] = "Action\tCondition\tSequence\n"
635 "s72\tS255\tI2\n"
636 "InstallUISequence\tAction\n"
637 "CostInitialize\t\t800\n"
638 "FileCost\t\t900\n"
639 "CostFinalize\t\t1000\n"
640 "ExecuteAction\t\t1100\n";
642 static const CHAR pp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
643 "s72\tS255\tI2\n"
644 "InstallExecuteSequence\tAction\n"
645 "ValidateProductID\t\t700\n"
646 "CostInitialize\t\t800\n"
647 "FileCost\t\t900\n"
648 "CostFinalize\t\t1000\n"
649 "InstallValidate\t\t1400\n"
650 "InstallInitialize\t\t1500\n"
651 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
652 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
653 "RemoveFiles\t\t3500\n"
654 "InstallFiles\t\t4000\n"
655 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
656 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
657 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
658 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
659 "InstallFinalize\t\t6600";
661 static const CHAR ppc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
662 "s72\tS38\ts72\ti2\tS255\tS72\n"
663 "Component\tComponent\n"
664 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n"
665 "augustus\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\taugustus\n";
667 static const CHAR ppc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
668 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
669 "File\tFile\n"
670 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1\n"
671 "augustus\taugustus\taugustus\t500\t\t\t8192\t2";
673 static const CHAR ppc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
674 "i2\ti4\tL64\tS255\tS32\tS72\n"
675 "Media\tDiskId\n"
676 "1\t2\t\t\tDISK1\t\n";
678 static const CHAR ppc_feature_comp_dat[] = "Feature_\tComponent_\n"
679 "s38\ts72\n"
680 "FeatureComponents\tFeature_\tComponent_\n"
681 "feature\tmaximus\n"
682 "feature\taugustus\n"
683 "montecristo\tmaximus";
685 static const CHAR tp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
686 "s72\tS38\ts72\ti2\tS255\tS72\n"
687 "Component\tComponent\n"
688 "augustus\t\tMSITESTDIR\t0\tprop=\"val\"\taugustus\n";
690 static const CHAR cwd_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
691 "s72\tS38\ts72\ti2\tS255\tS72\n"
692 "Component\tComponent\n"
693 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
695 static const CHAR adm_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
696 "s72\tS38\ts72\ti2\tS255\tS72\n"
697 "Component\tComponent\n"
698 "augustus\t\tMSITESTDIR\t0\tPOSTADMIN=1\taugustus";
700 static const CHAR adm_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
701 "s72\ti2\tS64\tS0\tS255\n"
702 "CustomAction\tAction\n"
703 "SetPOSTADMIN\t51\tPOSTADMIN\t1\t\n";
705 static const CHAR adm_admin_exec_seq_dat[] = "Action\tCondition\tSequence\n"
706 "s72\tS255\tI2\n"
707 "AdminExecuteSequence\tAction\n"
708 "CostFinalize\t\t1000\n"
709 "CostInitialize\t\t800\n"
710 "FileCost\t\t900\n"
711 "SetPOSTADMIN\t\t950\n"
712 "InstallFiles\t\t4000\n"
713 "InstallFinalize\t\t6600\n"
714 "InstallInitialize\t\t1500\n"
715 "InstallValidate\t\t1400\n"
716 "LaunchConditions\t\t100";
718 static const CHAR amp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
719 "s72\tS38\ts72\ti2\tS255\tS72\n"
720 "Component\tComponent\n"
721 "augustus\t\tMSITESTDIR\t0\tMYPROP=2718 and MyProp=42\taugustus\n";
723 static const CHAR rem_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
724 "s72\tS38\ts72\ti2\tS255\tS72\n"
725 "Component\tComponent\n"
726 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t0\t\thydrogen\n"
727 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\thelium\n"
728 "lithium\t\tMSITESTDIR\t2\t\tlithium\n";
730 static const CHAR rem_feature_comp_dat[] = "Feature_\tComponent_\n"
731 "s38\ts72\n"
732 "FeatureComponents\tFeature_\tComponent_\n"
733 "feature\thydrogen\n"
734 "feature\thelium\n"
735 "feature\tlithium";
737 static const CHAR rem_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
738 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
739 "File\tFile\n"
740 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
741 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
742 "lithium\tlithium\tlithium\t0\t\t\t8192\t1";
744 static const CHAR rem_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
745 "s72\tS255\tI2\n"
746 "InstallExecuteSequence\tAction\n"
747 "ValidateProductID\t\t700\n"
748 "CostInitialize\t\t800\n"
749 "FileCost\t\t900\n"
750 "CostFinalize\t\t1000\n"
751 "InstallValidate\t\t1400\n"
752 "InstallInitialize\t\t1500\n"
753 "ProcessComponents\t\t1600\n"
754 "UnpublishFeatures\t\t1800\n"
755 "RemoveFiles\t\t3500\n"
756 "InstallFiles\t\t4000\n"
757 "RegisterProduct\t\t6100\n"
758 "PublishFeatures\t\t6300\n"
759 "PublishProduct\t\t6400\n"
760 "InstallFinalize\t\t6600";
762 static const CHAR rem_remove_files_dat[] = "FileKey\tComponent_\tFileName\tDirProperty\tInstallMode\n"
763 "s72\ts72\tS255\ts72\tI2\n"
764 "RemoveFile\tFileKey\n"
765 "furlong\thydrogen\tfurlong\tMSITESTDIR\t1\n"
766 "firkin\thelium\tfirkin\tMSITESTDIR\t1\n"
767 "fortnight\tlithium\tfortnight\tMSITESTDIR\t1\n"
768 "becquerel\thydrogen\tbecquerel\tMSITESTDIR\t2\n"
769 "dioptre\thelium\tdioptre\tMSITESTDIR\t2\n"
770 "attoparsec\tlithium\tattoparsec\tMSITESTDIR\t2\n"
771 "storeys\thydrogen\tstoreys\tMSITESTDIR\t3\n"
772 "block\thelium\tblock\tMSITESTDIR\t3\n"
773 "siriometer\tlithium\tsiriometer\tMSITESTDIR\t3\n"
774 "nanoacre\thydrogen\t\tCABOUTDIR\t3\n";
776 static const CHAR mov_move_file_dat[] = "FileKey\tComponent_\tSourceName\tDestName\tSourceFolder\tDestFolder\tOptions\n"
777 "s72\ts72\tS255\tS255\tS72\ts72\ti2\n"
778 "MoveFile\tFileKey\n"
779 "abkhazia\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t0\n"
780 "bahamas\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t1\n"
781 "cambodia\taugustus\tcameroon\tcanada\tSourceDir\tMSITESTDIR\t0\n"
782 "denmark\taugustus\tdjibouti\tdominica\tSourceDir\tMSITESTDIR\t1\n"
783 "ecuador\taugustus\tegypt\telsalvador\tNotAProp\tMSITESTDIR\t1\n"
784 "fiji\taugustus\tfinland\tfrance\tSourceDir\tNotAProp\t1\n"
785 "gabon\taugustus\tgambia\tgeorgia\tSOURCEFULL\tMSITESTDIR\t1\n"
786 "haiti\taugustus\thonduras\thungary\tSourceDir\tDESTFULL\t1\n"
787 "iceland\taugustus\tindia\tindonesia\tMSITESTDIR\tMSITESTDIR\t1\n"
788 "jamaica\taugustus\tjapan\tjordan\tFILEPATHBAD\tMSITESTDIR\t1\n"
789 "kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n"
790 "laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n"
791 "namibia\taugustus\tnauru\tkiribati\tSourceDir\tMSITESTDIR\t1\n"
792 "pakistan\taugustus\tperu\tsfn|poland\tSourceDir\tMSITESTDIR\t1\n"
793 "wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
794 "single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
795 "wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
796 "singlenodest\taugustus\tb?r\t\tSourceDir\tMSITESTDIR\t1\n";
798 static const CHAR mc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
799 "s72\tS38\ts72\ti2\tS255\tS72\n"
800 "Component\tComponent\n"
801 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n"
802 "augustus\t\tMSITESTDIR\t0\t1\taugustus\n"
803 "caesar\t\tMSITESTDIR\t0\t1\tcaesar\n"
804 "gaius\t\tMSITESTDIR\t0\tGAIUS=1\tgaius\n";
806 static const CHAR mc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
807 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
808 "File\tFile\n"
809 "maximus\tmaximus\tmaximus\t500\t\t\t16384\t1\n"
810 "augustus\taugustus\taugustus\t500\t\t\t0\t2\n"
811 "caesar\tcaesar\tcaesar\t500\t\t\t16384\t3\n"
812 "gaius\tgaius\tgaius\t500\t\t\t16384\t4";
814 static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
815 "i2\ti4\tL64\tS255\tS32\tS72\n"
816 "Media\tDiskId\n"
817 "1\t1\t\ttest1.cab\tDISK1\t\n"
818 "2\t2\t\ttest2.cab\tDISK2\t\n"
819 "3\t3\t\ttest3.cab\tDISK3\t\n"
820 "4\t4\t\ttest3.cab\tDISK3\t\n";
822 static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
823 "s72\ti2\ti4\ti4\ti4\ti4\n"
824 "MsiFileHash\tFile_\n"
825 "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
827 static const CHAR df_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
828 "s72\tS72\tl255\n"
829 "Directory\tDirectory\n"
830 "THIS\tMSITESTDIR\tthis\n"
831 "DOESNOT\tTHIS\tdoesnot\n"
832 "NONEXISTENT\tDOESNOT\texist\n"
833 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
834 "ProgramFilesFolder\tTARGETDIR\t.\n"
835 "TARGETDIR\t\tSourceDir";
837 static const CHAR df_duplicate_file_dat[] = "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
838 "s72\ts72\ts72\tS255\tS72\n"
839 "DuplicateFile\tFileKey\n"
840 "maximus\tmaximus\tmaximus\taugustus\t\n"
841 "caesar\tmaximus\tmaximus\t\tNONEXISTENT\n"
842 "augustus\tnosuchcomponent\tmaximus\t\tMSITESTDIR\n";
844 static const CHAR wrv_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
845 "s72\tS38\ts72\ti2\tS255\tS72\n"
846 "Component\tComponent\n"
847 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
849 static const CHAR wrv_registry_dat[] = "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
850 "s72\ti2\tl255\tL255\tL0\ts72\n"
851 "Registry\tRegistry\n"
852 "regdata\t2\tSOFTWARE\\Wine\\msitest\tValue\t[~]one[~]two[~]three\taugustus";
854 static const CHAR ca51_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
855 "s72\tS38\ts72\ti2\tS255\tS72\n"
856 "Component\tComponent\n"
857 "augustus\t\tMSITESTDIR\t0\tMYPROP=42\taugustus\n";
859 static const CHAR ca51_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
860 "s72\tS255\tI2\n"
861 "InstallExecuteSequence\tAction\n"
862 "ValidateProductID\t\t700\n"
863 "GoodSetProperty\t\t725\n"
864 "BadSetProperty\t\t750\n"
865 "CostInitialize\t\t800\n"
866 "ResolveSource\t\t810\n"
867 "FileCost\t\t900\n"
868 "SetSourceDir\tSRCDIR\t910\n"
869 "CostFinalize\t\t1000\n"
870 "InstallValidate\t\t1400\n"
871 "InstallInitialize\t\t1500\n"
872 "InstallFiles\t\t4000\n"
873 "InstallFinalize\t\t6600";
875 static const CHAR ca51_custom_action_dat[] = "Action\tType\tSource\tTarget\n"
876 "s72\ti2\tS64\tS0\n"
877 "CustomAction\tAction\n"
878 "GoodSetProperty\t51\tMYPROP\t42\n"
879 "BadSetProperty\t51\t\tMYPROP\n"
880 "SetSourceDir\t51\tSourceDir\t[SRCDIR]\n";
882 static const CHAR is_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
883 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
884 "Feature\tFeature\n"
885 "one\t\t\t\t2\t1\t\t0\n" /* favorLocal */
886 "two\t\t\t\t2\t1\t\t1\n" /* favorSource */
887 "three\t\t\t\t2\t1\t\t4\n" /* favorAdvertise */
888 "four\t\t\t\t2\t0\t\t0"; /* disabled */
890 static const CHAR is_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
891 "s72\tS38\ts72\ti2\tS255\tS72\n"
892 "Component\tComponent\n"
893 "alpha\t\tMSITESTDIR\t0\t\talpha_file\n" /* favorLocal:Local */
894 "beta\t\tMSITESTDIR\t1\t\tbeta_file\n" /* favorLocal:Source */
895 "gamma\t\tMSITESTDIR\t2\t\tgamma_file\n" /* favorLocal:Optional */
896 "theta\t\tMSITESTDIR\t0\t\ttheta_file\n" /* favorSource:Local */
897 "delta\t\tMSITESTDIR\t1\t\tdelta_file\n" /* favorSource:Source */
898 "epsilon\t\tMSITESTDIR\t2\t\tepsilon_file\n" /* favorSource:Optional */
899 "zeta\t\tMSITESTDIR\t0\t\tzeta_file\n" /* favorAdvertise:Local */
900 "iota\t\tMSITESTDIR\t1\t\tiota_file\n" /* favorAdvertise:Source */
901 "eta\t\tMSITESTDIR\t2\t\teta_file\n" /* favorAdvertise:Optional */
902 "kappa\t\tMSITESTDIR\t0\t\tkappa_file\n" /* disabled:Local */
903 "lambda\t\tMSITESTDIR\t1\t\tlambda_file\n" /* disabled:Source */
904 "mu\t\tMSITESTDIR\t2\t\tmu_file\n"; /* disabled:Optional */
906 static const CHAR is_feature_comp_dat[] = "Feature_\tComponent_\n"
907 "s38\ts72\n"
908 "FeatureComponents\tFeature_\tComponent_\n"
909 "one\talpha\n"
910 "one\tbeta\n"
911 "one\tgamma\n"
912 "two\ttheta\n"
913 "two\tdelta\n"
914 "two\tepsilon\n"
915 "three\tzeta\n"
916 "three\tiota\n"
917 "three\teta\n"
918 "four\tkappa\n"
919 "four\tlambda\n"
920 "four\tmu";
922 static const CHAR is_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
923 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
924 "File\tFile\n"
925 "alpha_file\talpha\talpha\t500\t\t\t8192\t1\n"
926 "beta_file\tbeta\tbeta\t500\t\t\t8291\t2\n"
927 "gamma_file\tgamma\tgamma\t500\t\t\t8192\t3\n"
928 "theta_file\ttheta\ttheta\t500\t\t\t8192\t4\n"
929 "delta_file\tdelta\tdelta\t500\t\t\t8192\t5\n"
930 "epsilon_file\tepsilon\tepsilon\t500\t\t\t8192\t6\n"
931 "zeta_file\tzeta\tzeta\t500\t\t\t8192\t7\n"
932 "iota_file\tiota\tiota\t500\t\t\t8192\t8\n"
933 "eta_file\teta\teta\t500\t\t\t8192\t9\n"
934 "kappa_file\tkappa\tkappa\t500\t\t\t8192\t10\n"
935 "lambda_file\tlambda\tlambda\t500\t\t\t8192\t11\n"
936 "mu_file\tmu\tmu\t500\t\t\t8192\t12";
938 static const CHAR is_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
939 "i2\ti4\tL64\tS255\tS32\tS72\n"
940 "Media\tDiskId\n"
941 "1\t12\t\t\tDISK1\t\n";
943 static const CHAR sp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
944 "s72\tS38\ts72\ti2\tS255\tS72\n"
945 "Component\tComponent\n"
946 "augustus\t\tTWODIR\t0\t\taugustus\n";
948 static const CHAR sp_directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
949 "s72\tS72\tl255\n"
950 "Directory\tDirectory\n"
951 "TARGETDIR\t\tSourceDir\n"
952 "ProgramFilesFolder\tTARGETDIR\t.\n"
953 "MSITESTDIR\tProgramFilesFolder\tmsitest:.\n"
954 "ONEDIR\tMSITESTDIR\t.:shortone|longone\n"
955 "TWODIR\tONEDIR\t.:shorttwo|longtwo";
957 static const CHAR mcp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
958 "s72\tS38\ts72\ti2\tS255\tS72\n"
959 "Component\tComponent\n"
960 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t2\t\thydrogen\n"
961 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t2\t\thelium\n"
962 "lithium\t{4AF28FFC-71C7-4307-BDE4-B77C5338F56F}\tMSITESTDIR\t2\tPROPVAR=42\tlithium\n";
964 static const CHAR mcp_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
965 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
966 "Feature\tFeature\n"
967 "hydroxyl\t\thydroxyl\thydroxyl\t2\t1\tTARGETDIR\t0\n"
968 "heliox\t\theliox\theliox\t2\t5\tTARGETDIR\t0\n"
969 "lithia\t\tlithia\tlithia\t2\t10\tTARGETDIR\t0";
971 static const CHAR mcp_feature_comp_dat[] = "Feature_\tComponent_\n"
972 "s38\ts72\n"
973 "FeatureComponents\tFeature_\tComponent_\n"
974 "hydroxyl\thydrogen\n"
975 "heliox\thelium\n"
976 "lithia\tlithium";
978 static const CHAR mcomp_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
979 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
980 "File\tFile\n"
981 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
982 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
983 "lithium\tlithium\tlithium\t0\t\t\t8192\t1\n"
984 "beryllium\tmissingcomp\tberyllium\t0\t\t\t8192\t1";
986 static const CHAR ai_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
987 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
988 "File\tFile\n"
989 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
990 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
991 "one.txt\tOne\tone.txt\t1000\t\t\t16384\t1\n"
992 "three.txt\tThree\tthree.txt\t1000\t\t\t16384\t3\n"
993 "two.txt\tTwo\ttwo.txt\t1000\t\t\t16384\t2\n"
994 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
995 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
997 static const CHAR ip_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
998 "s72\tS255\tI2\n"
999 "InstallExecuteSequence\tAction\n"
1000 "CostFinalize\t\t1000\n"
1001 "ValidateProductID\t\t700\n"
1002 "CostInitialize\t\t800\n"
1003 "FileCost\t\t900\n"
1004 "RemoveFiles\t\t3500\n"
1005 "InstallFiles\t\t4000\n"
1006 "RegisterUser\t\t6000\n"
1007 "RegisterProduct\t\t6100\n"
1008 "PublishFeatures\t\t6300\n"
1009 "PublishProduct\t\t6400\n"
1010 "InstallFinalize\t\t6600\n"
1011 "InstallInitialize\t\t1500\n"
1012 "ProcessComponents\t\t1600\n"
1013 "UnpublishFeatures\t\t1800\n"
1014 "InstallValidate\t\t1400\n"
1015 "LaunchConditions\t\t100\n"
1016 "TestInstalledProp\tInstalled AND NOT REMOVE\t950\n";
1018 static const CHAR ip_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
1019 "s72\ti2\tS64\tS0\tS255\n"
1020 "CustomAction\tAction\n"
1021 "TestInstalledProp\t19\t\tTest failed\t\n";
1023 static const CHAR aup_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1024 "s72\tS255\tI2\n"
1025 "InstallExecuteSequence\tAction\n"
1026 "CostFinalize\t\t1000\n"
1027 "ValidateProductID\t\t700\n"
1028 "CostInitialize\t\t800\n"
1029 "FileCost\t\t900\n"
1030 "RemoveFiles\t\t3500\n"
1031 "InstallFiles\t\t4000\n"
1032 "RegisterUser\t\t6000\n"
1033 "RegisterProduct\t\t6100\n"
1034 "PublishFeatures\t\t6300\n"
1035 "PublishProduct\t\t6400\n"
1036 "InstallFinalize\t\t6600\n"
1037 "InstallInitialize\t\t1500\n"
1038 "ProcessComponents\t\t1600\n"
1039 "UnpublishFeatures\t\t1800\n"
1040 "InstallValidate\t\t1400\n"
1041 "LaunchConditions\t\t100\n"
1042 "TestAllUsersProp\tALLUSERS AND NOT REMOVE\t50\n";
1044 static const CHAR aup2_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1045 "s72\tS255\tI2\n"
1046 "InstallExecuteSequence\tAction\n"
1047 "CostFinalize\t\t1000\n"
1048 "ValidateProductID\t\t700\n"
1049 "CostInitialize\t\t800\n"
1050 "FileCost\t\t900\n"
1051 "RemoveFiles\t\t3500\n"
1052 "InstallFiles\t\t4000\n"
1053 "RegisterUser\t\t6000\n"
1054 "RegisterProduct\t\t6100\n"
1055 "PublishFeatures\t\t6300\n"
1056 "PublishProduct\t\t6400\n"
1057 "InstallFinalize\t\t6600\n"
1058 "InstallInitialize\t\t1500\n"
1059 "ProcessComponents\t\t1600\n"
1060 "UnpublishFeatures\t\t1800\n"
1061 "InstallValidate\t\t1400\n"
1062 "LaunchConditions\t\t100\n"
1063 "TestAllUsersProp\tALLUSERS=2 AND NOT REMOVE\t50\n";
1065 static const CHAR aup3_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1066 "s72\tS255\tI2\n"
1067 "InstallExecuteSequence\tAction\n"
1068 "CostFinalize\t\t1000\n"
1069 "ValidateProductID\t\t700\n"
1070 "CostInitialize\t\t800\n"
1071 "FileCost\t\t900\n"
1072 "RemoveFiles\t\t3500\n"
1073 "InstallFiles\t\t4000\n"
1074 "RegisterUser\t\t6000\n"
1075 "RegisterProduct\t\t6100\n"
1076 "PublishFeatures\t\t6300\n"
1077 "PublishProduct\t\t6400\n"
1078 "InstallFinalize\t\t6600\n"
1079 "InstallInitialize\t\t1500\n"
1080 "ProcessComponents\t\t1600\n"
1081 "UnpublishFeatures\t\t1800\n"
1082 "InstallValidate\t\t1400\n"
1083 "LaunchConditions\t\t100\n"
1084 "TestAllUsersProp\tALLUSERS=1 AND NOT REMOVE\t50\n";
1086 static const CHAR aup_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
1087 "s72\ti2\tS64\tS0\tS255\n"
1088 "CustomAction\tAction\n"
1089 "TestAllUsersProp\t19\t\tTest failed\t\n";
1091 static const CHAR cf_create_folders_dat[] = "Directory_\tComponent_\n"
1092 "s72\ts72\n"
1093 "CreateFolder\tDirectory_\tComponent_\n"
1094 "MSITESTDIR\tOne\n";
1096 static const CHAR cf_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1097 "s72\tS255\tI2\n"
1098 "InstallExecuteSequence\tAction\n"
1099 "CostFinalize\t\t1000\n"
1100 "ValidateProductID\t\t700\n"
1101 "CostInitialize\t\t800\n"
1102 "FileCost\t\t900\n"
1103 "RemoveFiles\t\t3500\n"
1104 "CreateFolders\t\t3700\n"
1105 "InstallExecute\t\t3800\n"
1106 "TestCreateFolders\t\t3900\n"
1107 "InstallFiles\t\t4000\n"
1108 "RegisterUser\t\t6000\n"
1109 "RegisterProduct\t\t6100\n"
1110 "PublishFeatures\t\t6300\n"
1111 "PublishProduct\t\t6400\n"
1112 "InstallFinalize\t\t6600\n"
1113 "InstallInitialize\t\t1500\n"
1114 "ProcessComponents\t\t1600\n"
1115 "UnpublishFeatures\t\t1800\n"
1116 "InstallValidate\t\t1400\n"
1117 "LaunchConditions\t\t100\n";
1119 static const CHAR cf_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
1120 "s72\ti2\tS64\tS0\tS255\n"
1121 "CustomAction\tAction\n"
1122 "TestCreateFolders\t19\t\tHalts installation\t\n";
1124 static const CHAR rf_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1125 "s72\tS255\tI2\n"
1126 "InstallExecuteSequence\tAction\n"
1127 "CostFinalize\t\t1000\n"
1128 "ValidateProductID\t\t700\n"
1129 "CostInitialize\t\t800\n"
1130 "FileCost\t\t900\n"
1131 "RemoveFiles\t\t3500\n"
1132 "CreateFolders\t\t3600\n"
1133 "RemoveFolders\t\t3700\n"
1134 "InstallExecute\t\t3800\n"
1135 "TestCreateFolders\t\t3900\n"
1136 "InstallFiles\t\t4000\n"
1137 "RegisterUser\t\t6000\n"
1138 "RegisterProduct\t\t6100\n"
1139 "PublishFeatures\t\t6300\n"
1140 "PublishProduct\t\t6400\n"
1141 "InstallFinalize\t\t6600\n"
1142 "InstallInitialize\t\t1500\n"
1143 "ProcessComponents\t\t1600\n"
1144 "UnpublishFeatures\t\t1800\n"
1145 "InstallValidate\t\t1400\n"
1146 "LaunchConditions\t\t100\n";
1148 typedef struct _msi_table
1150 const CHAR *filename;
1151 const CHAR *data;
1152 int size;
1153 } msi_table;
1155 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
1157 static const msi_table tables[] =
1159 ADD_TABLE(component),
1160 ADD_TABLE(directory),
1161 ADD_TABLE(feature),
1162 ADD_TABLE(feature_comp),
1163 ADD_TABLE(file),
1164 ADD_TABLE(install_exec_seq),
1165 ADD_TABLE(media),
1166 ADD_TABLE(property),
1167 ADD_TABLE(registry),
1168 ADD_TABLE(service_install),
1169 ADD_TABLE(service_control)
1172 static const msi_table sc_tables[] =
1174 ADD_TABLE(component),
1175 ADD_TABLE(directory),
1176 ADD_TABLE(feature),
1177 ADD_TABLE(feature_comp),
1178 ADD_TABLE(file),
1179 ADD_TABLE(install_exec_seq),
1180 ADD_TABLE(media),
1181 ADD_TABLE(property),
1182 ADD_TABLE(shortcut)
1185 static const msi_table ps_tables[] =
1187 ADD_TABLE(component),
1188 ADD_TABLE(directory),
1189 ADD_TABLE(feature),
1190 ADD_TABLE(feature_comp),
1191 ADD_TABLE(file),
1192 ADD_TABLE(install_exec_seq),
1193 ADD_TABLE(media),
1194 ADD_TABLE(property),
1195 ADD_TABLE(condition)
1198 static const msi_table env_tables[] =
1200 ADD_TABLE(component),
1201 ADD_TABLE(directory),
1202 ADD_TABLE(feature),
1203 ADD_TABLE(feature_comp),
1204 ADD_TABLE(file),
1205 ADD_TABLE(install_exec_seq),
1206 ADD_TABLE(media),
1207 ADD_TABLE(property),
1208 ADD_TABLE(environment)
1211 static const msi_table up_tables[] =
1213 ADD_TABLE(component),
1214 ADD_TABLE(directory),
1215 ADD_TABLE(feature),
1216 ADD_TABLE(feature_comp),
1217 ADD_TABLE(file),
1218 ADD_TABLE(install_exec_seq),
1219 ADD_TABLE(media),
1220 ADD_TABLE(up_property),
1221 ADD_TABLE(registry),
1222 ADD_TABLE(service_install),
1223 ADD_TABLE(service_control)
1226 static const msi_table up2_tables[] =
1228 ADD_TABLE(component),
1229 ADD_TABLE(directory),
1230 ADD_TABLE(feature),
1231 ADD_TABLE(feature_comp),
1232 ADD_TABLE(file),
1233 ADD_TABLE(install_exec_seq),
1234 ADD_TABLE(media),
1235 ADD_TABLE(up2_property),
1236 ADD_TABLE(registry),
1237 ADD_TABLE(service_install),
1238 ADD_TABLE(service_control)
1241 static const msi_table up3_tables[] =
1243 ADD_TABLE(component),
1244 ADD_TABLE(directory),
1245 ADD_TABLE(feature),
1246 ADD_TABLE(feature_comp),
1247 ADD_TABLE(file),
1248 ADD_TABLE(install_exec_seq),
1249 ADD_TABLE(media),
1250 ADD_TABLE(up3_property),
1251 ADD_TABLE(registry),
1252 ADD_TABLE(service_install),
1253 ADD_TABLE(service_control)
1256 static const msi_table up4_tables[] =
1258 ADD_TABLE(component),
1259 ADD_TABLE(directory),
1260 ADD_TABLE(feature),
1261 ADD_TABLE(feature_comp),
1262 ADD_TABLE(file),
1263 ADD_TABLE(pp_install_exec_seq),
1264 ADD_TABLE(media),
1265 ADD_TABLE(property),
1266 ADD_TABLE(registry),
1267 ADD_TABLE(service_install),
1268 ADD_TABLE(service_control)
1271 static const msi_table up5_tables[] =
1273 ADD_TABLE(component),
1274 ADD_TABLE(directory),
1275 ADD_TABLE(feature),
1276 ADD_TABLE(feature_comp),
1277 ADD_TABLE(file),
1278 ADD_TABLE(pp_install_exec_seq),
1279 ADD_TABLE(media),
1280 ADD_TABLE(up_property),
1281 ADD_TABLE(registry),
1282 ADD_TABLE(service_install),
1283 ADD_TABLE(service_control)
1286 static const msi_table up6_tables[] =
1288 ADD_TABLE(component),
1289 ADD_TABLE(directory),
1290 ADD_TABLE(feature),
1291 ADD_TABLE(feature_comp),
1292 ADD_TABLE(file),
1293 ADD_TABLE(pp_install_exec_seq),
1294 ADD_TABLE(media),
1295 ADD_TABLE(up2_property),
1296 ADD_TABLE(registry),
1297 ADD_TABLE(service_install),
1298 ADD_TABLE(service_control)
1301 static const msi_table up7_tables[] =
1303 ADD_TABLE(component),
1304 ADD_TABLE(directory),
1305 ADD_TABLE(feature),
1306 ADD_TABLE(feature_comp),
1307 ADD_TABLE(file),
1308 ADD_TABLE(pp_install_exec_seq),
1309 ADD_TABLE(media),
1310 ADD_TABLE(up3_property),
1311 ADD_TABLE(registry),
1312 ADD_TABLE(service_install),
1313 ADD_TABLE(service_control)
1316 static const msi_table cc_tables[] =
1318 ADD_TABLE(cc_component),
1319 ADD_TABLE(directory),
1320 ADD_TABLE(cc_feature),
1321 ADD_TABLE(cc_feature_comp),
1322 ADD_TABLE(cc_file),
1323 ADD_TABLE(install_exec_seq),
1324 ADD_TABLE(cc_media),
1325 ADD_TABLE(property),
1328 static const msi_table cc2_tables[] =
1330 ADD_TABLE(cc2_component),
1331 ADD_TABLE(directory),
1332 ADD_TABLE(cc_feature),
1333 ADD_TABLE(cc_feature_comp),
1334 ADD_TABLE(cc2_file),
1335 ADD_TABLE(install_exec_seq),
1336 ADD_TABLE(cc_media),
1337 ADD_TABLE(property),
1340 static const msi_table co_tables[] =
1342 ADD_TABLE(cc_component),
1343 ADD_TABLE(directory),
1344 ADD_TABLE(cc_feature),
1345 ADD_TABLE(cc_feature_comp),
1346 ADD_TABLE(co_file),
1347 ADD_TABLE(install_exec_seq),
1348 ADD_TABLE(co_media),
1349 ADD_TABLE(property),
1352 static const msi_table co2_tables[] =
1354 ADD_TABLE(cc_component),
1355 ADD_TABLE(directory),
1356 ADD_TABLE(cc_feature),
1357 ADD_TABLE(cc_feature_comp),
1358 ADD_TABLE(cc_file),
1359 ADD_TABLE(install_exec_seq),
1360 ADD_TABLE(co2_media),
1361 ADD_TABLE(property),
1364 static const msi_table mm_tables[] =
1366 ADD_TABLE(cc_component),
1367 ADD_TABLE(directory),
1368 ADD_TABLE(cc_feature),
1369 ADD_TABLE(cc_feature_comp),
1370 ADD_TABLE(mm_file),
1371 ADD_TABLE(install_exec_seq),
1372 ADD_TABLE(mm_media),
1373 ADD_TABLE(property),
1376 static const msi_table ss_tables[] =
1378 ADD_TABLE(cc_component),
1379 ADD_TABLE(directory),
1380 ADD_TABLE(cc_feature),
1381 ADD_TABLE(cc_feature_comp),
1382 ADD_TABLE(cc_file),
1383 ADD_TABLE(install_exec_seq),
1384 ADD_TABLE(ss_media),
1385 ADD_TABLE(property),
1388 static const msi_table ui_tables[] =
1390 ADD_TABLE(ui_component),
1391 ADD_TABLE(directory),
1392 ADD_TABLE(cc_feature),
1393 ADD_TABLE(cc_feature_comp),
1394 ADD_TABLE(cc_file),
1395 ADD_TABLE(install_exec_seq),
1396 ADD_TABLE(ui_install_ui_seq),
1397 ADD_TABLE(ui_custom_action),
1398 ADD_TABLE(cc_media),
1399 ADD_TABLE(property),
1402 static const msi_table rof_tables[] =
1404 ADD_TABLE(rof_component),
1405 ADD_TABLE(directory),
1406 ADD_TABLE(rof_feature),
1407 ADD_TABLE(rof_feature_comp),
1408 ADD_TABLE(rof_file),
1409 ADD_TABLE(install_exec_seq),
1410 ADD_TABLE(rof_media),
1411 ADD_TABLE(property),
1414 static const msi_table rofc_tables[] =
1416 ADD_TABLE(rof_component),
1417 ADD_TABLE(directory),
1418 ADD_TABLE(rof_feature),
1419 ADD_TABLE(rof_feature_comp),
1420 ADD_TABLE(rofc_file),
1421 ADD_TABLE(install_exec_seq),
1422 ADD_TABLE(rofc_media),
1423 ADD_TABLE(property),
1426 static const msi_table sdp_tables[] =
1428 ADD_TABLE(rof_component),
1429 ADD_TABLE(directory),
1430 ADD_TABLE(rof_feature),
1431 ADD_TABLE(rof_feature_comp),
1432 ADD_TABLE(rof_file),
1433 ADD_TABLE(sdp_install_exec_seq),
1434 ADD_TABLE(sdp_custom_action),
1435 ADD_TABLE(rof_media),
1436 ADD_TABLE(property),
1439 static const msi_table cie_tables[] =
1441 ADD_TABLE(cie_component),
1442 ADD_TABLE(directory),
1443 ADD_TABLE(cc_feature),
1444 ADD_TABLE(cie_feature_comp),
1445 ADD_TABLE(cie_file),
1446 ADD_TABLE(install_exec_seq),
1447 ADD_TABLE(cie_media),
1448 ADD_TABLE(property),
1451 static const msi_table ci_tables[] =
1453 ADD_TABLE(ci_component),
1454 ADD_TABLE(directory),
1455 ADD_TABLE(rof_feature),
1456 ADD_TABLE(rof_feature_comp),
1457 ADD_TABLE(rof_file),
1458 ADD_TABLE(ci_install_exec_seq),
1459 ADD_TABLE(rof_media),
1460 ADD_TABLE(property),
1461 ADD_TABLE(ci_custom_action),
1464 static const msi_table ci2_tables[] =
1466 ADD_TABLE(ci2_component),
1467 ADD_TABLE(directory),
1468 ADD_TABLE(rof_feature),
1469 ADD_TABLE(ci2_feature_comp),
1470 ADD_TABLE(ci2_file),
1471 ADD_TABLE(install_exec_seq),
1472 ADD_TABLE(rof_media),
1473 ADD_TABLE(property),
1476 static const msi_table spf_tables[] =
1478 ADD_TABLE(ci_component),
1479 ADD_TABLE(directory),
1480 ADD_TABLE(rof_feature),
1481 ADD_TABLE(rof_feature_comp),
1482 ADD_TABLE(rof_file),
1483 ADD_TABLE(spf_install_exec_seq),
1484 ADD_TABLE(rof_media),
1485 ADD_TABLE(property),
1486 ADD_TABLE(spf_custom_action),
1487 ADD_TABLE(spf_install_ui_seq),
1490 static const msi_table pp_tables[] =
1492 ADD_TABLE(ci_component),
1493 ADD_TABLE(directory),
1494 ADD_TABLE(rof_feature),
1495 ADD_TABLE(rof_feature_comp),
1496 ADD_TABLE(rof_file),
1497 ADD_TABLE(pp_install_exec_seq),
1498 ADD_TABLE(rof_media),
1499 ADD_TABLE(property),
1502 static const msi_table ppc_tables[] =
1504 ADD_TABLE(ppc_component),
1505 ADD_TABLE(directory),
1506 ADD_TABLE(rof_feature),
1507 ADD_TABLE(ppc_feature_comp),
1508 ADD_TABLE(ppc_file),
1509 ADD_TABLE(pp_install_exec_seq),
1510 ADD_TABLE(ppc_media),
1511 ADD_TABLE(property),
1514 static const msi_table lus0_tables[] =
1516 ADD_TABLE(ci_component),
1517 ADD_TABLE(directory),
1518 ADD_TABLE(rof_feature),
1519 ADD_TABLE(rof_feature_comp),
1520 ADD_TABLE(rof_file),
1521 ADD_TABLE(pp_install_exec_seq),
1522 ADD_TABLE(rof_media),
1523 ADD_TABLE(property),
1526 static const msi_table lus1_tables[] =
1528 ADD_TABLE(ci_component),
1529 ADD_TABLE(directory),
1530 ADD_TABLE(rof_feature),
1531 ADD_TABLE(rof_feature_comp),
1532 ADD_TABLE(rof_file),
1533 ADD_TABLE(pp_install_exec_seq),
1534 ADD_TABLE(rofc_media),
1535 ADD_TABLE(property),
1538 static const msi_table lus2_tables[] =
1540 ADD_TABLE(ci_component),
1541 ADD_TABLE(directory),
1542 ADD_TABLE(rof_feature),
1543 ADD_TABLE(rof_feature_comp),
1544 ADD_TABLE(rof_file),
1545 ADD_TABLE(pp_install_exec_seq),
1546 ADD_TABLE(lus2_media),
1547 ADD_TABLE(property),
1550 static const msi_table tp_tables[] =
1552 ADD_TABLE(tp_component),
1553 ADD_TABLE(directory),
1554 ADD_TABLE(rof_feature),
1555 ADD_TABLE(ci2_feature_comp),
1556 ADD_TABLE(ci2_file),
1557 ADD_TABLE(install_exec_seq),
1558 ADD_TABLE(rof_media),
1559 ADD_TABLE(property),
1562 static const msi_table cwd_tables[] =
1564 ADD_TABLE(cwd_component),
1565 ADD_TABLE(directory),
1566 ADD_TABLE(rof_feature),
1567 ADD_TABLE(ci2_feature_comp),
1568 ADD_TABLE(ci2_file),
1569 ADD_TABLE(install_exec_seq),
1570 ADD_TABLE(rof_media),
1571 ADD_TABLE(property),
1574 static const msi_table adm_tables[] =
1576 ADD_TABLE(adm_component),
1577 ADD_TABLE(directory),
1578 ADD_TABLE(rof_feature),
1579 ADD_TABLE(ci2_feature_comp),
1580 ADD_TABLE(ci2_file),
1581 ADD_TABLE(install_exec_seq),
1582 ADD_TABLE(rof_media),
1583 ADD_TABLE(property),
1584 ADD_TABLE(adm_custom_action),
1585 ADD_TABLE(adm_admin_exec_seq),
1588 static const msi_table amp_tables[] =
1590 ADD_TABLE(amp_component),
1591 ADD_TABLE(directory),
1592 ADD_TABLE(rof_feature),
1593 ADD_TABLE(ci2_feature_comp),
1594 ADD_TABLE(ci2_file),
1595 ADD_TABLE(install_exec_seq),
1596 ADD_TABLE(rof_media),
1597 ADD_TABLE(property),
1600 static const msi_table rem_tables[] =
1602 ADD_TABLE(rem_component),
1603 ADD_TABLE(directory),
1604 ADD_TABLE(rof_feature),
1605 ADD_TABLE(rem_feature_comp),
1606 ADD_TABLE(rem_file),
1607 ADD_TABLE(rem_install_exec_seq),
1608 ADD_TABLE(rof_media),
1609 ADD_TABLE(property),
1610 ADD_TABLE(rem_remove_files),
1613 static const msi_table mov_tables[] =
1615 ADD_TABLE(cwd_component),
1616 ADD_TABLE(directory),
1617 ADD_TABLE(rof_feature),
1618 ADD_TABLE(ci2_feature_comp),
1619 ADD_TABLE(ci2_file),
1620 ADD_TABLE(install_exec_seq),
1621 ADD_TABLE(rof_media),
1622 ADD_TABLE(property),
1623 ADD_TABLE(mov_move_file),
1626 static const msi_table mc_tables[] =
1628 ADD_TABLE(mc_component),
1629 ADD_TABLE(directory),
1630 ADD_TABLE(cc_feature),
1631 ADD_TABLE(cie_feature_comp),
1632 ADD_TABLE(mc_file),
1633 ADD_TABLE(install_exec_seq),
1634 ADD_TABLE(mc_media),
1635 ADD_TABLE(property),
1636 ADD_TABLE(mc_file_hash),
1639 static const msi_table df_tables[] =
1641 ADD_TABLE(rof_component),
1642 ADD_TABLE(df_directory),
1643 ADD_TABLE(rof_feature),
1644 ADD_TABLE(rof_feature_comp),
1645 ADD_TABLE(rof_file),
1646 ADD_TABLE(install_exec_seq),
1647 ADD_TABLE(rof_media),
1648 ADD_TABLE(property),
1649 ADD_TABLE(df_duplicate_file),
1652 static const msi_table wrv_tables[] =
1654 ADD_TABLE(wrv_component),
1655 ADD_TABLE(directory),
1656 ADD_TABLE(rof_feature),
1657 ADD_TABLE(ci2_feature_comp),
1658 ADD_TABLE(ci2_file),
1659 ADD_TABLE(install_exec_seq),
1660 ADD_TABLE(rof_media),
1661 ADD_TABLE(property),
1662 ADD_TABLE(wrv_registry),
1665 static const msi_table sf_tables[] =
1667 ADD_TABLE(wrv_component),
1668 ADD_TABLE(directory),
1669 ADD_TABLE(rof_feature),
1670 ADD_TABLE(ci2_feature_comp),
1671 ADD_TABLE(ci2_file),
1672 ADD_TABLE(install_exec_seq),
1673 ADD_TABLE(rof_media),
1674 ADD_TABLE(property),
1677 static const msi_table ca51_tables[] =
1679 ADD_TABLE(ca51_component),
1680 ADD_TABLE(directory),
1681 ADD_TABLE(rof_feature),
1682 ADD_TABLE(ci2_feature_comp),
1683 ADD_TABLE(ci2_file),
1684 ADD_TABLE(ca51_install_exec_seq),
1685 ADD_TABLE(rof_media),
1686 ADD_TABLE(property),
1687 ADD_TABLE(ca51_custom_action),
1690 static const msi_table is_tables[] =
1692 ADD_TABLE(is_component),
1693 ADD_TABLE(directory),
1694 ADD_TABLE(is_feature),
1695 ADD_TABLE(is_feature_comp),
1696 ADD_TABLE(is_file),
1697 ADD_TABLE(install_exec_seq),
1698 ADD_TABLE(is_media),
1699 ADD_TABLE(property),
1702 static const msi_table sp_tables[] =
1704 ADD_TABLE(sp_component),
1705 ADD_TABLE(sp_directory),
1706 ADD_TABLE(rof_feature),
1707 ADD_TABLE(ci2_feature_comp),
1708 ADD_TABLE(ci2_file),
1709 ADD_TABLE(install_exec_seq),
1710 ADD_TABLE(rof_media),
1711 ADD_TABLE(property),
1714 static const msi_table mcp_tables[] =
1716 ADD_TABLE(mcp_component),
1717 ADD_TABLE(directory),
1718 ADD_TABLE(mcp_feature),
1719 ADD_TABLE(mcp_feature_comp),
1720 ADD_TABLE(rem_file),
1721 ADD_TABLE(rem_install_exec_seq),
1722 ADD_TABLE(rof_media),
1723 ADD_TABLE(property),
1726 static const msi_table mcomp_tables[] =
1728 ADD_TABLE(mcp_component),
1729 ADD_TABLE(directory),
1730 ADD_TABLE(mcp_feature),
1731 ADD_TABLE(mcp_feature_comp),
1732 ADD_TABLE(mcomp_file),
1733 ADD_TABLE(rem_install_exec_seq),
1734 ADD_TABLE(rof_media),
1735 ADD_TABLE(property),
1738 static const msi_table ai_tables[] =
1740 ADD_TABLE(component),
1741 ADD_TABLE(directory),
1742 ADD_TABLE(feature),
1743 ADD_TABLE(feature_comp),
1744 ADD_TABLE(ai_file),
1745 ADD_TABLE(install_exec_seq),
1746 ADD_TABLE(media),
1747 ADD_TABLE(property)
1750 static const msi_table pc_tables[] =
1752 ADD_TABLE(ca51_component),
1753 ADD_TABLE(directory),
1754 ADD_TABLE(rof_feature),
1755 ADD_TABLE(ci2_feature_comp),
1756 ADD_TABLE(ci2_file),
1757 ADD_TABLE(install_exec_seq),
1758 ADD_TABLE(rof_media),
1759 ADD_TABLE(property)
1762 static const msi_table ip_tables[] =
1764 ADD_TABLE(component),
1765 ADD_TABLE(directory),
1766 ADD_TABLE(feature),
1767 ADD_TABLE(feature_comp),
1768 ADD_TABLE(file),
1769 ADD_TABLE(ip_install_exec_seq),
1770 ADD_TABLE(ip_custom_action),
1771 ADD_TABLE(media),
1772 ADD_TABLE(property)
1775 static const msi_table aup_tables[] =
1777 ADD_TABLE(component),
1778 ADD_TABLE(directory),
1779 ADD_TABLE(feature),
1780 ADD_TABLE(feature_comp),
1781 ADD_TABLE(file),
1782 ADD_TABLE(aup_install_exec_seq),
1783 ADD_TABLE(aup_custom_action),
1784 ADD_TABLE(media),
1785 ADD_TABLE(property)
1788 static const msi_table aup2_tables[] =
1790 ADD_TABLE(component),
1791 ADD_TABLE(directory),
1792 ADD_TABLE(feature),
1793 ADD_TABLE(feature_comp),
1794 ADD_TABLE(file),
1795 ADD_TABLE(aup2_install_exec_seq),
1796 ADD_TABLE(aup_custom_action),
1797 ADD_TABLE(media),
1798 ADD_TABLE(aup_property)
1801 static const msi_table aup3_tables[] =
1803 ADD_TABLE(component),
1804 ADD_TABLE(directory),
1805 ADD_TABLE(feature),
1806 ADD_TABLE(feature_comp),
1807 ADD_TABLE(file),
1808 ADD_TABLE(aup2_install_exec_seq),
1809 ADD_TABLE(aup_custom_action),
1810 ADD_TABLE(media),
1811 ADD_TABLE(aup2_property)
1814 static const msi_table aup4_tables[] =
1816 ADD_TABLE(component),
1817 ADD_TABLE(directory),
1818 ADD_TABLE(feature),
1819 ADD_TABLE(feature_comp),
1820 ADD_TABLE(file),
1821 ADD_TABLE(aup3_install_exec_seq),
1822 ADD_TABLE(aup_custom_action),
1823 ADD_TABLE(media),
1824 ADD_TABLE(aup2_property)
1827 static const msi_table fiu_tables[] =
1829 ADD_TABLE(rof_component),
1830 ADD_TABLE(directory),
1831 ADD_TABLE(rof_feature),
1832 ADD_TABLE(rof_feature_comp),
1833 ADD_TABLE(rof_file),
1834 ADD_TABLE(pp_install_exec_seq),
1835 ADD_TABLE(rof_media),
1836 ADD_TABLE(property),
1839 static const msi_table fiuc_tables[] =
1841 ADD_TABLE(rof_component),
1842 ADD_TABLE(directory),
1843 ADD_TABLE(rof_feature),
1844 ADD_TABLE(rof_feature_comp),
1845 ADD_TABLE(rofc_file),
1846 ADD_TABLE(pp_install_exec_seq),
1847 ADD_TABLE(rofc_media),
1848 ADD_TABLE(property),
1851 static const msi_table cf_tables[] =
1853 ADD_TABLE(component),
1854 ADD_TABLE(directory),
1855 ADD_TABLE(feature),
1856 ADD_TABLE(feature_comp),
1857 ADD_TABLE(file),
1858 ADD_TABLE(cf_create_folders),
1859 ADD_TABLE(cf_install_exec_seq),
1860 ADD_TABLE(cf_custom_action),
1861 ADD_TABLE(media),
1862 ADD_TABLE(property)
1865 static const msi_table rf_tables[] =
1867 ADD_TABLE(component),
1868 ADD_TABLE(directory),
1869 ADD_TABLE(feature),
1870 ADD_TABLE(feature_comp),
1871 ADD_TABLE(file),
1872 ADD_TABLE(cf_create_folders),
1873 ADD_TABLE(rf_install_exec_seq),
1874 ADD_TABLE(cf_custom_action),
1875 ADD_TABLE(media),
1876 ADD_TABLE(property)
1879 static const msi_table sss_tables[] =
1881 ADD_TABLE(component),
1882 ADD_TABLE(directory),
1883 ADD_TABLE(feature),
1884 ADD_TABLE(feature_comp),
1885 ADD_TABLE(file),
1886 ADD_TABLE(sss_install_exec_seq),
1887 ADD_TABLE(sss_service_control),
1888 ADD_TABLE(media),
1889 ADD_TABLE(property)
1892 static const msi_table sds_tables[] =
1894 ADD_TABLE(component),
1895 ADD_TABLE(directory),
1896 ADD_TABLE(feature),
1897 ADD_TABLE(feature_comp),
1898 ADD_TABLE(file),
1899 ADD_TABLE(sss_install_exec_seq),
1900 ADD_TABLE(service_control),
1901 ADD_TABLE(media),
1902 ADD_TABLE(property)
1905 /* cabinet definitions */
1907 /* make the max size large so there is only one cab file */
1908 #define MEDIA_SIZE 0x7FFFFFFF
1909 #define FOLDER_THRESHOLD 900000
1911 /* the FCI callbacks */
1913 static void * CDECL mem_alloc(ULONG cb)
1915 return HeapAlloc(GetProcessHeap(), 0, cb);
1918 static void CDECL mem_free(void *memory)
1920 HeapFree(GetProcessHeap(), 0, memory);
1923 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
1925 sprintf(pccab->szCab, pv, pccab->iCab);
1926 return TRUE;
1929 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
1931 return 0;
1934 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
1935 BOOL fContinuation, void *pv)
1937 return 0;
1940 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
1942 HANDLE handle;
1943 DWORD dwAccess = 0;
1944 DWORD dwShareMode = 0;
1945 DWORD dwCreateDisposition = OPEN_EXISTING;
1947 dwAccess = GENERIC_READ | GENERIC_WRITE;
1948 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
1949 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
1951 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
1952 dwCreateDisposition = OPEN_EXISTING;
1953 else
1954 dwCreateDisposition = CREATE_NEW;
1956 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
1957 dwCreateDisposition, 0, NULL);
1959 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
1961 return (INT_PTR)handle;
1964 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1966 HANDLE handle = (HANDLE)hf;
1967 DWORD dwRead;
1968 BOOL res;
1970 res = ReadFile(handle, memory, cb, &dwRead, NULL);
1971 ok(res, "Failed to ReadFile\n");
1973 return dwRead;
1976 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1978 HANDLE handle = (HANDLE)hf;
1979 DWORD dwWritten;
1980 BOOL res;
1982 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
1983 ok(res, "Failed to WriteFile\n");
1985 return dwWritten;
1988 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
1990 HANDLE handle = (HANDLE)hf;
1991 ok(CloseHandle(handle), "Failed to CloseHandle\n");
1993 return 0;
1996 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
1998 HANDLE handle = (HANDLE)hf;
1999 DWORD ret;
2001 ret = SetFilePointer(handle, dist, NULL, seektype);
2002 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2004 return ret;
2007 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
2009 BOOL ret = DeleteFileA(pszFile);
2010 ok(ret, "Failed to DeleteFile %s\n", pszFile);
2012 return 0;
2015 static void init_functionpointers(void)
2017 HMODULE hmsi = GetModuleHandleA("msi.dll");
2018 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2020 #define GET_PROC(mod, func) \
2021 p ## func = (void*)GetProcAddress(mod, #func); \
2022 if(!p ## func) \
2023 trace("GetProcAddress(%s) failed\n", #func);
2025 GET_PROC(hmsi, MsiQueryComponentStateA);
2026 GET_PROC(hmsi, MsiSetExternalUIRecord);
2027 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
2028 GET_PROC(hmsi, MsiSourceListGetInfoA);
2030 GET_PROC(hadvapi32, ConvertSidToStringSidA);
2032 hsrclient = LoadLibraryA("srclient.dll");
2033 GET_PROC(hsrclient, SRRemoveRestorePoint);
2034 GET_PROC(hsrclient, SRSetRestorePointA);
2036 #undef GET_PROC
2039 static BOOL check_win9x(void)
2041 SC_HANDLE scm;
2043 scm = OpenSCManager(NULL, NULL, GENERIC_ALL);
2044 if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
2045 return TRUE;
2047 CloseServiceHandle(scm);
2049 return FALSE;
2052 static LPSTR get_user_sid(LPSTR *usersid)
2054 HANDLE token;
2055 BYTE buf[1024];
2056 DWORD size;
2057 PTOKEN_USER user;
2059 if (!pConvertSidToStringSidA)
2061 win_skip("ConvertSidToStringSidA is not available\n");
2062 return NULL;
2065 *usersid = NULL;
2066 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
2067 size = sizeof(buf);
2068 GetTokenInformation(token, TokenUser, buf, size, &size);
2069 user = (PTOKEN_USER)buf;
2070 pConvertSidToStringSidA(user->User.Sid, usersid);
2071 ok(*usersid != NULL, "pConvertSidToStringSidA failed lre=%d\n", GetLastError());
2072 CloseHandle(token);
2073 return *usersid;
2076 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
2078 CHAR buffer[0x20];
2079 UINT r;
2080 DWORD sz;
2082 sz = sizeof buffer;
2083 r = MsiRecordGetString(rec, field, buffer, &sz);
2084 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
2087 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2089 LPSTR tempname;
2091 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2092 GetTempFileNameA(".", "xx", 0, tempname);
2094 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2096 lstrcpyA(pszTempName, tempname);
2097 HeapFree(GetProcessHeap(), 0, tempname);
2098 return TRUE;
2101 HeapFree(GetProcessHeap(), 0, tempname);
2103 return FALSE;
2106 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2107 USHORT *pattribs, int *err, void *pv)
2109 BY_HANDLE_FILE_INFORMATION finfo;
2110 FILETIME filetime;
2111 HANDLE handle;
2112 DWORD attrs;
2113 BOOL res;
2115 handle = CreateFile(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2116 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2118 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2120 res = GetFileInformationByHandle(handle, &finfo);
2121 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2123 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2124 FileTimeToDosDateTime(&filetime, pdate, ptime);
2126 attrs = GetFileAttributes(pszName);
2127 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2129 return (INT_PTR)handle;
2132 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2134 char path[MAX_PATH];
2135 char filename[MAX_PATH];
2137 lstrcpyA(path, CURR_DIR);
2138 lstrcatA(path, "\\");
2139 lstrcatA(path, file);
2141 lstrcpyA(filename, file);
2143 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2144 progress, get_open_info, compress);
2147 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2149 ZeroMemory(pCabParams, sizeof(CCAB));
2151 pCabParams->cb = max_size;
2152 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2153 pCabParams->setID = 0xbeef;
2154 pCabParams->iCab = 1;
2155 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2156 lstrcatA(pCabParams->szCabPath, "\\");
2157 lstrcpyA(pCabParams->szCab, name);
2160 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2162 CCAB cabParams;
2163 LPCSTR ptr;
2164 HFCI hfci;
2165 ERF erf;
2166 BOOL res;
2168 set_cab_parameters(&cabParams, name, max_size);
2170 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2171 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2172 get_temp_file, &cabParams, NULL);
2174 ok(hfci != NULL, "Failed to create an FCI context\n");
2176 ptr = files;
2177 while (*ptr)
2179 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2180 ok(res, "Failed to add file: %s\n", ptr);
2181 ptr += lstrlen(ptr) + 1;
2184 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2185 ok(res, "Failed to flush the cabinet\n");
2187 res = FCIDestroy(hfci);
2188 ok(res, "Failed to destroy the cabinet\n");
2191 static BOOL get_program_files_dir(LPSTR buf, LPSTR buf2)
2193 HKEY hkey;
2194 DWORD type, size;
2196 if (RegOpenKey(HKEY_LOCAL_MACHINE,
2197 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2198 return FALSE;
2200 size = MAX_PATH;
2201 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) {
2202 RegCloseKey(hkey);
2203 return FALSE;
2206 size = MAX_PATH;
2207 if (RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size)) {
2208 RegCloseKey(hkey);
2209 return FALSE;
2212 RegCloseKey(hkey);
2213 return TRUE;
2216 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2218 HANDLE file;
2219 DWORD written;
2221 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2222 if (file == INVALID_HANDLE_VALUE)
2223 return;
2225 WriteFile(file, data, strlen(data), &written, NULL);
2227 if (size)
2229 SetFilePointer(file, size, NULL, FILE_BEGIN);
2230 SetEndOfFile(file);
2233 CloseHandle(file);
2236 #define create_file(name, size) create_file_data(name, name, size)
2238 static void create_test_files(void)
2240 CreateDirectoryA("msitest", NULL);
2241 create_file("msitest\\one.txt", 100);
2242 CreateDirectoryA("msitest\\first", NULL);
2243 create_file("msitest\\first\\two.txt", 100);
2244 CreateDirectoryA("msitest\\second", NULL);
2245 create_file("msitest\\second\\three.txt", 100);
2247 create_file("four.txt", 100);
2248 create_file("five.txt", 100);
2249 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2251 create_file("msitest\\filename", 100);
2252 create_file("msitest\\service.exe", 100);
2254 DeleteFileA("four.txt");
2255 DeleteFileA("five.txt");
2258 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2260 CHAR path[MAX_PATH];
2262 lstrcpyA(path, PROG_FILES_DIR);
2263 lstrcatA(path, "\\");
2264 lstrcatA(path, rel_path);
2266 if (is_file)
2267 return DeleteFileA(path);
2268 else
2269 return RemoveDirectoryA(path);
2272 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
2274 CHAR path[MAX_PATH];
2276 lstrcpyA(path, COMMON_FILES_DIR);
2277 lstrcatA(path, "\\");
2278 lstrcatA(path, rel_path);
2280 if (is_file)
2281 return DeleteFileA(path);
2282 else
2283 return RemoveDirectoryA(path);
2286 static void delete_test_files(void)
2288 DeleteFileA("msitest.msi");
2289 DeleteFileA("msitest.cab");
2290 DeleteFileA("msitest\\second\\three.txt");
2291 DeleteFileA("msitest\\first\\two.txt");
2292 DeleteFileA("msitest\\one.txt");
2293 DeleteFileA("msitest\\service.exe");
2294 DeleteFileA("msitest\\filename");
2295 RemoveDirectoryA("msitest\\second");
2296 RemoveDirectoryA("msitest\\first");
2297 RemoveDirectoryA("msitest");
2300 static void write_file(const CHAR *filename, const char *data, int data_size)
2302 DWORD size;
2304 HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
2305 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2307 WriteFile(hf, data, data_size, &size, NULL);
2308 CloseHandle(hf);
2311 static void write_msi_summary_info(MSIHANDLE db, INT wordcount)
2313 MSIHANDLE summary;
2314 UINT r;
2316 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2317 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2319 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, ";1033");
2320 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2322 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
2323 "{004757CA-5092-49c2-AD20-28E1CE0DF5F2}");
2324 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2326 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
2327 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2329 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2330 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2332 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2333 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2335 /* write the summary changes back to the stream */
2336 r = MsiSummaryInfoPersist(summary);
2337 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2339 MsiCloseHandle(summary);
2342 #define create_database(name, tables, num_tables) \
2343 create_database_wordcount(name, tables, num_tables, 0);
2345 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2346 int num_tables, INT wordcount)
2348 MSIHANDLE db;
2349 UINT r;
2350 int j;
2352 r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db);
2353 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2355 /* import the tables into the database */
2356 for (j = 0; j < num_tables; j++)
2358 const msi_table *table = &tables[j];
2360 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2362 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2363 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2365 DeleteFileA(table->filename);
2368 write_msi_summary_info(db, wordcount);
2370 r = MsiDatabaseCommit(db);
2371 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2373 MsiCloseHandle(db);
2376 static void check_service_is_installed(void)
2378 SC_HANDLE scm, service;
2379 BOOL res;
2381 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
2382 ok(scm != NULL, "Failed to open the SC Manager\n");
2384 service = OpenService(scm, "TestService", SC_MANAGER_ALL_ACCESS);
2385 ok(service != NULL, "Failed to open TestService\n");
2387 res = DeleteService(service);
2388 ok(res, "Failed to delete TestService\n");
2390 CloseServiceHandle(service);
2391 CloseServiceHandle(scm);
2394 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2396 RESTOREPOINTINFOA spec;
2398 spec.dwEventType = event_type;
2399 spec.dwRestorePtType = APPLICATION_INSTALL;
2400 spec.llSequenceNumber = status->llSequenceNumber;
2401 lstrcpyA(spec.szDescription, "msitest restore point");
2403 return pSRSetRestorePointA(&spec, status);
2406 static void remove_restore_point(DWORD seq_number)
2408 DWORD res;
2410 res = pSRRemoveRestorePoint(seq_number);
2411 if (res != ERROR_SUCCESS)
2412 trace("Failed to remove the restore point : %08x\n", res);
2415 static void test_MsiInstallProduct(void)
2417 UINT r;
2418 CHAR path[MAX_PATH];
2419 LONG res;
2420 HKEY hkey;
2421 DWORD num, size, type;
2423 if (on_win9x)
2425 win_skip("Services are not implemented on Win9x and WinMe\n");
2426 return;
2429 /* szPackagePath is NULL */
2430 r = MsiInstallProductA(NULL, "INSTALL=ALL");
2431 ok(r == ERROR_INVALID_PARAMETER,
2432 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2434 /* both szPackagePath and szCommandLine are NULL */
2435 r = MsiInstallProductA(NULL, NULL);
2436 ok(r == ERROR_INVALID_PARAMETER,
2437 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2439 /* szPackagePath is empty */
2440 r = MsiInstallProductA("", "INSTALL=ALL");
2441 ok(r == ERROR_PATH_NOT_FOUND,
2442 "Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
2444 create_test_files();
2445 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2447 /* install, don't publish */
2448 r = MsiInstallProductA(msifile, NULL);
2449 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2451 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2452 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2453 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2454 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2455 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2456 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2457 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2458 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2459 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2460 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2461 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2462 ok(delete_pf("msitest", FALSE), "File not installed\n");
2464 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2465 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2467 size = MAX_PATH;
2468 type = REG_SZ;
2469 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
2470 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2471 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
2473 size = MAX_PATH;
2474 type = REG_SZ;
2475 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
2476 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2478 size = sizeof(num);
2479 type = REG_DWORD;
2480 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
2481 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2482 ok(num == 314, "Expected 314, got %d\n", num);
2484 size = MAX_PATH;
2485 type = REG_SZ;
2486 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
2487 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2488 ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
2490 check_service_is_installed();
2492 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2494 /* not published, reinstall */
2495 r = MsiInstallProductA(msifile, NULL);
2496 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2498 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2499 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2500 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2501 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2502 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2503 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2504 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2505 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2506 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2507 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2508 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2509 ok(delete_pf("msitest", FALSE), "File not installed\n");
2511 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2512 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2513 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2515 create_database(msifile, up_tables, sizeof(up_tables) / sizeof(msi_table));
2517 /* not published, RemovePreviousVersions set */
2518 r = MsiInstallProductA(msifile, NULL);
2519 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2521 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2522 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2523 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2524 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2525 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2526 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2527 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2528 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2529 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2530 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2531 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2532 ok(delete_pf("msitest", FALSE), "File not installed\n");
2534 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2535 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2536 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2538 create_database(msifile, up2_tables, sizeof(up2_tables) / sizeof(msi_table));
2540 /* not published, version number bumped */
2541 r = MsiInstallProductA(msifile, NULL);
2542 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2544 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2545 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2546 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2547 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2548 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2549 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2550 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2551 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2552 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2553 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2554 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2555 ok(delete_pf("msitest", FALSE), "File not installed\n");
2557 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2558 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2559 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2561 create_database(msifile, up3_tables, sizeof(up3_tables) / sizeof(msi_table));
2563 /* not published, RemovePreviousVersions set and version number bumped */
2564 r = MsiInstallProductA(msifile, NULL);
2565 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2567 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2568 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2569 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2570 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2571 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2572 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2573 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2574 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2575 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2576 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2577 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2578 ok(delete_pf("msitest", FALSE), "File not installed\n");
2580 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2581 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2582 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2584 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2586 /* install, publish product */
2587 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2588 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2590 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2591 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2592 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2593 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2594 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2595 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2596 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2597 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2598 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2599 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2600 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2601 ok(delete_pf("msitest", FALSE), "File not installed\n");
2603 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2604 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2606 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2608 /* published, reinstall */
2609 r = MsiInstallProductA(msifile, NULL);
2610 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2612 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2613 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2614 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2615 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2616 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2617 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2618 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2619 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2620 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2621 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2622 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2623 ok(delete_pf("msitest", FALSE), "File not installed\n");
2625 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2626 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2628 create_database(msifile, up5_tables, sizeof(up5_tables) / sizeof(msi_table));
2630 /* published product, RemovePreviousVersions set */
2631 r = MsiInstallProductA(msifile, NULL);
2632 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2634 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2635 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2636 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2637 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2638 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2639 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2640 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2641 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2642 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2643 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2644 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2645 ok(delete_pf("msitest", FALSE), "File not installed\n");
2647 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2648 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2650 create_database(msifile, up6_tables, sizeof(up6_tables) / sizeof(msi_table));
2652 /* published product, version number bumped */
2653 r = MsiInstallProductA(msifile, NULL);
2654 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2656 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2657 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2658 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2659 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2660 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2661 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2662 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2663 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2664 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2665 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2666 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2667 ok(delete_pf("msitest", FALSE), "File not installed\n");
2669 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2670 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2672 create_database(msifile, up7_tables, sizeof(up7_tables) / sizeof(msi_table));
2674 /* published product, RemovePreviousVersions set and version number bumped */
2675 r = MsiInstallProductA(msifile, NULL);
2676 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2678 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2679 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2680 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2681 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2682 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2683 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2684 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2685 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2686 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2687 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2688 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2689 ok(delete_pf("msitest", FALSE), "File not installed\n");
2691 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2692 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2694 r = MsiInstallProductA(msifile, "REMOVE=ALL");
2695 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2697 delete_test_files();
2700 static void test_MsiSetComponentState(void)
2702 INSTALLSTATE installed, action;
2703 MSIHANDLE package;
2704 char path[MAX_PATH];
2705 UINT r;
2707 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2709 CoInitialize(NULL);
2711 lstrcpy(path, CURR_DIR);
2712 lstrcat(path, "\\");
2713 lstrcat(path, msifile);
2715 r = MsiOpenPackage(path, &package);
2716 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2718 r = MsiDoAction(package, "CostInitialize");
2719 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2721 r = MsiDoAction(package, "FileCost");
2722 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2724 r = MsiDoAction(package, "CostFinalize");
2725 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2727 r = MsiGetComponentState(package, "dangler", &installed, &action);
2728 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2729 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
2730 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2732 r = MsiSetComponentState(package, "dangler", INSTALLSTATE_SOURCE);
2733 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2735 MsiCloseHandle(package);
2736 CoUninitialize();
2738 DeleteFileA(msifile);
2741 static void test_packagecoltypes(void)
2743 MSIHANDLE hdb, view, rec;
2744 char path[MAX_PATH];
2745 LPCSTR query;
2746 UINT r, count;
2748 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2750 CoInitialize(NULL);
2752 lstrcpy(path, CURR_DIR);
2753 lstrcat(path, "\\");
2754 lstrcat(path, msifile);
2756 r = MsiOpenDatabase(path, MSIDBOPEN_READONLY, &hdb);
2757 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2759 query = "SELECT * FROM `Media`";
2760 r = MsiDatabaseOpenView( hdb, query, &view );
2761 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2763 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
2764 count = MsiRecordGetFieldCount( rec );
2765 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2766 ok(count == 6, "Expected 6, got %d\n", count);
2767 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
2768 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
2769 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
2770 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
2771 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
2772 ok(check_record(rec, 6, "Source"), "wrong column label\n");
2773 MsiCloseHandle(rec);
2775 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
2776 count = MsiRecordGetFieldCount( rec );
2777 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2778 ok(count == 6, "Expected 6, got %d\n", count);
2779 ok(check_record(rec, 1, "i2"), "wrong column label\n");
2780 ok(check_record(rec, 2, "i4"), "wrong column label\n");
2781 ok(check_record(rec, 3, "L64"), "wrong column label\n");
2782 ok(check_record(rec, 4, "S255"), "wrong column label\n");
2783 ok(check_record(rec, 5, "S32"), "wrong column label\n");
2784 ok(check_record(rec, 6, "S72"), "wrong column label\n");
2786 MsiCloseHandle(rec);
2787 MsiCloseHandle(view);
2788 MsiCloseHandle(hdb);
2789 CoUninitialize();
2791 DeleteFile(msifile);
2794 static void create_cc_test_files(void)
2796 CCAB cabParams;
2797 HFCI hfci;
2798 ERF erf;
2799 static CHAR cab_context[] = "test%d.cab";
2800 BOOL res;
2802 create_file("maximus", 500);
2803 create_file("augustus", 50000);
2804 create_file("tiberius", 500);
2805 create_file("caesar", 500);
2807 set_cab_parameters(&cabParams, "test1.cab", 40000);
2809 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2810 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2811 get_temp_file, &cabParams, cab_context);
2812 ok(hfci != NULL, "Failed to create an FCI context\n");
2814 res = add_file(hfci, "maximus", tcompTYPE_NONE);
2815 ok(res, "Failed to add file maximus\n");
2817 res = add_file(hfci, "augustus", tcompTYPE_NONE);
2818 ok(res, "Failed to add file augustus\n");
2820 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
2821 ok(res, "Failed to add file tiberius\n");
2823 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2824 ok(res, "Failed to flush the cabinet\n");
2826 res = FCIDestroy(hfci);
2827 ok(res, "Failed to destroy the cabinet\n");
2829 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2831 DeleteFile("maximus");
2832 DeleteFile("augustus");
2833 DeleteFile("tiberius");
2834 DeleteFile("caesar");
2837 static void delete_cab_files(void)
2839 SHFILEOPSTRUCT shfl;
2840 CHAR path[MAX_PATH+10];
2842 lstrcpyA(path, CURR_DIR);
2843 lstrcatA(path, "\\*.cab");
2844 path[strlen(path) + 1] = '\0';
2846 shfl.hwnd = NULL;
2847 shfl.wFunc = FO_DELETE;
2848 shfl.pFrom = path;
2849 shfl.pTo = NULL;
2850 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
2852 SHFileOperation(&shfl);
2855 static void test_continuouscabs(void)
2857 UINT r;
2859 create_cc_test_files();
2860 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
2862 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2864 r = MsiInstallProductA(msifile, NULL);
2865 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
2867 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2868 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2869 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2870 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2871 ok(delete_pf("msitest", FALSE), "File not installed\n");
2874 delete_cab_files();
2875 DeleteFile(msifile);
2877 create_cc_test_files();
2878 create_database(msifile, cc2_tables, sizeof(cc2_tables) / sizeof(msi_table));
2880 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2882 r = MsiInstallProductA(msifile, NULL);
2883 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2884 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2885 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
2886 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
2887 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2888 ok(delete_pf("msitest", FALSE), "File not installed\n");
2890 delete_cab_files();
2891 DeleteFile(msifile);
2894 static void test_caborder(void)
2896 UINT r;
2898 create_file("imperator", 100);
2899 create_file("maximus", 500);
2900 create_file("augustus", 50000);
2901 create_file("caesar", 500);
2903 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
2905 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2907 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
2908 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
2909 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2911 r = MsiInstallProductA(msifile, NULL);
2912 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
2913 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
2914 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
2915 todo_wine
2917 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
2918 ok(!delete_pf("msitest", FALSE), "File is installed\n");
2921 delete_cab_files();
2923 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
2924 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
2925 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2927 r = MsiInstallProductA(msifile, NULL);
2928 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
2929 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
2930 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
2931 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
2932 todo_wine
2934 ok(!delete_pf("msitest", FALSE), "File is installed\n");
2937 delete_cab_files();
2938 DeleteFile(msifile);
2940 create_cc_test_files();
2941 create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
2943 r = MsiInstallProductA(msifile, NULL);
2944 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
2945 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
2946 ok(!delete_pf("msitest", FALSE), "File is installed\n");
2947 todo_wine
2949 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
2950 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
2953 delete_cab_files();
2954 DeleteFile(msifile);
2956 create_cc_test_files();
2957 create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
2959 r = MsiInstallProductA(msifile, NULL);
2960 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
2961 todo_wine
2963 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
2964 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
2965 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
2966 ok(!delete_pf("msitest", FALSE), "File is installed\n");
2969 delete_cab_files();
2970 DeleteFile("imperator");
2971 DeleteFile("maximus");
2972 DeleteFile("augustus");
2973 DeleteFile("caesar");
2974 DeleteFile(msifile);
2977 static void test_mixedmedia(void)
2979 UINT r;
2981 CreateDirectoryA("msitest", NULL);
2982 create_file("msitest\\maximus", 500);
2983 create_file("msitest\\augustus", 500);
2984 create_file("caesar", 500);
2986 create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
2988 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2990 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
2992 r = MsiInstallProductA(msifile, NULL);
2993 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2994 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2995 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2996 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2997 ok(delete_pf("msitest", FALSE), "File not installed\n");
2999 /* Delete the files in the temp (current) folder */
3000 DeleteFile("msitest\\maximus");
3001 DeleteFile("msitest\\augustus");
3002 RemoveDirectory("msitest");
3003 DeleteFile("caesar");
3004 DeleteFile("test1.cab");
3005 DeleteFile(msifile);
3008 static void test_samesequence(void)
3010 UINT r;
3012 create_cc_test_files();
3013 create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
3015 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3017 r = MsiInstallProductA(msifile, NULL);
3018 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
3020 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3021 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3022 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3023 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3024 ok(delete_pf("msitest", FALSE), "File not installed\n");
3027 delete_cab_files();
3028 DeleteFile(msifile);
3031 static void test_uiLevelFlags(void)
3033 UINT r;
3035 create_cc_test_files();
3036 create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
3038 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
3040 r = MsiInstallProductA(msifile, NULL);
3041 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
3043 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3044 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
3045 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3046 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3047 ok(delete_pf("msitest", FALSE), "File not installed\n");
3050 delete_cab_files();
3051 DeleteFile(msifile);
3054 static BOOL file_matches(LPSTR path)
3056 CHAR buf[MAX_PATH];
3057 HANDLE file;
3058 DWORD size;
3060 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3061 NULL, OPEN_EXISTING, 0, NULL);
3063 ZeroMemory(buf, MAX_PATH);
3064 ReadFile(file, buf, 15, &size, NULL);
3065 CloseHandle(file);
3067 return !lstrcmp(buf, "msitest\\maximus");
3070 static void test_readonlyfile(void)
3072 UINT r;
3073 DWORD size;
3074 HANDLE file;
3075 CHAR path[MAX_PATH];
3077 CreateDirectoryA("msitest", NULL);
3078 create_file("msitest\\maximus", 500);
3079 create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
3081 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3083 lstrcpy(path, PROG_FILES_DIR);
3084 lstrcat(path, "\\msitest");
3085 CreateDirectory(path, NULL);
3087 lstrcat(path, "\\maximus");
3088 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3089 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3091 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3092 CloseHandle(file);
3094 r = MsiInstallProductA(msifile, NULL);
3095 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3096 ok(file_matches(path), "Expected file to be overwritten\n");
3097 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3098 ok(delete_pf("msitest", FALSE), "File not installed\n");
3100 /* Delete the files in the temp (current) folder */
3101 DeleteFile("msitest\\maximus");
3102 RemoveDirectory("msitest");
3103 DeleteFile(msifile);
3106 static void test_readonlyfile_cab(void)
3108 UINT r;
3109 DWORD size;
3110 HANDLE file;
3111 CHAR path[MAX_PATH];
3112 CHAR buf[16];
3114 CreateDirectoryA("msitest", NULL);
3115 create_file("maximus", 500);
3116 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3117 DeleteFile("maximus");
3119 create_database(msifile, rofc_tables, sizeof(rofc_tables) / sizeof(msi_table));
3121 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3123 lstrcpy(path, PROG_FILES_DIR);
3124 lstrcat(path, "\\msitest");
3125 CreateDirectory(path, NULL);
3127 lstrcat(path, "\\maximus");
3128 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3129 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3131 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3132 CloseHandle(file);
3134 r = MsiInstallProductA(msifile, NULL);
3135 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3137 memset( buf, 0, sizeof(buf) );
3138 if ((file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3139 NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
3141 ReadFile(file, buf, sizeof(buf) - 1, &size, NULL);
3142 CloseHandle(file);
3144 ok(!memcmp( buf, "maximus", sizeof("maximus")-1 ), "Expected file to be overwritten, got '%s'\n", buf);
3145 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3146 ok(delete_pf("msitest", FALSE), "File not installed\n");
3148 /* Delete the files in the temp (current) folder */
3149 delete_cab_files();
3150 DeleteFile("msitest\\maximus");
3151 RemoveDirectory("msitest");
3152 DeleteFile(msifile);
3155 static BOOL add_cabinet_storage(LPCSTR db, LPCSTR cabinet)
3157 WCHAR dbW[MAX_PATH], cabinetW[MAX_PATH];
3158 IStorage *stg;
3159 IStream *stm;
3160 HRESULT hr;
3161 HANDLE handle;
3163 MultiByteToWideChar(CP_ACP, 0, db, -1, dbW, MAX_PATH);
3164 hr = StgOpenStorage(dbW, NULL, STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, 0, &stg);
3165 if (FAILED(hr))
3166 return FALSE;
3168 MultiByteToWideChar(CP_ACP, 0, cabinet, -1, cabinetW, MAX_PATH);
3169 hr = IStorage_CreateStream(stg, cabinetW, STGM_WRITE|STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3170 if (FAILED(hr))
3172 IStorage_Release(stg);
3173 return FALSE;
3176 handle = CreateFileW(cabinetW, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
3177 if (handle != INVALID_HANDLE_VALUE)
3179 DWORD count;
3180 char buffer[1024];
3181 if (ReadFile(handle, buffer, sizeof(buffer), &count, NULL))
3182 IStream_Write(stm, buffer, count, &count);
3183 CloseHandle(handle);
3186 IStream_Release(stm);
3187 IStorage_Release(stg);
3189 return TRUE;
3192 static void test_lastusedsource(void)
3194 static char prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3196 UINT r;
3197 char value[MAX_PATH], path[MAX_PATH];
3198 DWORD size;
3200 if (!pMsiSourceListGetInfoA)
3202 win_skip("MsiSourceListGetInfoA is not available\n");
3203 return;
3206 CreateDirectoryA("msitest", NULL);
3207 create_file("maximus", 500);
3208 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3209 DeleteFile("maximus");
3211 create_database("msifile0.msi", lus0_tables, sizeof(lus0_tables) / sizeof(msi_table));
3212 create_database("msifile1.msi", lus1_tables, sizeof(lus1_tables) / sizeof(msi_table));
3213 create_database("msifile2.msi", lus2_tables, sizeof(lus2_tables) / sizeof(msi_table));
3215 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3217 /* no cabinet file */
3219 size = MAX_PATH;
3220 lstrcpyA(value, "aaa");
3221 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3222 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3223 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
3224 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
3226 r = MsiInstallProductA("msifile0.msi", "PUBLISH_PRODUCT=1");
3227 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3229 lstrcpyA(path, CURR_DIR);
3230 lstrcatA(path, "\\");
3232 size = MAX_PATH;
3233 lstrcpyA(value, "aaa");
3234 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3235 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3236 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3237 todo_wine
3239 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3240 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3243 r = MsiInstallProductA("msifile0.msi", "REMOVE=ALL");
3244 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3246 /* separate cabinet file */
3248 size = MAX_PATH;
3249 lstrcpyA(value, "aaa");
3250 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3251 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3252 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
3253 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
3255 r = MsiInstallProductA("msifile1.msi", "PUBLISH_PRODUCT=1");
3256 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3258 lstrcpyA(path, CURR_DIR);
3259 lstrcatA(path, "\\");
3261 size = MAX_PATH;
3262 lstrcpyA(value, "aaa");
3263 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3264 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3265 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3266 todo_wine
3268 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3269 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3272 r = MsiInstallProductA("msifile1.msi", "REMOVE=ALL");
3273 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3275 size = MAX_PATH;
3276 lstrcpyA(value, "aaa");
3277 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3278 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3279 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
3280 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
3282 /* embedded cabinet stream */
3284 add_cabinet_storage("msifile2.msi", "test1.cab");
3286 r = MsiInstallProductA("msifile2.msi", "PUBLISH_PRODUCT=1");
3287 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3289 size = MAX_PATH;
3290 lstrcpyA(value, "aaa");
3291 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3292 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3293 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3294 todo_wine
3296 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3297 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3300 r = MsiInstallProductA("msifile2.msi", "REMOVE=ALL");
3301 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3303 size = MAX_PATH;
3304 lstrcpyA(value, "aaa");
3305 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3306 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3307 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
3308 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
3310 /* Delete the files in the temp (current) folder */
3311 delete_cab_files();
3312 DeleteFile("msitest\\maximus");
3313 RemoveDirectory("msitest");
3314 DeleteFile("msifile0.msi");
3315 DeleteFile("msifile1.msi");
3316 DeleteFile("msifile2.msi");
3319 static void test_setdirproperty(void)
3321 UINT r;
3323 CreateDirectoryA("msitest", NULL);
3324 create_file("msitest\\maximus", 500);
3325 create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
3327 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3329 r = MsiInstallProductA(msifile, NULL);
3330 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3331 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
3332 ok(delete_cf("msitest", FALSE), "File not installed\n");
3334 /* Delete the files in the temp (current) folder */
3335 DeleteFile(msifile);
3336 DeleteFile("msitest\\maximus");
3337 RemoveDirectory("msitest");
3340 static void test_cabisextracted(void)
3342 UINT r;
3344 CreateDirectoryA("msitest", NULL);
3345 create_file("msitest\\gaius", 500);
3346 create_file("maximus", 500);
3347 create_file("augustus", 500);
3348 create_file("caesar", 500);
3350 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3351 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3352 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3354 create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
3356 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3358 r = MsiInstallProductA(msifile, NULL);
3359 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3360 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3361 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3362 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3363 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
3364 ok(delete_pf("msitest", FALSE), "File not installed\n");
3366 /* Delete the files in the temp (current) folder */
3367 delete_cab_files();
3368 DeleteFile(msifile);
3369 DeleteFile("maximus");
3370 DeleteFile("augustus");
3371 DeleteFile("caesar");
3372 DeleteFile("msitest\\gaius");
3373 RemoveDirectory("msitest");
3376 static void test_concurrentinstall(void)
3378 UINT r;
3379 CHAR path[MAX_PATH];
3381 CreateDirectoryA("msitest", NULL);
3382 CreateDirectoryA("msitest\\msitest", NULL);
3383 create_file("msitest\\maximus", 500);
3384 create_file("msitest\\msitest\\augustus", 500);
3386 create_database(msifile, ci_tables, sizeof(ci_tables) / sizeof(msi_table));
3388 lstrcpyA(path, CURR_DIR);
3389 lstrcatA(path, "\\msitest\\concurrent.msi");
3390 create_database(path, ci2_tables, sizeof(ci2_tables) / sizeof(msi_table));
3392 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3394 r = MsiInstallProductA(msifile, NULL);
3395 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3396 if (!delete_pf("msitest\\augustus", TRUE))
3397 trace("concurrent installs not supported\n");
3398 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3399 ok(delete_pf("msitest", FALSE), "File not installed\n");
3401 DeleteFile(path);
3403 r = MsiInstallProductA(msifile, NULL);
3404 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3405 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3406 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3407 ok(delete_pf("msitest", FALSE), "File not installed\n");
3409 DeleteFile(msifile);
3410 DeleteFile("msitest\\msitest\\augustus");
3411 DeleteFile("msitest\\maximus");
3412 RemoveDirectory("msitest\\msitest");
3413 RemoveDirectory("msitest");
3416 static void test_setpropertyfolder(void)
3418 UINT r;
3419 CHAR path[MAX_PATH];
3420 DWORD attr;
3422 lstrcpyA(path, PROG_FILES_DIR);
3423 lstrcatA(path, "\\msitest\\added");
3425 CreateDirectoryA("msitest", NULL);
3426 create_file("msitest\\maximus", 500);
3428 create_database(msifile, spf_tables, sizeof(spf_tables) / sizeof(msi_table));
3430 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3432 r = MsiInstallProductA(msifile, NULL);
3433 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3434 attr = GetFileAttributesA(path);
3435 if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY))
3437 ok(delete_pf("msitest\\added\\maximus", TRUE), "File not installed\n");
3438 ok(delete_pf("msitest\\added", FALSE), "File not installed\n");
3439 ok(delete_pf("msitest", FALSE), "File not installed\n");
3441 else
3443 trace("changing folder property not supported\n");
3444 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3445 ok(delete_pf("msitest", FALSE), "File not installed\n");
3448 /* Delete the files in the temp (current) folder */
3449 DeleteFile(msifile);
3450 DeleteFile("msitest\\maximus");
3451 RemoveDirectory("msitest");
3454 static BOOL file_exists(LPCSTR file)
3456 return GetFileAttributes(file) != INVALID_FILE_ATTRIBUTES;
3459 static BOOL pf_exists(LPCSTR file)
3461 CHAR path[MAX_PATH];
3463 lstrcpyA(path, PROG_FILES_DIR);
3464 lstrcatA(path, "\\");
3465 lstrcatA(path, file);
3467 return file_exists(path);
3470 static void delete_pfmsitest_files(void)
3472 SHFILEOPSTRUCT shfl;
3473 CHAR path[MAX_PATH+11];
3475 lstrcpyA(path, PROG_FILES_DIR);
3476 lstrcatA(path, "\\msitest\\*");
3477 path[strlen(path) + 1] = '\0';
3479 shfl.hwnd = NULL;
3480 shfl.wFunc = FO_DELETE;
3481 shfl.pFrom = path;
3482 shfl.pTo = NULL;
3483 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
3485 SHFileOperation(&shfl);
3487 lstrcpyA(path, PROG_FILES_DIR);
3488 lstrcatA(path, "\\msitest");
3489 RemoveDirectoryA(path);
3492 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
3494 char val[MAX_PATH];
3495 DWORD size, type;
3496 LONG res;
3498 size = MAX_PATH;
3499 val[0] = '\0';
3500 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
3502 if (res != ERROR_SUCCESS ||
3503 (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
3505 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3506 return;
3509 if (!expected)
3510 ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val);
3511 else
3513 if (bcase)
3514 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
3515 else
3516 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
3520 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
3522 DWORD val, size, type;
3523 LONG res;
3525 size = sizeof(DWORD);
3526 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
3528 if (res != ERROR_SUCCESS || type != REG_DWORD)
3530 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3531 return;
3534 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
3537 static void check_reg_dword2(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD line)
3539 DWORD val, size, type;
3540 LONG res;
3542 size = sizeof(DWORD);
3543 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
3545 if (res != ERROR_SUCCESS || type != REG_DWORD)
3547 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3548 return;
3551 ok_(__FILE__, line)(val == expected1 || val == expected2, "Expected %d or %d, got %d\n", expected1, expected2, val);
3554 static void check_reg_dword3(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3, DWORD line)
3556 DWORD val, size, type;
3557 LONG res;
3559 size = sizeof(DWORD);
3560 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
3562 if (res != ERROR_SUCCESS || type != REG_DWORD)
3564 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3565 return;
3568 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3,
3569 "Expected %d, %d or %d, got %d\n", expected1, expected2, expected3, val);
3572 #define CHECK_REG_STR(prodkey, name, expected) \
3573 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
3575 #define CHECK_DEL_REG_STR(prodkey, name, expected) \
3576 check_reg_str(prodkey, name, expected, TRUE, __LINE__); \
3577 RegDeleteValueA(prodkey, name);
3579 #define CHECK_REG_ISTR(prodkey, name, expected) \
3580 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
3582 #define CHECK_DEL_REG_ISTR(prodkey, name, expected) \
3583 check_reg_str(prodkey, name, expected, FALSE, __LINE__); \
3584 RegDeleteValueA(prodkey, name);
3586 #define CHECK_REG_DWORD(prodkey, name, expected) \
3587 check_reg_dword(prodkey, name, expected, __LINE__);
3589 #define CHECK_DEL_REG_DWORD(prodkey, name, expected) \
3590 check_reg_dword(prodkey, name, expected, __LINE__); \
3591 RegDeleteValueA(prodkey, name);
3593 #define CHECK_REG_DWORD2(prodkey, name, expected1, expected2) \
3594 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__);
3596 #define CHECK_DEL_REG_DWORD2(prodkey, name, expected1, expected2) \
3597 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__); \
3598 RegDeleteValueA(prodkey, name);
3600 #define CHECK_REG_DWORD3(prodkey, name, expected1, expected2, expected3) \
3601 check_reg_dword3(prodkey, name, expected1, expected2, expected3, __LINE__);
3603 #define CHECK_DEL_REG_DWORD3(prodkey, name, expected1, expected2, expected3) \
3604 check_reg_dword3(prodkey, name, expected1, expected2, expected3, __LINE__); \
3605 RegDeleteValueA(prodkey, name);
3607 static void get_date_str(LPSTR date)
3609 SYSTEMTIME systime;
3611 static const char date_fmt[] = "%d%02d%02d";
3612 GetLocalTime(&systime);
3613 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
3616 static void test_publish_registerproduct(void)
3618 UINT r;
3619 LONG res;
3620 HKEY hkey;
3621 HKEY props, usage;
3622 LPSTR usersid;
3623 char date[MAX_PATH];
3624 char temp[MAX_PATH];
3625 char keypath[MAX_PATH];
3627 static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3628 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3629 static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
3630 "\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3631 static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
3632 "\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
3633 static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
3634 "\\51AAE0C44620A5E4788506E91F249BD2";
3636 if (!get_user_sid(&usersid))
3637 return;
3639 get_date_str(date);
3640 GetTempPath(MAX_PATH, temp);
3642 CreateDirectoryA("msitest", NULL);
3643 create_file("msitest\\maximus", 500);
3645 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3647 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3649 /* RegisterProduct */
3650 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
3651 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3652 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3653 ok(delete_pf("msitest", FALSE), "File not installed\n");
3655 res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
3656 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3658 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
3659 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3661 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
3662 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
3663 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
3664 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
3665 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3666 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
3667 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3668 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
3669 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
3670 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
3671 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
3672 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
3673 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
3674 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
3675 CHECK_DEL_REG_STR(hkey, "Size", NULL);
3676 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
3677 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
3678 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3679 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3680 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
3681 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
3682 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
3683 todo_wine
3685 CHECK_DEL_REG_DWORD3(hkey, "EstimatedSize", 12, -12, 4);
3688 RegDeleteKeyA(hkey, "");
3689 RegCloseKey(hkey);
3691 sprintf(keypath, userdata, usersid);
3692 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
3693 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3695 res = RegOpenKeyA(hkey, "InstallProperties", &props);
3696 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3698 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
3699 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
3700 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
3701 CHECK_DEL_REG_STR(props, "InstallDate", date);
3702 CHECK_DEL_REG_STR(props, "InstallSource", temp);
3703 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3704 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
3705 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3706 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
3707 CHECK_DEL_REG_STR(props, "Comments", NULL);
3708 CHECK_DEL_REG_STR(props, "Contact", NULL);
3709 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
3710 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
3711 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
3712 CHECK_DEL_REG_STR(props, "Readme", NULL);
3713 CHECK_DEL_REG_STR(props, "Size", NULL);
3714 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
3715 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
3716 CHECK_DEL_REG_DWORD(props, "Language", 1033);
3717 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
3718 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
3719 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
3720 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
3721 todo_wine
3723 CHECK_DEL_REG_DWORD3(props, "EstimatedSize", 12, -12, 4);
3726 RegDeleteKeyA(props, "");
3727 RegCloseKey(props);
3729 res = RegOpenKeyA(hkey, "Usage", &usage);
3730 todo_wine
3732 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3735 RegDeleteKeyA(usage, "");
3736 RegCloseKey(usage);
3737 RegDeleteKeyA(hkey, "");
3738 RegCloseKey(hkey);
3740 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
3741 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3743 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3745 RegDeleteKeyA(hkey, "");
3746 RegCloseKey(hkey);
3748 /* RegisterProduct, machine */
3749 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 ALLUSERS=1");
3750 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3751 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3752 ok(delete_pf("msitest", FALSE), "File not installed\n");
3754 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, userugkey, &hkey);
3755 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3757 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
3758 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3760 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
3761 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
3762 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
3763 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
3764 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3765 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
3766 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3767 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
3768 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
3769 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
3770 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
3771 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
3772 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
3773 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
3774 CHECK_DEL_REG_STR(hkey, "Size", NULL);
3775 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
3776 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
3777 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3778 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3779 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
3780 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
3781 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
3782 todo_wine
3784 CHECK_DEL_REG_DWORD3(hkey, "EstimatedSize", 12, -12, 4);
3787 RegDeleteKeyA(hkey, "");
3788 RegCloseKey(hkey);
3790 sprintf(keypath, userdata, "S-1-5-18");
3791 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
3792 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3794 res = RegOpenKeyA(hkey, "InstallProperties", &props);
3795 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3797 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
3798 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
3799 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
3800 CHECK_DEL_REG_STR(props, "InstallDate", date);
3801 CHECK_DEL_REG_STR(props, "InstallSource", temp);
3802 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3803 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
3804 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3805 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
3806 CHECK_DEL_REG_STR(props, "Comments", NULL);
3807 CHECK_DEL_REG_STR(props, "Contact", NULL);
3808 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
3809 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
3810 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
3811 CHECK_DEL_REG_STR(props, "Readme", NULL);
3812 CHECK_DEL_REG_STR(props, "Size", NULL);
3813 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
3814 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
3815 CHECK_DEL_REG_DWORD(props, "Language", 1033);
3816 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
3817 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
3818 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
3819 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
3820 todo_wine
3822 CHECK_DEL_REG_DWORD3(props, "EstimatedSize", 12, -12, 4);
3825 RegDeleteKeyA(props, "");
3826 RegCloseKey(props);
3828 res = RegOpenKeyA(hkey, "Usage", &usage);
3829 todo_wine
3831 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3834 RegDeleteKeyA(usage, "");
3835 RegCloseKey(usage);
3836 RegDeleteKeyA(hkey, "");
3837 RegCloseKey(hkey);
3839 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
3840 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3842 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3844 RegDeleteKeyA(hkey, "");
3845 RegCloseKey(hkey);
3847 DeleteFile(msifile);
3848 DeleteFile("msitest\\maximus");
3849 RemoveDirectory("msitest");
3850 HeapFree(GetProcessHeap(), 0, usersid);
3853 static void test_publish_publishproduct(void)
3855 UINT r;
3856 LONG res;
3857 LPSTR usersid;
3858 HKEY sourcelist, net, props;
3859 HKEY hkey, patches, media;
3860 CHAR keypath[MAX_PATH];
3861 CHAR temp[MAX_PATH];
3862 CHAR path[MAX_PATH];
3864 static const CHAR prodpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3865 "\\Installer\\UserData\\%s\\Products"
3866 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3867 static const CHAR cuprodpath[] = "Software\\Microsoft\\Installer\\Products"
3868 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3869 static const CHAR cuupgrades[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
3870 "\\51AAE0C44620A5E4788506E91F249BD2";
3871 static const CHAR badprod[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3872 "\\Installer\\Products"
3873 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3874 static const CHAR machprod[] = "Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3875 static const CHAR machup[] = "Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
3877 if (!get_user_sid(&usersid))
3878 return;
3880 GetTempPath(MAX_PATH, temp);
3882 CreateDirectoryA("msitest", NULL);
3883 create_file("msitest\\maximus", 500);
3885 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3887 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3889 /* PublishProduct, current user */
3890 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
3891 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3892 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3893 ok(delete_pf("msitest", FALSE), "File not installed\n");
3895 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
3896 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3898 sprintf(keypath, prodpath, usersid);
3899 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
3900 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3902 res = RegOpenKeyA(hkey, "InstallProperties", &props);
3903 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3905 res = RegOpenKeyA(hkey, "Patches", &patches);
3906 todo_wine
3908 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3910 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3913 RegDeleteKeyA(patches, "");
3914 RegCloseKey(patches);
3915 RegDeleteKeyA(hkey, "");
3916 RegCloseKey(hkey);
3918 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
3919 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3921 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3922 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
3923 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3924 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3925 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3926 CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
3927 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3928 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3929 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3931 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
3932 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3934 lstrcpyA(path, "n;1;");
3935 lstrcatA(path, temp);
3936 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3937 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3939 res = RegOpenKeyA(sourcelist, "Net", &net);
3940 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3942 CHECK_DEL_REG_STR(net, "1", temp);
3944 RegDeleteKeyA(net, "");
3945 RegCloseKey(net);
3947 res = RegOpenKeyA(sourcelist, "Media", &media);
3948 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3950 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3952 RegDeleteKeyA(media, "");
3953 RegCloseKey(media);
3954 RegDeleteKeyA(sourcelist, "");
3955 RegCloseKey(sourcelist);
3956 RegDeleteKeyA(hkey, "");
3957 RegCloseKey(hkey);
3959 res = RegOpenKeyA(HKEY_CURRENT_USER, cuupgrades, &hkey);
3960 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3962 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3964 RegDeleteKeyA(hkey, "");
3965 RegCloseKey(hkey);
3967 /* PublishProduct, machine */
3968 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
3969 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3970 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3971 ok(delete_pf("msitest", FALSE), "File not installed\n");
3973 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
3974 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3976 sprintf(keypath, prodpath, "S-1-5-18");
3977 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
3978 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3980 res = RegOpenKeyA(hkey, "InstallProperties", &props);
3981 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3983 res = RegOpenKeyA(hkey, "Patches", &patches);
3984 todo_wine
3986 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3988 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3991 RegDeleteKeyA(patches, "");
3992 RegCloseKey(patches);
3993 RegDeleteKeyA(hkey, "");
3994 RegCloseKey(hkey);
3996 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machprod, &hkey);
3997 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3999 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
4000 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
4001 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
4002 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
4003 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
4004 todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
4005 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
4006 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
4007 CHECK_DEL_REG_STR(hkey, "Clients", ":");
4009 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
4010 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4012 lstrcpyA(path, "n;1;");
4013 lstrcatA(path, temp);
4014 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
4015 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
4017 res = RegOpenKeyA(sourcelist, "Net", &net);
4018 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4020 CHECK_DEL_REG_STR(net, "1", temp);
4022 RegDeleteKeyA(net, "");
4023 RegCloseKey(net);
4025 res = RegOpenKeyA(sourcelist, "Media", &media);
4026 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4028 CHECK_DEL_REG_STR(media, "1", "DISK1;");
4030 RegDeleteKeyA(media, "");
4031 RegCloseKey(media);
4032 RegDeleteKeyA(sourcelist, "");
4033 RegCloseKey(sourcelist);
4034 RegDeleteKeyA(hkey, "");
4035 RegCloseKey(hkey);
4037 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machup, &hkey);
4038 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4040 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
4042 RegDeleteKeyA(hkey, "");
4043 RegCloseKey(hkey);
4045 DeleteFile(msifile);
4046 DeleteFile("msitest\\maximus");
4047 RemoveDirectory("msitest");
4048 HeapFree(GetProcessHeap(), 0, usersid);
4051 static void test_publish_publishfeatures(void)
4053 UINT r;
4054 LONG res;
4055 HKEY hkey;
4056 LPSTR usersid;
4057 CHAR keypath[MAX_PATH];
4059 static const CHAR cupath[] = "Software\\Microsoft\\Installer\\Features"
4060 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
4061 static const CHAR udpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
4062 "\\Installer\\UserData\\%s\\Products"
4063 "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
4064 static const CHAR featkey[] = "Software\\Microsoft\\Windows\\CurrentVersion"
4065 "\\Installer\\Features";
4066 static const CHAR classfeat[] = "Software\\Classes\\Installer\\Features"
4067 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
4069 if (!get_user_sid(&usersid))
4070 return;
4072 CreateDirectoryA("msitest", NULL);
4073 create_file("msitest\\maximus", 500);
4075 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4077 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4079 /* PublishFeatures, current user */
4080 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
4081 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4082 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4083 ok(delete_pf("msitest", FALSE), "File not installed\n");
4085 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
4086 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4088 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
4089 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4091 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
4092 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4094 CHECK_REG_STR(hkey, "feature", "");
4095 CHECK_REG_STR(hkey, "montecristo", "");
4097 RegDeleteValueA(hkey, "feature");
4098 RegDeleteValueA(hkey, "montecristo");
4099 RegDeleteKeyA(hkey, "");
4100 RegCloseKey(hkey);
4102 sprintf(keypath, udpath, usersid);
4103 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
4104 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4106 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
4107 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
4109 RegDeleteValueA(hkey, "feature");
4110 RegDeleteValueA(hkey, "montecristo");
4111 RegDeleteKeyA(hkey, "");
4112 RegCloseKey(hkey);
4114 /* PublishFeatures, machine */
4115 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
4116 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4117 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4118 ok(delete_pf("msitest", FALSE), "File not installed\n");
4120 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
4121 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4123 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
4124 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4126 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
4127 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4129 CHECK_REG_STR(hkey, "feature", "");
4130 CHECK_REG_STR(hkey, "montecristo", "");
4132 RegDeleteValueA(hkey, "feature");
4133 RegDeleteValueA(hkey, "montecristo");
4134 RegDeleteKeyA(hkey, "");
4135 RegCloseKey(hkey);
4137 sprintf(keypath, udpath, "S-1-5-18");
4138 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
4139 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4141 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
4142 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
4144 RegDeleteValueA(hkey, "feature");
4145 RegDeleteValueA(hkey, "montecristo");
4146 RegDeleteKeyA(hkey, "");
4147 RegCloseKey(hkey);
4149 DeleteFile(msifile);
4150 DeleteFile("msitest\\maximus");
4151 RemoveDirectory("msitest");
4152 HeapFree(GetProcessHeap(), 0, usersid);
4155 static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
4157 DWORD len = 0;
4158 LPSTR val;
4159 LONG r;
4161 r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
4162 if (r != ERROR_SUCCESS)
4163 return NULL;
4165 len += sizeof (WCHAR);
4166 val = HeapAlloc(GetProcessHeap(), 0, len);
4167 if (!val) return NULL;
4168 val[0] = 0;
4169 RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
4170 return val;
4173 static void get_owner_company(LPSTR *owner, LPSTR *company)
4175 LONG res;
4176 HKEY hkey;
4178 *owner = *company = NULL;
4180 res = RegOpenKeyA(HKEY_CURRENT_USER,
4181 "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
4182 if (res == ERROR_SUCCESS)
4184 *owner = reg_get_val_str(hkey, "DefName");
4185 *company = reg_get_val_str(hkey, "DefCompany");
4186 RegCloseKey(hkey);
4189 if (!*owner || !*company)
4191 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
4192 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey);
4193 if (res == ERROR_SUCCESS)
4195 *owner = reg_get_val_str(hkey, "RegisteredOwner");
4196 *company = reg_get_val_str(hkey, "RegisteredOrganization");
4197 RegCloseKey(hkey);
4201 if (!*owner || !*company)
4203 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
4204 "Software\\Microsoft\\Windows NT\\CurrentVersion", &hkey);
4205 if (res == ERROR_SUCCESS)
4207 *owner = reg_get_val_str(hkey, "RegisteredOwner");
4208 *company = reg_get_val_str(hkey, "RegisteredOrganization");
4209 RegCloseKey(hkey);
4214 static void test_publish_registeruser(void)
4216 UINT r;
4217 LONG res;
4218 HKEY props;
4219 LPSTR usersid;
4220 LPSTR owner, company;
4221 CHAR keypath[MAX_PATH];
4223 static const CHAR keyfmt[] =
4224 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
4225 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
4227 if (!get_user_sid(&usersid))
4228 return;
4230 get_owner_company(&owner, &company);
4232 CreateDirectoryA("msitest", NULL);
4233 create_file("msitest\\maximus", 500);
4235 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4237 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4239 /* RegisterUser, per-user */
4240 r = MsiInstallProductA(msifile, "REGISTER_USER=1");
4241 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4242 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4243 ok(delete_pf("msitest", FALSE), "File not installed\n");
4245 sprintf(keypath, keyfmt, usersid);
4247 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
4248 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4250 CHECK_REG_STR(props, "ProductID", "none");
4251 CHECK_REG_STR(props, "RegCompany", company);
4252 CHECK_REG_STR(props, "RegOwner", owner);
4254 RegDeleteValueA(props, "ProductID");
4255 RegDeleteValueA(props, "RegCompany");
4256 RegDeleteValueA(props, "RegOwner");
4257 RegDeleteKeyA(props, "");
4258 RegCloseKey(props);
4260 /* RegisterUser, machine */
4261 r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
4262 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4263 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4264 ok(delete_pf("msitest", FALSE), "File not installed\n");
4266 sprintf(keypath, keyfmt, "S-1-5-18");
4268 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
4269 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4271 CHECK_REG_STR(props, "ProductID", "none");
4272 CHECK_REG_STR(props, "RegCompany", company);
4273 CHECK_REG_STR(props, "RegOwner", owner);
4275 RegDeleteValueA(props, "ProductID");
4276 RegDeleteValueA(props, "RegCompany");
4277 RegDeleteValueA(props, "RegOwner");
4278 RegDeleteKeyA(props, "");
4279 RegCloseKey(props);
4281 HeapFree(GetProcessHeap(), 0, company);
4282 HeapFree(GetProcessHeap(), 0, owner);
4284 DeleteFile(msifile);
4285 DeleteFile("msitest\\maximus");
4286 RemoveDirectory("msitest");
4287 LocalFree(usersid);
4290 static void test_publish_processcomponents(void)
4292 UINT r;
4293 LONG res;
4294 DWORD size;
4295 HKEY comp, hkey;
4296 LPSTR usersid;
4297 CHAR val[MAX_PATH];
4298 CHAR keypath[MAX_PATH];
4299 CHAR program_files_maximus[MAX_PATH];
4301 static const CHAR keyfmt[] =
4302 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
4303 "UserData\\%s\\Components\\%s";
4304 static const CHAR compkey[] =
4305 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
4307 if (!get_user_sid(&usersid))
4308 return;
4310 CreateDirectoryA("msitest", NULL);
4311 create_file("msitest\\maximus", 500);
4313 create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table));
4315 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4317 /* ProcessComponents, per-user */
4318 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
4319 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4320 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4321 ok(delete_pf("msitest", FALSE), "File not installed\n");
4323 sprintf(keypath, keyfmt, usersid, "CBABC2FDCCB35E749A8944D8C1C098B5");
4325 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4326 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4328 size = MAX_PATH;
4329 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4330 NULL, NULL, (LPBYTE)val, &size);
4331 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4333 lstrcpyA(program_files_maximus,PROG_FILES_DIR);
4334 lstrcatA(program_files_maximus,"\\msitest\\maximus");
4336 ok(!lstrcmpiA(val, program_files_maximus),
4337 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
4339 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4340 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4342 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4343 RegDeleteKeyA(comp, "");
4344 RegCloseKey(comp);
4346 sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
4348 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4349 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4351 size = MAX_PATH;
4352 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4353 NULL, NULL, (LPBYTE)val, &size);
4354 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4355 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
4356 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
4358 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4359 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4361 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4362 RegDeleteKeyA(comp, "");
4363 RegCloseKey(comp);
4365 /* ProcessComponents, machine */
4366 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
4367 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4368 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4369 ok(delete_pf("msitest", FALSE), "File not installed\n");
4371 sprintf(keypath, keyfmt, "S-1-5-18", "CBABC2FDCCB35E749A8944D8C1C098B5");
4373 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4374 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4376 size = MAX_PATH;
4377 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4378 NULL, NULL, (LPBYTE)val, &size);
4379 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4380 ok(!lstrcmpiA(val, program_files_maximus),
4381 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
4383 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4384 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4386 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4387 RegDeleteKeyA(comp, "");
4388 RegCloseKey(comp);
4390 sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
4392 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4393 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4395 size = MAX_PATH;
4396 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4397 NULL, NULL, (LPBYTE)val, &size);
4398 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4399 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
4400 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
4402 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4403 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4405 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4406 RegDeleteKeyA(comp, "");
4407 RegCloseKey(comp);
4409 DeleteFile(msifile);
4410 DeleteFile("msitest\\maximus");
4411 RemoveDirectory("msitest");
4412 LocalFree(usersid);
4415 static void test_publish(void)
4417 UINT r;
4418 LONG res;
4419 HKEY uninstall, prodkey;
4420 INSTALLSTATE state;
4421 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
4422 char date[MAX_PATH];
4423 char temp[MAX_PATH];
4425 static const CHAR subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
4427 if (!pMsiQueryComponentStateA)
4429 win_skip("MsiQueryComponentStateA is not available\n");
4430 return;
4433 get_date_str(date);
4434 GetTempPath(MAX_PATH, temp);
4436 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, subkey, &uninstall);
4437 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4439 CreateDirectoryA("msitest", NULL);
4440 create_file("msitest\\maximus", 500);
4442 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4444 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4446 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4447 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4449 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4450 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4452 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4453 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4455 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4456 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4457 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4458 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4460 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4461 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4463 /* nothing published */
4464 r = MsiInstallProductA(msifile, NULL);
4465 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4466 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4467 ok(pf_exists("msitest"), "File not installed\n");
4469 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4470 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4472 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4473 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4475 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4476 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4478 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4479 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4480 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4481 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4483 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4484 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4486 /* PublishProduct and RegisterProduct */
4487 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
4488 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4489 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4490 ok(pf_exists("msitest"), "File not installed\n");
4492 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4493 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4495 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4496 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4498 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4499 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4501 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4502 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4503 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
4504 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4506 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4507 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4509 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4510 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4511 CHECK_REG_STR(prodkey, "InstallDate", date);
4512 CHECK_REG_STR(prodkey, "InstallSource", temp);
4513 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4514 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4515 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4516 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4517 CHECK_REG_STR(prodkey, "Comments", NULL);
4518 CHECK_REG_STR(prodkey, "Contact", NULL);
4519 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4520 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4521 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4522 CHECK_REG_STR(prodkey, "Readme", NULL);
4523 CHECK_REG_STR(prodkey, "Size", NULL);
4524 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4525 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4526 CHECK_REG_DWORD(prodkey, "Language", 1033);
4527 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4528 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4529 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4530 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4531 todo_wine
4533 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4536 RegCloseKey(prodkey);
4538 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4539 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4540 ok(pf_exists("msitest\\maximus"), "File deleted\n");
4541 ok(pf_exists("msitest"), "File deleted\n");
4543 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4544 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4546 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4547 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4549 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4550 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4552 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4553 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4554 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4555 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4557 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4558 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4560 /* complete install */
4561 r = MsiInstallProductA(msifile, "FULL=1");
4562 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4563 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4564 ok(pf_exists("msitest"), "File not installed\n");
4566 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4567 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4569 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4570 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4572 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4573 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4575 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4576 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4577 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4578 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4580 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4581 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4583 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4584 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4585 CHECK_REG_STR(prodkey, "InstallDate", date);
4586 CHECK_REG_STR(prodkey, "InstallSource", temp);
4587 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4588 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4589 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4590 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4591 CHECK_REG_STR(prodkey, "Comments", NULL);
4592 CHECK_REG_STR(prodkey, "Contact", NULL);
4593 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4594 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4595 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4596 CHECK_REG_STR(prodkey, "Readme", NULL);
4597 CHECK_REG_STR(prodkey, "Size", NULL);
4598 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4599 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4600 CHECK_REG_DWORD(prodkey, "Language", 1033);
4601 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4602 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4603 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4604 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4605 todo_wine
4607 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4610 RegCloseKey(prodkey);
4612 /* no UnpublishFeatures */
4613 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4614 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4615 ok(!pf_exists("msitest\\maximus"), "File deleted\n");
4616 todo_wine
4618 ok(!pf_exists("msitest"), "File deleted\n");
4621 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4622 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4624 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4625 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4627 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4628 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4630 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4631 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4632 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4633 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4635 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4636 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4638 /* complete install */
4639 r = MsiInstallProductA(msifile, "FULL=1");
4640 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4641 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4642 ok(pf_exists("msitest"), "File not installed\n");
4644 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4645 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4647 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4648 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4650 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4651 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4653 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4654 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4655 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4656 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4658 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4659 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4661 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4662 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4663 CHECK_REG_STR(prodkey, "InstallDate", date);
4664 CHECK_REG_STR(prodkey, "InstallSource", temp);
4665 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4666 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4667 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4668 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4669 CHECK_REG_STR(prodkey, "Comments", NULL);
4670 CHECK_REG_STR(prodkey, "Contact", NULL);
4671 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4672 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4673 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4674 CHECK_REG_STR(prodkey, "Readme", NULL);
4675 CHECK_REG_STR(prodkey, "Size", NULL);
4676 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4677 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4678 CHECK_REG_DWORD(prodkey, "Language", 1033);
4679 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4680 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4681 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4682 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4683 todo_wine
4685 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4688 RegCloseKey(prodkey);
4690 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
4691 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
4692 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4693 todo_wine ok(pf_exists("msitest\\maximus"), "File deleted\n");
4694 ok(pf_exists("msitest"), "File deleted\n");
4696 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4697 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4699 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4700 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4702 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4703 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4705 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4706 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4707 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4708 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4710 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4711 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4713 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4714 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4715 CHECK_REG_STR(prodkey, "InstallDate", date);
4716 CHECK_REG_STR(prodkey, "InstallSource", temp);
4717 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4718 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4719 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4720 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4721 CHECK_REG_STR(prodkey, "Comments", NULL);
4722 CHECK_REG_STR(prodkey, "Contact", NULL);
4723 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4724 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4725 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4726 CHECK_REG_STR(prodkey, "Readme", NULL);
4727 CHECK_REG_STR(prodkey, "Size", NULL);
4728 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4729 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4730 CHECK_REG_DWORD(prodkey, "Language", 1033);
4731 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4732 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4733 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4734 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4735 todo_wine
4737 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4740 RegCloseKey(prodkey);
4742 /* complete install */
4743 r = MsiInstallProductA(msifile, "FULL=1");
4744 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4745 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4746 ok(pf_exists("msitest"), "File not installed\n");
4748 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4749 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4751 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4752 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4754 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4755 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4757 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4758 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4759 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4760 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4762 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4763 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4765 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4766 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4767 CHECK_REG_STR(prodkey, "InstallDate", date);
4768 CHECK_REG_STR(prodkey, "InstallSource", temp);
4769 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4770 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4771 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4772 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4773 CHECK_REG_STR(prodkey, "Comments", NULL);
4774 CHECK_REG_STR(prodkey, "Contact", NULL);
4775 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4776 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4777 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4778 CHECK_REG_STR(prodkey, "Readme", NULL);
4779 CHECK_REG_STR(prodkey, "Size", NULL);
4780 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4781 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4782 CHECK_REG_DWORD(prodkey, "Language", 1033);
4783 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4784 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4785 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4786 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4787 todo_wine
4789 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -20);
4792 RegCloseKey(prodkey);
4794 /* UnpublishFeatures, both features removed */
4795 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
4796 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4797 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4798 todo_wine
4800 ok(!pf_exists("msitest"), "File not deleted\n");
4803 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4804 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4806 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4807 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4809 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4810 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4812 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4813 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4814 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4815 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4817 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4818 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4820 /* complete install */
4821 r = MsiInstallProductA(msifile, "FULL=1");
4822 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4823 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4824 ok(pf_exists("msitest"), "File not installed\n");
4826 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4827 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4829 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4830 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4832 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4833 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4835 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4836 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4837 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4838 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4840 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4841 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4843 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4844 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4845 CHECK_REG_STR(prodkey, "InstallDate", date);
4846 CHECK_REG_STR(prodkey, "InstallSource", temp);
4847 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4848 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4849 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4850 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4851 CHECK_REG_STR(prodkey, "Comments", NULL);
4852 CHECK_REG_STR(prodkey, "Contact", NULL);
4853 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4854 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4855 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4856 CHECK_REG_STR(prodkey, "Readme", NULL);
4857 CHECK_REG_STR(prodkey, "Size", NULL);
4858 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4859 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4860 CHECK_REG_DWORD(prodkey, "Language", 1033);
4861 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4862 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4863 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4864 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4865 todo_wine
4867 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4870 RegCloseKey(prodkey);
4872 /* complete uninstall */
4873 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4874 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4875 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4876 todo_wine
4878 ok(!pf_exists("msitest"), "File not deleted\n");
4881 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4882 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4884 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4885 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4887 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4888 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4890 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4891 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4892 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4893 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4895 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4896 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4898 /* make sure 'Program Files\msitest' is removed */
4899 delete_pfmsitest_files();
4901 RegCloseKey(uninstall);
4902 DeleteFile(msifile);
4903 DeleteFile("msitest\\maximus");
4904 RemoveDirectory("msitest");
4907 static void test_publishsourcelist(void)
4909 UINT r;
4910 DWORD size;
4911 CHAR value[MAX_PATH];
4912 CHAR path[MAX_PATH];
4913 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
4915 if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
4917 win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
4918 return;
4921 CreateDirectoryA("msitest", NULL);
4922 create_file("msitest\\maximus", 500);
4924 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4926 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4928 r = MsiInstallProductA(msifile, NULL);
4929 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4930 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4931 ok(pf_exists("msitest"), "File not installed\n");
4933 /* nothing published */
4934 size = MAX_PATH;
4935 lstrcpyA(value, "aaa");
4936 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4937 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4938 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4939 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4940 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4942 size = MAX_PATH;
4943 lstrcpyA(value, "aaa");
4944 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4945 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4946 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4947 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4948 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4950 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
4951 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4952 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4953 ok(pf_exists("msitest"), "File not installed\n");
4955 /* after RegisterProduct */
4956 size = MAX_PATH;
4957 lstrcpyA(value, "aaa");
4958 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4959 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4960 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4961 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4962 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4964 size = MAX_PATH;
4965 lstrcpyA(value, "aaa");
4966 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4967 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4968 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4969 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4970 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4972 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
4973 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4974 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4975 ok(pf_exists("msitest"), "File not installed\n");
4977 /* after ProcessComponents */
4978 size = MAX_PATH;
4979 lstrcpyA(value, "aaa");
4980 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4981 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4982 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4983 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4984 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4986 size = MAX_PATH;
4987 lstrcpyA(value, "aaa");
4988 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4989 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4990 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4991 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4992 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4994 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
4995 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4996 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4997 ok(pf_exists("msitest"), "File not installed\n");
4999 /* after PublishFeatures */
5000 size = MAX_PATH;
5001 lstrcpyA(value, "aaa");
5002 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5003 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
5004 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5005 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5006 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5008 size = MAX_PATH;
5009 lstrcpyA(value, "aaa");
5010 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5011 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
5012 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5013 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5014 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5016 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
5017 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5018 ok(pf_exists("msitest\\maximus"), "File not installed\n");
5019 ok(pf_exists("msitest"), "File not installed\n");
5021 /* after PublishProduct */
5022 size = MAX_PATH;
5023 lstrcpyA(value, "aaa");
5024 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5025 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
5026 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5027 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
5028 ok(size == 11, "Expected 11, got %d\n", size);
5030 size = MAX_PATH;
5031 lstrcpyA(value, "aaa");
5032 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5033 MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATH, value, &size);
5034 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5035 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
5036 ok(size == 0, "Expected 0, got %d\n", size);
5038 size = MAX_PATH;
5039 lstrcpyA(value, "aaa");
5040 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5041 MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPT, value, &size);
5042 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5043 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
5044 ok(size == 0, "Expected 0, got %d\n", size);
5046 lstrcpyA(path, CURR_DIR);
5047 lstrcatA(path, "\\");
5049 size = MAX_PATH;
5050 lstrcpyA(value, "aaa");
5051 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5052 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
5053 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5054 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
5055 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
5057 size = MAX_PATH;
5058 lstrcpyA(value, "aaa");
5059 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5060 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE, value, &size);
5061 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5062 ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
5063 ok(size == 1, "Expected 1, got %d\n", size);
5065 size = MAX_PATH;
5066 lstrcpyA(value, "aaa");
5067 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5068 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
5069 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
5070 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
5071 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
5073 size = MAX_PATH;
5074 lstrcpyA(value, "aaa");
5075 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5076 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
5077 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5078 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
5079 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
5081 size = MAX_PATH;
5082 lstrcpyA(value, "aaa");
5083 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5084 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
5085 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
5086 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
5087 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
5089 /* complete uninstall */
5090 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
5091 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5092 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
5093 todo_wine
5095 ok(!pf_exists("msitest"), "File not deleted\n");
5098 /* make sure 'Program Files\msitest' is removed */
5099 delete_pfmsitest_files();
5101 DeleteFile(msifile);
5102 DeleteFile("msitest\\maximus");
5103 RemoveDirectory("msitest");
5106 static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
5108 MSIHANDLE hview = 0;
5109 UINT r;
5111 r = MsiDatabaseOpenView(hdb, query, &hview);
5112 if(r != ERROR_SUCCESS)
5113 return r;
5115 r = MsiViewExecute(hview, hrec);
5116 if(r == ERROR_SUCCESS)
5117 r = MsiViewClose(hview);
5118 MsiCloseHandle(hview);
5119 return r;
5122 static void set_transform_summary_info(void)
5124 UINT r;
5125 MSIHANDLE suminfo = 0;
5127 /* build summary info */
5128 r = MsiGetSummaryInformation(0, mstfile, 3, &suminfo);
5129 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
5131 r = MsiSummaryInfoSetProperty(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
5132 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
5134 r = MsiSummaryInfoSetProperty(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
5135 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
5136 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
5137 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
5138 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
5140 r = MsiSummaryInfoSetProperty(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
5141 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
5143 r = MsiSummaryInfoPersist(suminfo);
5144 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
5146 r = MsiCloseHandle(suminfo);
5147 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
5150 static void generate_transform(void)
5152 MSIHANDLE hdb1, hdb2;
5153 LPCSTR query;
5154 UINT r;
5156 /* start with two identical databases */
5157 CopyFile(msifile, msifile2, FALSE);
5159 r = MsiOpenDatabase(msifile2, MSIDBOPEN_TRANSACT, &hdb1);
5160 ok(r == ERROR_SUCCESS , "Failed to create database\n");
5162 r = MsiDatabaseCommit(hdb1);
5163 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
5165 r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb2);
5166 ok(r == ERROR_SUCCESS , "Failed to create database\n");
5168 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
5169 r = run_query(hdb1, 0, query);
5170 ok(r == ERROR_SUCCESS, "failed to add property\n");
5172 /* database needs to be committed */
5173 MsiDatabaseCommit(hdb1);
5175 r = MsiDatabaseGenerateTransform(hdb1, hdb2, mstfile, 0, 0);
5176 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
5178 #if 0 /* not implemented in wine yet */
5179 r = MsiCreateTransformSummaryInfo(hdb2, hdb2, mstfile, 0, 0);
5180 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5181 #endif
5183 MsiCloseHandle(hdb1);
5184 MsiCloseHandle(hdb2);
5187 /* data for generating a transform */
5189 /* tables transform names - encoded as they would be in an msi database file */
5190 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
5191 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
5192 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
5194 /* data in each table */
5195 static const char data1[] = /* _StringData */
5196 "propval"; /* all the strings squashed together */
5198 static const WCHAR data2[] = { /* _StringPool */
5199 /* len, refs */
5200 0, 0, /* string 0 '' */
5201 4, 1, /* string 1 'prop' */
5202 3, 1, /* string 2 'val' */
5205 static const WCHAR data3[] = { /* Property */
5206 0x0201, 0x0001, 0x0002,
5209 static const struct {
5210 LPCWSTR name;
5211 const void *data;
5212 DWORD size;
5213 } table_transform_data[] =
5215 { name1, data1, sizeof data1 - 1 },
5216 { name2, data2, sizeof data2 },
5217 { name3, data3, sizeof data3 },
5220 #define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
5222 static void generate_transform_manual(void)
5224 IStorage *stg = NULL;
5225 IStream *stm;
5226 WCHAR name[0x20];
5227 HRESULT r;
5228 DWORD i, count;
5229 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
5231 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
5233 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
5235 r = StgCreateDocfile(name, mode, 0, &stg);
5236 ok(r == S_OK, "failed to create storage\n");
5237 if (!stg)
5238 return;
5240 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
5241 ok(r == S_OK, "failed to set storage type\n");
5243 for (i=0; i<NUM_TRANSFORM_TABLES; i++)
5245 r = IStorage_CreateStream(stg, table_transform_data[i].name,
5246 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
5247 if (FAILED(r))
5249 ok(0, "failed to create stream %08x\n", r);
5250 continue;
5253 r = IStream_Write(stm, table_transform_data[i].data,
5254 table_transform_data[i].size, &count);
5255 if (FAILED(r) || count != table_transform_data[i].size)
5256 ok(0, "failed to write stream\n");
5257 IStream_Release(stm);
5260 IStorage_Release(stg);
5262 set_transform_summary_info();
5265 static void test_transformprop(void)
5267 UINT r;
5269 CreateDirectoryA("msitest", NULL);
5270 create_file("msitest\\augustus", 500);
5272 create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
5274 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5276 r = MsiInstallProductA(msifile, NULL);
5277 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5278 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5279 ok(!delete_pf("msitest", FALSE), "File installed\n");
5281 if (0)
5282 generate_transform();
5283 else
5284 generate_transform_manual();
5286 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
5287 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5288 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5289 ok(delete_pf("msitest", FALSE), "File not installed\n");
5291 /* Delete the files in the temp (current) folder */
5292 DeleteFile(msifile);
5293 DeleteFile(msifile2);
5294 DeleteFile(mstfile);
5295 DeleteFile("msitest\\augustus");
5296 RemoveDirectory("msitest");
5299 static void test_currentworkingdir(void)
5301 UINT r;
5302 CHAR drive[MAX_PATH], path[MAX_PATH];
5303 LPSTR ptr;
5305 CreateDirectoryA("msitest", NULL);
5306 create_file("msitest\\augustus", 500);
5308 create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
5310 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5312 CreateDirectoryA("diffdir", NULL);
5313 SetCurrentDirectoryA("diffdir");
5315 sprintf(path, "..\\%s", msifile);
5316 r = MsiInstallProductA(path, NULL);
5317 todo_wine
5319 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
5320 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5321 ok(!delete_pf("msitest", FALSE), "File installed\n");
5324 sprintf(path, "%s\\%s", CURR_DIR, msifile);
5325 r = MsiInstallProductA(path, NULL);
5326 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5327 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5328 ok(delete_pf("msitest", FALSE), "File not installed\n");
5330 lstrcpyA(drive, CURR_DIR);
5331 drive[2] = '\\';
5332 drive[3] = '\0';
5333 SetCurrentDirectoryA(drive);
5335 lstrcpy(path, CURR_DIR);
5336 if (path[lstrlenA(path) - 1] != '\\')
5337 lstrcatA(path, "\\");
5338 lstrcatA(path, msifile);
5339 ptr = strchr(path, ':');
5340 ptr +=2;
5342 r = MsiInstallProductA(ptr, NULL);
5343 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5344 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5345 ok(delete_pf("msitest", FALSE), "File not installed\n");
5347 SetCurrentDirectoryA(CURR_DIR);
5349 DeleteFile(msifile);
5350 DeleteFile("msitest\\augustus");
5351 RemoveDirectory("msitest");
5352 RemoveDirectory("diffdir");
5355 static void set_admin_summary_info(const CHAR *name)
5357 MSIHANDLE db, summary;
5358 UINT r;
5360 r = MsiOpenDatabaseA(name, MSIDBOPEN_DIRECT, &db);
5361 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5363 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
5364 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5366 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
5367 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5369 /* write the summary changes back to the stream */
5370 r = MsiSummaryInfoPersist(summary);
5371 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5373 MsiCloseHandle(summary);
5375 r = MsiDatabaseCommit(db);
5376 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5378 MsiCloseHandle(db);
5381 static void test_admin(void)
5383 UINT r;
5385 CreateDirectoryA("msitest", NULL);
5386 create_file("msitest\\augustus", 500);
5388 create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
5389 set_admin_summary_info(msifile);
5391 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5393 r = MsiInstallProductA(msifile, NULL);
5394 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5395 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5396 ok(!delete_pf("msitest", FALSE), "File installed\n");
5397 ok(!DeleteFile("c:\\msitest\\augustus"), "File installed\n");
5398 ok(!RemoveDirectory("c:\\msitest"), "File installed\n");
5400 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
5401 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5402 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5403 ok(!delete_pf("msitest", FALSE), "File installed\n");
5404 todo_wine
5406 ok(DeleteFile("c:\\msitest\\augustus"), "File not installed\n");
5407 ok(RemoveDirectory("c:\\msitest"), "File not installed\n");
5410 DeleteFile(msifile);
5411 DeleteFile("msitest\\augustus");
5412 RemoveDirectory("msitest");
5415 static void set_admin_property_stream(LPCSTR file)
5417 IStorage *stg;
5418 IStream *stm;
5419 WCHAR fileW[MAX_PATH];
5420 HRESULT hr;
5421 DWORD count;
5422 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
5424 /* AdminProperties */
5425 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
5426 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',' ',
5427 'M','y','P','r','o','p','=','4','2',0};
5429 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
5431 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
5432 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
5433 if (!stg)
5434 return;
5436 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
5437 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
5439 hr = IStream_Write(stm, data, sizeof(data), &count);
5440 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
5442 IStream_Release(stm);
5443 IStorage_Release(stg);
5446 static void test_adminprops(void)
5448 UINT r;
5450 CreateDirectoryA("msitest", NULL);
5451 create_file("msitest\\augustus", 500);
5453 create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
5454 set_admin_summary_info(msifile);
5455 set_admin_property_stream(msifile);
5457 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5459 r = MsiInstallProductA(msifile, NULL);
5460 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5461 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
5462 ok(delete_pf("msitest", FALSE), "File installed\n");
5464 DeleteFile(msifile);
5465 DeleteFile("msitest\\augustus");
5466 RemoveDirectory("msitest");
5469 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
5471 CHAR path[MAX_PATH];
5473 lstrcpyA(path, PROG_FILES_DIR);
5474 lstrcatA(path, "\\");
5475 lstrcatA(path, file);
5477 if (is_file)
5478 create_file_data(path, data, 500);
5479 else
5480 CreateDirectoryA(path, NULL);
5483 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
5485 static void test_removefiles(void)
5487 UINT r;
5489 CreateDirectoryA("msitest", NULL);
5490 create_file("msitest\\hydrogen", 500);
5491 create_file("msitest\\helium", 500);
5492 create_file("msitest\\lithium", 500);
5494 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
5496 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
5498 r = MsiInstallProductA(msifile, NULL);
5499 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5500 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5501 ok(!pf_exists("msitest\\helium"), "File installed\n");
5502 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5503 ok(pf_exists("msitest"), "File not installed\n");
5505 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5506 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5507 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
5508 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
5509 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
5510 ok(delete_pf("msitest", FALSE), "File deleted\n");
5512 create_pf("msitest", FALSE);
5513 create_pf("msitest\\hydrogen", TRUE);
5514 create_pf("msitest\\helium", TRUE);
5515 create_pf("msitest\\lithium", TRUE);
5517 r = MsiInstallProductA(msifile, NULL);
5518 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5519 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5520 ok(pf_exists("msitest\\helium"), "File not installed\n");
5521 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5522 ok(pf_exists("msitest"), "File not installed\n");
5524 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5525 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5526 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
5527 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
5528 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
5529 ok(delete_pf("msitest", FALSE), "File deleted\n");
5531 create_pf("msitest", FALSE);
5532 create_pf("msitest\\furlong", TRUE);
5533 create_pf("msitest\\firkin", TRUE);
5534 create_pf("msitest\\fortnight", TRUE);
5535 create_pf("msitest\\becquerel", TRUE);
5536 create_pf("msitest\\dioptre", TRUE);
5537 create_pf("msitest\\attoparsec", TRUE);
5538 create_pf("msitest\\storeys", TRUE);
5539 create_pf("msitest\\block", TRUE);
5540 create_pf("msitest\\siriometer", TRUE);
5541 create_pf("msitest\\cabout", FALSE);
5542 create_pf("msitest\\cabout\\blocker", TRUE);
5544 r = MsiInstallProductA(msifile, NULL);
5545 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5546 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5547 ok(!pf_exists("msitest\\helium"), "File installed\n");
5548 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5549 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
5550 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
5551 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
5552 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
5553 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
5554 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
5555 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
5556 ok(!pf_exists("msitest\\block"), "File not deleted\n");
5557 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
5558 ok(pf_exists("msitest\\cabout"), "Directory removed\n");
5559 ok(pf_exists("msitest"), "File not installed\n");
5561 create_pf("msitest\\furlong", TRUE);
5562 create_pf("msitest\\firkin", TRUE);
5563 create_pf("msitest\\fortnight", TRUE);
5564 create_pf("msitest\\storeys", TRUE);
5565 create_pf("msitest\\block", TRUE);
5566 create_pf("msitest\\siriometer", TRUE);
5568 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5569 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5570 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
5571 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
5572 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
5573 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
5574 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
5575 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
5576 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
5577 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
5578 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
5579 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
5580 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
5581 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
5582 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
5583 ok(pf_exists("msitest"), "Directory deleted\n");
5585 r = MsiInstallProductA(msifile, NULL);
5586 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5587 ok(delete_pf("msitest\\hydrogen", TRUE), "File not installed\n");
5588 ok(!delete_pf("msitest\\helium", TRUE), "File installed\n");
5589 ok(delete_pf("msitest\\lithium", TRUE), "File not installed\n");
5590 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
5591 ok(pf_exists("msitest"), "Directory deleted\n");
5593 delete_pf("msitest\\cabout\\blocker", TRUE);
5595 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5596 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5597 ok(!delete_pf("msitest\\cabout", FALSE), "Directory not deleted\n");
5598 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
5600 DeleteFile(msifile);
5601 DeleteFile("msitest\\hydrogen");
5602 DeleteFile("msitest\\helium");
5603 DeleteFile("msitest\\lithium");
5604 RemoveDirectory("msitest");
5607 static void test_movefiles(void)
5609 UINT r;
5610 char props[MAX_PATH];
5612 CreateDirectoryA("msitest", NULL);
5613 create_file("msitest\\augustus", 100);
5614 create_file("cameroon", 100);
5615 create_file("djibouti", 100);
5616 create_file("egypt", 100);
5617 create_file("finland", 100);
5618 create_file("gambai", 100);
5619 create_file("honduras", 100);
5620 create_file("msitest\\india", 100);
5621 create_file("japan", 100);
5622 create_file("kenya", 100);
5623 CreateDirectoryA("latvia", NULL);
5624 create_file("nauru", 100);
5625 create_file("peru", 100);
5626 create_file("apple", 100);
5627 create_file("application", 100);
5628 create_file("ape", 100);
5629 create_file("foo", 100);
5630 create_file("fao", 100);
5631 create_file("fbod", 100);
5632 create_file("budding", 100);
5633 create_file("buddy", 100);
5634 create_file("bud", 100);
5635 create_file("bar", 100);
5636 create_file("bur", 100);
5637 create_file("bird", 100);
5639 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
5641 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
5643 /* if the source or dest property is not a full path,
5644 * windows tries to access it as a network resource
5647 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
5648 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
5649 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
5651 r = MsiInstallProductA(msifile, props);
5652 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5653 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5654 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
5655 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
5656 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
5657 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
5658 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
5659 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
5660 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
5661 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
5662 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
5663 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
5664 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
5665 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
5666 ok(delete_pf("msitest\\poland", TRUE), "File not moved\n");
5667 /* either apple or application will be moved depending on directory order */
5668 if (!delete_pf("msitest\\apple", TRUE))
5669 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
5670 else
5671 ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
5672 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
5673 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
5674 /* either fao or foo will be moved depending on directory order */
5675 if (delete_pf("msitest\\foo", TRUE))
5676 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
5677 else
5678 ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
5679 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
5680 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
5681 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
5682 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
5683 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
5684 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
5685 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
5686 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
5687 ok(delete_pf("msitest", FALSE), "File not installed\n");
5688 ok(DeleteFileA("cameroon"), "File moved\n");
5689 ok(!DeleteFileA("djibouti"), "File not moved\n");
5690 ok(DeleteFileA("egypt"), "File moved\n");
5691 ok(DeleteFileA("finland"), "File moved\n");
5692 ok(DeleteFileA("gambai"), "File moved\n");
5693 ok(!DeleteFileA("honduras"), "File not moved\n");
5694 ok(DeleteFileA("msitest\\india"), "File moved\n");
5695 ok(DeleteFileA("japan"), "File moved\n");
5696 ok(!DeleteFileA("kenya"), "File not moved\n");
5697 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
5698 ok(!DeleteFileA("nauru"), "File not moved\n");
5699 ok(!DeleteFileA("peru"), "File not moved\n");
5700 ok(!DeleteFileA("apple"), "File not moved\n");
5701 ok(!DeleteFileA("application"), "File not moved\n");
5702 ok(DeleteFileA("ape"), "File moved\n");
5703 ok(!DeleteFileA("foo"), "File not moved\n");
5704 ok(!DeleteFileA("fao"), "File not moved\n");
5705 ok(DeleteFileA("fbod"), "File moved\n");
5706 ok(!DeleteFileA("budding"), "File not moved\n");
5707 ok(!DeleteFileA("buddy"), "File not moved\n");
5708 ok(DeleteFileA("bud"), "File moved\n");
5709 ok(!DeleteFileA("bar"), "File not moved\n");
5710 ok(!DeleteFileA("bur"), "File not moved\n");
5711 ok(DeleteFileA("bird"), "File moved\n");
5713 DeleteFile("msitest\\augustus");
5714 RemoveDirectory("msitest");
5715 DeleteFile(msifile);
5718 static void test_missingcab(void)
5720 UINT r;
5722 CreateDirectoryA("msitest", NULL);
5723 create_file("msitest\\augustus", 500);
5724 create_file("maximus", 500);
5726 create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
5728 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5730 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
5732 create_pf("msitest", FALSE);
5733 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
5735 r = MsiInstallProductA(msifile, NULL);
5736 ok(r == ERROR_SUCCESS ||
5737 broken(r == ERROR_INSTALL_FAILURE), /* win9x */
5738 "Expected ERROR_SUCCESS, got %u\n", r);
5739 if (r == ERROR_SUCCESS)
5741 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5742 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
5744 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
5745 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
5746 ok(delete_pf("msitest", FALSE), "File not installed\n");
5748 create_pf("msitest", FALSE);
5749 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
5750 create_pf("msitest\\gaius", TRUE);
5752 r = MsiInstallProductA(msifile, "GAIUS=1");
5753 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5754 todo_wine
5756 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
5757 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5759 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
5760 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
5761 ok(delete_pf("msitest", FALSE), "File not installed\n");
5763 DeleteFile("msitest\\augustus");
5764 RemoveDirectory("msitest");
5765 DeleteFile("maximus");
5766 DeleteFile("test1.cab");
5767 DeleteFile(msifile);
5770 static void test_duplicatefiles(void)
5772 UINT r;
5774 CreateDirectoryA("msitest", NULL);
5775 create_file("msitest\\maximus", 500);
5776 create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
5778 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5780 /* fails if the destination folder is not a valid property */
5782 r = MsiInstallProductA(msifile, NULL);
5783 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5784 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
5785 ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
5786 ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
5787 ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "File not duplicated\n");
5788 ok(delete_pf("msitest\\this\\doesnot", FALSE), "File not duplicated\n");
5789 ok(delete_pf("msitest\\this", FALSE), "File not duplicated\n");
5790 ok(delete_pf("msitest", FALSE), "File not installed\n");
5792 DeleteFile("msitest\\maximus");
5793 RemoveDirectory("msitest");
5794 DeleteFile(msifile);
5797 static void test_writeregistryvalues(void)
5799 UINT r;
5800 LONG res;
5801 HKEY hkey;
5802 DWORD type, size;
5803 CHAR path[MAX_PATH];
5805 CreateDirectoryA("msitest", NULL);
5806 create_file("msitest\\augustus", 500);
5808 create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
5810 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5812 r = MsiInstallProductA(msifile, NULL);
5813 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5814 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
5815 ok(delete_pf("msitest", FALSE), "File installed\n");
5817 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
5818 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5820 size = MAX_PATH;
5821 type = REG_MULTI_SZ;
5822 memset(path, 'a', MAX_PATH);
5823 res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size);
5824 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5825 ok(!memcmp(path, "one\0two\0three\0\0", size), "Wrong multi-sz data\n");
5826 ok(size == 15, "Expected 15, got %d\n", size);
5827 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5829 DeleteFile(msifile);
5830 DeleteFile("msitest\\augustus");
5831 RemoveDirectory("msitest");
5833 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
5834 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine");
5837 static void test_sourcefolder(void)
5839 UINT r;
5841 CreateDirectoryA("msitest", NULL);
5842 create_file("augustus", 500);
5844 create_database(msifile, sf_tables, sizeof(sf_tables) / sizeof(msi_table));
5846 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5848 r = MsiInstallProductA(msifile, NULL);
5849 ok(r == ERROR_INSTALL_FAILURE,
5850 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5851 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5852 todo_wine
5854 ok(!delete_pf("msitest", FALSE), "File installed\n");
5857 RemoveDirectoryA("msitest");
5859 r = MsiInstallProductA(msifile, NULL);
5860 ok(r == ERROR_INSTALL_FAILURE,
5861 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5862 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5863 todo_wine
5865 ok(!delete_pf("msitest", FALSE), "File installed\n");
5868 DeleteFile(msifile);
5869 DeleteFile("augustus");
5872 static void test_customaction51(void)
5874 UINT r;
5876 CreateDirectoryA("msitest", NULL);
5877 create_file("msitest\\augustus", 500);
5879 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
5881 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5883 r = MsiInstallProductA(msifile, NULL);
5884 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5885 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
5886 ok(delete_pf("msitest", FALSE), "File installed\n");
5888 DeleteFile(msifile);
5889 DeleteFile("msitest\\augustus");
5890 RemoveDirectory("msitest");
5893 static void test_installstate(void)
5895 UINT r;
5897 CreateDirectoryA("msitest", NULL);
5898 create_file("msitest\\alpha", 500);
5899 create_file("msitest\\beta", 500);
5900 create_file("msitest\\gamma", 500);
5901 create_file("msitest\\theta", 500);
5902 create_file("msitest\\delta", 500);
5903 create_file("msitest\\epsilon", 500);
5904 create_file("msitest\\zeta", 500);
5905 create_file("msitest\\iota", 500);
5906 create_file("msitest\\eta", 500);
5907 create_file("msitest\\kappa", 500);
5908 create_file("msitest\\lambda", 500);
5909 create_file("msitest\\mu", 500);
5911 create_database(msifile, is_tables, sizeof(is_tables) / sizeof(msi_table));
5913 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5915 r = MsiInstallProductA(msifile, NULL);
5916 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5917 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
5918 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
5919 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
5920 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
5921 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
5922 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
5923 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
5924 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
5925 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
5926 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
5927 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
5928 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
5929 ok(delete_pf("msitest", FALSE), "File not installed\n");
5931 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
5932 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5933 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
5934 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
5935 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
5936 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
5937 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
5938 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
5939 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
5940 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
5941 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
5942 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
5943 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
5944 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
5945 ok(delete_pf("msitest", FALSE), "File not installed\n");
5947 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
5948 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5949 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
5950 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
5951 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
5952 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
5953 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
5954 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
5955 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
5956 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
5957 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
5958 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
5959 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
5960 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
5961 ok(delete_pf("msitest", FALSE), "File not installed\n");
5963 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
5964 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5965 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
5966 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
5967 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
5968 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
5969 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
5970 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
5971 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
5972 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
5973 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
5974 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
5975 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
5976 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
5977 ok(!delete_pf("msitest", FALSE), "File installed\n");
5979 DeleteFile(msifile);
5980 DeleteFile("msitest\\alpha");
5981 DeleteFile("msitest\\beta");
5982 DeleteFile("msitest\\gamma");
5983 DeleteFile("msitest\\theta");
5984 DeleteFile("msitest\\delta");
5985 DeleteFile("msitest\\epsilon");
5986 DeleteFile("msitest\\zeta");
5987 DeleteFile("msitest\\iota");
5988 DeleteFile("msitest\\eta");
5989 DeleteFile("msitest\\kappa");
5990 DeleteFile("msitest\\lambda");
5991 DeleteFile("msitest\\mu");
5992 RemoveDirectory("msitest");
5995 struct sourcepathmap
5997 BOOL sost; /* shortone\shorttwo */
5998 BOOL solt; /* shortone\longtwo */
5999 BOOL lost; /* longone\shorttwo */
6000 BOOL lolt; /* longone\longtwo */
6001 BOOL soste; /* shortone\shorttwo source exists */
6002 BOOL solte; /* shortone\longtwo source exists */
6003 BOOL loste; /* longone\shorttwo source exists */
6004 BOOL lolte; /* longone\longtwo source exists */
6005 UINT err;
6006 DWORD size;
6007 } spmap[256] =
6009 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6010 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6011 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6012 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6013 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6014 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6015 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6016 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6017 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6018 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6019 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6020 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6021 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6022 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6023 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6024 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6025 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6026 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6027 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6028 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6029 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6030 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6031 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6032 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6033 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6034 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6035 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6036 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6037 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6038 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6039 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6040 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6041 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6042 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6043 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6044 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6045 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6046 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6047 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6048 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6049 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6050 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6051 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6052 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6053 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6054 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6055 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6056 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6057 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6058 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6059 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6060 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6061 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6062 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6063 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6064 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6065 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6066 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6067 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6068 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6069 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6070 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6071 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6072 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6073 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6074 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6075 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6076 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6077 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6078 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6079 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6080 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6081 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6082 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6083 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6084 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6085 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6086 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6087 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6088 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6089 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6090 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6091 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6092 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6093 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6094 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6095 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6096 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6097 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6098 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6099 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6100 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6101 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6102 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6103 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6104 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6105 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6106 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6107 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6108 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6109 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6110 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6111 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6112 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6113 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6114 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6115 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6116 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6117 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6118 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6119 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6120 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6121 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6122 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6123 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6124 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6125 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6126 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6127 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6128 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6129 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6130 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6131 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6132 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6133 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6134 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6135 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6136 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6137 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6138 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6139 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6140 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6141 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6142 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6143 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6144 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6145 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6146 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6147 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6148 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6149 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6150 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6151 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6152 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6153 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6154 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6155 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6156 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6157 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6158 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6159 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6160 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6161 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6162 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6163 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6164 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6165 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6166 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6167 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6168 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6169 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6170 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6171 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6172 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6173 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6174 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6175 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6176 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6177 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6178 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6179 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6180 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6181 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6182 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6183 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6184 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6185 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6186 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6187 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6188 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6189 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6190 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6191 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6192 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6193 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6194 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6195 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6196 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6197 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6198 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6199 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6200 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6201 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6202 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6203 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6204 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6205 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6206 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6207 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6208 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6209 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6210 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6211 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6212 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6213 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6214 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6215 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6216 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6217 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6218 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6219 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6220 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6221 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6222 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6223 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6224 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6225 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6226 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6227 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6228 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6229 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6230 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6231 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6232 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6233 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6234 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6235 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6236 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6237 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6238 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6239 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6240 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6241 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6242 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6243 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6244 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6245 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6246 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6247 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6248 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6249 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6250 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6251 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6252 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6253 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6254 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6255 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6256 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6257 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6258 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6259 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6260 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6261 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6262 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6263 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6264 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6267 static DWORD get_pf_file_size(LPCSTR file)
6269 CHAR path[MAX_PATH];
6270 HANDLE hfile;
6271 DWORD size;
6273 lstrcpyA(path, PROG_FILES_DIR);
6274 lstrcatA(path, "\\");
6275 lstrcatA(path, file);
6277 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
6278 if (hfile == INVALID_HANDLE_VALUE)
6279 return 0;
6281 size = GetFileSize(hfile, NULL);
6282 CloseHandle(hfile);
6283 return size;
6286 static void test_sourcepath(void)
6288 UINT r, i;
6290 if (!winetest_interactive)
6292 skip("Run in interactive mode to run source path tests.\n");
6293 return;
6296 create_database(msifile, sp_tables, sizeof(sp_tables) / sizeof(msi_table));
6298 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6300 for (i = 0; i < sizeof(spmap) / sizeof(spmap[0]); i++)
6302 if (spmap[i].sost)
6304 CreateDirectoryA("shortone", NULL);
6305 CreateDirectoryA("shortone\\shorttwo", NULL);
6308 if (spmap[i].solt)
6310 CreateDirectoryA("shortone", NULL);
6311 CreateDirectoryA("shortone\\longtwo", NULL);
6314 if (spmap[i].lost)
6316 CreateDirectoryA("longone", NULL);
6317 CreateDirectoryA("longone\\shorttwo", NULL);
6320 if (spmap[i].lolt)
6322 CreateDirectoryA("longone", NULL);
6323 CreateDirectoryA("longone\\longtwo", NULL);
6326 if (spmap[i].soste)
6327 create_file("shortone\\shorttwo\\augustus", 50);
6328 if (spmap[i].solte)
6329 create_file("shortone\\longtwo\\augustus", 100);
6330 if (spmap[i].loste)
6331 create_file("longone\\shorttwo\\augustus", 150);
6332 if (spmap[i].lolte)
6333 create_file("longone\\longtwo\\augustus", 200);
6335 r = MsiInstallProductA(msifile, NULL);
6336 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
6337 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
6338 "%d: Expected %d, got %d\n", i, spmap[i].size,
6339 get_pf_file_size("msitest\\augustus"));
6341 if (r == ERROR_SUCCESS)
6343 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
6344 ok(delete_pf("msitest", FALSE), "%d: File not installed\n", i);
6346 else
6348 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
6349 todo_wine ok(!delete_pf("msitest", FALSE), "%d: File installed\n", i);
6352 DeleteFileA("shortone\\shorttwo\\augustus");
6353 DeleteFileA("shortone\\longtwo\\augustus");
6354 DeleteFileA("longone\\shorttwo\\augustus");
6355 DeleteFileA("longone\\longtwo\\augustus");
6356 RemoveDirectoryA("shortone\\shorttwo");
6357 RemoveDirectoryA("shortone\\longtwo");
6358 RemoveDirectoryA("longone\\shorttwo");
6359 RemoveDirectoryA("longone\\longtwo");
6360 RemoveDirectoryA("shortone");
6361 RemoveDirectoryA("longone");
6364 DeleteFileA(msifile);
6367 static void test_MsiConfigureProductEx(void)
6369 UINT r;
6370 LONG res;
6371 DWORD type, size;
6372 HKEY props, source;
6373 CHAR keypath[MAX_PATH * 2];
6374 CHAR localpack[MAX_PATH];
6376 if (on_win9x)
6378 win_skip("Different registry keys on Win9x and WinMe\n");
6379 return;
6382 CreateDirectoryA("msitest", NULL);
6383 create_file("msitest\\hydrogen", 500);
6384 create_file("msitest\\helium", 500);
6385 create_file("msitest\\lithium", 500);
6387 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
6389 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6391 /* NULL szProduct */
6392 r = MsiConfigureProductExA(NULL, INSTALLLEVEL_DEFAULT,
6393 INSTALLSTATE_DEFAULT, "PROPVAR=42");
6394 ok(r == ERROR_INVALID_PARAMETER,
6395 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6397 /* empty szProduct */
6398 r = MsiConfigureProductExA("", INSTALLLEVEL_DEFAULT,
6399 INSTALLSTATE_DEFAULT, "PROPVAR=42");
6400 ok(r == ERROR_INVALID_PARAMETER,
6401 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6403 /* garbage szProduct */
6404 r = MsiConfigureProductExA("garbage", INSTALLLEVEL_DEFAULT,
6405 INSTALLSTATE_DEFAULT, "PROPVAR=42");
6406 ok(r == ERROR_INVALID_PARAMETER,
6407 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6409 /* guid without brackets */
6410 r = MsiConfigureProductExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
6411 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6412 "PROPVAR=42");
6413 ok(r == ERROR_INVALID_PARAMETER,
6414 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6416 /* guid with brackets */
6417 r = MsiConfigureProductExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
6418 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6419 "PROPVAR=42");
6420 ok(r == ERROR_UNKNOWN_PRODUCT,
6421 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
6423 /* same length as guid, but random */
6424 r = MsiConfigureProductExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93",
6425 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6426 "PROPVAR=42");
6427 ok(r == ERROR_UNKNOWN_PRODUCT,
6428 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
6430 /* product not installed yet */
6431 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6432 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6433 "PROPVAR=42");
6434 ok(r == ERROR_UNKNOWN_PRODUCT,
6435 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
6437 /* install the product, per-user unmanaged */
6438 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
6439 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6440 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6441 ok(pf_exists("msitest\\helium"), "File not installed\n");
6442 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6443 ok(pf_exists("msitest"), "File not installed\n");
6445 /* product is installed per-user managed, remove it */
6446 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6447 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6448 "PROPVAR=42");
6449 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6450 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6451 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6452 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6453 todo_wine
6455 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6458 /* product has been removed */
6459 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6460 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6461 "PROPVAR=42");
6462 ok(r == ERROR_UNKNOWN_PRODUCT,
6463 "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
6465 /* install the product, machine */
6466 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6467 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6468 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6469 ok(pf_exists("msitest\\helium"), "File not installed\n");
6470 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6471 ok(pf_exists("msitest"), "File not installed\n");
6473 /* product is installed machine, remove it */
6474 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6475 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6476 "PROPVAR=42");
6477 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6478 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6479 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6480 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6481 todo_wine
6483 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6486 /* product has been removed */
6487 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6488 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6489 "PROPVAR=42");
6490 ok(r == ERROR_UNKNOWN_PRODUCT,
6491 "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
6493 /* install the product, machine */
6494 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6495 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6496 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6497 ok(pf_exists("msitest\\helium"), "File not installed\n");
6498 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6499 ok(pf_exists("msitest"), "File not installed\n");
6501 DeleteFileA(msifile);
6503 /* local msifile is removed */
6504 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6505 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6506 "PROPVAR=42");
6507 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6508 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6509 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6510 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6511 todo_wine
6513 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6516 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
6518 /* install the product, machine */
6519 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6520 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6521 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6522 ok(pf_exists("msitest\\helium"), "File not installed\n");
6523 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6524 ok(pf_exists("msitest"), "File not installed\n");
6526 DeleteFileA(msifile);
6528 lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
6529 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
6530 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties");
6532 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
6533 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6535 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
6536 (const BYTE *)"C:\\idontexist.msi", 18);
6537 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6539 /* LocalPackage is used to find the cached msi package */
6540 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6541 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6542 "PROPVAR=42");
6543 ok(r == ERROR_INSTALL_SOURCE_ABSENT,
6544 "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
6545 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6546 ok(pf_exists("msitest\\helium"), "File not installed\n");
6547 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6548 ok(pf_exists("msitest"), "File not installed\n");
6550 RegCloseKey(props);
6551 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
6553 /* LastUsedSource (local msi package) can be used as a last resort */
6554 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6555 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6556 "PROPVAR=42");
6557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6558 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6559 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6560 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6561 todo_wine
6563 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6566 /* install the product, machine */
6567 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6568 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6569 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6570 ok(pf_exists("msitest\\helium"), "File not installed\n");
6571 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6572 ok(pf_exists("msitest"), "File not installed\n");
6574 lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
6575 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
6576 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties");
6578 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
6579 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6581 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
6582 (const BYTE *)"C:\\idontexist.msi", 18);
6583 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6585 lstrcpyA(keypath, "SOFTWARE\\Classes\\Installer\\Products\\");
6586 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\SourceList");
6588 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &source);
6589 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6591 type = REG_SZ;
6592 size = MAX_PATH;
6593 res = RegQueryValueExA(source, "PackageName", NULL, &type,
6594 (LPBYTE)localpack, &size);
6595 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6597 res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
6598 (const BYTE *)"idontexist.msi", 15);
6599 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6601 /* SourceList is altered */
6602 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6603 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6604 "PROPVAR=42");
6605 ok(r == ERROR_INSTALL_SOURCE_ABSENT,
6606 "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
6607 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6608 ok(pf_exists("msitest\\helium"), "File not installed\n");
6609 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6610 ok(pf_exists("msitest"), "File not installed\n");
6612 /* restore the SourceList */
6613 res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
6614 (const BYTE *)localpack, lstrlenA(localpack) + 1);
6615 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6617 /* finally remove the product */
6618 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6619 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6620 "PROPVAR=42");
6621 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6622 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6623 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6624 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6625 todo_wine
6627 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6630 DeleteFileA(msifile);
6631 RegCloseKey(source);
6632 RegCloseKey(props);
6633 DeleteFileA("msitest\\hydrogen");
6634 DeleteFileA("msitest\\helium");
6635 DeleteFileA("msitest\\lithium");
6636 RemoveDirectoryA("msitest");
6639 static void test_missingcomponent(void)
6641 UINT r;
6643 CreateDirectoryA("msitest", NULL);
6644 create_file("msitest\\hydrogen", 500);
6645 create_file("msitest\\helium", 500);
6646 create_file("msitest\\lithium", 500);
6647 create_file("beryllium", 500);
6649 create_database(msifile, mcomp_tables, sizeof(mcomp_tables) / sizeof(msi_table));
6651 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6653 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
6654 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6655 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6656 ok(pf_exists("msitest\\helium"), "File not installed\n");
6657 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6658 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
6659 ok(pf_exists("msitest"), "File not installed\n");
6661 r = MsiInstallProductA(msifile, "REMOVE=ALL INSTALLLEVEL=10 PROPVAR=42");
6662 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6663 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6664 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6665 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6666 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
6667 todo_wine
6669 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6672 DeleteFileA(msifile);
6673 DeleteFileA("msitest\\hydrogen");
6674 DeleteFileA("msitest\\helium");
6675 DeleteFileA("msitest\\lithium");
6676 DeleteFileA("beryllium");
6677 RemoveDirectoryA("msitest");
6680 static void test_sourcedirprop(void)
6682 UINT r;
6683 CHAR props[MAX_PATH];
6685 CreateDirectoryA("msitest", NULL);
6686 create_file("msitest\\augustus", 500);
6688 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
6690 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6692 r = MsiInstallProductA(msifile, NULL);
6693 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6694 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
6695 ok(delete_pf("msitest", FALSE), "File installed\n");
6697 DeleteFile("msitest\\augustus");
6698 RemoveDirectory("msitest");
6700 CreateDirectoryA("altsource", NULL);
6701 CreateDirectoryA("altsource\\msitest", NULL);
6702 create_file("altsource\\msitest\\augustus", 500);
6704 sprintf(props, "SRCDIR=%s\\altsource\\", CURR_DIR);
6706 r = MsiInstallProductA(msifile, props);
6707 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6708 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
6709 ok(delete_pf("msitest", FALSE), "File installed\n");
6711 DeleteFile(msifile);
6712 DeleteFile("altsource\\msitest\\augustus");
6713 RemoveDirectory("altsource\\msitest");
6714 RemoveDirectory("altsource");
6717 static void test_adminimage(void)
6719 UINT r;
6721 CreateDirectoryA("msitest", NULL);
6722 CreateDirectoryA("msitest\\first", NULL);
6723 CreateDirectoryA("msitest\\second", NULL);
6724 CreateDirectoryA("msitest\\cabout", NULL);
6725 CreateDirectoryA("msitest\\cabout\\new", NULL);
6726 create_file("msitest\\one.txt", 100);
6727 create_file("msitest\\first\\two.txt", 100);
6728 create_file("msitest\\second\\three.txt", 100);
6729 create_file("msitest\\cabout\\four.txt", 100);
6730 create_file("msitest\\cabout\\new\\five.txt", 100);
6731 create_file("msitest\\filename", 100);
6732 create_file("msitest\\service.exe", 100);
6734 create_database_wordcount(msifile, ai_tables,
6735 sizeof(ai_tables) / sizeof(msi_table),
6736 msidbSumInfoSourceTypeAdminImage);
6738 r = MsiInstallProductA(msifile, NULL);
6739 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6741 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
6742 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
6743 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
6744 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
6745 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
6746 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
6747 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
6748 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
6749 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
6750 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
6751 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
6752 ok(delete_pf("msitest", FALSE), "File not installed\n");
6754 DeleteFileA("msitest.msi");
6755 DeleteFileA("msitest\\cabout\\new\\five.txt");
6756 DeleteFileA("msitest\\cabout\\four.txt");
6757 DeleteFileA("msitest\\second\\three.txt");
6758 DeleteFileA("msitest\\first\\two.txt");
6759 DeleteFileA("msitest\\one.txt");
6760 DeleteFileA("msitest\\service.exe");
6761 DeleteFileA("msitest\\filename");
6762 RemoveDirectoryA("msitest\\cabout\\new");
6763 RemoveDirectoryA("msitest\\cabout");
6764 RemoveDirectoryA("msitest\\second");
6765 RemoveDirectoryA("msitest\\first");
6766 RemoveDirectoryA("msitest");
6769 static void test_propcase(void)
6771 UINT r;
6773 CreateDirectoryA("msitest", NULL);
6774 create_file("msitest\\augustus", 500);
6776 create_database(msifile, pc_tables, sizeof(pc_tables) / sizeof(msi_table));
6778 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6780 r = MsiInstallProductA(msifile, "MyProp=42");
6781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6782 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
6783 ok(delete_pf("msitest", FALSE), "File not installed\n");
6785 DeleteFile(msifile);
6786 DeleteFile("msitest\\augustus");
6787 RemoveDirectory("msitest");
6790 static void test_int_widths( void )
6792 static const char int0[] = "int0\ni0\nint0\tint0\n1";
6793 static const char int1[] = "int1\ni1\nint1\tint1\n1";
6794 static const char int2[] = "int2\ni2\nint2\tint2\n1";
6795 static const char int3[] = "int3\ni3\nint3\tint3\n1";
6796 static const char int4[] = "int4\ni4\nint4\tint4\n1";
6797 static const char int5[] = "int5\ni5\nint5\tint5\n1";
6798 static const char int8[] = "int8\ni8\nint8\tint8\n1";
6800 static const struct
6802 const char *data;
6803 unsigned int size;
6804 UINT ret;
6806 tests[] =
6808 { int0, sizeof(int0) - 1, ERROR_SUCCESS },
6809 { int1, sizeof(int1) - 1, ERROR_SUCCESS },
6810 { int2, sizeof(int2) - 1, ERROR_SUCCESS },
6811 { int3, sizeof(int3) - 1, ERROR_FUNCTION_FAILED },
6812 { int4, sizeof(int4) - 1, ERROR_SUCCESS },
6813 { int5, sizeof(int5) - 1, ERROR_FUNCTION_FAILED },
6814 { int8, sizeof(int8) - 1, ERROR_FUNCTION_FAILED }
6817 char tmpdir[MAX_PATH], msitable[MAX_PATH], msidb[MAX_PATH];
6818 MSIHANDLE db;
6819 UINT r, i;
6821 GetTempPathA(MAX_PATH, tmpdir);
6822 CreateDirectoryA(tmpdir, NULL);
6824 strcpy(msitable, tmpdir);
6825 strcat(msitable, "\\msitable.idt");
6827 strcpy(msidb, tmpdir);
6828 strcat(msidb, "\\msitest.msi");
6830 r = MsiOpenDatabaseA(msidb, MSIDBOPEN_CREATE, &db);
6831 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6833 for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
6835 write_file(msitable, tests[i].data, tests[i].size);
6837 r = MsiDatabaseImportA(db, tmpdir, "msitable.idt");
6838 ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r);
6840 r = MsiDatabaseCommit(db);
6841 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6842 DeleteFileA(msitable);
6845 MsiCloseHandle(db);
6846 DeleteFileA(msidb);
6847 RemoveDirectoryA(tmpdir);
6850 static void test_shortcut(void)
6852 UINT r;
6853 HRESULT hr;
6855 create_test_files();
6856 create_database(msifile, sc_tables, sizeof(sc_tables) / sizeof(msi_table));
6858 r = MsiInstallProductA(msifile, NULL);
6859 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6861 hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
6862 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
6864 r = MsiInstallProductA(msifile, NULL);
6865 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6867 CoUninitialize();
6869 hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
6870 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
6872 r = MsiInstallProductA(msifile, NULL);
6873 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6875 CoUninitialize();
6877 delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
6878 delete_pf("msitest\\cabout\\new", FALSE);
6879 delete_pf("msitest\\cabout\\four.txt", TRUE);
6880 delete_pf("msitest\\cabout", FALSE);
6881 delete_pf("msitest\\changed\\three.txt", TRUE);
6882 delete_pf("msitest\\changed", FALSE);
6883 delete_pf("msitest\\first\\two.txt", TRUE);
6884 delete_pf("msitest\\first", FALSE);
6885 delete_pf("msitest\\filename", TRUE);
6886 delete_pf("msitest\\one.txt", TRUE);
6887 delete_pf("msitest\\service.exe", TRUE);
6888 delete_pf("msitest\\Shortcut.lnk", TRUE);
6889 delete_pf("msitest", FALSE);
6890 delete_test_files();
6893 static void test_envvar(void)
6895 UINT r;
6896 HKEY env;
6897 LONG res;
6898 DWORD type, size;
6899 char buffer[16];
6900 UINT i;
6902 if (on_win9x)
6904 win_skip("Environment variables are handled differently on Win9x and WinMe\n");
6905 return;
6908 create_test_files();
6909 create_database(msifile, env_tables, sizeof(env_tables) / sizeof(msi_table));
6911 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Environment", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &env, NULL);
6912 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6914 res = RegSetValueExA(env, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"0", 2);
6915 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6917 res = RegSetValueExA(env, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"0", 2);
6918 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6920 r = MsiInstallProductA(msifile, NULL);
6921 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6923 type = REG_NONE;
6924 size = sizeof(buffer);
6925 buffer[0] = 0;
6926 res = RegQueryValueExA(env, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
6927 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6928 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
6929 ok(!lstrcmp(buffer, "1"), "Expected \"1\", got %s\n", buffer);
6931 res = RegDeleteValueA(env, "MSITESTVAR1");
6932 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6934 type = REG_NONE;
6935 size = sizeof(buffer);
6936 buffer[0] = 0;
6937 res = RegQueryValueExA(env, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
6938 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6939 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
6940 ok(!lstrcmp(buffer, "1"), "Expected \"1\", got %s\n", buffer);
6942 res = RegDeleteValueA(env, "MSITESTVAR2");
6943 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6945 res = RegDeleteValueA(env, "MSITESTVAR3");
6946 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6948 res = RegDeleteValueA(env, "MSITESTVAR4");
6949 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6951 res = RegDeleteValueA(env, "MSITESTVAR5");
6952 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6954 res = RegDeleteValueA(env, "MSITESTVAR6");
6955 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6957 res = RegDeleteValueA(env, "MSITESTVAR7");
6958 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6960 res = RegDeleteValueA(env, "MSITESTVAR8");
6961 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6963 res = RegDeleteValueA(env, "MSITESTVAR9");
6964 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6966 res = RegDeleteValueA(env, "MSITESTVAR10");
6967 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6969 i = 11;
6970 while (environment_dat_results[(i-11)]) {
6971 char name[20];
6972 sprintf(name, "MSITESTVAR%d", i);
6974 type = REG_NONE;
6975 size = sizeof(buffer);
6976 buffer[0] = 0;
6977 res = RegQueryValueExA(env, name, NULL, &type, (LPBYTE)buffer, &size);
6978 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
6979 ok(type == REG_SZ, "%d: Expected REG_SZ, got %u\n", i, type);
6980 ok(!lstrcmp(buffer, environment_dat_results[(i-11)]), "%d: Expected %s, got %s\n",
6981 i, environment_dat_results[(i-11)], buffer);
6983 res = RegDeleteValueA(env, name);
6984 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
6985 i++;
6989 RegCloseKey(env);
6990 delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
6991 delete_pf("msitest\\cabout\\new", FALSE);
6992 delete_pf("msitest\\cabout\\four.txt", TRUE);
6993 delete_pf("msitest\\cabout", FALSE);
6994 delete_pf("msitest\\changed\\three.txt", TRUE);
6995 delete_pf("msitest\\changed", FALSE);
6996 delete_pf("msitest\\first\\two.txt", TRUE);
6997 delete_pf("msitest\\first", FALSE);
6998 delete_pf("msitest\\filename", TRUE);
6999 delete_pf("msitest\\one.txt", TRUE);
7000 delete_pf("msitest\\service.exe", TRUE);
7001 delete_pf("msitest", FALSE);
7002 delete_test_files();
7005 static void test_preselected(void)
7007 UINT r;
7009 create_test_files();
7010 create_database(msifile, ps_tables, sizeof(ps_tables) / sizeof(msi_table));
7012 r = MsiInstallProductA(msifile, "ADDLOCAL=One");
7013 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7015 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
7016 ok(!delete_pf("msitest\\cabout\\new", FALSE), "File installed\n");
7017 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
7018 ok(!delete_pf("msitest\\cabout", FALSE), "File installed\n");
7019 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
7020 ok(!delete_pf("msitest\\changed", FALSE), "File installed\n");
7021 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
7022 ok(!delete_pf("msitest\\first", FALSE), "File installed\n");
7023 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
7024 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
7025 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
7026 ok(delete_pf("msitest", FALSE), "File not installed\n");
7028 r = MsiInstallProductA(msifile, NULL);
7029 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7031 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7032 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7033 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7034 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7035 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7036 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7037 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7038 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7039 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7040 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7041 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7042 ok(delete_pf("msitest", FALSE), "File not installed\n");
7043 delete_test_files();
7046 static void test_installed_prop(void)
7048 static char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}";
7049 UINT r;
7051 create_test_files();
7052 create_database(msifile, ip_tables, sizeof(ip_tables) / sizeof(msi_table));
7054 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7056 r = MsiInstallProductA(msifile, "FULL=1");
7057 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7059 r = MsiInstallProductA(msifile, "FULL=1");
7060 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7062 r = MsiConfigureProductExA(prodcode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, "FULL=1");
7063 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7065 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7066 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7067 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7068 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7069 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7070 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7071 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7072 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7073 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7074 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7075 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7076 ok(delete_pf("msitest", FALSE), "File not installed\n");
7078 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7079 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7081 delete_test_files();
7084 static void test_allusers_prop(void)
7086 UINT r;
7088 create_test_files();
7089 create_database(msifile, aup_tables, sizeof(aup_tables) / sizeof(msi_table));
7091 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7093 /* ALLUSERS property unset */
7094 r = MsiInstallProductA(msifile, "FULL=1");
7095 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7097 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7098 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7099 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7100 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7101 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7102 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7103 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7104 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7105 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7106 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7107 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7108 ok(delete_pf("msitest", FALSE), "File not installed\n");
7110 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7111 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7113 delete_test_files();
7115 create_test_files();
7116 create_database(msifile, aup2_tables, sizeof(aup2_tables) / sizeof(msi_table));
7118 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7120 /* ALLUSERS property set to 1 */
7121 r = MsiInstallProductA(msifile, "FULL=1");
7122 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7124 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7125 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7126 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7127 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7128 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7129 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7130 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7131 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7132 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7133 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7134 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7135 ok(delete_pf("msitest", FALSE), "File not installed\n");
7137 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7138 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7140 delete_test_files();
7142 create_test_files();
7143 create_database(msifile, aup3_tables, sizeof(aup3_tables) / sizeof(msi_table));
7145 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7147 /* ALLUSERS property set to 2 */
7148 r = MsiInstallProductA(msifile, "FULL=1");
7149 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7151 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7152 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7153 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7154 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7155 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7156 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7157 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7158 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7159 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7160 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7161 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7162 ok(delete_pf("msitest", FALSE), "File not installed\n");
7164 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7165 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7167 delete_test_files();
7169 create_test_files();
7170 create_database(msifile, aup4_tables, sizeof(aup4_tables) / sizeof(msi_table));
7172 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7174 /* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */
7175 r = MsiInstallProductA(msifile, "FULL=1");
7176 if (r == ERROR_SUCCESS)
7178 /* Win9x/WinMe */
7179 win_skip("Win9x and WinMe act differently with respect to ALLUSERS\n");
7181 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7182 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7183 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7184 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7185 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7186 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7187 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7188 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7189 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7190 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7191 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7192 ok(delete_pf("msitest", FALSE), "File not installed\n");
7194 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7195 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7197 delete_test_files();
7199 else
7200 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7203 static char session_manager[] = "System\\CurrentControlSet\\Control\\Session Manager";
7204 static char rename_ops[] = "PendingFileRenameOperations";
7206 static void process_pending_renames(HKEY hkey)
7208 char *buf, *src, *dst;
7209 DWORD size;
7210 LONG ret;
7212 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size);
7213 buf = HeapAlloc(GetProcessHeap(), 0, size);
7214 buf[0] = 0;
7216 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size);
7217 ok(!ret, "RegQueryValueExA failed %d (%u)\n", ret, GetLastError());
7218 ok(strstr(buf, "msitest\\maximus") != NULL, "Unexpected value \"%s\"\n", buf);
7220 for (src = buf; *src; src = dst + strlen(dst) + 1)
7222 DWORD flags = MOVEFILE_COPY_ALLOWED;
7224 dst = src + strlen(src) + 1;
7225 if (*dst == '!')
7227 flags |= MOVEFILE_REPLACE_EXISTING;
7228 dst++;
7230 if (src[0] == '\\' && src[1] == '?' && src[2] == '?' && src[3] == '\\') src += 4;
7231 if (*dst)
7233 if (dst[0] == '\\' && dst[1] == '?' && dst[2] == '?' && dst[3] == '\\') dst += 4;
7234 ok(MoveFileExA(src, dst, flags), "Failed to move file %s -> %s (%u)\n", src, dst, GetLastError());
7236 else
7237 ok(DeleteFileA(src), "Failed to delete file %s (%u)\n", src, GetLastError());
7239 HeapFree(GetProcessHeap(), 0, buf);
7240 RegDeleteValueA(hkey, rename_ops);
7243 static BOOL file_matches_data(LPCSTR file, LPCSTR data)
7245 DWORD len, data_len = strlen(data);
7246 HANDLE handle;
7247 char buf[128];
7249 handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
7250 ok(handle != INVALID_HANDLE_VALUE, "failed to open %s (%u)\n", file, GetLastError());
7252 if (ReadFile(handle, buf, sizeof(buf), &len, NULL) && len >= data_len)
7254 CloseHandle(handle);
7255 return !memcmp(buf, data, data_len);
7257 CloseHandle(handle);
7258 return FALSE;
7261 static void test_file_in_use(void)
7263 UINT r;
7264 DWORD size;
7265 HANDLE file;
7266 HKEY hkey;
7267 char path[MAX_PATH];
7269 if (on_win9x)
7271 win_skip("Pending file renaming is implemented differently on Win9x and WinMe\n");
7272 return;
7275 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
7276 if (!RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size))
7278 skip("Pending file rename operations, skipping test\n");
7279 return;
7282 CreateDirectoryA("msitest", NULL);
7283 create_file("msitest\\maximus", 500);
7284 create_database(msifile, fiu_tables, sizeof(fiu_tables) / sizeof(msi_table));
7286 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7288 lstrcpy(path, PROG_FILES_DIR);
7289 lstrcat(path, "\\msitest");
7290 CreateDirectoryA(path, NULL);
7292 lstrcat(path, "\\maximus");
7293 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
7295 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
7296 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
7297 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
7298 CloseHandle(file);
7299 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
7301 process_pending_renames(hkey);
7302 RegCloseKey(hkey);
7304 ok(file_matches_data(path, "msitest\\maximus"), "Expected file to match\n");
7305 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
7306 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
7308 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7309 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7311 delete_test_files();
7314 static void test_file_in_use_cab(void)
7316 UINT r;
7317 DWORD size;
7318 HANDLE file;
7319 HKEY hkey;
7320 char path[MAX_PATH];
7322 if (on_win9x)
7324 win_skip("Pending file renaming is implemented differently on Win9x and WinMe\n");
7325 return;
7328 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
7329 if (!RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size))
7331 skip("Pending file rename operations, skipping test\n");
7332 return;
7335 CreateDirectoryA("msitest", NULL);
7336 create_file("maximus", 500);
7337 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
7338 DeleteFile("maximus");
7340 create_database(msifile, fiuc_tables, sizeof(fiuc_tables) / sizeof(msi_table));
7342 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7344 lstrcpy(path, PROG_FILES_DIR);
7345 lstrcat(path, "\\msitest");
7346 CreateDirectoryA(path, NULL);
7348 lstrcat(path, "\\maximus");
7349 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
7351 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
7352 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
7353 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
7354 CloseHandle(file);
7355 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
7357 process_pending_renames(hkey);
7358 RegCloseKey(hkey);
7360 ok(file_matches_data(path, "maximus"), "Expected file to match\n");
7361 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
7362 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
7364 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7365 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7367 delete_cab_files();
7368 delete_test_files();
7371 static INT CALLBACK handler_a(LPVOID context, UINT type, LPCSTR msg)
7373 return IDOK;
7376 static INT CALLBACK handler_w(LPVOID context, UINT type, LPCWSTR msg)
7378 return IDOK;
7381 static INT CALLBACK handler_record(LPVOID context, UINT type, MSIHANDLE record)
7383 return IDOK;
7386 static void test_MsiSetExternalUI(void)
7388 INSTALLUI_HANDLERA ret_a;
7389 INSTALLUI_HANDLERW ret_w;
7390 INSTALLUI_HANDLER_RECORD prev;
7391 UINT error;
7393 ret_a = MsiSetExternalUIA(handler_a, INSTALLLOGMODE_ERROR, NULL);
7394 ok(ret_a == NULL, "expected NULL, got %p\n", ret_a);
7396 ret_a = MsiSetExternalUIA(NULL, 0, NULL);
7397 ok(ret_a == handler_a, "expected %p, got %p\n", handler_a, ret_a);
7399 /* Not present before Installer 3.1 */
7400 if (!pMsiSetExternalUIRecord) {
7401 win_skip("MsiSetExternalUIRecord is not available\n");
7402 return;
7405 error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev);
7406 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7407 ok(prev == NULL, "expected NULL, got %p\n", prev);
7409 prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
7410 error = pMsiSetExternalUIRecord(NULL, INSTALLLOGMODE_ERROR, NULL, &prev);
7411 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7412 ok(prev == handler_record, "expected %p, got %p\n", handler_record, prev);
7414 ret_w = MsiSetExternalUIW(handler_w, INSTALLLOGMODE_ERROR, NULL);
7415 ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
7417 ret_w = MsiSetExternalUIW(NULL, 0, NULL);
7418 ok(ret_w == handler_w, "expected %p, got %p\n", handler_w, ret_w);
7420 ret_a = MsiSetExternalUIA(handler_a, INSTALLLOGMODE_ERROR, NULL);
7421 ok(ret_a == NULL, "expected NULL, got %p\n", ret_a);
7423 ret_w = MsiSetExternalUIW(handler_w, INSTALLLOGMODE_ERROR, NULL);
7424 ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
7426 prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
7427 error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev);
7428 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7429 ok(prev == NULL, "expected NULL, got %p\n", prev);
7431 ret_a = MsiSetExternalUIA(NULL, 0, NULL);
7432 ok(ret_a == NULL, "expected NULL, got %p\n", ret_a);
7434 ret_w = MsiSetExternalUIW(NULL, 0, NULL);
7435 ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
7437 prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
7438 error = pMsiSetExternalUIRecord(NULL, 0, NULL, &prev);
7439 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7440 ok(prev == handler_record, "expected %p, got %p\n", handler_record, prev);
7442 error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, NULL);
7443 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7445 error = pMsiSetExternalUIRecord(NULL, 0, NULL, NULL);
7446 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7449 static void test_feature_override(void)
7451 UINT r;
7453 create_test_files();
7454 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
7456 r = MsiInstallProductA(msifile, "ADDLOCAL=One");
7457 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7459 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
7460 ok(!delete_pf("msitest\\cabout\\new", FALSE), "File installed\n");
7461 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
7462 ok(!delete_pf("msitest\\cabout", FALSE), "File installed\n");
7463 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
7464 ok(!delete_pf("msitest\\changed", FALSE), "File installed\n");
7465 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
7466 ok(!delete_pf("msitest\\first", FALSE), "File installed\n");
7467 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
7468 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
7469 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
7470 ok(delete_pf("msitest", FALSE), "File not installed\n");
7472 delete_test_files();
7475 static void test_create_folder(void)
7477 UINT r;
7479 create_test_files();
7480 create_database(msifile, cf_tables, sizeof(cf_tables) / sizeof(msi_table));
7482 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7484 r = MsiInstallProductA(msifile, NULL);
7485 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7487 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
7488 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
7489 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
7490 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
7491 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
7492 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
7493 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
7494 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
7495 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
7496 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7497 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
7498 todo_wine ok(!delete_pf("msitest", FALSE), "Directory created\n");
7500 delete_test_files();
7503 static void test_remove_folder(void)
7505 UINT r;
7507 create_test_files();
7508 create_database(msifile, rf_tables, sizeof(rf_tables) / sizeof(msi_table));
7510 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7512 r = MsiInstallProductA(msifile, NULL);
7513 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7515 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
7516 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
7517 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
7518 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
7519 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
7520 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
7521 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
7522 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
7523 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
7524 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7525 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
7526 ok(!delete_pf("msitest", FALSE), "Directory created\n");
7528 delete_test_files();
7531 static void test_start_services(void)
7533 UINT r;
7534 SC_HANDLE scm, service;
7535 BOOL ret;
7536 DWORD error = ERROR_SUCCESS;
7538 if (on_win9x)
7540 win_skip("Services are not implemented on Win9x and WinMe\n");
7541 return;
7543 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
7544 ok(scm != NULL, "Failed to open the SC Manager\n");
7545 if (!scm) return;
7547 service = OpenService(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
7548 if (!service && GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST)
7550 win_skip("The 'Spooler' service does not exist\n");
7551 CloseServiceHandle(scm);
7552 return;
7554 ok(service != NULL, "Failed to open Spooler, error %d\n", GetLastError());
7555 if (!service) {
7556 CloseServiceHandle(scm);
7557 return;
7560 ret = StartService(service, 0, NULL);
7561 if (!ret && (error = GetLastError()) != ERROR_SERVICE_ALREADY_RUNNING)
7563 skip("Terminal service not available, skipping test\n");
7564 CloseServiceHandle(service);
7565 CloseServiceHandle(scm);
7566 return;
7569 CloseServiceHandle(service);
7570 CloseServiceHandle(scm);
7572 create_test_files();
7573 create_database(msifile, sss_tables, sizeof(sss_tables) / sizeof(msi_table));
7575 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7577 r = MsiInstallProductA(msifile, NULL);
7578 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7580 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7581 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
7582 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7583 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
7584 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7585 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
7586 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7587 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
7588 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7589 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
7590 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7591 ok(delete_pf("msitest", FALSE), "Directory not created\n");
7593 delete_test_files();
7595 if (error == ERROR_SUCCESS)
7597 SERVICE_STATUS status;
7599 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
7600 service = OpenService(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
7602 ret = ControlService(service, SERVICE_CONTROL_STOP, &status);
7603 ok(ret, "ControlService failed %u\n", GetLastError());
7605 CloseServiceHandle(service);
7606 CloseServiceHandle(scm);
7610 static void test_delete_services(void)
7612 UINT r;
7614 create_test_files();
7615 create_database(msifile, sds_tables, sizeof(sds_tables) / sizeof(msi_table));
7617 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7619 r = MsiInstallProductA(msifile, NULL);
7620 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7622 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7623 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
7624 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7625 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
7626 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7627 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
7628 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7629 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
7630 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7631 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
7632 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7633 ok(delete_pf("msitest", FALSE), "Directory not created\n");
7635 delete_test_files();
7638 START_TEST(install)
7640 DWORD len;
7641 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
7642 STATEMGRSTATUS status;
7643 BOOL ret = FALSE;
7645 init_functionpointers();
7647 on_win9x = check_win9x();
7649 GetCurrentDirectoryA(MAX_PATH, prev_path);
7650 GetTempPath(MAX_PATH, temp_path);
7651 SetCurrentDirectoryA(temp_path);
7653 lstrcpyA(CURR_DIR, temp_path);
7654 len = lstrlenA(CURR_DIR);
7656 if(len && (CURR_DIR[len - 1] == '\\'))
7657 CURR_DIR[len - 1] = 0;
7659 get_program_files_dir(PROG_FILES_DIR, COMMON_FILES_DIR);
7661 /* Create a restore point ourselves so we circumvent the multitude of restore points
7662 * that would have been created by all the installation and removal tests.
7664 if (pSRSetRestorePointA)
7666 memset(&status, 0, sizeof(status));
7667 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
7670 /* Create only one log file and don't append. We have to pass something
7671 * for the log mode for this to work. The logfile needs to have an absolute
7672 * path otherwise we still end up with some extra logfiles as some tests
7673 * change the current directory.
7675 lstrcpyA(log_file, temp_path);
7676 lstrcatA(log_file, "\\msitest.log");
7677 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
7679 test_MsiInstallProduct();
7680 test_MsiSetComponentState();
7681 test_packagecoltypes();
7682 test_continuouscabs();
7683 test_caborder();
7684 test_mixedmedia();
7685 test_samesequence();
7686 test_uiLevelFlags();
7687 test_readonlyfile();
7688 test_readonlyfile_cab();
7689 test_setdirproperty();
7690 test_cabisextracted();
7691 test_concurrentinstall();
7692 test_setpropertyfolder();
7693 test_publish_registerproduct();
7694 test_publish_publishproduct();
7695 test_publish_publishfeatures();
7696 test_publish_registeruser();
7697 test_publish_processcomponents();
7698 test_publish();
7699 test_publishsourcelist();
7700 test_transformprop();
7701 test_currentworkingdir();
7702 test_admin();
7703 test_adminprops();
7704 test_removefiles();
7705 test_movefiles();
7706 test_missingcab();
7707 test_duplicatefiles();
7708 test_writeregistryvalues();
7709 test_sourcefolder();
7710 test_customaction51();
7711 test_installstate();
7712 test_sourcepath();
7713 test_MsiConfigureProductEx();
7714 test_missingcomponent();
7715 test_sourcedirprop();
7716 test_adminimage();
7717 test_propcase();
7718 test_int_widths();
7719 test_shortcut();
7720 test_envvar();
7721 test_lastusedsource();
7722 test_preselected();
7723 test_installed_prop();
7724 test_file_in_use();
7725 test_file_in_use_cab();
7726 test_MsiSetExternalUI();
7727 test_allusers_prop();
7728 test_feature_override();
7729 test_create_folder();
7730 test_remove_folder();
7731 test_start_services();
7732 test_delete_services();
7734 DeleteFileA(log_file);
7736 if (pSRSetRestorePointA && ret)
7738 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
7739 if (ret)
7740 remove_restore_point(status.llSequenceNumber);
7742 FreeLibrary(hsrclient);
7744 SetCurrentDirectoryA(prev_path);