msi: Implement the SelfUnregModules standard action.
[wine.git] / dlls / msi / tests / install.c
bloba3f1897352ed5da396dd07e854a419fc52b65e0f
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";
1149 static const CHAR sr_selfreg_dat[] = "File_\tCost\n"
1150 "s72\tI2\n"
1151 "SelfReg\tFile_\n"
1152 "one.txt\t1\n";
1154 static const CHAR sr_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1155 "s72\tS255\tI2\n"
1156 "InstallExecuteSequence\tAction\n"
1157 "CostFinalize\t\t1000\n"
1158 "CostInitialize\t\t800\n"
1159 "FileCost\t\t900\n"
1160 "ResolveSource\t\t950\n"
1161 "MoveFiles\t\t1700\n"
1162 "SelfUnregModules\t\t3900\n"
1163 "InstallFiles\t\t4000\n"
1164 "DuplicateFiles\t\t4500\n"
1165 "WriteEnvironmentStrings\t\t4550\n"
1166 "CreateShortcuts\t\t4600\n"
1167 "InstallFinalize\t\t6600\n"
1168 "InstallInitialize\t\t1500\n"
1169 "InstallValidate\t\t1400\n"
1170 "LaunchConditions\t\t100\n";
1172 typedef struct _msi_table
1174 const CHAR *filename;
1175 const CHAR *data;
1176 int size;
1177 } msi_table;
1179 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
1181 static const msi_table tables[] =
1183 ADD_TABLE(component),
1184 ADD_TABLE(directory),
1185 ADD_TABLE(feature),
1186 ADD_TABLE(feature_comp),
1187 ADD_TABLE(file),
1188 ADD_TABLE(install_exec_seq),
1189 ADD_TABLE(media),
1190 ADD_TABLE(property),
1191 ADD_TABLE(registry),
1192 ADD_TABLE(service_install),
1193 ADD_TABLE(service_control)
1196 static const msi_table sc_tables[] =
1198 ADD_TABLE(component),
1199 ADD_TABLE(directory),
1200 ADD_TABLE(feature),
1201 ADD_TABLE(feature_comp),
1202 ADD_TABLE(file),
1203 ADD_TABLE(install_exec_seq),
1204 ADD_TABLE(media),
1205 ADD_TABLE(property),
1206 ADD_TABLE(shortcut)
1209 static const msi_table ps_tables[] =
1211 ADD_TABLE(component),
1212 ADD_TABLE(directory),
1213 ADD_TABLE(feature),
1214 ADD_TABLE(feature_comp),
1215 ADD_TABLE(file),
1216 ADD_TABLE(install_exec_seq),
1217 ADD_TABLE(media),
1218 ADD_TABLE(property),
1219 ADD_TABLE(condition)
1222 static const msi_table env_tables[] =
1224 ADD_TABLE(component),
1225 ADD_TABLE(directory),
1226 ADD_TABLE(feature),
1227 ADD_TABLE(feature_comp),
1228 ADD_TABLE(file),
1229 ADD_TABLE(install_exec_seq),
1230 ADD_TABLE(media),
1231 ADD_TABLE(property),
1232 ADD_TABLE(environment)
1235 static const msi_table up_tables[] =
1237 ADD_TABLE(component),
1238 ADD_TABLE(directory),
1239 ADD_TABLE(feature),
1240 ADD_TABLE(feature_comp),
1241 ADD_TABLE(file),
1242 ADD_TABLE(install_exec_seq),
1243 ADD_TABLE(media),
1244 ADD_TABLE(up_property),
1245 ADD_TABLE(registry),
1246 ADD_TABLE(service_install),
1247 ADD_TABLE(service_control)
1250 static const msi_table up2_tables[] =
1252 ADD_TABLE(component),
1253 ADD_TABLE(directory),
1254 ADD_TABLE(feature),
1255 ADD_TABLE(feature_comp),
1256 ADD_TABLE(file),
1257 ADD_TABLE(install_exec_seq),
1258 ADD_TABLE(media),
1259 ADD_TABLE(up2_property),
1260 ADD_TABLE(registry),
1261 ADD_TABLE(service_install),
1262 ADD_TABLE(service_control)
1265 static const msi_table up3_tables[] =
1267 ADD_TABLE(component),
1268 ADD_TABLE(directory),
1269 ADD_TABLE(feature),
1270 ADD_TABLE(feature_comp),
1271 ADD_TABLE(file),
1272 ADD_TABLE(install_exec_seq),
1273 ADD_TABLE(media),
1274 ADD_TABLE(up3_property),
1275 ADD_TABLE(registry),
1276 ADD_TABLE(service_install),
1277 ADD_TABLE(service_control)
1280 static const msi_table up4_tables[] =
1282 ADD_TABLE(component),
1283 ADD_TABLE(directory),
1284 ADD_TABLE(feature),
1285 ADD_TABLE(feature_comp),
1286 ADD_TABLE(file),
1287 ADD_TABLE(pp_install_exec_seq),
1288 ADD_TABLE(media),
1289 ADD_TABLE(property),
1290 ADD_TABLE(registry),
1291 ADD_TABLE(service_install),
1292 ADD_TABLE(service_control)
1295 static const msi_table up5_tables[] =
1297 ADD_TABLE(component),
1298 ADD_TABLE(directory),
1299 ADD_TABLE(feature),
1300 ADD_TABLE(feature_comp),
1301 ADD_TABLE(file),
1302 ADD_TABLE(pp_install_exec_seq),
1303 ADD_TABLE(media),
1304 ADD_TABLE(up_property),
1305 ADD_TABLE(registry),
1306 ADD_TABLE(service_install),
1307 ADD_TABLE(service_control)
1310 static const msi_table up6_tables[] =
1312 ADD_TABLE(component),
1313 ADD_TABLE(directory),
1314 ADD_TABLE(feature),
1315 ADD_TABLE(feature_comp),
1316 ADD_TABLE(file),
1317 ADD_TABLE(pp_install_exec_seq),
1318 ADD_TABLE(media),
1319 ADD_TABLE(up2_property),
1320 ADD_TABLE(registry),
1321 ADD_TABLE(service_install),
1322 ADD_TABLE(service_control)
1325 static const msi_table up7_tables[] =
1327 ADD_TABLE(component),
1328 ADD_TABLE(directory),
1329 ADD_TABLE(feature),
1330 ADD_TABLE(feature_comp),
1331 ADD_TABLE(file),
1332 ADD_TABLE(pp_install_exec_seq),
1333 ADD_TABLE(media),
1334 ADD_TABLE(up3_property),
1335 ADD_TABLE(registry),
1336 ADD_TABLE(service_install),
1337 ADD_TABLE(service_control)
1340 static const msi_table cc_tables[] =
1342 ADD_TABLE(cc_component),
1343 ADD_TABLE(directory),
1344 ADD_TABLE(cc_feature),
1345 ADD_TABLE(cc_feature_comp),
1346 ADD_TABLE(cc_file),
1347 ADD_TABLE(install_exec_seq),
1348 ADD_TABLE(cc_media),
1349 ADD_TABLE(property),
1352 static const msi_table cc2_tables[] =
1354 ADD_TABLE(cc2_component),
1355 ADD_TABLE(directory),
1356 ADD_TABLE(cc_feature),
1357 ADD_TABLE(cc_feature_comp),
1358 ADD_TABLE(cc2_file),
1359 ADD_TABLE(install_exec_seq),
1360 ADD_TABLE(cc_media),
1361 ADD_TABLE(property),
1364 static const msi_table co_tables[] =
1366 ADD_TABLE(cc_component),
1367 ADD_TABLE(directory),
1368 ADD_TABLE(cc_feature),
1369 ADD_TABLE(cc_feature_comp),
1370 ADD_TABLE(co_file),
1371 ADD_TABLE(install_exec_seq),
1372 ADD_TABLE(co_media),
1373 ADD_TABLE(property),
1376 static const msi_table co2_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(co2_media),
1385 ADD_TABLE(property),
1388 static const msi_table mm_tables[] =
1390 ADD_TABLE(cc_component),
1391 ADD_TABLE(directory),
1392 ADD_TABLE(cc_feature),
1393 ADD_TABLE(cc_feature_comp),
1394 ADD_TABLE(mm_file),
1395 ADD_TABLE(install_exec_seq),
1396 ADD_TABLE(mm_media),
1397 ADD_TABLE(property),
1400 static const msi_table ss_tables[] =
1402 ADD_TABLE(cc_component),
1403 ADD_TABLE(directory),
1404 ADD_TABLE(cc_feature),
1405 ADD_TABLE(cc_feature_comp),
1406 ADD_TABLE(cc_file),
1407 ADD_TABLE(install_exec_seq),
1408 ADD_TABLE(ss_media),
1409 ADD_TABLE(property),
1412 static const msi_table ui_tables[] =
1414 ADD_TABLE(ui_component),
1415 ADD_TABLE(directory),
1416 ADD_TABLE(cc_feature),
1417 ADD_TABLE(cc_feature_comp),
1418 ADD_TABLE(cc_file),
1419 ADD_TABLE(install_exec_seq),
1420 ADD_TABLE(ui_install_ui_seq),
1421 ADD_TABLE(ui_custom_action),
1422 ADD_TABLE(cc_media),
1423 ADD_TABLE(property),
1426 static const msi_table rof_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(install_exec_seq),
1434 ADD_TABLE(rof_media),
1435 ADD_TABLE(property),
1438 static const msi_table rofc_tables[] =
1440 ADD_TABLE(rof_component),
1441 ADD_TABLE(directory),
1442 ADD_TABLE(rof_feature),
1443 ADD_TABLE(rof_feature_comp),
1444 ADD_TABLE(rofc_file),
1445 ADD_TABLE(install_exec_seq),
1446 ADD_TABLE(rofc_media),
1447 ADD_TABLE(property),
1450 static const msi_table sdp_tables[] =
1452 ADD_TABLE(rof_component),
1453 ADD_TABLE(directory),
1454 ADD_TABLE(rof_feature),
1455 ADD_TABLE(rof_feature_comp),
1456 ADD_TABLE(rof_file),
1457 ADD_TABLE(sdp_install_exec_seq),
1458 ADD_TABLE(sdp_custom_action),
1459 ADD_TABLE(rof_media),
1460 ADD_TABLE(property),
1463 static const msi_table cie_tables[] =
1465 ADD_TABLE(cie_component),
1466 ADD_TABLE(directory),
1467 ADD_TABLE(cc_feature),
1468 ADD_TABLE(cie_feature_comp),
1469 ADD_TABLE(cie_file),
1470 ADD_TABLE(install_exec_seq),
1471 ADD_TABLE(cie_media),
1472 ADD_TABLE(property),
1475 static const msi_table ci_tables[] =
1477 ADD_TABLE(ci_component),
1478 ADD_TABLE(directory),
1479 ADD_TABLE(rof_feature),
1480 ADD_TABLE(rof_feature_comp),
1481 ADD_TABLE(rof_file),
1482 ADD_TABLE(ci_install_exec_seq),
1483 ADD_TABLE(rof_media),
1484 ADD_TABLE(property),
1485 ADD_TABLE(ci_custom_action),
1488 static const msi_table ci2_tables[] =
1490 ADD_TABLE(ci2_component),
1491 ADD_TABLE(directory),
1492 ADD_TABLE(rof_feature),
1493 ADD_TABLE(ci2_feature_comp),
1494 ADD_TABLE(ci2_file),
1495 ADD_TABLE(install_exec_seq),
1496 ADD_TABLE(rof_media),
1497 ADD_TABLE(property),
1500 static const msi_table spf_tables[] =
1502 ADD_TABLE(ci_component),
1503 ADD_TABLE(directory),
1504 ADD_TABLE(rof_feature),
1505 ADD_TABLE(rof_feature_comp),
1506 ADD_TABLE(rof_file),
1507 ADD_TABLE(spf_install_exec_seq),
1508 ADD_TABLE(rof_media),
1509 ADD_TABLE(property),
1510 ADD_TABLE(spf_custom_action),
1511 ADD_TABLE(spf_install_ui_seq),
1514 static const msi_table pp_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 ppc_tables[] =
1528 ADD_TABLE(ppc_component),
1529 ADD_TABLE(directory),
1530 ADD_TABLE(rof_feature),
1531 ADD_TABLE(ppc_feature_comp),
1532 ADD_TABLE(ppc_file),
1533 ADD_TABLE(pp_install_exec_seq),
1534 ADD_TABLE(ppc_media),
1535 ADD_TABLE(property),
1538 static const msi_table lus0_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(rof_media),
1547 ADD_TABLE(property),
1550 static const msi_table lus1_tables[] =
1552 ADD_TABLE(ci_component),
1553 ADD_TABLE(directory),
1554 ADD_TABLE(rof_feature),
1555 ADD_TABLE(rof_feature_comp),
1556 ADD_TABLE(rof_file),
1557 ADD_TABLE(pp_install_exec_seq),
1558 ADD_TABLE(rofc_media),
1559 ADD_TABLE(property),
1562 static const msi_table lus2_tables[] =
1564 ADD_TABLE(ci_component),
1565 ADD_TABLE(directory),
1566 ADD_TABLE(rof_feature),
1567 ADD_TABLE(rof_feature_comp),
1568 ADD_TABLE(rof_file),
1569 ADD_TABLE(pp_install_exec_seq),
1570 ADD_TABLE(lus2_media),
1571 ADD_TABLE(property),
1574 static const msi_table tp_tables[] =
1576 ADD_TABLE(tp_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),
1586 static const msi_table cwd_tables[] =
1588 ADD_TABLE(cwd_component),
1589 ADD_TABLE(directory),
1590 ADD_TABLE(rof_feature),
1591 ADD_TABLE(ci2_feature_comp),
1592 ADD_TABLE(ci2_file),
1593 ADD_TABLE(install_exec_seq),
1594 ADD_TABLE(rof_media),
1595 ADD_TABLE(property),
1598 static const msi_table adm_tables[] =
1600 ADD_TABLE(adm_component),
1601 ADD_TABLE(directory),
1602 ADD_TABLE(rof_feature),
1603 ADD_TABLE(ci2_feature_comp),
1604 ADD_TABLE(ci2_file),
1605 ADD_TABLE(install_exec_seq),
1606 ADD_TABLE(rof_media),
1607 ADD_TABLE(property),
1608 ADD_TABLE(adm_custom_action),
1609 ADD_TABLE(adm_admin_exec_seq),
1612 static const msi_table amp_tables[] =
1614 ADD_TABLE(amp_component),
1615 ADD_TABLE(directory),
1616 ADD_TABLE(rof_feature),
1617 ADD_TABLE(ci2_feature_comp),
1618 ADD_TABLE(ci2_file),
1619 ADD_TABLE(install_exec_seq),
1620 ADD_TABLE(rof_media),
1621 ADD_TABLE(property),
1624 static const msi_table rem_tables[] =
1626 ADD_TABLE(rem_component),
1627 ADD_TABLE(directory),
1628 ADD_TABLE(rof_feature),
1629 ADD_TABLE(rem_feature_comp),
1630 ADD_TABLE(rem_file),
1631 ADD_TABLE(rem_install_exec_seq),
1632 ADD_TABLE(rof_media),
1633 ADD_TABLE(property),
1634 ADD_TABLE(rem_remove_files),
1637 static const msi_table mov_tables[] =
1639 ADD_TABLE(cwd_component),
1640 ADD_TABLE(directory),
1641 ADD_TABLE(rof_feature),
1642 ADD_TABLE(ci2_feature_comp),
1643 ADD_TABLE(ci2_file),
1644 ADD_TABLE(install_exec_seq),
1645 ADD_TABLE(rof_media),
1646 ADD_TABLE(property),
1647 ADD_TABLE(mov_move_file),
1650 static const msi_table mc_tables[] =
1652 ADD_TABLE(mc_component),
1653 ADD_TABLE(directory),
1654 ADD_TABLE(cc_feature),
1655 ADD_TABLE(cie_feature_comp),
1656 ADD_TABLE(mc_file),
1657 ADD_TABLE(install_exec_seq),
1658 ADD_TABLE(mc_media),
1659 ADD_TABLE(property),
1660 ADD_TABLE(mc_file_hash),
1663 static const msi_table df_tables[] =
1665 ADD_TABLE(rof_component),
1666 ADD_TABLE(df_directory),
1667 ADD_TABLE(rof_feature),
1668 ADD_TABLE(rof_feature_comp),
1669 ADD_TABLE(rof_file),
1670 ADD_TABLE(install_exec_seq),
1671 ADD_TABLE(rof_media),
1672 ADD_TABLE(property),
1673 ADD_TABLE(df_duplicate_file),
1676 static const msi_table wrv_tables[] =
1678 ADD_TABLE(wrv_component),
1679 ADD_TABLE(directory),
1680 ADD_TABLE(rof_feature),
1681 ADD_TABLE(ci2_feature_comp),
1682 ADD_TABLE(ci2_file),
1683 ADD_TABLE(install_exec_seq),
1684 ADD_TABLE(rof_media),
1685 ADD_TABLE(property),
1686 ADD_TABLE(wrv_registry),
1689 static const msi_table sf_tables[] =
1691 ADD_TABLE(wrv_component),
1692 ADD_TABLE(directory),
1693 ADD_TABLE(rof_feature),
1694 ADD_TABLE(ci2_feature_comp),
1695 ADD_TABLE(ci2_file),
1696 ADD_TABLE(install_exec_seq),
1697 ADD_TABLE(rof_media),
1698 ADD_TABLE(property),
1701 static const msi_table ca51_tables[] =
1703 ADD_TABLE(ca51_component),
1704 ADD_TABLE(directory),
1705 ADD_TABLE(rof_feature),
1706 ADD_TABLE(ci2_feature_comp),
1707 ADD_TABLE(ci2_file),
1708 ADD_TABLE(ca51_install_exec_seq),
1709 ADD_TABLE(rof_media),
1710 ADD_TABLE(property),
1711 ADD_TABLE(ca51_custom_action),
1714 static const msi_table is_tables[] =
1716 ADD_TABLE(is_component),
1717 ADD_TABLE(directory),
1718 ADD_TABLE(is_feature),
1719 ADD_TABLE(is_feature_comp),
1720 ADD_TABLE(is_file),
1721 ADD_TABLE(install_exec_seq),
1722 ADD_TABLE(is_media),
1723 ADD_TABLE(property),
1726 static const msi_table sp_tables[] =
1728 ADD_TABLE(sp_component),
1729 ADD_TABLE(sp_directory),
1730 ADD_TABLE(rof_feature),
1731 ADD_TABLE(ci2_feature_comp),
1732 ADD_TABLE(ci2_file),
1733 ADD_TABLE(install_exec_seq),
1734 ADD_TABLE(rof_media),
1735 ADD_TABLE(property),
1738 static const msi_table mcp_tables[] =
1740 ADD_TABLE(mcp_component),
1741 ADD_TABLE(directory),
1742 ADD_TABLE(mcp_feature),
1743 ADD_TABLE(mcp_feature_comp),
1744 ADD_TABLE(rem_file),
1745 ADD_TABLE(rem_install_exec_seq),
1746 ADD_TABLE(rof_media),
1747 ADD_TABLE(property),
1750 static const msi_table mcomp_tables[] =
1752 ADD_TABLE(mcp_component),
1753 ADD_TABLE(directory),
1754 ADD_TABLE(mcp_feature),
1755 ADD_TABLE(mcp_feature_comp),
1756 ADD_TABLE(mcomp_file),
1757 ADD_TABLE(rem_install_exec_seq),
1758 ADD_TABLE(rof_media),
1759 ADD_TABLE(property),
1762 static const msi_table ai_tables[] =
1764 ADD_TABLE(component),
1765 ADD_TABLE(directory),
1766 ADD_TABLE(feature),
1767 ADD_TABLE(feature_comp),
1768 ADD_TABLE(ai_file),
1769 ADD_TABLE(install_exec_seq),
1770 ADD_TABLE(media),
1771 ADD_TABLE(property)
1774 static const msi_table pc_tables[] =
1776 ADD_TABLE(ca51_component),
1777 ADD_TABLE(directory),
1778 ADD_TABLE(rof_feature),
1779 ADD_TABLE(ci2_feature_comp),
1780 ADD_TABLE(ci2_file),
1781 ADD_TABLE(install_exec_seq),
1782 ADD_TABLE(rof_media),
1783 ADD_TABLE(property)
1786 static const msi_table ip_tables[] =
1788 ADD_TABLE(component),
1789 ADD_TABLE(directory),
1790 ADD_TABLE(feature),
1791 ADD_TABLE(feature_comp),
1792 ADD_TABLE(file),
1793 ADD_TABLE(ip_install_exec_seq),
1794 ADD_TABLE(ip_custom_action),
1795 ADD_TABLE(media),
1796 ADD_TABLE(property)
1799 static const msi_table aup_tables[] =
1801 ADD_TABLE(component),
1802 ADD_TABLE(directory),
1803 ADD_TABLE(feature),
1804 ADD_TABLE(feature_comp),
1805 ADD_TABLE(file),
1806 ADD_TABLE(aup_install_exec_seq),
1807 ADD_TABLE(aup_custom_action),
1808 ADD_TABLE(media),
1809 ADD_TABLE(property)
1812 static const msi_table aup2_tables[] =
1814 ADD_TABLE(component),
1815 ADD_TABLE(directory),
1816 ADD_TABLE(feature),
1817 ADD_TABLE(feature_comp),
1818 ADD_TABLE(file),
1819 ADD_TABLE(aup2_install_exec_seq),
1820 ADD_TABLE(aup_custom_action),
1821 ADD_TABLE(media),
1822 ADD_TABLE(aup_property)
1825 static const msi_table aup3_tables[] =
1827 ADD_TABLE(component),
1828 ADD_TABLE(directory),
1829 ADD_TABLE(feature),
1830 ADD_TABLE(feature_comp),
1831 ADD_TABLE(file),
1832 ADD_TABLE(aup2_install_exec_seq),
1833 ADD_TABLE(aup_custom_action),
1834 ADD_TABLE(media),
1835 ADD_TABLE(aup2_property)
1838 static const msi_table aup4_tables[] =
1840 ADD_TABLE(component),
1841 ADD_TABLE(directory),
1842 ADD_TABLE(feature),
1843 ADD_TABLE(feature_comp),
1844 ADD_TABLE(file),
1845 ADD_TABLE(aup3_install_exec_seq),
1846 ADD_TABLE(aup_custom_action),
1847 ADD_TABLE(media),
1848 ADD_TABLE(aup2_property)
1851 static const msi_table fiu_tables[] =
1853 ADD_TABLE(rof_component),
1854 ADD_TABLE(directory),
1855 ADD_TABLE(rof_feature),
1856 ADD_TABLE(rof_feature_comp),
1857 ADD_TABLE(rof_file),
1858 ADD_TABLE(pp_install_exec_seq),
1859 ADD_TABLE(rof_media),
1860 ADD_TABLE(property),
1863 static const msi_table fiuc_tables[] =
1865 ADD_TABLE(rof_component),
1866 ADD_TABLE(directory),
1867 ADD_TABLE(rof_feature),
1868 ADD_TABLE(rof_feature_comp),
1869 ADD_TABLE(rofc_file),
1870 ADD_TABLE(pp_install_exec_seq),
1871 ADD_TABLE(rofc_media),
1872 ADD_TABLE(property),
1875 static const msi_table cf_tables[] =
1877 ADD_TABLE(component),
1878 ADD_TABLE(directory),
1879 ADD_TABLE(feature),
1880 ADD_TABLE(feature_comp),
1881 ADD_TABLE(file),
1882 ADD_TABLE(cf_create_folders),
1883 ADD_TABLE(cf_install_exec_seq),
1884 ADD_TABLE(cf_custom_action),
1885 ADD_TABLE(media),
1886 ADD_TABLE(property)
1889 static const msi_table rf_tables[] =
1891 ADD_TABLE(component),
1892 ADD_TABLE(directory),
1893 ADD_TABLE(feature),
1894 ADD_TABLE(feature_comp),
1895 ADD_TABLE(file),
1896 ADD_TABLE(cf_create_folders),
1897 ADD_TABLE(rf_install_exec_seq),
1898 ADD_TABLE(cf_custom_action),
1899 ADD_TABLE(media),
1900 ADD_TABLE(property)
1903 static const msi_table sss_tables[] =
1905 ADD_TABLE(component),
1906 ADD_TABLE(directory),
1907 ADD_TABLE(feature),
1908 ADD_TABLE(feature_comp),
1909 ADD_TABLE(file),
1910 ADD_TABLE(sss_install_exec_seq),
1911 ADD_TABLE(sss_service_control),
1912 ADD_TABLE(media),
1913 ADD_TABLE(property)
1916 static const msi_table sds_tables[] =
1918 ADD_TABLE(component),
1919 ADD_TABLE(directory),
1920 ADD_TABLE(feature),
1921 ADD_TABLE(feature_comp),
1922 ADD_TABLE(file),
1923 ADD_TABLE(sss_install_exec_seq),
1924 ADD_TABLE(service_control),
1925 ADD_TABLE(media),
1926 ADD_TABLE(property)
1929 static const msi_table sr_tables[] =
1931 ADD_TABLE(component),
1932 ADD_TABLE(directory),
1933 ADD_TABLE(feature),
1934 ADD_TABLE(feature_comp),
1935 ADD_TABLE(file),
1936 ADD_TABLE(sr_selfreg),
1937 ADD_TABLE(sr_install_exec_seq),
1938 ADD_TABLE(media),
1939 ADD_TABLE(property)
1942 /* cabinet definitions */
1944 /* make the max size large so there is only one cab file */
1945 #define MEDIA_SIZE 0x7FFFFFFF
1946 #define FOLDER_THRESHOLD 900000
1948 /* the FCI callbacks */
1950 static void * CDECL mem_alloc(ULONG cb)
1952 return HeapAlloc(GetProcessHeap(), 0, cb);
1955 static void CDECL mem_free(void *memory)
1957 HeapFree(GetProcessHeap(), 0, memory);
1960 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
1962 sprintf(pccab->szCab, pv, pccab->iCab);
1963 return TRUE;
1966 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
1968 return 0;
1971 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
1972 BOOL fContinuation, void *pv)
1974 return 0;
1977 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
1979 HANDLE handle;
1980 DWORD dwAccess = 0;
1981 DWORD dwShareMode = 0;
1982 DWORD dwCreateDisposition = OPEN_EXISTING;
1984 dwAccess = GENERIC_READ | GENERIC_WRITE;
1985 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
1986 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
1988 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
1989 dwCreateDisposition = OPEN_EXISTING;
1990 else
1991 dwCreateDisposition = CREATE_NEW;
1993 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
1994 dwCreateDisposition, 0, NULL);
1996 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
1998 return (INT_PTR)handle;
2001 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2003 HANDLE handle = (HANDLE)hf;
2004 DWORD dwRead;
2005 BOOL res;
2007 res = ReadFile(handle, memory, cb, &dwRead, NULL);
2008 ok(res, "Failed to ReadFile\n");
2010 return dwRead;
2013 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2015 HANDLE handle = (HANDLE)hf;
2016 DWORD dwWritten;
2017 BOOL res;
2019 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2020 ok(res, "Failed to WriteFile\n");
2022 return dwWritten;
2025 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
2027 HANDLE handle = (HANDLE)hf;
2028 ok(CloseHandle(handle), "Failed to CloseHandle\n");
2030 return 0;
2033 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
2035 HANDLE handle = (HANDLE)hf;
2036 DWORD ret;
2038 ret = SetFilePointer(handle, dist, NULL, seektype);
2039 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2041 return ret;
2044 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
2046 BOOL ret = DeleteFileA(pszFile);
2047 ok(ret, "Failed to DeleteFile %s\n", pszFile);
2049 return 0;
2052 static void init_functionpointers(void)
2054 HMODULE hmsi = GetModuleHandleA("msi.dll");
2055 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2057 #define GET_PROC(mod, func) \
2058 p ## func = (void*)GetProcAddress(mod, #func); \
2059 if(!p ## func) \
2060 trace("GetProcAddress(%s) failed\n", #func);
2062 GET_PROC(hmsi, MsiQueryComponentStateA);
2063 GET_PROC(hmsi, MsiSetExternalUIRecord);
2064 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
2065 GET_PROC(hmsi, MsiSourceListGetInfoA);
2067 GET_PROC(hadvapi32, ConvertSidToStringSidA);
2069 hsrclient = LoadLibraryA("srclient.dll");
2070 GET_PROC(hsrclient, SRRemoveRestorePoint);
2071 GET_PROC(hsrclient, SRSetRestorePointA);
2073 #undef GET_PROC
2076 static BOOL check_win9x(void)
2078 SC_HANDLE scm;
2080 scm = OpenSCManager(NULL, NULL, GENERIC_ALL);
2081 if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
2082 return TRUE;
2084 CloseServiceHandle(scm);
2086 return FALSE;
2089 static LPSTR get_user_sid(LPSTR *usersid)
2091 HANDLE token;
2092 BYTE buf[1024];
2093 DWORD size;
2094 PTOKEN_USER user;
2096 if (!pConvertSidToStringSidA)
2098 win_skip("ConvertSidToStringSidA is not available\n");
2099 return NULL;
2102 *usersid = NULL;
2103 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
2104 size = sizeof(buf);
2105 GetTokenInformation(token, TokenUser, buf, size, &size);
2106 user = (PTOKEN_USER)buf;
2107 pConvertSidToStringSidA(user->User.Sid, usersid);
2108 ok(*usersid != NULL, "pConvertSidToStringSidA failed lre=%d\n", GetLastError());
2109 CloseHandle(token);
2110 return *usersid;
2113 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
2115 CHAR buffer[0x20];
2116 UINT r;
2117 DWORD sz;
2119 sz = sizeof buffer;
2120 r = MsiRecordGetString(rec, field, buffer, &sz);
2121 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
2124 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2126 LPSTR tempname;
2128 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2129 GetTempFileNameA(".", "xx", 0, tempname);
2131 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2133 lstrcpyA(pszTempName, tempname);
2134 HeapFree(GetProcessHeap(), 0, tempname);
2135 return TRUE;
2138 HeapFree(GetProcessHeap(), 0, tempname);
2140 return FALSE;
2143 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2144 USHORT *pattribs, int *err, void *pv)
2146 BY_HANDLE_FILE_INFORMATION finfo;
2147 FILETIME filetime;
2148 HANDLE handle;
2149 DWORD attrs;
2150 BOOL res;
2152 handle = CreateFile(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2153 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2155 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2157 res = GetFileInformationByHandle(handle, &finfo);
2158 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2160 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2161 FileTimeToDosDateTime(&filetime, pdate, ptime);
2163 attrs = GetFileAttributes(pszName);
2164 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2166 return (INT_PTR)handle;
2169 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2171 char path[MAX_PATH];
2172 char filename[MAX_PATH];
2174 lstrcpyA(path, CURR_DIR);
2175 lstrcatA(path, "\\");
2176 lstrcatA(path, file);
2178 lstrcpyA(filename, file);
2180 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2181 progress, get_open_info, compress);
2184 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2186 ZeroMemory(pCabParams, sizeof(CCAB));
2188 pCabParams->cb = max_size;
2189 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2190 pCabParams->setID = 0xbeef;
2191 pCabParams->iCab = 1;
2192 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2193 lstrcatA(pCabParams->szCabPath, "\\");
2194 lstrcpyA(pCabParams->szCab, name);
2197 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2199 CCAB cabParams;
2200 LPCSTR ptr;
2201 HFCI hfci;
2202 ERF erf;
2203 BOOL res;
2205 set_cab_parameters(&cabParams, name, max_size);
2207 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2208 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2209 get_temp_file, &cabParams, NULL);
2211 ok(hfci != NULL, "Failed to create an FCI context\n");
2213 ptr = files;
2214 while (*ptr)
2216 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2217 ok(res, "Failed to add file: %s\n", ptr);
2218 ptr += lstrlen(ptr) + 1;
2221 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2222 ok(res, "Failed to flush the cabinet\n");
2224 res = FCIDestroy(hfci);
2225 ok(res, "Failed to destroy the cabinet\n");
2228 static BOOL get_program_files_dir(LPSTR buf, LPSTR buf2)
2230 HKEY hkey;
2231 DWORD type, size;
2233 if (RegOpenKey(HKEY_LOCAL_MACHINE,
2234 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2235 return FALSE;
2237 size = MAX_PATH;
2238 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) {
2239 RegCloseKey(hkey);
2240 return FALSE;
2243 size = MAX_PATH;
2244 if (RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size)) {
2245 RegCloseKey(hkey);
2246 return FALSE;
2249 RegCloseKey(hkey);
2250 return TRUE;
2253 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2255 HANDLE file;
2256 DWORD written;
2258 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2259 if (file == INVALID_HANDLE_VALUE)
2260 return;
2262 WriteFile(file, data, strlen(data), &written, NULL);
2264 if (size)
2266 SetFilePointer(file, size, NULL, FILE_BEGIN);
2267 SetEndOfFile(file);
2270 CloseHandle(file);
2273 #define create_file(name, size) create_file_data(name, name, size)
2275 static void create_test_files(void)
2277 CreateDirectoryA("msitest", NULL);
2278 create_file("msitest\\one.txt", 100);
2279 CreateDirectoryA("msitest\\first", NULL);
2280 create_file("msitest\\first\\two.txt", 100);
2281 CreateDirectoryA("msitest\\second", NULL);
2282 create_file("msitest\\second\\three.txt", 100);
2284 create_file("four.txt", 100);
2285 create_file("five.txt", 100);
2286 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2288 create_file("msitest\\filename", 100);
2289 create_file("msitest\\service.exe", 100);
2291 DeleteFileA("four.txt");
2292 DeleteFileA("five.txt");
2295 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2297 CHAR path[MAX_PATH];
2299 lstrcpyA(path, PROG_FILES_DIR);
2300 lstrcatA(path, "\\");
2301 lstrcatA(path, rel_path);
2303 if (is_file)
2304 return DeleteFileA(path);
2305 else
2306 return RemoveDirectoryA(path);
2309 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
2311 CHAR path[MAX_PATH];
2313 lstrcpyA(path, COMMON_FILES_DIR);
2314 lstrcatA(path, "\\");
2315 lstrcatA(path, rel_path);
2317 if (is_file)
2318 return DeleteFileA(path);
2319 else
2320 return RemoveDirectoryA(path);
2323 static void delete_test_files(void)
2325 DeleteFileA("msitest.msi");
2326 DeleteFileA("msitest.cab");
2327 DeleteFileA("msitest\\second\\three.txt");
2328 DeleteFileA("msitest\\first\\two.txt");
2329 DeleteFileA("msitest\\one.txt");
2330 DeleteFileA("msitest\\service.exe");
2331 DeleteFileA("msitest\\filename");
2332 RemoveDirectoryA("msitest\\second");
2333 RemoveDirectoryA("msitest\\first");
2334 RemoveDirectoryA("msitest");
2337 static void write_file(const CHAR *filename, const char *data, int data_size)
2339 DWORD size;
2341 HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
2342 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2344 WriteFile(hf, data, data_size, &size, NULL);
2345 CloseHandle(hf);
2348 static void write_msi_summary_info(MSIHANDLE db, INT wordcount)
2350 MSIHANDLE summary;
2351 UINT r;
2353 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2354 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2356 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, ";1033");
2357 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2359 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
2360 "{004757CA-5092-49c2-AD20-28E1CE0DF5F2}");
2361 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2363 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
2364 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2366 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2367 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2369 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2370 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2372 /* write the summary changes back to the stream */
2373 r = MsiSummaryInfoPersist(summary);
2374 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2376 MsiCloseHandle(summary);
2379 #define create_database(name, tables, num_tables) \
2380 create_database_wordcount(name, tables, num_tables, 0);
2382 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2383 int num_tables, INT wordcount)
2385 MSIHANDLE db;
2386 UINT r;
2387 int j;
2389 r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db);
2390 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2392 /* import the tables into the database */
2393 for (j = 0; j < num_tables; j++)
2395 const msi_table *table = &tables[j];
2397 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2399 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2400 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2402 DeleteFileA(table->filename);
2405 write_msi_summary_info(db, wordcount);
2407 r = MsiDatabaseCommit(db);
2408 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2410 MsiCloseHandle(db);
2413 static void check_service_is_installed(void)
2415 SC_HANDLE scm, service;
2416 BOOL res;
2418 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
2419 ok(scm != NULL, "Failed to open the SC Manager\n");
2421 service = OpenService(scm, "TestService", SC_MANAGER_ALL_ACCESS);
2422 ok(service != NULL, "Failed to open TestService\n");
2424 res = DeleteService(service);
2425 ok(res, "Failed to delete TestService\n");
2427 CloseServiceHandle(service);
2428 CloseServiceHandle(scm);
2431 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2433 RESTOREPOINTINFOA spec;
2435 spec.dwEventType = event_type;
2436 spec.dwRestorePtType = APPLICATION_INSTALL;
2437 spec.llSequenceNumber = status->llSequenceNumber;
2438 lstrcpyA(spec.szDescription, "msitest restore point");
2440 return pSRSetRestorePointA(&spec, status);
2443 static void remove_restore_point(DWORD seq_number)
2445 DWORD res;
2447 res = pSRRemoveRestorePoint(seq_number);
2448 if (res != ERROR_SUCCESS)
2449 trace("Failed to remove the restore point : %08x\n", res);
2452 static void test_MsiInstallProduct(void)
2454 UINT r;
2455 CHAR path[MAX_PATH];
2456 LONG res;
2457 HKEY hkey;
2458 DWORD num, size, type;
2460 if (on_win9x)
2462 win_skip("Services are not implemented on Win9x and WinMe\n");
2463 return;
2466 /* szPackagePath is NULL */
2467 r = MsiInstallProductA(NULL, "INSTALL=ALL");
2468 ok(r == ERROR_INVALID_PARAMETER,
2469 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2471 /* both szPackagePath and szCommandLine are NULL */
2472 r = MsiInstallProductA(NULL, NULL);
2473 ok(r == ERROR_INVALID_PARAMETER,
2474 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2476 /* szPackagePath is empty */
2477 r = MsiInstallProductA("", "INSTALL=ALL");
2478 ok(r == ERROR_PATH_NOT_FOUND,
2479 "Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
2481 create_test_files();
2482 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2484 /* install, don't publish */
2485 r = MsiInstallProductA(msifile, NULL);
2486 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2488 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2489 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2490 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2491 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2492 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2493 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2494 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2495 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2496 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2497 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2498 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2499 ok(delete_pf("msitest", FALSE), "File not installed\n");
2501 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2502 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2504 size = MAX_PATH;
2505 type = REG_SZ;
2506 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
2507 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2508 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
2510 size = MAX_PATH;
2511 type = REG_SZ;
2512 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
2513 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2515 size = sizeof(num);
2516 type = REG_DWORD;
2517 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
2518 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2519 ok(num == 314, "Expected 314, got %d\n", num);
2521 size = MAX_PATH;
2522 type = REG_SZ;
2523 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
2524 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2525 ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
2527 check_service_is_installed();
2529 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2531 /* not published, reinstall */
2532 r = MsiInstallProductA(msifile, NULL);
2533 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2535 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2536 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2537 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2538 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2539 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2540 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2541 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2542 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2543 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2544 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2545 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2546 ok(delete_pf("msitest", FALSE), "File not installed\n");
2548 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2549 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2550 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2552 create_database(msifile, up_tables, sizeof(up_tables) / sizeof(msi_table));
2554 /* not published, RemovePreviousVersions set */
2555 r = MsiInstallProductA(msifile, NULL);
2556 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2558 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2559 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2560 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2561 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2562 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2563 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2564 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2565 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2566 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2567 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2568 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2569 ok(delete_pf("msitest", FALSE), "File not installed\n");
2571 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2572 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2573 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2575 create_database(msifile, up2_tables, sizeof(up2_tables) / sizeof(msi_table));
2577 /* not published, version number bumped */
2578 r = MsiInstallProductA(msifile, NULL);
2579 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2581 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2582 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2583 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2584 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2585 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2586 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2587 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2588 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2589 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2590 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2591 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2592 ok(delete_pf("msitest", FALSE), "File not installed\n");
2594 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2595 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2596 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2598 create_database(msifile, up3_tables, sizeof(up3_tables) / sizeof(msi_table));
2600 /* not published, RemovePreviousVersions set and version number bumped */
2601 r = MsiInstallProductA(msifile, NULL);
2602 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2604 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2605 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2606 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2607 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2608 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2609 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2610 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2611 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2612 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2613 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2614 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2615 ok(delete_pf("msitest", FALSE), "File not installed\n");
2617 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2618 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2619 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2621 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2623 /* install, publish product */
2624 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2625 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2627 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2628 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2629 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2630 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2631 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2632 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2633 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2634 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2635 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2636 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2637 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2638 ok(delete_pf("msitest", FALSE), "File not installed\n");
2640 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2641 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2643 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2645 /* published, reinstall */
2646 r = MsiInstallProductA(msifile, NULL);
2647 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2649 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2650 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2651 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2652 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2653 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2654 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2655 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2656 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2657 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2658 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2659 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2660 ok(delete_pf("msitest", FALSE), "File not installed\n");
2662 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2663 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2665 create_database(msifile, up5_tables, sizeof(up5_tables) / sizeof(msi_table));
2667 /* published product, RemovePreviousVersions set */
2668 r = MsiInstallProductA(msifile, NULL);
2669 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2671 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2672 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2673 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2674 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2675 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2676 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2677 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2678 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2679 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2680 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2681 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2682 ok(delete_pf("msitest", FALSE), "File not installed\n");
2684 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2685 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2687 create_database(msifile, up6_tables, sizeof(up6_tables) / sizeof(msi_table));
2689 /* published product, version number bumped */
2690 r = MsiInstallProductA(msifile, NULL);
2691 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2693 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2694 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2695 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2696 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2697 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2698 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2699 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2700 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2701 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2702 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2703 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2704 ok(delete_pf("msitest", FALSE), "File not installed\n");
2706 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2707 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2709 create_database(msifile, up7_tables, sizeof(up7_tables) / sizeof(msi_table));
2711 /* published product, RemovePreviousVersions set and version number bumped */
2712 r = MsiInstallProductA(msifile, NULL);
2713 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2715 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2716 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2717 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2718 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2719 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2720 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2721 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2722 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2723 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2724 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2725 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2726 ok(delete_pf("msitest", FALSE), "File not installed\n");
2728 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2729 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2731 r = MsiInstallProductA(msifile, "REMOVE=ALL");
2732 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2734 delete_test_files();
2737 static void test_MsiSetComponentState(void)
2739 INSTALLSTATE installed, action;
2740 MSIHANDLE package;
2741 char path[MAX_PATH];
2742 UINT r;
2744 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2746 CoInitialize(NULL);
2748 lstrcpy(path, CURR_DIR);
2749 lstrcat(path, "\\");
2750 lstrcat(path, msifile);
2752 r = MsiOpenPackage(path, &package);
2753 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2755 r = MsiDoAction(package, "CostInitialize");
2756 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2758 r = MsiDoAction(package, "FileCost");
2759 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2761 r = MsiDoAction(package, "CostFinalize");
2762 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2764 r = MsiGetComponentState(package, "dangler", &installed, &action);
2765 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2766 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
2767 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
2769 r = MsiSetComponentState(package, "dangler", INSTALLSTATE_SOURCE);
2770 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2772 MsiCloseHandle(package);
2773 CoUninitialize();
2775 DeleteFileA(msifile);
2778 static void test_packagecoltypes(void)
2780 MSIHANDLE hdb, view, rec;
2781 char path[MAX_PATH];
2782 LPCSTR query;
2783 UINT r, count;
2785 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2787 CoInitialize(NULL);
2789 lstrcpy(path, CURR_DIR);
2790 lstrcat(path, "\\");
2791 lstrcat(path, msifile);
2793 r = MsiOpenDatabase(path, MSIDBOPEN_READONLY, &hdb);
2794 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2796 query = "SELECT * FROM `Media`";
2797 r = MsiDatabaseOpenView( hdb, query, &view );
2798 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
2800 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
2801 count = MsiRecordGetFieldCount( rec );
2802 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2803 ok(count == 6, "Expected 6, got %d\n", count);
2804 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
2805 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
2806 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
2807 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
2808 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
2809 ok(check_record(rec, 6, "Source"), "wrong column label\n");
2810 MsiCloseHandle(rec);
2812 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
2813 count = MsiRecordGetFieldCount( rec );
2814 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
2815 ok(count == 6, "Expected 6, got %d\n", count);
2816 ok(check_record(rec, 1, "i2"), "wrong column label\n");
2817 ok(check_record(rec, 2, "i4"), "wrong column label\n");
2818 ok(check_record(rec, 3, "L64"), "wrong column label\n");
2819 ok(check_record(rec, 4, "S255"), "wrong column label\n");
2820 ok(check_record(rec, 5, "S32"), "wrong column label\n");
2821 ok(check_record(rec, 6, "S72"), "wrong column label\n");
2823 MsiCloseHandle(rec);
2824 MsiCloseHandle(view);
2825 MsiCloseHandle(hdb);
2826 CoUninitialize();
2828 DeleteFile(msifile);
2831 static void create_cc_test_files(void)
2833 CCAB cabParams;
2834 HFCI hfci;
2835 ERF erf;
2836 static CHAR cab_context[] = "test%d.cab";
2837 BOOL res;
2839 create_file("maximus", 500);
2840 create_file("augustus", 50000);
2841 create_file("tiberius", 500);
2842 create_file("caesar", 500);
2844 set_cab_parameters(&cabParams, "test1.cab", 40000);
2846 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2847 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2848 get_temp_file, &cabParams, cab_context);
2849 ok(hfci != NULL, "Failed to create an FCI context\n");
2851 res = add_file(hfci, "maximus", tcompTYPE_NONE);
2852 ok(res, "Failed to add file maximus\n");
2854 res = add_file(hfci, "augustus", tcompTYPE_NONE);
2855 ok(res, "Failed to add file augustus\n");
2857 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
2858 ok(res, "Failed to add file tiberius\n");
2860 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2861 ok(res, "Failed to flush the cabinet\n");
2863 res = FCIDestroy(hfci);
2864 ok(res, "Failed to destroy the cabinet\n");
2866 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2868 DeleteFile("maximus");
2869 DeleteFile("augustus");
2870 DeleteFile("tiberius");
2871 DeleteFile("caesar");
2874 static void delete_cab_files(void)
2876 SHFILEOPSTRUCT shfl;
2877 CHAR path[MAX_PATH+10];
2879 lstrcpyA(path, CURR_DIR);
2880 lstrcatA(path, "\\*.cab");
2881 path[strlen(path) + 1] = '\0';
2883 shfl.hwnd = NULL;
2884 shfl.wFunc = FO_DELETE;
2885 shfl.pFrom = path;
2886 shfl.pTo = NULL;
2887 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
2889 SHFileOperation(&shfl);
2892 static void test_continuouscabs(void)
2894 UINT r;
2896 create_cc_test_files();
2897 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
2899 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2901 r = MsiInstallProductA(msifile, NULL);
2902 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
2904 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2905 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
2906 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2907 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2908 ok(delete_pf("msitest", FALSE), "File not installed\n");
2911 delete_cab_files();
2912 DeleteFile(msifile);
2914 create_cc_test_files();
2915 create_database(msifile, cc2_tables, sizeof(cc2_tables) / sizeof(msi_table));
2917 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2919 r = MsiInstallProductA(msifile, NULL);
2920 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2921 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2922 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
2923 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
2924 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
2925 ok(delete_pf("msitest", FALSE), "File not installed\n");
2927 delete_cab_files();
2928 DeleteFile(msifile);
2931 static void test_caborder(void)
2933 UINT r;
2935 create_file("imperator", 100);
2936 create_file("maximus", 500);
2937 create_file("augustus", 50000);
2938 create_file("caesar", 500);
2940 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
2942 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
2944 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
2945 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
2946 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2948 r = MsiInstallProductA(msifile, NULL);
2949 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
2950 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
2951 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
2952 todo_wine
2954 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
2955 ok(!delete_pf("msitest", FALSE), "File is installed\n");
2958 delete_cab_files();
2960 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
2961 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
2962 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
2964 r = MsiInstallProductA(msifile, NULL);
2965 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
2966 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
2967 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
2968 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
2969 todo_wine
2971 ok(!delete_pf("msitest", FALSE), "File is installed\n");
2974 delete_cab_files();
2975 DeleteFile(msifile);
2977 create_cc_test_files();
2978 create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
2980 r = MsiInstallProductA(msifile, NULL);
2981 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
2982 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
2983 ok(!delete_pf("msitest", FALSE), "File is installed\n");
2984 todo_wine
2986 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
2987 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
2990 delete_cab_files();
2991 DeleteFile(msifile);
2993 create_cc_test_files();
2994 create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
2996 r = MsiInstallProductA(msifile, NULL);
2997 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
2998 todo_wine
3000 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3001 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3002 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3003 ok(!delete_pf("msitest", FALSE), "File is installed\n");
3006 delete_cab_files();
3007 DeleteFile("imperator");
3008 DeleteFile("maximus");
3009 DeleteFile("augustus");
3010 DeleteFile("caesar");
3011 DeleteFile(msifile);
3014 static void test_mixedmedia(void)
3016 UINT r;
3018 CreateDirectoryA("msitest", NULL);
3019 create_file("msitest\\maximus", 500);
3020 create_file("msitest\\augustus", 500);
3021 create_file("caesar", 500);
3023 create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
3025 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3027 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
3029 r = MsiInstallProductA(msifile, NULL);
3030 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3031 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3032 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3033 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3034 ok(delete_pf("msitest", FALSE), "File not installed\n");
3036 /* Delete the files in the temp (current) folder */
3037 DeleteFile("msitest\\maximus");
3038 DeleteFile("msitest\\augustus");
3039 RemoveDirectory("msitest");
3040 DeleteFile("caesar");
3041 DeleteFile("test1.cab");
3042 DeleteFile(msifile);
3045 static void test_samesequence(void)
3047 UINT r;
3049 create_cc_test_files();
3050 create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
3052 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3054 r = MsiInstallProductA(msifile, NULL);
3055 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
3057 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3058 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3059 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3060 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3061 ok(delete_pf("msitest", FALSE), "File not installed\n");
3064 delete_cab_files();
3065 DeleteFile(msifile);
3068 static void test_uiLevelFlags(void)
3070 UINT r;
3072 create_cc_test_files();
3073 create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
3075 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
3077 r = MsiInstallProductA(msifile, NULL);
3078 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
3080 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3081 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
3082 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3083 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3084 ok(delete_pf("msitest", FALSE), "File not installed\n");
3087 delete_cab_files();
3088 DeleteFile(msifile);
3091 static BOOL file_matches(LPSTR path)
3093 CHAR buf[MAX_PATH];
3094 HANDLE file;
3095 DWORD size;
3097 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3098 NULL, OPEN_EXISTING, 0, NULL);
3100 ZeroMemory(buf, MAX_PATH);
3101 ReadFile(file, buf, 15, &size, NULL);
3102 CloseHandle(file);
3104 return !lstrcmp(buf, "msitest\\maximus");
3107 static void test_readonlyfile(void)
3109 UINT r;
3110 DWORD size;
3111 HANDLE file;
3112 CHAR path[MAX_PATH];
3114 CreateDirectoryA("msitest", NULL);
3115 create_file("msitest\\maximus", 500);
3116 create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
3118 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3120 lstrcpy(path, PROG_FILES_DIR);
3121 lstrcat(path, "\\msitest");
3122 CreateDirectory(path, NULL);
3124 lstrcat(path, "\\maximus");
3125 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3126 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3128 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3129 CloseHandle(file);
3131 r = MsiInstallProductA(msifile, NULL);
3132 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3133 ok(file_matches(path), "Expected file to be overwritten\n");
3134 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3135 ok(delete_pf("msitest", FALSE), "File not installed\n");
3137 /* Delete the files in the temp (current) folder */
3138 DeleteFile("msitest\\maximus");
3139 RemoveDirectory("msitest");
3140 DeleteFile(msifile);
3143 static void test_readonlyfile_cab(void)
3145 UINT r;
3146 DWORD size;
3147 HANDLE file;
3148 CHAR path[MAX_PATH];
3149 CHAR buf[16];
3151 CreateDirectoryA("msitest", NULL);
3152 create_file("maximus", 500);
3153 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3154 DeleteFile("maximus");
3156 create_database(msifile, rofc_tables, sizeof(rofc_tables) / sizeof(msi_table));
3158 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3160 lstrcpy(path, PROG_FILES_DIR);
3161 lstrcat(path, "\\msitest");
3162 CreateDirectory(path, NULL);
3164 lstrcat(path, "\\maximus");
3165 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3166 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3168 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3169 CloseHandle(file);
3171 r = MsiInstallProductA(msifile, NULL);
3172 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3174 memset( buf, 0, sizeof(buf) );
3175 if ((file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3176 NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
3178 ReadFile(file, buf, sizeof(buf) - 1, &size, NULL);
3179 CloseHandle(file);
3181 ok(!memcmp( buf, "maximus", sizeof("maximus")-1 ), "Expected file to be overwritten, got '%s'\n", buf);
3182 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3183 ok(delete_pf("msitest", FALSE), "File not installed\n");
3185 /* Delete the files in the temp (current) folder */
3186 delete_cab_files();
3187 DeleteFile("msitest\\maximus");
3188 RemoveDirectory("msitest");
3189 DeleteFile(msifile);
3192 static BOOL add_cabinet_storage(LPCSTR db, LPCSTR cabinet)
3194 WCHAR dbW[MAX_PATH], cabinetW[MAX_PATH];
3195 IStorage *stg;
3196 IStream *stm;
3197 HRESULT hr;
3198 HANDLE handle;
3200 MultiByteToWideChar(CP_ACP, 0, db, -1, dbW, MAX_PATH);
3201 hr = StgOpenStorage(dbW, NULL, STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, 0, &stg);
3202 if (FAILED(hr))
3203 return FALSE;
3205 MultiByteToWideChar(CP_ACP, 0, cabinet, -1, cabinetW, MAX_PATH);
3206 hr = IStorage_CreateStream(stg, cabinetW, STGM_WRITE|STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3207 if (FAILED(hr))
3209 IStorage_Release(stg);
3210 return FALSE;
3213 handle = CreateFileW(cabinetW, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
3214 if (handle != INVALID_HANDLE_VALUE)
3216 DWORD count;
3217 char buffer[1024];
3218 if (ReadFile(handle, buffer, sizeof(buffer), &count, NULL))
3219 IStream_Write(stm, buffer, count, &count);
3220 CloseHandle(handle);
3223 IStream_Release(stm);
3224 IStorage_Release(stg);
3226 return TRUE;
3229 static void test_lastusedsource(void)
3231 static char prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3233 UINT r;
3234 char value[MAX_PATH], path[MAX_PATH];
3235 DWORD size;
3237 if (!pMsiSourceListGetInfoA)
3239 win_skip("MsiSourceListGetInfoA is not available\n");
3240 return;
3243 CreateDirectoryA("msitest", NULL);
3244 create_file("maximus", 500);
3245 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3246 DeleteFile("maximus");
3248 create_database("msifile0.msi", lus0_tables, sizeof(lus0_tables) / sizeof(msi_table));
3249 create_database("msifile1.msi", lus1_tables, sizeof(lus1_tables) / sizeof(msi_table));
3250 create_database("msifile2.msi", lus2_tables, sizeof(lus2_tables) / sizeof(msi_table));
3252 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3254 /* no cabinet file */
3256 size = MAX_PATH;
3257 lstrcpyA(value, "aaa");
3258 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3259 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3260 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
3261 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
3263 r = MsiInstallProductA("msifile0.msi", "PUBLISH_PRODUCT=1");
3264 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3266 lstrcpyA(path, CURR_DIR);
3267 lstrcatA(path, "\\");
3269 size = MAX_PATH;
3270 lstrcpyA(value, "aaa");
3271 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3272 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3273 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3274 todo_wine
3276 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3277 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3280 r = MsiInstallProductA("msifile0.msi", "REMOVE=ALL");
3281 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3283 /* separate cabinet file */
3285 size = MAX_PATH;
3286 lstrcpyA(value, "aaa");
3287 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3288 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3289 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
3290 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
3292 r = MsiInstallProductA("msifile1.msi", "PUBLISH_PRODUCT=1");
3293 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3295 lstrcpyA(path, CURR_DIR);
3296 lstrcatA(path, "\\");
3298 size = MAX_PATH;
3299 lstrcpyA(value, "aaa");
3300 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3301 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3302 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3303 todo_wine
3305 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3306 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3309 r = MsiInstallProductA("msifile1.msi", "REMOVE=ALL");
3310 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3312 size = MAX_PATH;
3313 lstrcpyA(value, "aaa");
3314 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3315 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3316 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
3317 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
3319 /* embedded cabinet stream */
3321 add_cabinet_storage("msifile2.msi", "test1.cab");
3323 r = MsiInstallProductA("msifile2.msi", "PUBLISH_PRODUCT=1");
3324 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3326 size = MAX_PATH;
3327 lstrcpyA(value, "aaa");
3328 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3329 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3330 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3331 todo_wine
3333 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3334 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3337 r = MsiInstallProductA("msifile2.msi", "REMOVE=ALL");
3338 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3340 size = MAX_PATH;
3341 lstrcpyA(value, "aaa");
3342 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3343 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3344 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
3345 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
3347 /* Delete the files in the temp (current) folder */
3348 delete_cab_files();
3349 DeleteFile("msitest\\maximus");
3350 RemoveDirectory("msitest");
3351 DeleteFile("msifile0.msi");
3352 DeleteFile("msifile1.msi");
3353 DeleteFile("msifile2.msi");
3356 static void test_setdirproperty(void)
3358 UINT r;
3360 CreateDirectoryA("msitest", NULL);
3361 create_file("msitest\\maximus", 500);
3362 create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
3364 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3366 r = MsiInstallProductA(msifile, NULL);
3367 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3368 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
3369 ok(delete_cf("msitest", FALSE), "File not installed\n");
3371 /* Delete the files in the temp (current) folder */
3372 DeleteFile(msifile);
3373 DeleteFile("msitest\\maximus");
3374 RemoveDirectory("msitest");
3377 static void test_cabisextracted(void)
3379 UINT r;
3381 CreateDirectoryA("msitest", NULL);
3382 create_file("msitest\\gaius", 500);
3383 create_file("maximus", 500);
3384 create_file("augustus", 500);
3385 create_file("caesar", 500);
3387 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3388 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3389 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3391 create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
3393 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3395 r = MsiInstallProductA(msifile, NULL);
3396 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3397 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3398 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3399 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3400 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
3401 ok(delete_pf("msitest", FALSE), "File not installed\n");
3403 /* Delete the files in the temp (current) folder */
3404 delete_cab_files();
3405 DeleteFile(msifile);
3406 DeleteFile("maximus");
3407 DeleteFile("augustus");
3408 DeleteFile("caesar");
3409 DeleteFile("msitest\\gaius");
3410 RemoveDirectory("msitest");
3413 static void test_concurrentinstall(void)
3415 UINT r;
3416 CHAR path[MAX_PATH];
3418 CreateDirectoryA("msitest", NULL);
3419 CreateDirectoryA("msitest\\msitest", NULL);
3420 create_file("msitest\\maximus", 500);
3421 create_file("msitest\\msitest\\augustus", 500);
3423 create_database(msifile, ci_tables, sizeof(ci_tables) / sizeof(msi_table));
3425 lstrcpyA(path, CURR_DIR);
3426 lstrcatA(path, "\\msitest\\concurrent.msi");
3427 create_database(path, ci2_tables, sizeof(ci2_tables) / sizeof(msi_table));
3429 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3431 r = MsiInstallProductA(msifile, NULL);
3432 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3433 if (!delete_pf("msitest\\augustus", TRUE))
3434 trace("concurrent installs not supported\n");
3435 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3436 ok(delete_pf("msitest", FALSE), "File not installed\n");
3438 DeleteFile(path);
3440 r = MsiInstallProductA(msifile, NULL);
3441 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3442 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3443 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3444 ok(delete_pf("msitest", FALSE), "File not installed\n");
3446 DeleteFile(msifile);
3447 DeleteFile("msitest\\msitest\\augustus");
3448 DeleteFile("msitest\\maximus");
3449 RemoveDirectory("msitest\\msitest");
3450 RemoveDirectory("msitest");
3453 static void test_setpropertyfolder(void)
3455 UINT r;
3456 CHAR path[MAX_PATH];
3457 DWORD attr;
3459 lstrcpyA(path, PROG_FILES_DIR);
3460 lstrcatA(path, "\\msitest\\added");
3462 CreateDirectoryA("msitest", NULL);
3463 create_file("msitest\\maximus", 500);
3465 create_database(msifile, spf_tables, sizeof(spf_tables) / sizeof(msi_table));
3467 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3469 r = MsiInstallProductA(msifile, NULL);
3470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3471 attr = GetFileAttributesA(path);
3472 if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY))
3474 ok(delete_pf("msitest\\added\\maximus", TRUE), "File not installed\n");
3475 ok(delete_pf("msitest\\added", FALSE), "File not installed\n");
3476 ok(delete_pf("msitest", FALSE), "File not installed\n");
3478 else
3480 trace("changing folder property not supported\n");
3481 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3482 ok(delete_pf("msitest", FALSE), "File not installed\n");
3485 /* Delete the files in the temp (current) folder */
3486 DeleteFile(msifile);
3487 DeleteFile("msitest\\maximus");
3488 RemoveDirectory("msitest");
3491 static BOOL file_exists(LPCSTR file)
3493 return GetFileAttributes(file) != INVALID_FILE_ATTRIBUTES;
3496 static BOOL pf_exists(LPCSTR file)
3498 CHAR path[MAX_PATH];
3500 lstrcpyA(path, PROG_FILES_DIR);
3501 lstrcatA(path, "\\");
3502 lstrcatA(path, file);
3504 return file_exists(path);
3507 static void delete_pfmsitest_files(void)
3509 SHFILEOPSTRUCT shfl;
3510 CHAR path[MAX_PATH+11];
3512 lstrcpyA(path, PROG_FILES_DIR);
3513 lstrcatA(path, "\\msitest\\*");
3514 path[strlen(path) + 1] = '\0';
3516 shfl.hwnd = NULL;
3517 shfl.wFunc = FO_DELETE;
3518 shfl.pFrom = path;
3519 shfl.pTo = NULL;
3520 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
3522 SHFileOperation(&shfl);
3524 lstrcpyA(path, PROG_FILES_DIR);
3525 lstrcatA(path, "\\msitest");
3526 RemoveDirectoryA(path);
3529 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
3531 char val[MAX_PATH];
3532 DWORD size, type;
3533 LONG res;
3535 size = MAX_PATH;
3536 val[0] = '\0';
3537 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
3539 if (res != ERROR_SUCCESS ||
3540 (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
3542 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3543 return;
3546 if (!expected)
3547 ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val);
3548 else
3550 if (bcase)
3551 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
3552 else
3553 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
3557 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
3559 DWORD val, size, type;
3560 LONG res;
3562 size = sizeof(DWORD);
3563 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
3565 if (res != ERROR_SUCCESS || type != REG_DWORD)
3567 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3568 return;
3571 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
3574 static void check_reg_dword2(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD line)
3576 DWORD val, size, type;
3577 LONG res;
3579 size = sizeof(DWORD);
3580 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
3582 if (res != ERROR_SUCCESS || type != REG_DWORD)
3584 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3585 return;
3588 ok_(__FILE__, line)(val == expected1 || val == expected2, "Expected %d or %d, got %d\n", expected1, expected2, val);
3591 static void check_reg_dword3(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3, DWORD line)
3593 DWORD val, size, type;
3594 LONG res;
3596 size = sizeof(DWORD);
3597 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
3599 if (res != ERROR_SUCCESS || type != REG_DWORD)
3601 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3602 return;
3605 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3,
3606 "Expected %d, %d or %d, got %d\n", expected1, expected2, expected3, val);
3609 #define CHECK_REG_STR(prodkey, name, expected) \
3610 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
3612 #define CHECK_DEL_REG_STR(prodkey, name, expected) \
3613 check_reg_str(prodkey, name, expected, TRUE, __LINE__); \
3614 RegDeleteValueA(prodkey, name);
3616 #define CHECK_REG_ISTR(prodkey, name, expected) \
3617 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
3619 #define CHECK_DEL_REG_ISTR(prodkey, name, expected) \
3620 check_reg_str(prodkey, name, expected, FALSE, __LINE__); \
3621 RegDeleteValueA(prodkey, name);
3623 #define CHECK_REG_DWORD(prodkey, name, expected) \
3624 check_reg_dword(prodkey, name, expected, __LINE__);
3626 #define CHECK_DEL_REG_DWORD(prodkey, name, expected) \
3627 check_reg_dword(prodkey, name, expected, __LINE__); \
3628 RegDeleteValueA(prodkey, name);
3630 #define CHECK_REG_DWORD2(prodkey, name, expected1, expected2) \
3631 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__);
3633 #define CHECK_DEL_REG_DWORD2(prodkey, name, expected1, expected2) \
3634 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__); \
3635 RegDeleteValueA(prodkey, name);
3637 #define CHECK_REG_DWORD3(prodkey, name, expected1, expected2, expected3) \
3638 check_reg_dword3(prodkey, name, expected1, expected2, expected3, __LINE__);
3640 #define CHECK_DEL_REG_DWORD3(prodkey, name, expected1, expected2, expected3) \
3641 check_reg_dword3(prodkey, name, expected1, expected2, expected3, __LINE__); \
3642 RegDeleteValueA(prodkey, name);
3644 static void get_date_str(LPSTR date)
3646 SYSTEMTIME systime;
3648 static const char date_fmt[] = "%d%02d%02d";
3649 GetLocalTime(&systime);
3650 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
3653 static void test_publish_registerproduct(void)
3655 UINT r;
3656 LONG res;
3657 HKEY hkey;
3658 HKEY props, usage;
3659 LPSTR usersid;
3660 char date[MAX_PATH];
3661 char temp[MAX_PATH];
3662 char keypath[MAX_PATH];
3664 static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3665 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3666 static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
3667 "\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3668 static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
3669 "\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
3670 static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
3671 "\\51AAE0C44620A5E4788506E91F249BD2";
3673 if (!get_user_sid(&usersid))
3674 return;
3676 get_date_str(date);
3677 GetTempPath(MAX_PATH, temp);
3679 CreateDirectoryA("msitest", NULL);
3680 create_file("msitest\\maximus", 500);
3682 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3684 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3686 /* RegisterProduct */
3687 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
3688 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3689 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3690 ok(delete_pf("msitest", FALSE), "File not installed\n");
3692 res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
3693 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3695 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
3696 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3698 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
3699 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
3700 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
3701 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
3702 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3703 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
3704 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3705 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
3706 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
3707 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
3708 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
3709 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
3710 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
3711 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
3712 CHECK_DEL_REG_STR(hkey, "Size", NULL);
3713 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
3714 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
3715 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3716 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3717 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
3718 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
3719 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
3720 todo_wine
3722 CHECK_DEL_REG_DWORD3(hkey, "EstimatedSize", 12, -12, 4);
3725 RegDeleteKeyA(hkey, "");
3726 RegCloseKey(hkey);
3728 sprintf(keypath, userdata, usersid);
3729 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
3730 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3732 res = RegOpenKeyA(hkey, "InstallProperties", &props);
3733 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3735 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
3736 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
3737 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
3738 CHECK_DEL_REG_STR(props, "InstallDate", date);
3739 CHECK_DEL_REG_STR(props, "InstallSource", temp);
3740 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3741 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
3742 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3743 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
3744 CHECK_DEL_REG_STR(props, "Comments", NULL);
3745 CHECK_DEL_REG_STR(props, "Contact", NULL);
3746 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
3747 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
3748 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
3749 CHECK_DEL_REG_STR(props, "Readme", NULL);
3750 CHECK_DEL_REG_STR(props, "Size", NULL);
3751 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
3752 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
3753 CHECK_DEL_REG_DWORD(props, "Language", 1033);
3754 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
3755 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
3756 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
3757 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
3758 todo_wine
3760 CHECK_DEL_REG_DWORD3(props, "EstimatedSize", 12, -12, 4);
3763 RegDeleteKeyA(props, "");
3764 RegCloseKey(props);
3766 res = RegOpenKeyA(hkey, "Usage", &usage);
3767 todo_wine
3769 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3772 RegDeleteKeyA(usage, "");
3773 RegCloseKey(usage);
3774 RegDeleteKeyA(hkey, "");
3775 RegCloseKey(hkey);
3777 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
3778 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3780 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3782 RegDeleteKeyA(hkey, "");
3783 RegCloseKey(hkey);
3785 /* RegisterProduct, machine */
3786 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 ALLUSERS=1");
3787 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3788 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3789 ok(delete_pf("msitest", FALSE), "File not installed\n");
3791 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, userugkey, &hkey);
3792 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3794 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
3795 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3797 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
3798 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
3799 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
3800 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
3801 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3802 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
3803 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3804 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
3805 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
3806 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
3807 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
3808 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
3809 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
3810 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
3811 CHECK_DEL_REG_STR(hkey, "Size", NULL);
3812 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
3813 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
3814 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3815 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3816 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
3817 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
3818 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
3819 todo_wine
3821 CHECK_DEL_REG_DWORD3(hkey, "EstimatedSize", 12, -12, 4);
3824 RegDeleteKeyA(hkey, "");
3825 RegCloseKey(hkey);
3827 sprintf(keypath, userdata, "S-1-5-18");
3828 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
3829 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3831 res = RegOpenKeyA(hkey, "InstallProperties", &props);
3832 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3834 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
3835 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
3836 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
3837 CHECK_DEL_REG_STR(props, "InstallDate", date);
3838 CHECK_DEL_REG_STR(props, "InstallSource", temp);
3839 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3840 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
3841 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3842 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
3843 CHECK_DEL_REG_STR(props, "Comments", NULL);
3844 CHECK_DEL_REG_STR(props, "Contact", NULL);
3845 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
3846 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
3847 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
3848 CHECK_DEL_REG_STR(props, "Readme", NULL);
3849 CHECK_DEL_REG_STR(props, "Size", NULL);
3850 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
3851 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
3852 CHECK_DEL_REG_DWORD(props, "Language", 1033);
3853 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
3854 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
3855 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
3856 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
3857 todo_wine
3859 CHECK_DEL_REG_DWORD3(props, "EstimatedSize", 12, -12, 4);
3862 RegDeleteKeyA(props, "");
3863 RegCloseKey(props);
3865 res = RegOpenKeyA(hkey, "Usage", &usage);
3866 todo_wine
3868 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3871 RegDeleteKeyA(usage, "");
3872 RegCloseKey(usage);
3873 RegDeleteKeyA(hkey, "");
3874 RegCloseKey(hkey);
3876 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
3877 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3879 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3881 RegDeleteKeyA(hkey, "");
3882 RegCloseKey(hkey);
3884 DeleteFile(msifile);
3885 DeleteFile("msitest\\maximus");
3886 RemoveDirectory("msitest");
3887 HeapFree(GetProcessHeap(), 0, usersid);
3890 static void test_publish_publishproduct(void)
3892 UINT r;
3893 LONG res;
3894 LPSTR usersid;
3895 HKEY sourcelist, net, props;
3896 HKEY hkey, patches, media;
3897 CHAR keypath[MAX_PATH];
3898 CHAR temp[MAX_PATH];
3899 CHAR path[MAX_PATH];
3901 static const CHAR prodpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3902 "\\Installer\\UserData\\%s\\Products"
3903 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3904 static const CHAR cuprodpath[] = "Software\\Microsoft\\Installer\\Products"
3905 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3906 static const CHAR cuupgrades[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
3907 "\\51AAE0C44620A5E4788506E91F249BD2";
3908 static const CHAR badprod[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3909 "\\Installer\\Products"
3910 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3911 static const CHAR machprod[] = "Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3912 static const CHAR machup[] = "Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
3914 if (!get_user_sid(&usersid))
3915 return;
3917 GetTempPath(MAX_PATH, temp);
3919 CreateDirectoryA("msitest", NULL);
3920 create_file("msitest\\maximus", 500);
3922 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3924 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3926 /* PublishProduct, current user */
3927 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
3928 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3929 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3930 ok(delete_pf("msitest", FALSE), "File not installed\n");
3932 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
3933 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3935 sprintf(keypath, prodpath, usersid);
3936 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
3937 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3939 res = RegOpenKeyA(hkey, "InstallProperties", &props);
3940 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3942 res = RegOpenKeyA(hkey, "Patches", &patches);
3943 todo_wine
3945 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3947 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3950 RegDeleteKeyA(patches, "");
3951 RegCloseKey(patches);
3952 RegDeleteKeyA(hkey, "");
3953 RegCloseKey(hkey);
3955 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
3956 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3958 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3959 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
3960 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3961 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3962 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3963 CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
3964 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3965 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3966 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3968 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
3969 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3971 lstrcpyA(path, "n;1;");
3972 lstrcatA(path, temp);
3973 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3974 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3976 res = RegOpenKeyA(sourcelist, "Net", &net);
3977 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3979 CHECK_DEL_REG_STR(net, "1", temp);
3981 RegDeleteKeyA(net, "");
3982 RegCloseKey(net);
3984 res = RegOpenKeyA(sourcelist, "Media", &media);
3985 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3987 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3989 RegDeleteKeyA(media, "");
3990 RegCloseKey(media);
3991 RegDeleteKeyA(sourcelist, "");
3992 RegCloseKey(sourcelist);
3993 RegDeleteKeyA(hkey, "");
3994 RegCloseKey(hkey);
3996 res = RegOpenKeyA(HKEY_CURRENT_USER, cuupgrades, &hkey);
3997 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3999 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
4001 RegDeleteKeyA(hkey, "");
4002 RegCloseKey(hkey);
4004 /* PublishProduct, machine */
4005 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
4006 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4007 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4008 ok(delete_pf("msitest", FALSE), "File not installed\n");
4010 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
4011 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4013 sprintf(keypath, prodpath, "S-1-5-18");
4014 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
4015 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4017 res = RegOpenKeyA(hkey, "InstallProperties", &props);
4018 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4020 res = RegOpenKeyA(hkey, "Patches", &patches);
4021 todo_wine
4023 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4025 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
4028 RegDeleteKeyA(patches, "");
4029 RegCloseKey(patches);
4030 RegDeleteKeyA(hkey, "");
4031 RegCloseKey(hkey);
4033 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machprod, &hkey);
4034 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4036 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
4037 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
4038 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
4039 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
4040 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
4041 todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
4042 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
4043 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
4044 CHECK_DEL_REG_STR(hkey, "Clients", ":");
4046 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
4047 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4049 lstrcpyA(path, "n;1;");
4050 lstrcatA(path, temp);
4051 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
4052 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
4054 res = RegOpenKeyA(sourcelist, "Net", &net);
4055 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4057 CHECK_DEL_REG_STR(net, "1", temp);
4059 RegDeleteKeyA(net, "");
4060 RegCloseKey(net);
4062 res = RegOpenKeyA(sourcelist, "Media", &media);
4063 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4065 CHECK_DEL_REG_STR(media, "1", "DISK1;");
4067 RegDeleteKeyA(media, "");
4068 RegCloseKey(media);
4069 RegDeleteKeyA(sourcelist, "");
4070 RegCloseKey(sourcelist);
4071 RegDeleteKeyA(hkey, "");
4072 RegCloseKey(hkey);
4074 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machup, &hkey);
4075 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4077 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
4079 RegDeleteKeyA(hkey, "");
4080 RegCloseKey(hkey);
4082 DeleteFile(msifile);
4083 DeleteFile("msitest\\maximus");
4084 RemoveDirectory("msitest");
4085 HeapFree(GetProcessHeap(), 0, usersid);
4088 static void test_publish_publishfeatures(void)
4090 UINT r;
4091 LONG res;
4092 HKEY hkey;
4093 LPSTR usersid;
4094 CHAR keypath[MAX_PATH];
4096 static const CHAR cupath[] = "Software\\Microsoft\\Installer\\Features"
4097 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
4098 static const CHAR udpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
4099 "\\Installer\\UserData\\%s\\Products"
4100 "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
4101 static const CHAR featkey[] = "Software\\Microsoft\\Windows\\CurrentVersion"
4102 "\\Installer\\Features";
4103 static const CHAR classfeat[] = "Software\\Classes\\Installer\\Features"
4104 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
4106 if (!get_user_sid(&usersid))
4107 return;
4109 CreateDirectoryA("msitest", NULL);
4110 create_file("msitest\\maximus", 500);
4112 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4114 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4116 /* PublishFeatures, current user */
4117 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
4118 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4119 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4120 ok(delete_pf("msitest", FALSE), "File not installed\n");
4122 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
4123 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4125 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
4126 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4128 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
4129 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4131 CHECK_REG_STR(hkey, "feature", "");
4132 CHECK_REG_STR(hkey, "montecristo", "");
4134 RegDeleteValueA(hkey, "feature");
4135 RegDeleteValueA(hkey, "montecristo");
4136 RegDeleteKeyA(hkey, "");
4137 RegCloseKey(hkey);
4139 sprintf(keypath, udpath, usersid);
4140 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
4141 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4143 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
4144 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
4146 RegDeleteValueA(hkey, "feature");
4147 RegDeleteValueA(hkey, "montecristo");
4148 RegDeleteKeyA(hkey, "");
4149 RegCloseKey(hkey);
4151 /* PublishFeatures, machine */
4152 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
4153 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4154 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4155 ok(delete_pf("msitest", FALSE), "File not installed\n");
4157 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
4158 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4160 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
4161 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4163 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
4164 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4166 CHECK_REG_STR(hkey, "feature", "");
4167 CHECK_REG_STR(hkey, "montecristo", "");
4169 RegDeleteValueA(hkey, "feature");
4170 RegDeleteValueA(hkey, "montecristo");
4171 RegDeleteKeyA(hkey, "");
4172 RegCloseKey(hkey);
4174 sprintf(keypath, udpath, "S-1-5-18");
4175 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
4176 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4178 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
4179 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
4181 RegDeleteValueA(hkey, "feature");
4182 RegDeleteValueA(hkey, "montecristo");
4183 RegDeleteKeyA(hkey, "");
4184 RegCloseKey(hkey);
4186 DeleteFile(msifile);
4187 DeleteFile("msitest\\maximus");
4188 RemoveDirectory("msitest");
4189 HeapFree(GetProcessHeap(), 0, usersid);
4192 static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
4194 DWORD len = 0;
4195 LPSTR val;
4196 LONG r;
4198 r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
4199 if (r != ERROR_SUCCESS)
4200 return NULL;
4202 len += sizeof (WCHAR);
4203 val = HeapAlloc(GetProcessHeap(), 0, len);
4204 if (!val) return NULL;
4205 val[0] = 0;
4206 RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
4207 return val;
4210 static void get_owner_company(LPSTR *owner, LPSTR *company)
4212 LONG res;
4213 HKEY hkey;
4215 *owner = *company = NULL;
4217 res = RegOpenKeyA(HKEY_CURRENT_USER,
4218 "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
4219 if (res == ERROR_SUCCESS)
4221 *owner = reg_get_val_str(hkey, "DefName");
4222 *company = reg_get_val_str(hkey, "DefCompany");
4223 RegCloseKey(hkey);
4226 if (!*owner || !*company)
4228 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
4229 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey);
4230 if (res == ERROR_SUCCESS)
4232 *owner = reg_get_val_str(hkey, "RegisteredOwner");
4233 *company = reg_get_val_str(hkey, "RegisteredOrganization");
4234 RegCloseKey(hkey);
4238 if (!*owner || !*company)
4240 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
4241 "Software\\Microsoft\\Windows NT\\CurrentVersion", &hkey);
4242 if (res == ERROR_SUCCESS)
4244 *owner = reg_get_val_str(hkey, "RegisteredOwner");
4245 *company = reg_get_val_str(hkey, "RegisteredOrganization");
4246 RegCloseKey(hkey);
4251 static void test_publish_registeruser(void)
4253 UINT r;
4254 LONG res;
4255 HKEY props;
4256 LPSTR usersid;
4257 LPSTR owner, company;
4258 CHAR keypath[MAX_PATH];
4260 static const CHAR keyfmt[] =
4261 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
4262 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
4264 if (!get_user_sid(&usersid))
4265 return;
4267 get_owner_company(&owner, &company);
4269 CreateDirectoryA("msitest", NULL);
4270 create_file("msitest\\maximus", 500);
4272 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4274 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4276 /* RegisterUser, per-user */
4277 r = MsiInstallProductA(msifile, "REGISTER_USER=1");
4278 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4279 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4280 ok(delete_pf("msitest", FALSE), "File not installed\n");
4282 sprintf(keypath, keyfmt, usersid);
4284 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
4285 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4287 CHECK_REG_STR(props, "ProductID", "none");
4288 CHECK_REG_STR(props, "RegCompany", company);
4289 CHECK_REG_STR(props, "RegOwner", owner);
4291 RegDeleteValueA(props, "ProductID");
4292 RegDeleteValueA(props, "RegCompany");
4293 RegDeleteValueA(props, "RegOwner");
4294 RegDeleteKeyA(props, "");
4295 RegCloseKey(props);
4297 /* RegisterUser, machine */
4298 r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
4299 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4300 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4301 ok(delete_pf("msitest", FALSE), "File not installed\n");
4303 sprintf(keypath, keyfmt, "S-1-5-18");
4305 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
4306 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4308 CHECK_REG_STR(props, "ProductID", "none");
4309 CHECK_REG_STR(props, "RegCompany", company);
4310 CHECK_REG_STR(props, "RegOwner", owner);
4312 RegDeleteValueA(props, "ProductID");
4313 RegDeleteValueA(props, "RegCompany");
4314 RegDeleteValueA(props, "RegOwner");
4315 RegDeleteKeyA(props, "");
4316 RegCloseKey(props);
4318 HeapFree(GetProcessHeap(), 0, company);
4319 HeapFree(GetProcessHeap(), 0, owner);
4321 DeleteFile(msifile);
4322 DeleteFile("msitest\\maximus");
4323 RemoveDirectory("msitest");
4324 LocalFree(usersid);
4327 static void test_publish_processcomponents(void)
4329 UINT r;
4330 LONG res;
4331 DWORD size;
4332 HKEY comp, hkey;
4333 LPSTR usersid;
4334 CHAR val[MAX_PATH];
4335 CHAR keypath[MAX_PATH];
4336 CHAR program_files_maximus[MAX_PATH];
4338 static const CHAR keyfmt[] =
4339 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
4340 "UserData\\%s\\Components\\%s";
4341 static const CHAR compkey[] =
4342 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
4344 if (!get_user_sid(&usersid))
4345 return;
4347 CreateDirectoryA("msitest", NULL);
4348 create_file("msitest\\maximus", 500);
4350 create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table));
4352 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4354 /* ProcessComponents, per-user */
4355 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
4356 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4357 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4358 ok(delete_pf("msitest", FALSE), "File not installed\n");
4360 sprintf(keypath, keyfmt, usersid, "CBABC2FDCCB35E749A8944D8C1C098B5");
4362 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4363 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4365 size = MAX_PATH;
4366 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4367 NULL, NULL, (LPBYTE)val, &size);
4368 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4370 lstrcpyA(program_files_maximus,PROG_FILES_DIR);
4371 lstrcatA(program_files_maximus,"\\msitest\\maximus");
4373 ok(!lstrcmpiA(val, program_files_maximus),
4374 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
4376 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4377 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4379 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4380 RegDeleteKeyA(comp, "");
4381 RegCloseKey(comp);
4383 sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
4385 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4386 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4388 size = MAX_PATH;
4389 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4390 NULL, NULL, (LPBYTE)val, &size);
4391 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4392 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
4393 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
4395 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4396 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4398 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4399 RegDeleteKeyA(comp, "");
4400 RegCloseKey(comp);
4402 /* ProcessComponents, machine */
4403 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
4404 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4405 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4406 ok(delete_pf("msitest", FALSE), "File not installed\n");
4408 sprintf(keypath, keyfmt, "S-1-5-18", "CBABC2FDCCB35E749A8944D8C1C098B5");
4410 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4411 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4413 size = MAX_PATH;
4414 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4415 NULL, NULL, (LPBYTE)val, &size);
4416 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4417 ok(!lstrcmpiA(val, program_files_maximus),
4418 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
4420 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4421 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4423 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4424 RegDeleteKeyA(comp, "");
4425 RegCloseKey(comp);
4427 sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
4429 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4430 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4432 size = MAX_PATH;
4433 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4434 NULL, NULL, (LPBYTE)val, &size);
4435 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4436 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
4437 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
4439 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4440 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4442 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4443 RegDeleteKeyA(comp, "");
4444 RegCloseKey(comp);
4446 DeleteFile(msifile);
4447 DeleteFile("msitest\\maximus");
4448 RemoveDirectory("msitest");
4449 LocalFree(usersid);
4452 static void test_publish(void)
4454 UINT r;
4455 LONG res;
4456 HKEY uninstall, prodkey;
4457 INSTALLSTATE state;
4458 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
4459 char date[MAX_PATH];
4460 char temp[MAX_PATH];
4462 static const CHAR subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
4464 if (!pMsiQueryComponentStateA)
4466 win_skip("MsiQueryComponentStateA is not available\n");
4467 return;
4470 get_date_str(date);
4471 GetTempPath(MAX_PATH, temp);
4473 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, subkey, &uninstall);
4474 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4476 CreateDirectoryA("msitest", NULL);
4477 create_file("msitest\\maximus", 500);
4479 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4481 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4483 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4484 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4486 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4487 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4489 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4490 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4492 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4493 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4494 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4495 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4497 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4498 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4500 /* nothing published */
4501 r = MsiInstallProductA(msifile, NULL);
4502 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4503 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4504 ok(pf_exists("msitest"), "File not installed\n");
4506 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4507 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4509 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4510 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4512 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4513 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4515 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4516 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4517 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4518 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4520 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4521 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4523 /* PublishProduct and RegisterProduct */
4524 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
4525 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4526 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4527 ok(pf_exists("msitest"), "File not installed\n");
4529 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4530 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4532 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4533 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4535 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4536 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4538 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4539 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4540 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
4541 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4543 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4544 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4546 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4547 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4548 CHECK_REG_STR(prodkey, "InstallDate", date);
4549 CHECK_REG_STR(prodkey, "InstallSource", temp);
4550 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4551 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4552 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4553 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4554 CHECK_REG_STR(prodkey, "Comments", NULL);
4555 CHECK_REG_STR(prodkey, "Contact", NULL);
4556 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4557 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4558 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4559 CHECK_REG_STR(prodkey, "Readme", NULL);
4560 CHECK_REG_STR(prodkey, "Size", NULL);
4561 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4562 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4563 CHECK_REG_DWORD(prodkey, "Language", 1033);
4564 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4565 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4566 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4567 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4568 todo_wine
4570 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4573 RegCloseKey(prodkey);
4575 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4576 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4577 ok(pf_exists("msitest\\maximus"), "File deleted\n");
4578 ok(pf_exists("msitest"), "File deleted\n");
4580 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4581 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4583 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4584 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4586 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4587 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4589 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4590 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4591 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4592 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4594 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4595 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4597 /* complete install */
4598 r = MsiInstallProductA(msifile, "FULL=1");
4599 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4600 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4601 ok(pf_exists("msitest"), "File not installed\n");
4603 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4604 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4606 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4607 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4609 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4610 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4612 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4613 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4614 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4615 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4617 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4618 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4620 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4621 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4622 CHECK_REG_STR(prodkey, "InstallDate", date);
4623 CHECK_REG_STR(prodkey, "InstallSource", temp);
4624 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4625 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4626 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4627 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4628 CHECK_REG_STR(prodkey, "Comments", NULL);
4629 CHECK_REG_STR(prodkey, "Contact", NULL);
4630 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4631 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4632 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4633 CHECK_REG_STR(prodkey, "Readme", NULL);
4634 CHECK_REG_STR(prodkey, "Size", NULL);
4635 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4636 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4637 CHECK_REG_DWORD(prodkey, "Language", 1033);
4638 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4639 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4640 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4641 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4642 todo_wine
4644 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4647 RegCloseKey(prodkey);
4649 /* no UnpublishFeatures */
4650 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4651 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4652 ok(!pf_exists("msitest\\maximus"), "File deleted\n");
4653 todo_wine
4655 ok(!pf_exists("msitest"), "File deleted\n");
4658 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4659 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4661 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4662 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4664 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4665 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4667 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4668 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4669 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4670 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4672 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4673 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4675 /* complete install */
4676 r = MsiInstallProductA(msifile, "FULL=1");
4677 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4678 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4679 ok(pf_exists("msitest"), "File not installed\n");
4681 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4682 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4684 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4685 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4687 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4688 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4690 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4691 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4692 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4693 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4695 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4696 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4698 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4699 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4700 CHECK_REG_STR(prodkey, "InstallDate", date);
4701 CHECK_REG_STR(prodkey, "InstallSource", temp);
4702 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4703 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4704 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4705 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4706 CHECK_REG_STR(prodkey, "Comments", NULL);
4707 CHECK_REG_STR(prodkey, "Contact", NULL);
4708 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4709 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4710 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4711 CHECK_REG_STR(prodkey, "Readme", NULL);
4712 CHECK_REG_STR(prodkey, "Size", NULL);
4713 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4714 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4715 CHECK_REG_DWORD(prodkey, "Language", 1033);
4716 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4717 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4718 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4719 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4720 todo_wine
4722 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4725 RegCloseKey(prodkey);
4727 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
4728 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
4729 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4730 todo_wine ok(pf_exists("msitest\\maximus"), "File deleted\n");
4731 ok(pf_exists("msitest"), "File deleted\n");
4733 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4734 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4736 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4737 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4739 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4740 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4742 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4743 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4744 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4745 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4747 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4748 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4750 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4751 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4752 CHECK_REG_STR(prodkey, "InstallDate", date);
4753 CHECK_REG_STR(prodkey, "InstallSource", temp);
4754 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4755 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4756 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4757 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4758 CHECK_REG_STR(prodkey, "Comments", NULL);
4759 CHECK_REG_STR(prodkey, "Contact", NULL);
4760 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4761 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4762 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4763 CHECK_REG_STR(prodkey, "Readme", NULL);
4764 CHECK_REG_STR(prodkey, "Size", NULL);
4765 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4766 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4767 CHECK_REG_DWORD(prodkey, "Language", 1033);
4768 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4769 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4770 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4771 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4772 todo_wine
4774 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4777 RegCloseKey(prodkey);
4779 /* complete install */
4780 r = MsiInstallProductA(msifile, "FULL=1");
4781 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4782 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4783 ok(pf_exists("msitest"), "File not installed\n");
4785 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4786 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4788 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4789 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4791 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4792 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4794 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4795 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4796 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4797 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4799 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4800 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4802 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4803 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4804 CHECK_REG_STR(prodkey, "InstallDate", date);
4805 CHECK_REG_STR(prodkey, "InstallSource", temp);
4806 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4807 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4808 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4809 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4810 CHECK_REG_STR(prodkey, "Comments", NULL);
4811 CHECK_REG_STR(prodkey, "Contact", NULL);
4812 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4813 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4814 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4815 CHECK_REG_STR(prodkey, "Readme", NULL);
4816 CHECK_REG_STR(prodkey, "Size", NULL);
4817 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4818 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4819 CHECK_REG_DWORD(prodkey, "Language", 1033);
4820 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4821 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4822 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4823 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4824 todo_wine
4826 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -20);
4829 RegCloseKey(prodkey);
4831 /* UnpublishFeatures, both features removed */
4832 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
4833 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4834 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4835 todo_wine
4837 ok(!pf_exists("msitest"), "File not deleted\n");
4840 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4841 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4843 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4844 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4846 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4847 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4849 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4850 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4851 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4852 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4854 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4855 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4857 /* complete install */
4858 r = MsiInstallProductA(msifile, "FULL=1");
4859 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4860 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4861 ok(pf_exists("msitest"), "File not installed\n");
4863 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4864 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4866 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4867 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4869 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4870 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4872 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4873 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4874 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4875 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4877 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4878 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4880 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4881 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4882 CHECK_REG_STR(prodkey, "InstallDate", date);
4883 CHECK_REG_STR(prodkey, "InstallSource", temp);
4884 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4885 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4886 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4887 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4888 CHECK_REG_STR(prodkey, "Comments", NULL);
4889 CHECK_REG_STR(prodkey, "Contact", NULL);
4890 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4891 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4892 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4893 CHECK_REG_STR(prodkey, "Readme", NULL);
4894 CHECK_REG_STR(prodkey, "Size", NULL);
4895 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4896 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4897 CHECK_REG_DWORD(prodkey, "Language", 1033);
4898 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4899 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4900 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4901 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4902 todo_wine
4904 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4907 RegCloseKey(prodkey);
4909 /* complete uninstall */
4910 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4911 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4912 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4913 todo_wine
4915 ok(!pf_exists("msitest"), "File not deleted\n");
4918 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4919 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4921 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4922 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4924 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4925 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4927 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4928 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4929 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4930 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4932 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4933 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4935 /* make sure 'Program Files\msitest' is removed */
4936 delete_pfmsitest_files();
4938 RegCloseKey(uninstall);
4939 DeleteFile(msifile);
4940 DeleteFile("msitest\\maximus");
4941 RemoveDirectory("msitest");
4944 static void test_publishsourcelist(void)
4946 UINT r;
4947 DWORD size;
4948 CHAR value[MAX_PATH];
4949 CHAR path[MAX_PATH];
4950 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
4952 if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
4954 win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
4955 return;
4958 CreateDirectoryA("msitest", NULL);
4959 create_file("msitest\\maximus", 500);
4961 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4963 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4965 r = MsiInstallProductA(msifile, NULL);
4966 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4967 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4968 ok(pf_exists("msitest"), "File not installed\n");
4970 /* nothing published */
4971 size = MAX_PATH;
4972 lstrcpyA(value, "aaa");
4973 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4974 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4975 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4976 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4977 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4979 size = MAX_PATH;
4980 lstrcpyA(value, "aaa");
4981 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4982 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4983 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4984 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4985 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4987 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
4988 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4989 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4990 ok(pf_exists("msitest"), "File not installed\n");
4992 /* after RegisterProduct */
4993 size = MAX_PATH;
4994 lstrcpyA(value, "aaa");
4995 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4996 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4997 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4998 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4999 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5001 size = MAX_PATH;
5002 lstrcpyA(value, "aaa");
5003 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5004 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
5005 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5006 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5007 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5009 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
5010 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5011 ok(pf_exists("msitest\\maximus"), "File not installed\n");
5012 ok(pf_exists("msitest"), "File not installed\n");
5014 /* after ProcessComponents */
5015 size = MAX_PATH;
5016 lstrcpyA(value, "aaa");
5017 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5018 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
5019 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5020 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5021 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5023 size = MAX_PATH;
5024 lstrcpyA(value, "aaa");
5025 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5026 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
5027 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5028 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5029 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5031 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
5032 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5033 ok(pf_exists("msitest\\maximus"), "File not installed\n");
5034 ok(pf_exists("msitest"), "File not installed\n");
5036 /* after PublishFeatures */
5037 size = MAX_PATH;
5038 lstrcpyA(value, "aaa");
5039 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5040 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
5041 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5042 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5043 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5045 size = MAX_PATH;
5046 lstrcpyA(value, "aaa");
5047 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5048 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
5049 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5050 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5051 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5053 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
5054 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5055 ok(pf_exists("msitest\\maximus"), "File not installed\n");
5056 ok(pf_exists("msitest"), "File not installed\n");
5058 /* after PublishProduct */
5059 size = MAX_PATH;
5060 lstrcpyA(value, "aaa");
5061 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5062 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
5063 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5064 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
5065 ok(size == 11, "Expected 11, got %d\n", size);
5067 size = MAX_PATH;
5068 lstrcpyA(value, "aaa");
5069 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5070 MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATH, value, &size);
5071 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5072 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
5073 ok(size == 0, "Expected 0, got %d\n", size);
5075 size = MAX_PATH;
5076 lstrcpyA(value, "aaa");
5077 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5078 MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPT, value, &size);
5079 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5080 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
5081 ok(size == 0, "Expected 0, got %d\n", size);
5083 lstrcpyA(path, CURR_DIR);
5084 lstrcatA(path, "\\");
5086 size = MAX_PATH;
5087 lstrcpyA(value, "aaa");
5088 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5089 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
5090 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5091 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
5092 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
5094 size = MAX_PATH;
5095 lstrcpyA(value, "aaa");
5096 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5097 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE, value, &size);
5098 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5099 ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
5100 ok(size == 1, "Expected 1, got %d\n", size);
5102 size = MAX_PATH;
5103 lstrcpyA(value, "aaa");
5104 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5105 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
5106 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
5107 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
5108 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
5110 size = MAX_PATH;
5111 lstrcpyA(value, "aaa");
5112 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5113 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
5114 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5115 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
5116 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
5118 size = MAX_PATH;
5119 lstrcpyA(value, "aaa");
5120 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5121 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
5122 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
5123 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
5124 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
5126 /* complete uninstall */
5127 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
5128 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5129 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
5130 todo_wine
5132 ok(!pf_exists("msitest"), "File not deleted\n");
5135 /* make sure 'Program Files\msitest' is removed */
5136 delete_pfmsitest_files();
5138 DeleteFile(msifile);
5139 DeleteFile("msitest\\maximus");
5140 RemoveDirectory("msitest");
5143 static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
5145 MSIHANDLE hview = 0;
5146 UINT r;
5148 r = MsiDatabaseOpenView(hdb, query, &hview);
5149 if(r != ERROR_SUCCESS)
5150 return r;
5152 r = MsiViewExecute(hview, hrec);
5153 if(r == ERROR_SUCCESS)
5154 r = MsiViewClose(hview);
5155 MsiCloseHandle(hview);
5156 return r;
5159 static void set_transform_summary_info(void)
5161 UINT r;
5162 MSIHANDLE suminfo = 0;
5164 /* build summary info */
5165 r = MsiGetSummaryInformation(0, mstfile, 3, &suminfo);
5166 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
5168 r = MsiSummaryInfoSetProperty(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
5169 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
5171 r = MsiSummaryInfoSetProperty(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
5172 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
5173 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
5174 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
5175 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
5177 r = MsiSummaryInfoSetProperty(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
5178 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
5180 r = MsiSummaryInfoPersist(suminfo);
5181 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
5183 r = MsiCloseHandle(suminfo);
5184 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
5187 static void generate_transform(void)
5189 MSIHANDLE hdb1, hdb2;
5190 LPCSTR query;
5191 UINT r;
5193 /* start with two identical databases */
5194 CopyFile(msifile, msifile2, FALSE);
5196 r = MsiOpenDatabase(msifile2, MSIDBOPEN_TRANSACT, &hdb1);
5197 ok(r == ERROR_SUCCESS , "Failed to create database\n");
5199 r = MsiDatabaseCommit(hdb1);
5200 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
5202 r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb2);
5203 ok(r == ERROR_SUCCESS , "Failed to create database\n");
5205 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
5206 r = run_query(hdb1, 0, query);
5207 ok(r == ERROR_SUCCESS, "failed to add property\n");
5209 /* database needs to be committed */
5210 MsiDatabaseCommit(hdb1);
5212 r = MsiDatabaseGenerateTransform(hdb1, hdb2, mstfile, 0, 0);
5213 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
5215 #if 0 /* not implemented in wine yet */
5216 r = MsiCreateTransformSummaryInfo(hdb2, hdb2, mstfile, 0, 0);
5217 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5218 #endif
5220 MsiCloseHandle(hdb1);
5221 MsiCloseHandle(hdb2);
5224 /* data for generating a transform */
5226 /* tables transform names - encoded as they would be in an msi database file */
5227 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
5228 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
5229 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
5231 /* data in each table */
5232 static const char data1[] = /* _StringData */
5233 "propval"; /* all the strings squashed together */
5235 static const WCHAR data2[] = { /* _StringPool */
5236 /* len, refs */
5237 0, 0, /* string 0 '' */
5238 4, 1, /* string 1 'prop' */
5239 3, 1, /* string 2 'val' */
5242 static const WCHAR data3[] = { /* Property */
5243 0x0201, 0x0001, 0x0002,
5246 static const struct {
5247 LPCWSTR name;
5248 const void *data;
5249 DWORD size;
5250 } table_transform_data[] =
5252 { name1, data1, sizeof data1 - 1 },
5253 { name2, data2, sizeof data2 },
5254 { name3, data3, sizeof data3 },
5257 #define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
5259 static void generate_transform_manual(void)
5261 IStorage *stg = NULL;
5262 IStream *stm;
5263 WCHAR name[0x20];
5264 HRESULT r;
5265 DWORD i, count;
5266 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
5268 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
5270 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
5272 r = StgCreateDocfile(name, mode, 0, &stg);
5273 ok(r == S_OK, "failed to create storage\n");
5274 if (!stg)
5275 return;
5277 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
5278 ok(r == S_OK, "failed to set storage type\n");
5280 for (i=0; i<NUM_TRANSFORM_TABLES; i++)
5282 r = IStorage_CreateStream(stg, table_transform_data[i].name,
5283 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
5284 if (FAILED(r))
5286 ok(0, "failed to create stream %08x\n", r);
5287 continue;
5290 r = IStream_Write(stm, table_transform_data[i].data,
5291 table_transform_data[i].size, &count);
5292 if (FAILED(r) || count != table_transform_data[i].size)
5293 ok(0, "failed to write stream\n");
5294 IStream_Release(stm);
5297 IStorage_Release(stg);
5299 set_transform_summary_info();
5302 static void test_transformprop(void)
5304 UINT r;
5306 CreateDirectoryA("msitest", NULL);
5307 create_file("msitest\\augustus", 500);
5309 create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
5311 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5313 r = MsiInstallProductA(msifile, NULL);
5314 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5315 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5316 ok(!delete_pf("msitest", FALSE), "File installed\n");
5318 if (0)
5319 generate_transform();
5320 else
5321 generate_transform_manual();
5323 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
5324 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5325 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5326 ok(delete_pf("msitest", FALSE), "File not installed\n");
5328 /* Delete the files in the temp (current) folder */
5329 DeleteFile(msifile);
5330 DeleteFile(msifile2);
5331 DeleteFile(mstfile);
5332 DeleteFile("msitest\\augustus");
5333 RemoveDirectory("msitest");
5336 static void test_currentworkingdir(void)
5338 UINT r;
5339 CHAR drive[MAX_PATH], path[MAX_PATH];
5340 LPSTR ptr;
5342 CreateDirectoryA("msitest", NULL);
5343 create_file("msitest\\augustus", 500);
5345 create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
5347 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5349 CreateDirectoryA("diffdir", NULL);
5350 SetCurrentDirectoryA("diffdir");
5352 sprintf(path, "..\\%s", msifile);
5353 r = MsiInstallProductA(path, NULL);
5354 todo_wine
5356 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
5357 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5358 ok(!delete_pf("msitest", FALSE), "File installed\n");
5361 sprintf(path, "%s\\%s", CURR_DIR, msifile);
5362 r = MsiInstallProductA(path, NULL);
5363 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5364 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5365 ok(delete_pf("msitest", FALSE), "File not installed\n");
5367 lstrcpyA(drive, CURR_DIR);
5368 drive[2] = '\\';
5369 drive[3] = '\0';
5370 SetCurrentDirectoryA(drive);
5372 lstrcpy(path, CURR_DIR);
5373 if (path[lstrlenA(path) - 1] != '\\')
5374 lstrcatA(path, "\\");
5375 lstrcatA(path, msifile);
5376 ptr = strchr(path, ':');
5377 ptr +=2;
5379 r = MsiInstallProductA(ptr, NULL);
5380 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5381 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5382 ok(delete_pf("msitest", FALSE), "File not installed\n");
5384 SetCurrentDirectoryA(CURR_DIR);
5386 DeleteFile(msifile);
5387 DeleteFile("msitest\\augustus");
5388 RemoveDirectory("msitest");
5389 RemoveDirectory("diffdir");
5392 static void set_admin_summary_info(const CHAR *name)
5394 MSIHANDLE db, summary;
5395 UINT r;
5397 r = MsiOpenDatabaseA(name, MSIDBOPEN_DIRECT, &db);
5398 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5400 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
5401 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5403 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
5404 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5406 /* write the summary changes back to the stream */
5407 r = MsiSummaryInfoPersist(summary);
5408 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5410 MsiCloseHandle(summary);
5412 r = MsiDatabaseCommit(db);
5413 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5415 MsiCloseHandle(db);
5418 static void test_admin(void)
5420 UINT r;
5422 CreateDirectoryA("msitest", NULL);
5423 create_file("msitest\\augustus", 500);
5425 create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
5426 set_admin_summary_info(msifile);
5428 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5430 r = MsiInstallProductA(msifile, NULL);
5431 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5432 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5433 ok(!delete_pf("msitest", FALSE), "File installed\n");
5434 ok(!DeleteFile("c:\\msitest\\augustus"), "File installed\n");
5435 ok(!RemoveDirectory("c:\\msitest"), "File installed\n");
5437 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
5438 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5439 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5440 ok(!delete_pf("msitest", FALSE), "File installed\n");
5441 todo_wine
5443 ok(DeleteFile("c:\\msitest\\augustus"), "File not installed\n");
5444 ok(RemoveDirectory("c:\\msitest"), "File not installed\n");
5447 DeleteFile(msifile);
5448 DeleteFile("msitest\\augustus");
5449 RemoveDirectory("msitest");
5452 static void set_admin_property_stream(LPCSTR file)
5454 IStorage *stg;
5455 IStream *stm;
5456 WCHAR fileW[MAX_PATH];
5457 HRESULT hr;
5458 DWORD count;
5459 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
5461 /* AdminProperties */
5462 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
5463 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',' ',
5464 'M','y','P','r','o','p','=','4','2',0};
5466 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
5468 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
5469 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
5470 if (!stg)
5471 return;
5473 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
5474 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
5476 hr = IStream_Write(stm, data, sizeof(data), &count);
5477 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
5479 IStream_Release(stm);
5480 IStorage_Release(stg);
5483 static void test_adminprops(void)
5485 UINT r;
5487 CreateDirectoryA("msitest", NULL);
5488 create_file("msitest\\augustus", 500);
5490 create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
5491 set_admin_summary_info(msifile);
5492 set_admin_property_stream(msifile);
5494 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5496 r = MsiInstallProductA(msifile, NULL);
5497 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5498 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
5499 ok(delete_pf("msitest", FALSE), "File installed\n");
5501 DeleteFile(msifile);
5502 DeleteFile("msitest\\augustus");
5503 RemoveDirectory("msitest");
5506 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
5508 CHAR path[MAX_PATH];
5510 lstrcpyA(path, PROG_FILES_DIR);
5511 lstrcatA(path, "\\");
5512 lstrcatA(path, file);
5514 if (is_file)
5515 create_file_data(path, data, 500);
5516 else
5517 CreateDirectoryA(path, NULL);
5520 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
5522 static void test_removefiles(void)
5524 UINT r;
5526 CreateDirectoryA("msitest", NULL);
5527 create_file("msitest\\hydrogen", 500);
5528 create_file("msitest\\helium", 500);
5529 create_file("msitest\\lithium", 500);
5531 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
5533 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
5535 r = MsiInstallProductA(msifile, NULL);
5536 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5537 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5538 ok(!pf_exists("msitest\\helium"), "File installed\n");
5539 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5540 ok(pf_exists("msitest"), "File not installed\n");
5542 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5543 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5544 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
5545 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
5546 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
5547 ok(delete_pf("msitest", FALSE), "File deleted\n");
5549 create_pf("msitest", FALSE);
5550 create_pf("msitest\\hydrogen", TRUE);
5551 create_pf("msitest\\helium", TRUE);
5552 create_pf("msitest\\lithium", TRUE);
5554 r = MsiInstallProductA(msifile, NULL);
5555 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5556 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5557 ok(pf_exists("msitest\\helium"), "File not installed\n");
5558 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5559 ok(pf_exists("msitest"), "File not installed\n");
5561 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5562 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5563 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
5564 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
5565 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
5566 ok(delete_pf("msitest", FALSE), "File deleted\n");
5568 create_pf("msitest", FALSE);
5569 create_pf("msitest\\furlong", TRUE);
5570 create_pf("msitest\\firkin", TRUE);
5571 create_pf("msitest\\fortnight", TRUE);
5572 create_pf("msitest\\becquerel", TRUE);
5573 create_pf("msitest\\dioptre", TRUE);
5574 create_pf("msitest\\attoparsec", TRUE);
5575 create_pf("msitest\\storeys", TRUE);
5576 create_pf("msitest\\block", TRUE);
5577 create_pf("msitest\\siriometer", TRUE);
5578 create_pf("msitest\\cabout", FALSE);
5579 create_pf("msitest\\cabout\\blocker", TRUE);
5581 r = MsiInstallProductA(msifile, NULL);
5582 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5583 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5584 ok(!pf_exists("msitest\\helium"), "File installed\n");
5585 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5586 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
5587 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
5588 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
5589 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
5590 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
5591 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
5592 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
5593 ok(!pf_exists("msitest\\block"), "File not deleted\n");
5594 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
5595 ok(pf_exists("msitest\\cabout"), "Directory removed\n");
5596 ok(pf_exists("msitest"), "File not installed\n");
5598 create_pf("msitest\\furlong", TRUE);
5599 create_pf("msitest\\firkin", TRUE);
5600 create_pf("msitest\\fortnight", TRUE);
5601 create_pf("msitest\\storeys", TRUE);
5602 create_pf("msitest\\block", TRUE);
5603 create_pf("msitest\\siriometer", TRUE);
5605 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5606 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5607 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
5608 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
5609 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
5610 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
5611 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
5612 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
5613 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
5614 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
5615 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
5616 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
5617 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
5618 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
5619 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
5620 ok(pf_exists("msitest"), "Directory deleted\n");
5622 r = MsiInstallProductA(msifile, NULL);
5623 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5624 ok(delete_pf("msitest\\hydrogen", TRUE), "File not installed\n");
5625 ok(!delete_pf("msitest\\helium", TRUE), "File installed\n");
5626 ok(delete_pf("msitest\\lithium", TRUE), "File not installed\n");
5627 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
5628 ok(pf_exists("msitest"), "Directory deleted\n");
5630 delete_pf("msitest\\cabout\\blocker", TRUE);
5632 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5633 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5634 ok(!delete_pf("msitest\\cabout", FALSE), "Directory not deleted\n");
5635 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
5637 DeleteFile(msifile);
5638 DeleteFile("msitest\\hydrogen");
5639 DeleteFile("msitest\\helium");
5640 DeleteFile("msitest\\lithium");
5641 RemoveDirectory("msitest");
5644 static void test_movefiles(void)
5646 UINT r;
5647 char props[MAX_PATH];
5649 CreateDirectoryA("msitest", NULL);
5650 create_file("msitest\\augustus", 100);
5651 create_file("cameroon", 100);
5652 create_file("djibouti", 100);
5653 create_file("egypt", 100);
5654 create_file("finland", 100);
5655 create_file("gambai", 100);
5656 create_file("honduras", 100);
5657 create_file("msitest\\india", 100);
5658 create_file("japan", 100);
5659 create_file("kenya", 100);
5660 CreateDirectoryA("latvia", NULL);
5661 create_file("nauru", 100);
5662 create_file("peru", 100);
5663 create_file("apple", 100);
5664 create_file("application", 100);
5665 create_file("ape", 100);
5666 create_file("foo", 100);
5667 create_file("fao", 100);
5668 create_file("fbod", 100);
5669 create_file("budding", 100);
5670 create_file("buddy", 100);
5671 create_file("bud", 100);
5672 create_file("bar", 100);
5673 create_file("bur", 100);
5674 create_file("bird", 100);
5676 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
5678 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
5680 /* if the source or dest property is not a full path,
5681 * windows tries to access it as a network resource
5684 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
5685 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
5686 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
5688 r = MsiInstallProductA(msifile, props);
5689 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5690 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5691 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
5692 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
5693 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
5694 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
5695 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
5696 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
5697 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
5698 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
5699 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
5700 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
5701 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
5702 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
5703 ok(delete_pf("msitest\\poland", TRUE), "File not moved\n");
5704 /* either apple or application will be moved depending on directory order */
5705 if (!delete_pf("msitest\\apple", TRUE))
5706 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
5707 else
5708 ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
5709 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
5710 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
5711 /* either fao or foo will be moved depending on directory order */
5712 if (delete_pf("msitest\\foo", TRUE))
5713 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
5714 else
5715 ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
5716 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
5717 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
5718 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
5719 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
5720 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
5721 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
5722 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
5723 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
5724 ok(delete_pf("msitest", FALSE), "File not installed\n");
5725 ok(DeleteFileA("cameroon"), "File moved\n");
5726 ok(!DeleteFileA("djibouti"), "File not moved\n");
5727 ok(DeleteFileA("egypt"), "File moved\n");
5728 ok(DeleteFileA("finland"), "File moved\n");
5729 ok(DeleteFileA("gambai"), "File moved\n");
5730 ok(!DeleteFileA("honduras"), "File not moved\n");
5731 ok(DeleteFileA("msitest\\india"), "File moved\n");
5732 ok(DeleteFileA("japan"), "File moved\n");
5733 ok(!DeleteFileA("kenya"), "File not moved\n");
5734 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
5735 ok(!DeleteFileA("nauru"), "File not moved\n");
5736 ok(!DeleteFileA("peru"), "File not moved\n");
5737 ok(!DeleteFileA("apple"), "File not moved\n");
5738 ok(!DeleteFileA("application"), "File not moved\n");
5739 ok(DeleteFileA("ape"), "File moved\n");
5740 ok(!DeleteFileA("foo"), "File not moved\n");
5741 ok(!DeleteFileA("fao"), "File not moved\n");
5742 ok(DeleteFileA("fbod"), "File moved\n");
5743 ok(!DeleteFileA("budding"), "File not moved\n");
5744 ok(!DeleteFileA("buddy"), "File not moved\n");
5745 ok(DeleteFileA("bud"), "File moved\n");
5746 ok(!DeleteFileA("bar"), "File not moved\n");
5747 ok(!DeleteFileA("bur"), "File not moved\n");
5748 ok(DeleteFileA("bird"), "File moved\n");
5750 DeleteFile("msitest\\augustus");
5751 RemoveDirectory("msitest");
5752 DeleteFile(msifile);
5755 static void test_missingcab(void)
5757 UINT r;
5759 CreateDirectoryA("msitest", NULL);
5760 create_file("msitest\\augustus", 500);
5761 create_file("maximus", 500);
5763 create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
5765 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5767 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
5769 create_pf("msitest", FALSE);
5770 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
5772 r = MsiInstallProductA(msifile, NULL);
5773 ok(r == ERROR_SUCCESS ||
5774 broken(r == ERROR_INSTALL_FAILURE), /* win9x */
5775 "Expected ERROR_SUCCESS, got %u\n", r);
5776 if (r == ERROR_SUCCESS)
5778 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5779 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
5781 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
5782 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
5783 ok(delete_pf("msitest", FALSE), "File not installed\n");
5785 create_pf("msitest", FALSE);
5786 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
5787 create_pf("msitest\\gaius", TRUE);
5789 r = MsiInstallProductA(msifile, "GAIUS=1");
5790 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5791 todo_wine
5793 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
5794 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5796 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
5797 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
5798 ok(delete_pf("msitest", FALSE), "File not installed\n");
5800 DeleteFile("msitest\\augustus");
5801 RemoveDirectory("msitest");
5802 DeleteFile("maximus");
5803 DeleteFile("test1.cab");
5804 DeleteFile(msifile);
5807 static void test_duplicatefiles(void)
5809 UINT r;
5811 CreateDirectoryA("msitest", NULL);
5812 create_file("msitest\\maximus", 500);
5813 create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
5815 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5817 /* fails if the destination folder is not a valid property */
5819 r = MsiInstallProductA(msifile, NULL);
5820 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5821 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
5822 ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
5823 ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
5824 ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "File not duplicated\n");
5825 ok(delete_pf("msitest\\this\\doesnot", FALSE), "File not duplicated\n");
5826 ok(delete_pf("msitest\\this", FALSE), "File not duplicated\n");
5827 ok(delete_pf("msitest", FALSE), "File not installed\n");
5829 DeleteFile("msitest\\maximus");
5830 RemoveDirectory("msitest");
5831 DeleteFile(msifile);
5834 static void test_writeregistryvalues(void)
5836 UINT r;
5837 LONG res;
5838 HKEY hkey;
5839 DWORD type, size;
5840 CHAR path[MAX_PATH];
5842 CreateDirectoryA("msitest", NULL);
5843 create_file("msitest\\augustus", 500);
5845 create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
5847 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5849 r = MsiInstallProductA(msifile, NULL);
5850 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5851 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
5852 ok(delete_pf("msitest", FALSE), "File installed\n");
5854 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
5855 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5857 size = MAX_PATH;
5858 type = REG_MULTI_SZ;
5859 memset(path, 'a', MAX_PATH);
5860 res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size);
5861 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5862 ok(!memcmp(path, "one\0two\0three\0\0", size), "Wrong multi-sz data\n");
5863 ok(size == 15, "Expected 15, got %d\n", size);
5864 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5866 DeleteFile(msifile);
5867 DeleteFile("msitest\\augustus");
5868 RemoveDirectory("msitest");
5870 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
5871 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine");
5874 static void test_sourcefolder(void)
5876 UINT r;
5878 CreateDirectoryA("msitest", NULL);
5879 create_file("augustus", 500);
5881 create_database(msifile, sf_tables, sizeof(sf_tables) / sizeof(msi_table));
5883 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5885 r = MsiInstallProductA(msifile, NULL);
5886 ok(r == ERROR_INSTALL_FAILURE,
5887 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5888 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5889 todo_wine
5891 ok(!delete_pf("msitest", FALSE), "File installed\n");
5894 RemoveDirectoryA("msitest");
5896 r = MsiInstallProductA(msifile, NULL);
5897 ok(r == ERROR_INSTALL_FAILURE,
5898 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5899 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5900 todo_wine
5902 ok(!delete_pf("msitest", FALSE), "File installed\n");
5905 DeleteFile(msifile);
5906 DeleteFile("augustus");
5909 static void test_customaction51(void)
5911 UINT r;
5913 CreateDirectoryA("msitest", NULL);
5914 create_file("msitest\\augustus", 500);
5916 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
5918 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5920 r = MsiInstallProductA(msifile, NULL);
5921 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5922 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
5923 ok(delete_pf("msitest", FALSE), "File installed\n");
5925 DeleteFile(msifile);
5926 DeleteFile("msitest\\augustus");
5927 RemoveDirectory("msitest");
5930 static void test_installstate(void)
5932 UINT r;
5934 CreateDirectoryA("msitest", NULL);
5935 create_file("msitest\\alpha", 500);
5936 create_file("msitest\\beta", 500);
5937 create_file("msitest\\gamma", 500);
5938 create_file("msitest\\theta", 500);
5939 create_file("msitest\\delta", 500);
5940 create_file("msitest\\epsilon", 500);
5941 create_file("msitest\\zeta", 500);
5942 create_file("msitest\\iota", 500);
5943 create_file("msitest\\eta", 500);
5944 create_file("msitest\\kappa", 500);
5945 create_file("msitest\\lambda", 500);
5946 create_file("msitest\\mu", 500);
5948 create_database(msifile, is_tables, sizeof(is_tables) / sizeof(msi_table));
5950 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5952 r = MsiInstallProductA(msifile, NULL);
5953 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5954 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
5955 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
5956 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
5957 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
5958 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
5959 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
5960 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
5961 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
5962 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
5963 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
5964 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
5965 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
5966 ok(delete_pf("msitest", FALSE), "File not installed\n");
5968 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
5969 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5970 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
5971 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
5972 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
5973 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
5974 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
5975 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
5976 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
5977 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
5978 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
5979 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
5980 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
5981 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
5982 ok(delete_pf("msitest", FALSE), "File not installed\n");
5984 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
5985 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5986 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
5987 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
5988 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
5989 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
5990 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
5991 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
5992 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
5993 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
5994 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
5995 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
5996 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
5997 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
5998 ok(delete_pf("msitest", FALSE), "File not installed\n");
6000 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
6001 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6002 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
6003 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
6004 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
6005 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
6006 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
6007 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
6008 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
6009 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
6010 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
6011 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
6012 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
6013 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
6014 ok(!delete_pf("msitest", FALSE), "File installed\n");
6016 DeleteFile(msifile);
6017 DeleteFile("msitest\\alpha");
6018 DeleteFile("msitest\\beta");
6019 DeleteFile("msitest\\gamma");
6020 DeleteFile("msitest\\theta");
6021 DeleteFile("msitest\\delta");
6022 DeleteFile("msitest\\epsilon");
6023 DeleteFile("msitest\\zeta");
6024 DeleteFile("msitest\\iota");
6025 DeleteFile("msitest\\eta");
6026 DeleteFile("msitest\\kappa");
6027 DeleteFile("msitest\\lambda");
6028 DeleteFile("msitest\\mu");
6029 RemoveDirectory("msitest");
6032 struct sourcepathmap
6034 BOOL sost; /* shortone\shorttwo */
6035 BOOL solt; /* shortone\longtwo */
6036 BOOL lost; /* longone\shorttwo */
6037 BOOL lolt; /* longone\longtwo */
6038 BOOL soste; /* shortone\shorttwo source exists */
6039 BOOL solte; /* shortone\longtwo source exists */
6040 BOOL loste; /* longone\shorttwo source exists */
6041 BOOL lolte; /* longone\longtwo source exists */
6042 UINT err;
6043 DWORD size;
6044 } spmap[256] =
6046 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6047 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6048 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6049 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6050 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6051 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6052 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6053 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6054 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6055 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6056 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6057 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6058 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6059 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6060 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6061 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6062 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6063 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6064 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6065 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6066 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6067 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6068 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6069 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6070 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6071 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6072 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6073 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6074 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6075 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6076 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6077 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6078 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6079 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6080 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6081 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6082 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6083 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6084 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6085 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6086 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6087 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6088 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6089 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6090 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6091 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6092 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6093 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6094 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6095 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6096 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6097 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6098 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6099 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6100 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6101 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6102 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6103 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6104 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6105 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6106 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6107 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6108 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6109 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6110 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6111 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6112 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6113 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6114 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6115 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6116 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6117 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6118 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6119 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6120 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6121 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6122 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6123 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6124 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6125 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6126 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6127 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6128 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6129 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6130 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6131 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6132 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6133 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6134 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6135 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6136 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6137 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6138 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6139 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6140 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6141 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6142 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6143 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6144 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6145 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6146 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6147 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6148 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6149 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6150 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6151 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6152 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6153 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6154 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6155 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6156 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6157 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6158 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6159 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6160 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6161 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6162 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6163 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6164 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6165 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6166 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6167 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6168 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6169 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6170 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6171 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6172 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6173 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6174 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6175 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6176 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6177 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6178 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6179 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6180 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6181 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6182 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6183 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6184 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6185 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6186 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6187 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6188 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6189 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6190 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6191 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6192 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6193 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6194 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6195 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6196 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6197 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6198 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6199 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6200 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6201 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6202 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6203 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6204 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6205 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6206 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6207 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6208 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6209 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6210 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6211 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6212 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6213 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6214 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6215 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6216 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6217 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6218 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6219 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6220 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6221 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6222 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6223 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6224 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6225 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6226 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6227 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6228 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6229 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6230 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6231 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6232 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6233 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6234 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6235 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6236 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6237 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6238 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6239 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6240 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6241 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6242 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6243 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6244 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6245 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6246 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6247 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6248 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6249 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6250 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6251 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6252 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6253 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6254 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6255 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6256 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6257 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6258 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6259 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6260 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6261 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6262 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6263 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6264 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6265 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6266 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6267 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6268 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6269 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6270 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6271 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6272 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6273 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6274 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6275 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6276 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6277 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6278 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6279 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6280 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6281 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6282 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6283 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6284 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6285 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6286 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6287 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6288 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6289 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6290 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6291 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6292 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6293 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6294 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6295 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6296 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6297 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6298 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6299 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6300 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6301 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6304 static DWORD get_pf_file_size(LPCSTR file)
6306 CHAR path[MAX_PATH];
6307 HANDLE hfile;
6308 DWORD size;
6310 lstrcpyA(path, PROG_FILES_DIR);
6311 lstrcatA(path, "\\");
6312 lstrcatA(path, file);
6314 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
6315 if (hfile == INVALID_HANDLE_VALUE)
6316 return 0;
6318 size = GetFileSize(hfile, NULL);
6319 CloseHandle(hfile);
6320 return size;
6323 static void test_sourcepath(void)
6325 UINT r, i;
6327 if (!winetest_interactive)
6329 skip("Run in interactive mode to run source path tests.\n");
6330 return;
6333 create_database(msifile, sp_tables, sizeof(sp_tables) / sizeof(msi_table));
6335 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6337 for (i = 0; i < sizeof(spmap) / sizeof(spmap[0]); i++)
6339 if (spmap[i].sost)
6341 CreateDirectoryA("shortone", NULL);
6342 CreateDirectoryA("shortone\\shorttwo", NULL);
6345 if (spmap[i].solt)
6347 CreateDirectoryA("shortone", NULL);
6348 CreateDirectoryA("shortone\\longtwo", NULL);
6351 if (spmap[i].lost)
6353 CreateDirectoryA("longone", NULL);
6354 CreateDirectoryA("longone\\shorttwo", NULL);
6357 if (spmap[i].lolt)
6359 CreateDirectoryA("longone", NULL);
6360 CreateDirectoryA("longone\\longtwo", NULL);
6363 if (spmap[i].soste)
6364 create_file("shortone\\shorttwo\\augustus", 50);
6365 if (spmap[i].solte)
6366 create_file("shortone\\longtwo\\augustus", 100);
6367 if (spmap[i].loste)
6368 create_file("longone\\shorttwo\\augustus", 150);
6369 if (spmap[i].lolte)
6370 create_file("longone\\longtwo\\augustus", 200);
6372 r = MsiInstallProductA(msifile, NULL);
6373 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
6374 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
6375 "%d: Expected %d, got %d\n", i, spmap[i].size,
6376 get_pf_file_size("msitest\\augustus"));
6378 if (r == ERROR_SUCCESS)
6380 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
6381 ok(delete_pf("msitest", FALSE), "%d: File not installed\n", i);
6383 else
6385 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
6386 todo_wine ok(!delete_pf("msitest", FALSE), "%d: File installed\n", i);
6389 DeleteFileA("shortone\\shorttwo\\augustus");
6390 DeleteFileA("shortone\\longtwo\\augustus");
6391 DeleteFileA("longone\\shorttwo\\augustus");
6392 DeleteFileA("longone\\longtwo\\augustus");
6393 RemoveDirectoryA("shortone\\shorttwo");
6394 RemoveDirectoryA("shortone\\longtwo");
6395 RemoveDirectoryA("longone\\shorttwo");
6396 RemoveDirectoryA("longone\\longtwo");
6397 RemoveDirectoryA("shortone");
6398 RemoveDirectoryA("longone");
6401 DeleteFileA(msifile);
6404 static void test_MsiConfigureProductEx(void)
6406 UINT r;
6407 LONG res;
6408 DWORD type, size;
6409 HKEY props, source;
6410 CHAR keypath[MAX_PATH * 2];
6411 CHAR localpack[MAX_PATH];
6413 if (on_win9x)
6415 win_skip("Different registry keys on Win9x and WinMe\n");
6416 return;
6419 CreateDirectoryA("msitest", NULL);
6420 create_file("msitest\\hydrogen", 500);
6421 create_file("msitest\\helium", 500);
6422 create_file("msitest\\lithium", 500);
6424 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
6426 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6428 /* NULL szProduct */
6429 r = MsiConfigureProductExA(NULL, INSTALLLEVEL_DEFAULT,
6430 INSTALLSTATE_DEFAULT, "PROPVAR=42");
6431 ok(r == ERROR_INVALID_PARAMETER,
6432 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6434 /* empty szProduct */
6435 r = MsiConfigureProductExA("", INSTALLLEVEL_DEFAULT,
6436 INSTALLSTATE_DEFAULT, "PROPVAR=42");
6437 ok(r == ERROR_INVALID_PARAMETER,
6438 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6440 /* garbage szProduct */
6441 r = MsiConfigureProductExA("garbage", INSTALLLEVEL_DEFAULT,
6442 INSTALLSTATE_DEFAULT, "PROPVAR=42");
6443 ok(r == ERROR_INVALID_PARAMETER,
6444 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6446 /* guid without brackets */
6447 r = MsiConfigureProductExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
6448 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6449 "PROPVAR=42");
6450 ok(r == ERROR_INVALID_PARAMETER,
6451 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6453 /* guid with brackets */
6454 r = MsiConfigureProductExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
6455 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6456 "PROPVAR=42");
6457 ok(r == ERROR_UNKNOWN_PRODUCT,
6458 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
6460 /* same length as guid, but random */
6461 r = MsiConfigureProductExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93",
6462 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6463 "PROPVAR=42");
6464 ok(r == ERROR_UNKNOWN_PRODUCT,
6465 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
6467 /* product not installed yet */
6468 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6469 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6470 "PROPVAR=42");
6471 ok(r == ERROR_UNKNOWN_PRODUCT,
6472 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
6474 /* install the product, per-user unmanaged */
6475 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
6476 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6477 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6478 ok(pf_exists("msitest\\helium"), "File not installed\n");
6479 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6480 ok(pf_exists("msitest"), "File not installed\n");
6482 /* product is installed per-user managed, remove it */
6483 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6484 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6485 "PROPVAR=42");
6486 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6487 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6488 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6489 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6490 todo_wine
6492 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6495 /* product has been removed */
6496 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6497 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6498 "PROPVAR=42");
6499 ok(r == ERROR_UNKNOWN_PRODUCT,
6500 "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
6502 /* install the product, machine */
6503 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6504 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6505 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6506 ok(pf_exists("msitest\\helium"), "File not installed\n");
6507 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6508 ok(pf_exists("msitest"), "File not installed\n");
6510 /* product is installed machine, remove it */
6511 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6512 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6513 "PROPVAR=42");
6514 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6515 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6516 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6517 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6518 todo_wine
6520 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6523 /* product has been removed */
6524 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6525 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6526 "PROPVAR=42");
6527 ok(r == ERROR_UNKNOWN_PRODUCT,
6528 "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
6530 /* install the product, machine */
6531 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6532 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6533 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6534 ok(pf_exists("msitest\\helium"), "File not installed\n");
6535 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6536 ok(pf_exists("msitest"), "File not installed\n");
6538 DeleteFileA(msifile);
6540 /* local msifile is removed */
6541 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6542 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6543 "PROPVAR=42");
6544 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6545 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6546 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6547 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6548 todo_wine
6550 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6553 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
6555 /* install the product, machine */
6556 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6558 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6559 ok(pf_exists("msitest\\helium"), "File not installed\n");
6560 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6561 ok(pf_exists("msitest"), "File not installed\n");
6563 DeleteFileA(msifile);
6565 lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
6566 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
6567 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties");
6569 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
6570 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6572 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
6573 (const BYTE *)"C:\\idontexist.msi", 18);
6574 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6576 /* LocalPackage is used to find the cached msi package */
6577 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6578 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6579 "PROPVAR=42");
6580 ok(r == ERROR_INSTALL_SOURCE_ABSENT,
6581 "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
6582 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6583 ok(pf_exists("msitest\\helium"), "File not installed\n");
6584 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6585 ok(pf_exists("msitest"), "File not installed\n");
6587 RegCloseKey(props);
6588 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
6590 /* LastUsedSource (local msi package) can be used as a last resort */
6591 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6592 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6593 "PROPVAR=42");
6594 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6595 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6596 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6597 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6598 todo_wine
6600 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6603 /* install the product, machine */
6604 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6605 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6606 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6607 ok(pf_exists("msitest\\helium"), "File not installed\n");
6608 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6609 ok(pf_exists("msitest"), "File not installed\n");
6611 lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
6612 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
6613 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties");
6615 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
6616 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6618 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
6619 (const BYTE *)"C:\\idontexist.msi", 18);
6620 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6622 lstrcpyA(keypath, "SOFTWARE\\Classes\\Installer\\Products\\");
6623 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\SourceList");
6625 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &source);
6626 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6628 type = REG_SZ;
6629 size = MAX_PATH;
6630 res = RegQueryValueExA(source, "PackageName", NULL, &type,
6631 (LPBYTE)localpack, &size);
6632 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6634 res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
6635 (const BYTE *)"idontexist.msi", 15);
6636 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6638 /* SourceList is altered */
6639 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6640 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6641 "PROPVAR=42");
6642 ok(r == ERROR_INSTALL_SOURCE_ABSENT,
6643 "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
6644 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6645 ok(pf_exists("msitest\\helium"), "File not installed\n");
6646 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6647 ok(pf_exists("msitest"), "File not installed\n");
6649 /* restore the SourceList */
6650 res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
6651 (const BYTE *)localpack, lstrlenA(localpack) + 1);
6652 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6654 /* finally remove the product */
6655 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6656 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6657 "PROPVAR=42");
6658 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6659 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6660 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6661 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6662 todo_wine
6664 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6667 DeleteFileA(msifile);
6668 RegCloseKey(source);
6669 RegCloseKey(props);
6670 DeleteFileA("msitest\\hydrogen");
6671 DeleteFileA("msitest\\helium");
6672 DeleteFileA("msitest\\lithium");
6673 RemoveDirectoryA("msitest");
6676 static void test_missingcomponent(void)
6678 UINT r;
6680 CreateDirectoryA("msitest", NULL);
6681 create_file("msitest\\hydrogen", 500);
6682 create_file("msitest\\helium", 500);
6683 create_file("msitest\\lithium", 500);
6684 create_file("beryllium", 500);
6686 create_database(msifile, mcomp_tables, sizeof(mcomp_tables) / sizeof(msi_table));
6688 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6690 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
6691 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6692 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6693 ok(pf_exists("msitest\\helium"), "File not installed\n");
6694 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6695 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
6696 ok(pf_exists("msitest"), "File not installed\n");
6698 r = MsiInstallProductA(msifile, "REMOVE=ALL INSTALLLEVEL=10 PROPVAR=42");
6699 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6700 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6701 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6702 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6703 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
6704 todo_wine
6706 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6709 DeleteFileA(msifile);
6710 DeleteFileA("msitest\\hydrogen");
6711 DeleteFileA("msitest\\helium");
6712 DeleteFileA("msitest\\lithium");
6713 DeleteFileA("beryllium");
6714 RemoveDirectoryA("msitest");
6717 static void test_sourcedirprop(void)
6719 UINT r;
6720 CHAR props[MAX_PATH];
6722 CreateDirectoryA("msitest", NULL);
6723 create_file("msitest\\augustus", 500);
6725 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
6727 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6729 r = MsiInstallProductA(msifile, NULL);
6730 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6731 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
6732 ok(delete_pf("msitest", FALSE), "File installed\n");
6734 DeleteFile("msitest\\augustus");
6735 RemoveDirectory("msitest");
6737 CreateDirectoryA("altsource", NULL);
6738 CreateDirectoryA("altsource\\msitest", NULL);
6739 create_file("altsource\\msitest\\augustus", 500);
6741 sprintf(props, "SRCDIR=%s\\altsource\\", CURR_DIR);
6743 r = MsiInstallProductA(msifile, props);
6744 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6745 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
6746 ok(delete_pf("msitest", FALSE), "File installed\n");
6748 DeleteFile(msifile);
6749 DeleteFile("altsource\\msitest\\augustus");
6750 RemoveDirectory("altsource\\msitest");
6751 RemoveDirectory("altsource");
6754 static void test_adminimage(void)
6756 UINT r;
6758 CreateDirectoryA("msitest", NULL);
6759 CreateDirectoryA("msitest\\first", NULL);
6760 CreateDirectoryA("msitest\\second", NULL);
6761 CreateDirectoryA("msitest\\cabout", NULL);
6762 CreateDirectoryA("msitest\\cabout\\new", NULL);
6763 create_file("msitest\\one.txt", 100);
6764 create_file("msitest\\first\\two.txt", 100);
6765 create_file("msitest\\second\\three.txt", 100);
6766 create_file("msitest\\cabout\\four.txt", 100);
6767 create_file("msitest\\cabout\\new\\five.txt", 100);
6768 create_file("msitest\\filename", 100);
6769 create_file("msitest\\service.exe", 100);
6771 create_database_wordcount(msifile, ai_tables,
6772 sizeof(ai_tables) / sizeof(msi_table),
6773 msidbSumInfoSourceTypeAdminImage);
6775 r = MsiInstallProductA(msifile, NULL);
6776 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6778 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
6779 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
6780 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
6781 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
6782 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
6783 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
6784 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
6785 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
6786 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
6787 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
6788 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
6789 ok(delete_pf("msitest", FALSE), "File not installed\n");
6791 DeleteFileA("msitest.msi");
6792 DeleteFileA("msitest\\cabout\\new\\five.txt");
6793 DeleteFileA("msitest\\cabout\\four.txt");
6794 DeleteFileA("msitest\\second\\three.txt");
6795 DeleteFileA("msitest\\first\\two.txt");
6796 DeleteFileA("msitest\\one.txt");
6797 DeleteFileA("msitest\\service.exe");
6798 DeleteFileA("msitest\\filename");
6799 RemoveDirectoryA("msitest\\cabout\\new");
6800 RemoveDirectoryA("msitest\\cabout");
6801 RemoveDirectoryA("msitest\\second");
6802 RemoveDirectoryA("msitest\\first");
6803 RemoveDirectoryA("msitest");
6806 static void test_propcase(void)
6808 UINT r;
6810 CreateDirectoryA("msitest", NULL);
6811 create_file("msitest\\augustus", 500);
6813 create_database(msifile, pc_tables, sizeof(pc_tables) / sizeof(msi_table));
6815 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6817 r = MsiInstallProductA(msifile, "MyProp=42");
6818 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6819 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
6820 ok(delete_pf("msitest", FALSE), "File not installed\n");
6822 DeleteFile(msifile);
6823 DeleteFile("msitest\\augustus");
6824 RemoveDirectory("msitest");
6827 static void test_int_widths( void )
6829 static const char int0[] = "int0\ni0\nint0\tint0\n1";
6830 static const char int1[] = "int1\ni1\nint1\tint1\n1";
6831 static const char int2[] = "int2\ni2\nint2\tint2\n1";
6832 static const char int3[] = "int3\ni3\nint3\tint3\n1";
6833 static const char int4[] = "int4\ni4\nint4\tint4\n1";
6834 static const char int5[] = "int5\ni5\nint5\tint5\n1";
6835 static const char int8[] = "int8\ni8\nint8\tint8\n1";
6837 static const struct
6839 const char *data;
6840 unsigned int size;
6841 UINT ret;
6843 tests[] =
6845 { int0, sizeof(int0) - 1, ERROR_SUCCESS },
6846 { int1, sizeof(int1) - 1, ERROR_SUCCESS },
6847 { int2, sizeof(int2) - 1, ERROR_SUCCESS },
6848 { int3, sizeof(int3) - 1, ERROR_FUNCTION_FAILED },
6849 { int4, sizeof(int4) - 1, ERROR_SUCCESS },
6850 { int5, sizeof(int5) - 1, ERROR_FUNCTION_FAILED },
6851 { int8, sizeof(int8) - 1, ERROR_FUNCTION_FAILED }
6854 char tmpdir[MAX_PATH], msitable[MAX_PATH], msidb[MAX_PATH];
6855 MSIHANDLE db;
6856 UINT r, i;
6858 GetTempPathA(MAX_PATH, tmpdir);
6859 CreateDirectoryA(tmpdir, NULL);
6861 strcpy(msitable, tmpdir);
6862 strcat(msitable, "\\msitable.idt");
6864 strcpy(msidb, tmpdir);
6865 strcat(msidb, "\\msitest.msi");
6867 r = MsiOpenDatabaseA(msidb, MSIDBOPEN_CREATE, &db);
6868 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6870 for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
6872 write_file(msitable, tests[i].data, tests[i].size);
6874 r = MsiDatabaseImportA(db, tmpdir, "msitable.idt");
6875 ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r);
6877 r = MsiDatabaseCommit(db);
6878 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6879 DeleteFileA(msitable);
6882 MsiCloseHandle(db);
6883 DeleteFileA(msidb);
6884 RemoveDirectoryA(tmpdir);
6887 static void test_shortcut(void)
6889 UINT r;
6890 HRESULT hr;
6892 create_test_files();
6893 create_database(msifile, sc_tables, sizeof(sc_tables) / sizeof(msi_table));
6895 r = MsiInstallProductA(msifile, NULL);
6896 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6898 hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
6899 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
6901 r = MsiInstallProductA(msifile, NULL);
6902 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6904 CoUninitialize();
6906 hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
6907 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
6909 r = MsiInstallProductA(msifile, NULL);
6910 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6912 CoUninitialize();
6914 delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
6915 delete_pf("msitest\\cabout\\new", FALSE);
6916 delete_pf("msitest\\cabout\\four.txt", TRUE);
6917 delete_pf("msitest\\cabout", FALSE);
6918 delete_pf("msitest\\changed\\three.txt", TRUE);
6919 delete_pf("msitest\\changed", FALSE);
6920 delete_pf("msitest\\first\\two.txt", TRUE);
6921 delete_pf("msitest\\first", FALSE);
6922 delete_pf("msitest\\filename", TRUE);
6923 delete_pf("msitest\\one.txt", TRUE);
6924 delete_pf("msitest\\service.exe", TRUE);
6925 delete_pf("msitest\\Shortcut.lnk", TRUE);
6926 delete_pf("msitest", FALSE);
6927 delete_test_files();
6930 static void test_envvar(void)
6932 UINT r;
6933 HKEY env;
6934 LONG res;
6935 DWORD type, size;
6936 char buffer[16];
6937 UINT i;
6939 if (on_win9x)
6941 win_skip("Environment variables are handled differently on Win9x and WinMe\n");
6942 return;
6945 create_test_files();
6946 create_database(msifile, env_tables, sizeof(env_tables) / sizeof(msi_table));
6948 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Environment", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &env, NULL);
6949 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6951 res = RegSetValueExA(env, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"0", 2);
6952 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6954 res = RegSetValueExA(env, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"0", 2);
6955 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6957 r = MsiInstallProductA(msifile, NULL);
6958 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6960 type = REG_NONE;
6961 size = sizeof(buffer);
6962 buffer[0] = 0;
6963 res = RegQueryValueExA(env, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
6964 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6965 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
6966 ok(!lstrcmp(buffer, "1"), "Expected \"1\", got %s\n", buffer);
6968 res = RegDeleteValueA(env, "MSITESTVAR1");
6969 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6971 type = REG_NONE;
6972 size = sizeof(buffer);
6973 buffer[0] = 0;
6974 res = RegQueryValueExA(env, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
6975 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6976 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
6977 ok(!lstrcmp(buffer, "1"), "Expected \"1\", got %s\n", buffer);
6979 res = RegDeleteValueA(env, "MSITESTVAR2");
6980 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6982 res = RegDeleteValueA(env, "MSITESTVAR3");
6983 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6985 res = RegDeleteValueA(env, "MSITESTVAR4");
6986 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6988 res = RegDeleteValueA(env, "MSITESTVAR5");
6989 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6991 res = RegDeleteValueA(env, "MSITESTVAR6");
6992 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6994 res = RegDeleteValueA(env, "MSITESTVAR7");
6995 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6997 res = RegDeleteValueA(env, "MSITESTVAR8");
6998 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
7000 res = RegDeleteValueA(env, "MSITESTVAR9");
7001 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
7003 res = RegDeleteValueA(env, "MSITESTVAR10");
7004 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
7006 i = 11;
7007 while (environment_dat_results[(i-11)]) {
7008 char name[20];
7009 sprintf(name, "MSITESTVAR%d", i);
7011 type = REG_NONE;
7012 size = sizeof(buffer);
7013 buffer[0] = 0;
7014 res = RegQueryValueExA(env, name, NULL, &type, (LPBYTE)buffer, &size);
7015 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
7016 ok(type == REG_SZ, "%d: Expected REG_SZ, got %u\n", i, type);
7017 ok(!lstrcmp(buffer, environment_dat_results[(i-11)]), "%d: Expected %s, got %s\n",
7018 i, environment_dat_results[(i-11)], buffer);
7020 res = RegDeleteValueA(env, name);
7021 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
7022 i++;
7026 RegCloseKey(env);
7027 delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
7028 delete_pf("msitest\\cabout\\new", FALSE);
7029 delete_pf("msitest\\cabout\\four.txt", TRUE);
7030 delete_pf("msitest\\cabout", FALSE);
7031 delete_pf("msitest\\changed\\three.txt", TRUE);
7032 delete_pf("msitest\\changed", FALSE);
7033 delete_pf("msitest\\first\\two.txt", TRUE);
7034 delete_pf("msitest\\first", FALSE);
7035 delete_pf("msitest\\filename", TRUE);
7036 delete_pf("msitest\\one.txt", TRUE);
7037 delete_pf("msitest\\service.exe", TRUE);
7038 delete_pf("msitest", FALSE);
7039 delete_test_files();
7042 static void test_preselected(void)
7044 UINT r;
7046 create_test_files();
7047 create_database(msifile, ps_tables, sizeof(ps_tables) / sizeof(msi_table));
7049 r = MsiInstallProductA(msifile, "ADDLOCAL=One");
7050 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7052 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
7053 ok(!delete_pf("msitest\\cabout\\new", FALSE), "File installed\n");
7054 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
7055 ok(!delete_pf("msitest\\cabout", FALSE), "File installed\n");
7056 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
7057 ok(!delete_pf("msitest\\changed", FALSE), "File installed\n");
7058 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
7059 ok(!delete_pf("msitest\\first", FALSE), "File installed\n");
7060 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
7061 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
7062 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
7063 ok(delete_pf("msitest", FALSE), "File not installed\n");
7065 r = MsiInstallProductA(msifile, NULL);
7066 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7068 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7069 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7070 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7071 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7072 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7073 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7074 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7075 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7076 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7077 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7078 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7079 ok(delete_pf("msitest", FALSE), "File not installed\n");
7080 delete_test_files();
7083 static void test_installed_prop(void)
7085 static char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}";
7086 UINT r;
7088 create_test_files();
7089 create_database(msifile, ip_tables, sizeof(ip_tables) / sizeof(msi_table));
7091 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7093 r = MsiInstallProductA(msifile, "FULL=1");
7094 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7096 r = MsiInstallProductA(msifile, "FULL=1");
7097 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7099 r = MsiConfigureProductExA(prodcode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, "FULL=1");
7100 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7102 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7103 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7104 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7105 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7106 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7107 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7108 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7109 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7110 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7111 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7112 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7113 ok(delete_pf("msitest", FALSE), "File not installed\n");
7115 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7116 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7118 delete_test_files();
7121 static void test_allusers_prop(void)
7123 UINT r;
7125 create_test_files();
7126 create_database(msifile, aup_tables, sizeof(aup_tables) / sizeof(msi_table));
7128 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7130 /* ALLUSERS property unset */
7131 r = MsiInstallProductA(msifile, "FULL=1");
7132 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7134 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7135 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7136 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7137 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7138 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7139 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7140 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7141 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7142 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7143 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7144 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7145 ok(delete_pf("msitest", FALSE), "File not installed\n");
7147 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7148 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7150 delete_test_files();
7152 create_test_files();
7153 create_database(msifile, aup2_tables, sizeof(aup2_tables) / sizeof(msi_table));
7155 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7157 /* ALLUSERS property set to 1 */
7158 r = MsiInstallProductA(msifile, "FULL=1");
7159 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7161 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7162 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7163 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7164 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7165 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7166 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7167 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7168 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7169 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7170 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7171 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7172 ok(delete_pf("msitest", FALSE), "File not installed\n");
7174 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7175 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7177 delete_test_files();
7179 create_test_files();
7180 create_database(msifile, aup3_tables, sizeof(aup3_tables) / sizeof(msi_table));
7182 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7184 /* ALLUSERS property set to 2 */
7185 r = MsiInstallProductA(msifile, "FULL=1");
7186 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7188 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7189 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7190 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7191 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7192 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7193 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7194 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7195 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7196 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7197 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7198 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7199 ok(delete_pf("msitest", FALSE), "File not installed\n");
7201 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7204 delete_test_files();
7206 create_test_files();
7207 create_database(msifile, aup4_tables, sizeof(aup4_tables) / sizeof(msi_table));
7209 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7211 /* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */
7212 r = MsiInstallProductA(msifile, "FULL=1");
7213 if (r == ERROR_SUCCESS)
7215 /* Win9x/WinMe */
7216 win_skip("Win9x and WinMe act differently with respect to ALLUSERS\n");
7218 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7219 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7220 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7221 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7222 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7223 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7224 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7225 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7226 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7227 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7228 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7229 ok(delete_pf("msitest", FALSE), "File not installed\n");
7231 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7232 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7234 delete_test_files();
7236 else
7237 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7240 static char session_manager[] = "System\\CurrentControlSet\\Control\\Session Manager";
7241 static char rename_ops[] = "PendingFileRenameOperations";
7243 static void process_pending_renames(HKEY hkey)
7245 char *buf, *src, *dst;
7246 DWORD size;
7247 LONG ret;
7249 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size);
7250 buf = HeapAlloc(GetProcessHeap(), 0, size);
7251 buf[0] = 0;
7253 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size);
7254 ok(!ret, "RegQueryValueExA failed %d (%u)\n", ret, GetLastError());
7255 ok(strstr(buf, "msitest\\maximus") != NULL, "Unexpected value \"%s\"\n", buf);
7257 for (src = buf; *src; src = dst + strlen(dst) + 1)
7259 DWORD flags = MOVEFILE_COPY_ALLOWED;
7261 dst = src + strlen(src) + 1;
7262 if (*dst == '!')
7264 flags |= MOVEFILE_REPLACE_EXISTING;
7265 dst++;
7267 if (src[0] == '\\' && src[1] == '?' && src[2] == '?' && src[3] == '\\') src += 4;
7268 if (*dst)
7270 if (dst[0] == '\\' && dst[1] == '?' && dst[2] == '?' && dst[3] == '\\') dst += 4;
7271 ok(MoveFileExA(src, dst, flags), "Failed to move file %s -> %s (%u)\n", src, dst, GetLastError());
7273 else
7274 ok(DeleteFileA(src), "Failed to delete file %s (%u)\n", src, GetLastError());
7276 HeapFree(GetProcessHeap(), 0, buf);
7277 RegDeleteValueA(hkey, rename_ops);
7280 static BOOL file_matches_data(LPCSTR file, LPCSTR data)
7282 DWORD len, data_len = strlen(data);
7283 HANDLE handle;
7284 char buf[128];
7286 handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
7287 ok(handle != INVALID_HANDLE_VALUE, "failed to open %s (%u)\n", file, GetLastError());
7289 if (ReadFile(handle, buf, sizeof(buf), &len, NULL) && len >= data_len)
7291 CloseHandle(handle);
7292 return !memcmp(buf, data, data_len);
7294 CloseHandle(handle);
7295 return FALSE;
7298 static void test_file_in_use(void)
7300 UINT r;
7301 DWORD size;
7302 HANDLE file;
7303 HKEY hkey;
7304 char path[MAX_PATH];
7306 if (on_win9x)
7308 win_skip("Pending file renaming is implemented differently on Win9x and WinMe\n");
7309 return;
7312 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
7313 if (!RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size))
7315 skip("Pending file rename operations, skipping test\n");
7316 return;
7319 CreateDirectoryA("msitest", NULL);
7320 create_file("msitest\\maximus", 500);
7321 create_database(msifile, fiu_tables, sizeof(fiu_tables) / sizeof(msi_table));
7323 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7325 lstrcpy(path, PROG_FILES_DIR);
7326 lstrcat(path, "\\msitest");
7327 CreateDirectoryA(path, NULL);
7329 lstrcat(path, "\\maximus");
7330 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
7332 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
7333 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
7334 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
7335 CloseHandle(file);
7336 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
7338 process_pending_renames(hkey);
7339 RegCloseKey(hkey);
7341 ok(file_matches_data(path, "msitest\\maximus"), "Expected file to match\n");
7342 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
7343 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
7345 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7346 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7348 delete_test_files();
7351 static void test_file_in_use_cab(void)
7353 UINT r;
7354 DWORD size;
7355 HANDLE file;
7356 HKEY hkey;
7357 char path[MAX_PATH];
7359 if (on_win9x)
7361 win_skip("Pending file renaming is implemented differently on Win9x and WinMe\n");
7362 return;
7365 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
7366 if (!RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size))
7368 skip("Pending file rename operations, skipping test\n");
7369 return;
7372 CreateDirectoryA("msitest", NULL);
7373 create_file("maximus", 500);
7374 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
7375 DeleteFile("maximus");
7377 create_database(msifile, fiuc_tables, sizeof(fiuc_tables) / sizeof(msi_table));
7379 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7381 lstrcpy(path, PROG_FILES_DIR);
7382 lstrcat(path, "\\msitest");
7383 CreateDirectoryA(path, NULL);
7385 lstrcat(path, "\\maximus");
7386 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
7388 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
7389 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
7390 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
7391 CloseHandle(file);
7392 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
7394 process_pending_renames(hkey);
7395 RegCloseKey(hkey);
7397 ok(file_matches_data(path, "maximus"), "Expected file to match\n");
7398 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
7399 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
7401 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7402 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7404 delete_cab_files();
7405 delete_test_files();
7408 static INT CALLBACK handler_a(LPVOID context, UINT type, LPCSTR msg)
7410 return IDOK;
7413 static INT CALLBACK handler_w(LPVOID context, UINT type, LPCWSTR msg)
7415 return IDOK;
7418 static INT CALLBACK handler_record(LPVOID context, UINT type, MSIHANDLE record)
7420 return IDOK;
7423 static void test_MsiSetExternalUI(void)
7425 INSTALLUI_HANDLERA ret_a;
7426 INSTALLUI_HANDLERW ret_w;
7427 INSTALLUI_HANDLER_RECORD prev;
7428 UINT error;
7430 ret_a = MsiSetExternalUIA(handler_a, INSTALLLOGMODE_ERROR, NULL);
7431 ok(ret_a == NULL, "expected NULL, got %p\n", ret_a);
7433 ret_a = MsiSetExternalUIA(NULL, 0, NULL);
7434 ok(ret_a == handler_a, "expected %p, got %p\n", handler_a, ret_a);
7436 /* Not present before Installer 3.1 */
7437 if (!pMsiSetExternalUIRecord) {
7438 win_skip("MsiSetExternalUIRecord is not available\n");
7439 return;
7442 error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev);
7443 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7444 ok(prev == NULL, "expected NULL, got %p\n", prev);
7446 prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
7447 error = pMsiSetExternalUIRecord(NULL, INSTALLLOGMODE_ERROR, NULL, &prev);
7448 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7449 ok(prev == handler_record, "expected %p, got %p\n", handler_record, prev);
7451 ret_w = MsiSetExternalUIW(handler_w, INSTALLLOGMODE_ERROR, NULL);
7452 ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
7454 ret_w = MsiSetExternalUIW(NULL, 0, NULL);
7455 ok(ret_w == handler_w, "expected %p, got %p\n", handler_w, ret_w);
7457 ret_a = MsiSetExternalUIA(handler_a, INSTALLLOGMODE_ERROR, NULL);
7458 ok(ret_a == NULL, "expected NULL, got %p\n", ret_a);
7460 ret_w = MsiSetExternalUIW(handler_w, INSTALLLOGMODE_ERROR, NULL);
7461 ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
7463 prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
7464 error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev);
7465 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7466 ok(prev == NULL, "expected NULL, got %p\n", prev);
7468 ret_a = MsiSetExternalUIA(NULL, 0, NULL);
7469 ok(ret_a == NULL, "expected NULL, got %p\n", ret_a);
7471 ret_w = MsiSetExternalUIW(NULL, 0, NULL);
7472 ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
7474 prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
7475 error = pMsiSetExternalUIRecord(NULL, 0, NULL, &prev);
7476 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7477 ok(prev == handler_record, "expected %p, got %p\n", handler_record, prev);
7479 error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, NULL);
7480 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7482 error = pMsiSetExternalUIRecord(NULL, 0, NULL, NULL);
7483 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7486 static void test_feature_override(void)
7488 UINT r;
7490 create_test_files();
7491 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
7493 r = MsiInstallProductA(msifile, "ADDLOCAL=One");
7494 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7496 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
7497 ok(!delete_pf("msitest\\cabout\\new", FALSE), "File installed\n");
7498 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
7499 ok(!delete_pf("msitest\\cabout", FALSE), "File installed\n");
7500 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
7501 ok(!delete_pf("msitest\\changed", FALSE), "File installed\n");
7502 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
7503 ok(!delete_pf("msitest\\first", FALSE), "File installed\n");
7504 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
7505 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
7506 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
7507 ok(delete_pf("msitest", FALSE), "File not installed\n");
7509 delete_test_files();
7512 static void test_create_folder(void)
7514 UINT r;
7516 create_test_files();
7517 create_database(msifile, cf_tables, sizeof(cf_tables) / sizeof(msi_table));
7519 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7521 r = MsiInstallProductA(msifile, NULL);
7522 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7524 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
7525 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
7526 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
7527 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
7528 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
7529 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
7530 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
7531 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
7532 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
7533 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7534 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
7535 todo_wine ok(!delete_pf("msitest", FALSE), "Directory created\n");
7537 delete_test_files();
7540 static void test_remove_folder(void)
7542 UINT r;
7544 create_test_files();
7545 create_database(msifile, rf_tables, sizeof(rf_tables) / sizeof(msi_table));
7547 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7549 r = MsiInstallProductA(msifile, NULL);
7550 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7552 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
7553 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
7554 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
7555 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
7556 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
7557 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
7558 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
7559 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
7560 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
7561 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7562 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
7563 ok(!delete_pf("msitest", FALSE), "Directory created\n");
7565 delete_test_files();
7568 static void test_start_services(void)
7570 UINT r;
7571 SC_HANDLE scm, service;
7572 BOOL ret;
7573 DWORD error = ERROR_SUCCESS;
7575 if (on_win9x)
7577 win_skip("Services are not implemented on Win9x and WinMe\n");
7578 return;
7580 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
7581 ok(scm != NULL, "Failed to open the SC Manager\n");
7582 if (!scm) return;
7584 service = OpenService(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
7585 if (!service && GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST)
7587 win_skip("The 'Spooler' service does not exist\n");
7588 CloseServiceHandle(scm);
7589 return;
7591 ok(service != NULL, "Failed to open Spooler, error %d\n", GetLastError());
7592 if (!service) {
7593 CloseServiceHandle(scm);
7594 return;
7597 ret = StartService(service, 0, NULL);
7598 if (!ret && (error = GetLastError()) != ERROR_SERVICE_ALREADY_RUNNING)
7600 skip("Terminal service not available, skipping test\n");
7601 CloseServiceHandle(service);
7602 CloseServiceHandle(scm);
7603 return;
7606 CloseServiceHandle(service);
7607 CloseServiceHandle(scm);
7609 create_test_files();
7610 create_database(msifile, sss_tables, sizeof(sss_tables) / sizeof(msi_table));
7612 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7614 r = MsiInstallProductA(msifile, NULL);
7615 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7617 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7618 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
7619 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7620 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
7621 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7622 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
7623 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7624 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
7625 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7626 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
7627 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7628 ok(delete_pf("msitest", FALSE), "Directory not created\n");
7630 delete_test_files();
7632 if (error == ERROR_SUCCESS)
7634 SERVICE_STATUS status;
7636 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
7637 service = OpenService(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
7639 ret = ControlService(service, SERVICE_CONTROL_STOP, &status);
7640 ok(ret, "ControlService failed %u\n", GetLastError());
7642 CloseServiceHandle(service);
7643 CloseServiceHandle(scm);
7647 static void test_delete_services(void)
7649 UINT r;
7651 create_test_files();
7652 create_database(msifile, sds_tables, sizeof(sds_tables) / sizeof(msi_table));
7654 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7656 r = MsiInstallProductA(msifile, NULL);
7657 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7659 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7660 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
7661 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7662 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
7663 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7664 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
7665 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7666 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
7667 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7668 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
7669 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7670 ok(delete_pf("msitest", FALSE), "Directory not created\n");
7672 delete_test_files();
7675 static void test_self_registration(void)
7677 UINT r;
7679 create_test_files();
7680 create_database(msifile, sr_tables, sizeof(sr_tables) / sizeof(msi_table));
7682 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7684 r = MsiInstallProductA(msifile, NULL);
7685 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7687 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7688 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
7689 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7690 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
7691 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7692 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
7693 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7694 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
7695 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7696 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
7697 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7698 ok(delete_pf("msitest", FALSE), "Directory not created\n");
7700 delete_test_files();
7703 START_TEST(install)
7705 DWORD len;
7706 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
7707 STATEMGRSTATUS status;
7708 BOOL ret = FALSE;
7710 init_functionpointers();
7712 on_win9x = check_win9x();
7714 GetCurrentDirectoryA(MAX_PATH, prev_path);
7715 GetTempPath(MAX_PATH, temp_path);
7716 SetCurrentDirectoryA(temp_path);
7718 lstrcpyA(CURR_DIR, temp_path);
7719 len = lstrlenA(CURR_DIR);
7721 if(len && (CURR_DIR[len - 1] == '\\'))
7722 CURR_DIR[len - 1] = 0;
7724 get_program_files_dir(PROG_FILES_DIR, COMMON_FILES_DIR);
7726 /* Create a restore point ourselves so we circumvent the multitude of restore points
7727 * that would have been created by all the installation and removal tests.
7729 if (pSRSetRestorePointA)
7731 memset(&status, 0, sizeof(status));
7732 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
7735 /* Create only one log file and don't append. We have to pass something
7736 * for the log mode for this to work. The logfile needs to have an absolute
7737 * path otherwise we still end up with some extra logfiles as some tests
7738 * change the current directory.
7740 lstrcpyA(log_file, temp_path);
7741 lstrcatA(log_file, "\\msitest.log");
7742 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
7744 test_MsiInstallProduct();
7745 test_MsiSetComponentState();
7746 test_packagecoltypes();
7747 test_continuouscabs();
7748 test_caborder();
7749 test_mixedmedia();
7750 test_samesequence();
7751 test_uiLevelFlags();
7752 test_readonlyfile();
7753 test_readonlyfile_cab();
7754 test_setdirproperty();
7755 test_cabisextracted();
7756 test_concurrentinstall();
7757 test_setpropertyfolder();
7758 test_publish_registerproduct();
7759 test_publish_publishproduct();
7760 test_publish_publishfeatures();
7761 test_publish_registeruser();
7762 test_publish_processcomponents();
7763 test_publish();
7764 test_publishsourcelist();
7765 test_transformprop();
7766 test_currentworkingdir();
7767 test_admin();
7768 test_adminprops();
7769 test_removefiles();
7770 test_movefiles();
7771 test_missingcab();
7772 test_duplicatefiles();
7773 test_writeregistryvalues();
7774 test_sourcefolder();
7775 test_customaction51();
7776 test_installstate();
7777 test_sourcepath();
7778 test_MsiConfigureProductEx();
7779 test_missingcomponent();
7780 test_sourcedirprop();
7781 test_adminimage();
7782 test_propcase();
7783 test_int_widths();
7784 test_shortcut();
7785 test_envvar();
7786 test_lastusedsource();
7787 test_preselected();
7788 test_installed_prop();
7789 test_file_in_use();
7790 test_file_in_use_cab();
7791 test_MsiSetExternalUI();
7792 test_allusers_prop();
7793 test_feature_override();
7794 test_create_folder();
7795 test_remove_folder();
7796 test_start_services();
7797 test_delete_services();
7798 test_self_registration();
7800 DeleteFileA(log_file);
7802 if (pSRSetRestorePointA && ret)
7804 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
7805 if (ret)
7806 remove_restore_point(status.llSequenceNumber);
7808 FreeLibrary(hsrclient);
7810 SetCurrentDirectoryA(prev_path);