msi: Only run the CreateFolder and RemoveFolder actions when the component is set...
[wine.git] / dlls / msi / tests / install.c
blob44eec8e036e93241b73d128064312b89f93d1e34
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 "FIRSTDIR\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 static const CHAR font_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
1173 "i2\ti4\tL64\tS255\tS32\tS72\n"
1174 "Media\tDiskId\n"
1175 "1\t3\t\t\tDISK1\t\n";
1177 static const CHAR font_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1178 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1179 "File\tFile\n"
1180 "font.ttf\tfonts\tfont.ttf\t1000\t\t\t8192\t1\n";
1182 static const CHAR font_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1183 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1184 "Feature\tFeature\n"
1185 "fonts\t\t\tfont feature\t1\t2\tMSITESTDIR\t0\n";
1187 static const CHAR font_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1188 "s72\tS38\ts72\ti2\tS255\tS72\n"
1189 "Component\tComponent\n"
1190 "fonts\t{F5920ED0-1183-4B8F-9330-86CE56557C05}\tMSITESTDIR\t0\t\tfont.ttf\n";
1192 static const CHAR font_feature_comp_dat[] = "Feature_\tComponent_\n"
1193 "s38\ts72\n"
1194 "FeatureComponents\tFeature_\tComponent_\n"
1195 "fonts\tfonts\n";
1197 static const CHAR font_dat[] = "File_\tFontTitle\n"
1198 "s72\tS128\n"
1199 "Font\tFile_\n"
1200 "font.ttf\tmsi test font\n";
1202 static const CHAR font_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1203 "s72\tS255\tI2\n"
1204 "InstallExecuteSequence\tAction\n"
1205 "ValidateProductID\t\t700\n"
1206 "CostInitialize\t\t800\n"
1207 "FileCost\t\t900\n"
1208 "CostFinalize\t\t1000\n"
1209 "InstallValidate\t\t1400\n"
1210 "InstallInitialize\t\t1500\n"
1211 "ProcessComponents\t\t1600\n"
1212 "UnpublishFeatures\t\t1800\n"
1213 "RemoveFiles\t\t3500\n"
1214 "InstallFiles\t\t4000\n"
1215 "RegisterFonts\t\t4100\n"
1216 "UnregisterFonts\t\t4200\n"
1217 "RegisterUser\t\t6000\n"
1218 "RegisterProduct\t\t6100\n"
1219 "PublishFeatures\t\t6300\n"
1220 "PublishProduct\t\t6400\n"
1221 "InstallFinalize\t\t6600";
1223 static const CHAR vp_property_dat[] = "Property\tValue\n"
1224 "s72\tl0\n"
1225 "Property\tProperty\n"
1226 "HASUIRUN\t0\n"
1227 "INSTALLLEVEL\t3\n"
1228 "InstallMode\tTypical\n"
1229 "Manufacturer\tWine\n"
1230 "PIDTemplate\t###-#######\n"
1231 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
1232 "ProductLanguage\t1033\n"
1233 "ProductName\tMSITEST\n"
1234 "ProductVersion\t1.1.1\n"
1235 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n";
1237 static const CHAR vp_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n"
1238 "s72\ti2\tS64\tS0\tS255\n"
1239 "CustomAction\tAction\n"
1240 "SetProductID1\t51\tProductID\t1\t\n"
1241 "SetProductID2\t51\tProductID\t2\t\n"
1242 "TestProductID1\t19\t\t\tHalts installation\n"
1243 "TestProductID2\t19\t\t\tHalts installation\n";
1245 static const CHAR vp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1246 "s72\tS255\tI2\n"
1247 "InstallExecuteSequence\tAction\n"
1248 "LaunchConditions\t\t100\n"
1249 "CostInitialize\t\t800\n"
1250 "FileCost\t\t900\n"
1251 "CostFinalize\t\t1000\n"
1252 "InstallValidate\t\t1400\n"
1253 "InstallInitialize\t\t1500\n"
1254 "SetProductID1\tSET_PRODUCT_ID=1\t3000\n"
1255 "SetProductID2\tSET_PRODUCT_ID=2\t3100\n"
1256 "ValidateProductID\t\t3200\n"
1257 "InstallExecute\t\t3300\n"
1258 "TestProductID1\tProductID=1\t3400\n"
1259 "TestProductID2\tProductID=\"123-1234567\"\t3500\n"
1260 "InstallFiles\t\t4000\n"
1261 "InstallFinalize\t\t6000\n";
1263 static const CHAR odbc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1264 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1265 "File\tFile\n"
1266 "ODBCdriver.dll\todbc\tODBCdriver.dll\t1000\t\t\t8192\t1\n"
1267 "ODBCdriver2.dll\todbc\tODBCdriver2.dll\t1000\t\t\t8192\t2\n"
1268 "ODBCtranslator.dll\todbc\tODBCtranslator.dll\t1000\t\t\t8192\t3\n"
1269 "ODBCtranslator2.dll\todbc\tODBCtranslator2.dll\t1000\t\t\t8192\t4\n"
1270 "ODBCsetup.dll\todbc\tODBCsetup.dll\t1000\t\t\t8192\t5\n";
1272 static const CHAR odbc_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1273 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1274 "Feature\tFeature\n"
1275 "odbc\t\t\todbc feature\t1\t2\tMSITESTDIR\t0\n";
1277 static const CHAR odbc_feature_comp_dat[] = "Feature_\tComponent_\n"
1278 "s38\ts72\n"
1279 "FeatureComponents\tFeature_\tComponent_\n"
1280 "odbc\todbc\n";
1282 static const CHAR odbc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1283 "s72\tS38\ts72\ti2\tS255\tS72\n"
1284 "Component\tComponent\n"
1285 "odbc\t{B6F3E4AE-35D1-4B72-9044-989F03E20A43}\tMSITESTDIR\t0\t\tODBCdriver.dll\n";
1287 static const CHAR odbc_driver_dat[] = "Driver\tComponent_\tDescription\tFile_\tFile_Setup\n"
1288 "s72\ts72\ts255\ts72\tS72\n"
1289 "ODBCDriver\tDriver\n"
1290 "ODBC test driver\todbc\tODBC test driver\tODBCdriver.dll\t\n"
1291 "ODBC test driver2\todbc\tODBC test driver2\tODBCdriver2.dll\tODBCsetup.dll\n";
1293 static const CHAR odbc_translator_dat[] = "Translator\tComponent_\tDescription\tFile_\tFile_Setup\n"
1294 "s72\ts72\ts255\ts72\tS72\n"
1295 "ODBCTranslator\tTranslator\n"
1296 "ODBC test translator\todbc\tODBC test translator\tODBCtranslator.dll\t\n"
1297 "ODBC test translator2\todbc\tODBC test translator2\tODBCtranslator2.dll\tODBCsetup.dll\n";
1299 static const CHAR odbc_datasource_dat[] = "DataSource\tComponent_\tDescription\tDriverDescription\tRegistration\n"
1300 "s72\ts72\ts255\ts255\ti2\n"
1301 "ODBCDataSource\tDataSource\n"
1302 "ODBC data source\todbc\tODBC data source\tODBC driver\t0\n";
1304 static const CHAR odbc_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1305 "s72\tS255\tI2\n"
1306 "InstallExecuteSequence\tAction\n"
1307 "LaunchConditions\t\t100\n"
1308 "CostInitialize\t\t800\n"
1309 "FileCost\t\t900\n"
1310 "CostFinalize\t\t1000\n"
1311 "InstallValidate\t\t1400\n"
1312 "InstallInitialize\t\t1500\n"
1313 "InstallODBC\t\t3000\n"
1314 "RemoveODBC\t\t3100\n"
1315 "InstallFiles\t\t4000\n"
1316 "InstallFinalize\t\t6000\n";
1318 static const CHAR odbc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
1319 "i2\ti4\tL64\tS255\tS32\tS72\n"
1320 "Media\tDiskId\n"
1321 "1\t5\t\t\tDISK1\t\n";
1323 static const CHAR tl_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1324 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1325 "File\tFile\n"
1326 "typelib.dll\ttypelib\ttypelib.dll\t1000\t\t\t8192\t1\n";
1328 static const CHAR tl_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1329 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1330 "Feature\tFeature\n"
1331 "typelib\t\t\ttypelib feature\t1\t2\tMSITESTDIR\t0\n";
1333 static const CHAR tl_feature_comp_dat[] = "Feature_\tComponent_\n"
1334 "s38\ts72\n"
1335 "FeatureComponents\tFeature_\tComponent_\n"
1336 "typelib\ttypelib\n";
1338 static const CHAR tl_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1339 "s72\tS38\ts72\ti2\tS255\tS72\n"
1340 "Component\tComponent\n"
1341 "typelib\t{BB4C26FD-89D8-4E49-AF1C-DB4DCB5BF1B0}\tMSITESTDIR\t0\t\ttypelib.dll\n";
1343 static const CHAR tl_typelib_dat[] = "LibID\tLanguage\tComponent_\tVersion\tDescription\tDirectory_\tFeature_\tCost\n"
1344 "s38\ti2\ts72\tI4\tL128\tS72\ts38\tI4\n"
1345 "TypeLib\tLibID\tLanguage\tComponent_\n"
1346 "{EAC5166A-9734-4D91-878F-1DD02304C66C}\t0\ttypelib\t1793\t\tMSITESTDIR\ttypelib\t\n";
1348 static const CHAR tl_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1349 "s72\tS255\tI2\n"
1350 "InstallExecuteSequence\tAction\n"
1351 "LaunchConditions\t\t100\n"
1352 "CostInitialize\t\t800\n"
1353 "FileCost\t\t900\n"
1354 "CostFinalize\t\t1000\n"
1355 "InstallValidate\t\t1400\n"
1356 "InstallInitialize\t\t1500\n"
1357 "ProcessComponents\t\t1600\n"
1358 "RemoveFiles\t\t1700\n"
1359 "InstallFiles\t\t2000\n"
1360 "RegisterTypeLibraries\tREGISTER_TYPELIB=1\t3000\n"
1361 "UnregisterTypeLibraries\t\t3100\n"
1362 "RegisterProduct\t\t5100\n"
1363 "PublishFeatures\t\t5200\n"
1364 "PublishProduct\t\t5300\n"
1365 "InstallFinalize\t\t6000\n";
1367 static const CHAR crs_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1368 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1369 "File\tFile\n"
1370 "target.txt\tshortcut\ttarget.txt\t1000\t\t\t8192\t1\n";
1372 static const CHAR crs_feature_dat[] = "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1373 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1374 "Feature\tFeature\n"
1375 "shortcut\t\t\tshortcut feature\t1\t2\tMSITESTDIR\t0\n";
1377 static const CHAR crs_feature_comp_dat[] = "Feature_\tComponent_\n"
1378 "s38\ts72\n"
1379 "FeatureComponents\tFeature_\tComponent_\n"
1380 "shortcut\tshortcut\n";
1382 static const CHAR crs_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1383 "s72\tS38\ts72\ti2\tS255\tS72\n"
1384 "Component\tComponent\n"
1385 "shortcut\t{5D20E3C6-7206-498F-AC28-87AF2F9AD4CC}\tMSITESTDIR\t0\t\ttarget.txt\n";
1387 static const CHAR crs_shortcut_dat[] = "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
1388 "s72\ts72\tl128\ts72\ts72\tL255\tL255\tI2\tS72\tI2\tI2\tS72\n"
1389 "Shortcut\tShortcut\n"
1390 "shortcut\tMSITESTDIR\tshortcut\tshortcut\t[MSITESTDIR]target.txt\t\t\t\t\t\t\t\n";
1392 static const CHAR crs_install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
1393 "s72\tS255\tI2\n"
1394 "InstallExecuteSequence\tAction\n"
1395 "LaunchConditions\t\t100\n"
1396 "CostInitialize\t\t800\n"
1397 "FileCost\t\t900\n"
1398 "CostFinalize\t\t1000\n"
1399 "InstallValidate\t\t1400\n"
1400 "InstallInitialize\t\t1500\n"
1401 "ProcessComponents\t\t1600\n"
1402 "RemoveFiles\t\t1700\n"
1403 "InstallFiles\t\t2000\n"
1404 "RemoveShortcuts\t\t3000\n"
1405 "CreateShortcuts\t\t3100\n"
1406 "RegisterProduct\t\t5000\n"
1407 "PublishFeatures\t\t5100\n"
1408 "PublishProduct\t\t5200\n"
1409 "InstallFinalize\t\t6000\n";
1411 typedef struct _msi_table
1413 const CHAR *filename;
1414 const CHAR *data;
1415 int size;
1416 } msi_table;
1418 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
1420 static const msi_table tables[] =
1422 ADD_TABLE(component),
1423 ADD_TABLE(directory),
1424 ADD_TABLE(feature),
1425 ADD_TABLE(feature_comp),
1426 ADD_TABLE(file),
1427 ADD_TABLE(install_exec_seq),
1428 ADD_TABLE(media),
1429 ADD_TABLE(property),
1430 ADD_TABLE(registry),
1431 ADD_TABLE(service_install),
1432 ADD_TABLE(service_control)
1435 static const msi_table sc_tables[] =
1437 ADD_TABLE(component),
1438 ADD_TABLE(directory),
1439 ADD_TABLE(feature),
1440 ADD_TABLE(feature_comp),
1441 ADD_TABLE(file),
1442 ADD_TABLE(install_exec_seq),
1443 ADD_TABLE(media),
1444 ADD_TABLE(property),
1445 ADD_TABLE(shortcut)
1448 static const msi_table ps_tables[] =
1450 ADD_TABLE(component),
1451 ADD_TABLE(directory),
1452 ADD_TABLE(feature),
1453 ADD_TABLE(feature_comp),
1454 ADD_TABLE(file),
1455 ADD_TABLE(install_exec_seq),
1456 ADD_TABLE(media),
1457 ADD_TABLE(property),
1458 ADD_TABLE(condition)
1461 static const msi_table env_tables[] =
1463 ADD_TABLE(component),
1464 ADD_TABLE(directory),
1465 ADD_TABLE(feature),
1466 ADD_TABLE(feature_comp),
1467 ADD_TABLE(file),
1468 ADD_TABLE(install_exec_seq),
1469 ADD_TABLE(media),
1470 ADD_TABLE(property),
1471 ADD_TABLE(environment)
1474 static const msi_table up_tables[] =
1476 ADD_TABLE(component),
1477 ADD_TABLE(directory),
1478 ADD_TABLE(feature),
1479 ADD_TABLE(feature_comp),
1480 ADD_TABLE(file),
1481 ADD_TABLE(install_exec_seq),
1482 ADD_TABLE(media),
1483 ADD_TABLE(up_property),
1484 ADD_TABLE(registry),
1485 ADD_TABLE(service_install),
1486 ADD_TABLE(service_control)
1489 static const msi_table up2_tables[] =
1491 ADD_TABLE(component),
1492 ADD_TABLE(directory),
1493 ADD_TABLE(feature),
1494 ADD_TABLE(feature_comp),
1495 ADD_TABLE(file),
1496 ADD_TABLE(install_exec_seq),
1497 ADD_TABLE(media),
1498 ADD_TABLE(up2_property),
1499 ADD_TABLE(registry),
1500 ADD_TABLE(service_install),
1501 ADD_TABLE(service_control)
1504 static const msi_table up3_tables[] =
1506 ADD_TABLE(component),
1507 ADD_TABLE(directory),
1508 ADD_TABLE(feature),
1509 ADD_TABLE(feature_comp),
1510 ADD_TABLE(file),
1511 ADD_TABLE(install_exec_seq),
1512 ADD_TABLE(media),
1513 ADD_TABLE(up3_property),
1514 ADD_TABLE(registry),
1515 ADD_TABLE(service_install),
1516 ADD_TABLE(service_control)
1519 static const msi_table up4_tables[] =
1521 ADD_TABLE(component),
1522 ADD_TABLE(directory),
1523 ADD_TABLE(feature),
1524 ADD_TABLE(feature_comp),
1525 ADD_TABLE(file),
1526 ADD_TABLE(pp_install_exec_seq),
1527 ADD_TABLE(media),
1528 ADD_TABLE(property),
1529 ADD_TABLE(registry),
1530 ADD_TABLE(service_install),
1531 ADD_TABLE(service_control)
1534 static const msi_table up5_tables[] =
1536 ADD_TABLE(component),
1537 ADD_TABLE(directory),
1538 ADD_TABLE(feature),
1539 ADD_TABLE(feature_comp),
1540 ADD_TABLE(file),
1541 ADD_TABLE(pp_install_exec_seq),
1542 ADD_TABLE(media),
1543 ADD_TABLE(up_property),
1544 ADD_TABLE(registry),
1545 ADD_TABLE(service_install),
1546 ADD_TABLE(service_control)
1549 static const msi_table up6_tables[] =
1551 ADD_TABLE(component),
1552 ADD_TABLE(directory),
1553 ADD_TABLE(feature),
1554 ADD_TABLE(feature_comp),
1555 ADD_TABLE(file),
1556 ADD_TABLE(pp_install_exec_seq),
1557 ADD_TABLE(media),
1558 ADD_TABLE(up2_property),
1559 ADD_TABLE(registry),
1560 ADD_TABLE(service_install),
1561 ADD_TABLE(service_control)
1564 static const msi_table up7_tables[] =
1566 ADD_TABLE(component),
1567 ADD_TABLE(directory),
1568 ADD_TABLE(feature),
1569 ADD_TABLE(feature_comp),
1570 ADD_TABLE(file),
1571 ADD_TABLE(pp_install_exec_seq),
1572 ADD_TABLE(media),
1573 ADD_TABLE(up3_property),
1574 ADD_TABLE(registry),
1575 ADD_TABLE(service_install),
1576 ADD_TABLE(service_control)
1579 static const msi_table cc_tables[] =
1581 ADD_TABLE(cc_component),
1582 ADD_TABLE(directory),
1583 ADD_TABLE(cc_feature),
1584 ADD_TABLE(cc_feature_comp),
1585 ADD_TABLE(cc_file),
1586 ADD_TABLE(install_exec_seq),
1587 ADD_TABLE(cc_media),
1588 ADD_TABLE(property),
1591 static const msi_table cc2_tables[] =
1593 ADD_TABLE(cc2_component),
1594 ADD_TABLE(directory),
1595 ADD_TABLE(cc_feature),
1596 ADD_TABLE(cc_feature_comp),
1597 ADD_TABLE(cc2_file),
1598 ADD_TABLE(install_exec_seq),
1599 ADD_TABLE(cc_media),
1600 ADD_TABLE(property),
1603 static const msi_table co_tables[] =
1605 ADD_TABLE(cc_component),
1606 ADD_TABLE(directory),
1607 ADD_TABLE(cc_feature),
1608 ADD_TABLE(cc_feature_comp),
1609 ADD_TABLE(co_file),
1610 ADD_TABLE(install_exec_seq),
1611 ADD_TABLE(co_media),
1612 ADD_TABLE(property),
1615 static const msi_table co2_tables[] =
1617 ADD_TABLE(cc_component),
1618 ADD_TABLE(directory),
1619 ADD_TABLE(cc_feature),
1620 ADD_TABLE(cc_feature_comp),
1621 ADD_TABLE(cc_file),
1622 ADD_TABLE(install_exec_seq),
1623 ADD_TABLE(co2_media),
1624 ADD_TABLE(property),
1627 static const msi_table mm_tables[] =
1629 ADD_TABLE(cc_component),
1630 ADD_TABLE(directory),
1631 ADD_TABLE(cc_feature),
1632 ADD_TABLE(cc_feature_comp),
1633 ADD_TABLE(mm_file),
1634 ADD_TABLE(install_exec_seq),
1635 ADD_TABLE(mm_media),
1636 ADD_TABLE(property),
1639 static const msi_table ss_tables[] =
1641 ADD_TABLE(cc_component),
1642 ADD_TABLE(directory),
1643 ADD_TABLE(cc_feature),
1644 ADD_TABLE(cc_feature_comp),
1645 ADD_TABLE(cc_file),
1646 ADD_TABLE(install_exec_seq),
1647 ADD_TABLE(ss_media),
1648 ADD_TABLE(property),
1651 static const msi_table ui_tables[] =
1653 ADD_TABLE(ui_component),
1654 ADD_TABLE(directory),
1655 ADD_TABLE(cc_feature),
1656 ADD_TABLE(cc_feature_comp),
1657 ADD_TABLE(cc_file),
1658 ADD_TABLE(install_exec_seq),
1659 ADD_TABLE(ui_install_ui_seq),
1660 ADD_TABLE(ui_custom_action),
1661 ADD_TABLE(cc_media),
1662 ADD_TABLE(property),
1665 static const msi_table rof_tables[] =
1667 ADD_TABLE(rof_component),
1668 ADD_TABLE(directory),
1669 ADD_TABLE(rof_feature),
1670 ADD_TABLE(rof_feature_comp),
1671 ADD_TABLE(rof_file),
1672 ADD_TABLE(install_exec_seq),
1673 ADD_TABLE(rof_media),
1674 ADD_TABLE(property),
1677 static const msi_table rofc_tables[] =
1679 ADD_TABLE(rof_component),
1680 ADD_TABLE(directory),
1681 ADD_TABLE(rof_feature),
1682 ADD_TABLE(rof_feature_comp),
1683 ADD_TABLE(rofc_file),
1684 ADD_TABLE(install_exec_seq),
1685 ADD_TABLE(rofc_media),
1686 ADD_TABLE(property),
1689 static const msi_table sdp_tables[] =
1691 ADD_TABLE(rof_component),
1692 ADD_TABLE(directory),
1693 ADD_TABLE(rof_feature),
1694 ADD_TABLE(rof_feature_comp),
1695 ADD_TABLE(rof_file),
1696 ADD_TABLE(sdp_install_exec_seq),
1697 ADD_TABLE(sdp_custom_action),
1698 ADD_TABLE(rof_media),
1699 ADD_TABLE(property),
1702 static const msi_table cie_tables[] =
1704 ADD_TABLE(cie_component),
1705 ADD_TABLE(directory),
1706 ADD_TABLE(cc_feature),
1707 ADD_TABLE(cie_feature_comp),
1708 ADD_TABLE(cie_file),
1709 ADD_TABLE(install_exec_seq),
1710 ADD_TABLE(cie_media),
1711 ADD_TABLE(property),
1714 static const msi_table ci_tables[] =
1716 ADD_TABLE(ci_component),
1717 ADD_TABLE(directory),
1718 ADD_TABLE(rof_feature),
1719 ADD_TABLE(rof_feature_comp),
1720 ADD_TABLE(rof_file),
1721 ADD_TABLE(ci_install_exec_seq),
1722 ADD_TABLE(rof_media),
1723 ADD_TABLE(property),
1724 ADD_TABLE(ci_custom_action),
1727 static const msi_table ci2_tables[] =
1729 ADD_TABLE(ci2_component),
1730 ADD_TABLE(directory),
1731 ADD_TABLE(rof_feature),
1732 ADD_TABLE(ci2_feature_comp),
1733 ADD_TABLE(ci2_file),
1734 ADD_TABLE(install_exec_seq),
1735 ADD_TABLE(rof_media),
1736 ADD_TABLE(property),
1739 static const msi_table spf_tables[] =
1741 ADD_TABLE(ci_component),
1742 ADD_TABLE(directory),
1743 ADD_TABLE(rof_feature),
1744 ADD_TABLE(rof_feature_comp),
1745 ADD_TABLE(rof_file),
1746 ADD_TABLE(spf_install_exec_seq),
1747 ADD_TABLE(rof_media),
1748 ADD_TABLE(property),
1749 ADD_TABLE(spf_custom_action),
1750 ADD_TABLE(spf_install_ui_seq),
1753 static const msi_table pp_tables[] =
1755 ADD_TABLE(ci_component),
1756 ADD_TABLE(directory),
1757 ADD_TABLE(rof_feature),
1758 ADD_TABLE(rof_feature_comp),
1759 ADD_TABLE(rof_file),
1760 ADD_TABLE(pp_install_exec_seq),
1761 ADD_TABLE(rof_media),
1762 ADD_TABLE(property),
1765 static const msi_table ppc_tables[] =
1767 ADD_TABLE(ppc_component),
1768 ADD_TABLE(directory),
1769 ADD_TABLE(rof_feature),
1770 ADD_TABLE(ppc_feature_comp),
1771 ADD_TABLE(ppc_file),
1772 ADD_TABLE(pp_install_exec_seq),
1773 ADD_TABLE(ppc_media),
1774 ADD_TABLE(property),
1777 static const msi_table lus0_tables[] =
1779 ADD_TABLE(ci_component),
1780 ADD_TABLE(directory),
1781 ADD_TABLE(rof_feature),
1782 ADD_TABLE(rof_feature_comp),
1783 ADD_TABLE(rof_file),
1784 ADD_TABLE(pp_install_exec_seq),
1785 ADD_TABLE(rof_media),
1786 ADD_TABLE(property),
1789 static const msi_table lus1_tables[] =
1791 ADD_TABLE(ci_component),
1792 ADD_TABLE(directory),
1793 ADD_TABLE(rof_feature),
1794 ADD_TABLE(rof_feature_comp),
1795 ADD_TABLE(rof_file),
1796 ADD_TABLE(pp_install_exec_seq),
1797 ADD_TABLE(rofc_media),
1798 ADD_TABLE(property),
1801 static const msi_table lus2_tables[] =
1803 ADD_TABLE(ci_component),
1804 ADD_TABLE(directory),
1805 ADD_TABLE(rof_feature),
1806 ADD_TABLE(rof_feature_comp),
1807 ADD_TABLE(rof_file),
1808 ADD_TABLE(pp_install_exec_seq),
1809 ADD_TABLE(lus2_media),
1810 ADD_TABLE(property),
1813 static const msi_table tp_tables[] =
1815 ADD_TABLE(tp_component),
1816 ADD_TABLE(directory),
1817 ADD_TABLE(rof_feature),
1818 ADD_TABLE(ci2_feature_comp),
1819 ADD_TABLE(ci2_file),
1820 ADD_TABLE(install_exec_seq),
1821 ADD_TABLE(rof_media),
1822 ADD_TABLE(property),
1825 static const msi_table cwd_tables[] =
1827 ADD_TABLE(cwd_component),
1828 ADD_TABLE(directory),
1829 ADD_TABLE(rof_feature),
1830 ADD_TABLE(ci2_feature_comp),
1831 ADD_TABLE(ci2_file),
1832 ADD_TABLE(install_exec_seq),
1833 ADD_TABLE(rof_media),
1834 ADD_TABLE(property),
1837 static const msi_table adm_tables[] =
1839 ADD_TABLE(adm_component),
1840 ADD_TABLE(directory),
1841 ADD_TABLE(rof_feature),
1842 ADD_TABLE(ci2_feature_comp),
1843 ADD_TABLE(ci2_file),
1844 ADD_TABLE(install_exec_seq),
1845 ADD_TABLE(rof_media),
1846 ADD_TABLE(property),
1847 ADD_TABLE(adm_custom_action),
1848 ADD_TABLE(adm_admin_exec_seq),
1851 static const msi_table amp_tables[] =
1853 ADD_TABLE(amp_component),
1854 ADD_TABLE(directory),
1855 ADD_TABLE(rof_feature),
1856 ADD_TABLE(ci2_feature_comp),
1857 ADD_TABLE(ci2_file),
1858 ADD_TABLE(install_exec_seq),
1859 ADD_TABLE(rof_media),
1860 ADD_TABLE(property),
1863 static const msi_table rem_tables[] =
1865 ADD_TABLE(rem_component),
1866 ADD_TABLE(directory),
1867 ADD_TABLE(rof_feature),
1868 ADD_TABLE(rem_feature_comp),
1869 ADD_TABLE(rem_file),
1870 ADD_TABLE(rem_install_exec_seq),
1871 ADD_TABLE(rof_media),
1872 ADD_TABLE(property),
1873 ADD_TABLE(rem_remove_files),
1876 static const msi_table mov_tables[] =
1878 ADD_TABLE(cwd_component),
1879 ADD_TABLE(directory),
1880 ADD_TABLE(rof_feature),
1881 ADD_TABLE(ci2_feature_comp),
1882 ADD_TABLE(ci2_file),
1883 ADD_TABLE(install_exec_seq),
1884 ADD_TABLE(rof_media),
1885 ADD_TABLE(property),
1886 ADD_TABLE(mov_move_file),
1889 static const msi_table mc_tables[] =
1891 ADD_TABLE(mc_component),
1892 ADD_TABLE(directory),
1893 ADD_TABLE(cc_feature),
1894 ADD_TABLE(cie_feature_comp),
1895 ADD_TABLE(mc_file),
1896 ADD_TABLE(install_exec_seq),
1897 ADD_TABLE(mc_media),
1898 ADD_TABLE(property),
1899 ADD_TABLE(mc_file_hash),
1902 static const msi_table df_tables[] =
1904 ADD_TABLE(rof_component),
1905 ADD_TABLE(df_directory),
1906 ADD_TABLE(rof_feature),
1907 ADD_TABLE(rof_feature_comp),
1908 ADD_TABLE(rof_file),
1909 ADD_TABLE(install_exec_seq),
1910 ADD_TABLE(rof_media),
1911 ADD_TABLE(property),
1912 ADD_TABLE(df_duplicate_file),
1915 static const msi_table wrv_tables[] =
1917 ADD_TABLE(wrv_component),
1918 ADD_TABLE(directory),
1919 ADD_TABLE(rof_feature),
1920 ADD_TABLE(ci2_feature_comp),
1921 ADD_TABLE(ci2_file),
1922 ADD_TABLE(install_exec_seq),
1923 ADD_TABLE(rof_media),
1924 ADD_TABLE(property),
1925 ADD_TABLE(wrv_registry),
1928 static const msi_table sf_tables[] =
1930 ADD_TABLE(wrv_component),
1931 ADD_TABLE(directory),
1932 ADD_TABLE(rof_feature),
1933 ADD_TABLE(ci2_feature_comp),
1934 ADD_TABLE(ci2_file),
1935 ADD_TABLE(install_exec_seq),
1936 ADD_TABLE(rof_media),
1937 ADD_TABLE(property),
1940 static const msi_table ca51_tables[] =
1942 ADD_TABLE(ca51_component),
1943 ADD_TABLE(directory),
1944 ADD_TABLE(rof_feature),
1945 ADD_TABLE(ci2_feature_comp),
1946 ADD_TABLE(ci2_file),
1947 ADD_TABLE(ca51_install_exec_seq),
1948 ADD_TABLE(rof_media),
1949 ADD_TABLE(property),
1950 ADD_TABLE(ca51_custom_action),
1953 static const msi_table is_tables[] =
1955 ADD_TABLE(is_component),
1956 ADD_TABLE(directory),
1957 ADD_TABLE(is_feature),
1958 ADD_TABLE(is_feature_comp),
1959 ADD_TABLE(is_file),
1960 ADD_TABLE(install_exec_seq),
1961 ADD_TABLE(is_media),
1962 ADD_TABLE(property),
1965 static const msi_table sp_tables[] =
1967 ADD_TABLE(sp_component),
1968 ADD_TABLE(sp_directory),
1969 ADD_TABLE(rof_feature),
1970 ADD_TABLE(ci2_feature_comp),
1971 ADD_TABLE(ci2_file),
1972 ADD_TABLE(install_exec_seq),
1973 ADD_TABLE(rof_media),
1974 ADD_TABLE(property),
1977 static const msi_table mcp_tables[] =
1979 ADD_TABLE(mcp_component),
1980 ADD_TABLE(directory),
1981 ADD_TABLE(mcp_feature),
1982 ADD_TABLE(mcp_feature_comp),
1983 ADD_TABLE(rem_file),
1984 ADD_TABLE(rem_install_exec_seq),
1985 ADD_TABLE(rof_media),
1986 ADD_TABLE(property),
1989 static const msi_table mcomp_tables[] =
1991 ADD_TABLE(mcp_component),
1992 ADD_TABLE(directory),
1993 ADD_TABLE(mcp_feature),
1994 ADD_TABLE(mcp_feature_comp),
1995 ADD_TABLE(mcomp_file),
1996 ADD_TABLE(rem_install_exec_seq),
1997 ADD_TABLE(rof_media),
1998 ADD_TABLE(property),
2001 static const msi_table ai_tables[] =
2003 ADD_TABLE(component),
2004 ADD_TABLE(directory),
2005 ADD_TABLE(feature),
2006 ADD_TABLE(feature_comp),
2007 ADD_TABLE(ai_file),
2008 ADD_TABLE(install_exec_seq),
2009 ADD_TABLE(media),
2010 ADD_TABLE(property)
2013 static const msi_table pc_tables[] =
2015 ADD_TABLE(ca51_component),
2016 ADD_TABLE(directory),
2017 ADD_TABLE(rof_feature),
2018 ADD_TABLE(ci2_feature_comp),
2019 ADD_TABLE(ci2_file),
2020 ADD_TABLE(install_exec_seq),
2021 ADD_TABLE(rof_media),
2022 ADD_TABLE(property)
2025 static const msi_table ip_tables[] =
2027 ADD_TABLE(component),
2028 ADD_TABLE(directory),
2029 ADD_TABLE(feature),
2030 ADD_TABLE(feature_comp),
2031 ADD_TABLE(file),
2032 ADD_TABLE(ip_install_exec_seq),
2033 ADD_TABLE(ip_custom_action),
2034 ADD_TABLE(media),
2035 ADD_TABLE(property)
2038 static const msi_table aup_tables[] =
2040 ADD_TABLE(component),
2041 ADD_TABLE(directory),
2042 ADD_TABLE(feature),
2043 ADD_TABLE(feature_comp),
2044 ADD_TABLE(file),
2045 ADD_TABLE(aup_install_exec_seq),
2046 ADD_TABLE(aup_custom_action),
2047 ADD_TABLE(media),
2048 ADD_TABLE(property)
2051 static const msi_table aup2_tables[] =
2053 ADD_TABLE(component),
2054 ADD_TABLE(directory),
2055 ADD_TABLE(feature),
2056 ADD_TABLE(feature_comp),
2057 ADD_TABLE(file),
2058 ADD_TABLE(aup2_install_exec_seq),
2059 ADD_TABLE(aup_custom_action),
2060 ADD_TABLE(media),
2061 ADD_TABLE(aup_property)
2064 static const msi_table aup3_tables[] =
2066 ADD_TABLE(component),
2067 ADD_TABLE(directory),
2068 ADD_TABLE(feature),
2069 ADD_TABLE(feature_comp),
2070 ADD_TABLE(file),
2071 ADD_TABLE(aup2_install_exec_seq),
2072 ADD_TABLE(aup_custom_action),
2073 ADD_TABLE(media),
2074 ADD_TABLE(aup2_property)
2077 static const msi_table aup4_tables[] =
2079 ADD_TABLE(component),
2080 ADD_TABLE(directory),
2081 ADD_TABLE(feature),
2082 ADD_TABLE(feature_comp),
2083 ADD_TABLE(file),
2084 ADD_TABLE(aup3_install_exec_seq),
2085 ADD_TABLE(aup_custom_action),
2086 ADD_TABLE(media),
2087 ADD_TABLE(aup2_property)
2090 static const msi_table fiu_tables[] =
2092 ADD_TABLE(rof_component),
2093 ADD_TABLE(directory),
2094 ADD_TABLE(rof_feature),
2095 ADD_TABLE(rof_feature_comp),
2096 ADD_TABLE(rof_file),
2097 ADD_TABLE(pp_install_exec_seq),
2098 ADD_TABLE(rof_media),
2099 ADD_TABLE(property),
2102 static const msi_table fiuc_tables[] =
2104 ADD_TABLE(rof_component),
2105 ADD_TABLE(directory),
2106 ADD_TABLE(rof_feature),
2107 ADD_TABLE(rof_feature_comp),
2108 ADD_TABLE(rofc_file),
2109 ADD_TABLE(pp_install_exec_seq),
2110 ADD_TABLE(rofc_media),
2111 ADD_TABLE(property),
2114 static const msi_table cf_tables[] =
2116 ADD_TABLE(component),
2117 ADD_TABLE(directory),
2118 ADD_TABLE(feature),
2119 ADD_TABLE(feature_comp),
2120 ADD_TABLE(file),
2121 ADD_TABLE(cf_create_folders),
2122 ADD_TABLE(cf_install_exec_seq),
2123 ADD_TABLE(cf_custom_action),
2124 ADD_TABLE(media),
2125 ADD_TABLE(property)
2128 static const msi_table rf_tables[] =
2130 ADD_TABLE(component),
2131 ADD_TABLE(directory),
2132 ADD_TABLE(feature),
2133 ADD_TABLE(feature_comp),
2134 ADD_TABLE(file),
2135 ADD_TABLE(cf_create_folders),
2136 ADD_TABLE(rf_install_exec_seq),
2137 ADD_TABLE(cf_custom_action),
2138 ADD_TABLE(media),
2139 ADD_TABLE(property)
2142 static const msi_table sss_tables[] =
2144 ADD_TABLE(component),
2145 ADD_TABLE(directory),
2146 ADD_TABLE(feature),
2147 ADD_TABLE(feature_comp),
2148 ADD_TABLE(file),
2149 ADD_TABLE(sss_install_exec_seq),
2150 ADD_TABLE(sss_service_control),
2151 ADD_TABLE(media),
2152 ADD_TABLE(property)
2155 static const msi_table sds_tables[] =
2157 ADD_TABLE(component),
2158 ADD_TABLE(directory),
2159 ADD_TABLE(feature),
2160 ADD_TABLE(feature_comp),
2161 ADD_TABLE(file),
2162 ADD_TABLE(sss_install_exec_seq),
2163 ADD_TABLE(service_control),
2164 ADD_TABLE(media),
2165 ADD_TABLE(property)
2168 static const msi_table sr_tables[] =
2170 ADD_TABLE(component),
2171 ADD_TABLE(directory),
2172 ADD_TABLE(feature),
2173 ADD_TABLE(feature_comp),
2174 ADD_TABLE(file),
2175 ADD_TABLE(sr_selfreg),
2176 ADD_TABLE(sr_install_exec_seq),
2177 ADD_TABLE(media),
2178 ADD_TABLE(property)
2181 static const msi_table font_tables[] =
2183 ADD_TABLE(font_component),
2184 ADD_TABLE(directory),
2185 ADD_TABLE(font_feature),
2186 ADD_TABLE(font_feature_comp),
2187 ADD_TABLE(font_file),
2188 ADD_TABLE(font),
2189 ADD_TABLE(font_install_exec_seq),
2190 ADD_TABLE(font_media),
2191 ADD_TABLE(property)
2194 static const msi_table vp_tables[] =
2196 ADD_TABLE(component),
2197 ADD_TABLE(directory),
2198 ADD_TABLE(feature),
2199 ADD_TABLE(feature_comp),
2200 ADD_TABLE(file),
2201 ADD_TABLE(vp_custom_action),
2202 ADD_TABLE(vp_install_exec_seq),
2203 ADD_TABLE(media),
2204 ADD_TABLE(vp_property)
2207 static const msi_table odbc_tables[] =
2209 ADD_TABLE(odbc_component),
2210 ADD_TABLE(directory),
2211 ADD_TABLE(odbc_feature),
2212 ADD_TABLE(odbc_feature_comp),
2213 ADD_TABLE(odbc_file),
2214 ADD_TABLE(odbc_driver),
2215 ADD_TABLE(odbc_translator),
2216 ADD_TABLE(odbc_datasource),
2217 ADD_TABLE(odbc_install_exec_seq),
2218 ADD_TABLE(odbc_media),
2219 ADD_TABLE(property)
2222 static const msi_table tl_tables[] =
2224 ADD_TABLE(tl_component),
2225 ADD_TABLE(directory),
2226 ADD_TABLE(tl_feature),
2227 ADD_TABLE(tl_feature_comp),
2228 ADD_TABLE(tl_file),
2229 ADD_TABLE(tl_typelib),
2230 ADD_TABLE(tl_install_exec_seq),
2231 ADD_TABLE(media),
2232 ADD_TABLE(property)
2235 static const msi_table crs_tables[] =
2237 ADD_TABLE(crs_component),
2238 ADD_TABLE(directory),
2239 ADD_TABLE(crs_feature),
2240 ADD_TABLE(crs_feature_comp),
2241 ADD_TABLE(crs_file),
2242 ADD_TABLE(crs_shortcut),
2243 ADD_TABLE(crs_install_exec_seq),
2244 ADD_TABLE(media),
2245 ADD_TABLE(property)
2248 /* cabinet definitions */
2250 /* make the max size large so there is only one cab file */
2251 #define MEDIA_SIZE 0x7FFFFFFF
2252 #define FOLDER_THRESHOLD 900000
2254 /* the FCI callbacks */
2256 static void * CDECL mem_alloc(ULONG cb)
2258 return HeapAlloc(GetProcessHeap(), 0, cb);
2261 static void CDECL mem_free(void *memory)
2263 HeapFree(GetProcessHeap(), 0, memory);
2266 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
2268 sprintf(pccab->szCab, pv, pccab->iCab);
2269 return TRUE;
2272 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
2274 return 0;
2277 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
2278 BOOL fContinuation, void *pv)
2280 return 0;
2283 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
2285 HANDLE handle;
2286 DWORD dwAccess = 0;
2287 DWORD dwShareMode = 0;
2288 DWORD dwCreateDisposition = OPEN_EXISTING;
2290 dwAccess = GENERIC_READ | GENERIC_WRITE;
2291 /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
2292 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
2294 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
2295 dwCreateDisposition = OPEN_EXISTING;
2296 else
2297 dwCreateDisposition = CREATE_NEW;
2299 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
2300 dwCreateDisposition, 0, NULL);
2302 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
2304 return (INT_PTR)handle;
2307 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2309 HANDLE handle = (HANDLE)hf;
2310 DWORD dwRead;
2311 BOOL res;
2313 res = ReadFile(handle, memory, cb, &dwRead, NULL);
2314 ok(res, "Failed to ReadFile\n");
2316 return dwRead;
2319 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2321 HANDLE handle = (HANDLE)hf;
2322 DWORD dwWritten;
2323 BOOL res;
2325 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2326 ok(res, "Failed to WriteFile\n");
2328 return dwWritten;
2331 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
2333 HANDLE handle = (HANDLE)hf;
2334 ok(CloseHandle(handle), "Failed to CloseHandle\n");
2336 return 0;
2339 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
2341 HANDLE handle = (HANDLE)hf;
2342 DWORD ret;
2344 ret = SetFilePointer(handle, dist, NULL, seektype);
2345 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2347 return ret;
2350 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
2352 BOOL ret = DeleteFileA(pszFile);
2353 ok(ret, "Failed to DeleteFile %s\n", pszFile);
2355 return 0;
2358 static void init_functionpointers(void)
2360 HMODULE hmsi = GetModuleHandleA("msi.dll");
2361 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2363 #define GET_PROC(mod, func) \
2364 p ## func = (void*)GetProcAddress(mod, #func); \
2365 if(!p ## func) \
2366 trace("GetProcAddress(%s) failed\n", #func);
2368 GET_PROC(hmsi, MsiQueryComponentStateA);
2369 GET_PROC(hmsi, MsiSetExternalUIRecord);
2370 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
2371 GET_PROC(hmsi, MsiSourceListGetInfoA);
2373 GET_PROC(hadvapi32, ConvertSidToStringSidA);
2375 hsrclient = LoadLibraryA("srclient.dll");
2376 GET_PROC(hsrclient, SRRemoveRestorePoint);
2377 GET_PROC(hsrclient, SRSetRestorePointA);
2379 #undef GET_PROC
2382 static BOOL check_win9x(void)
2384 SC_HANDLE scm;
2386 scm = OpenSCManager(NULL, NULL, GENERIC_ALL);
2387 if (!scm && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED))
2388 return TRUE;
2390 CloseServiceHandle(scm);
2392 return FALSE;
2395 static LPSTR get_user_sid(LPSTR *usersid)
2397 HANDLE token;
2398 BYTE buf[1024];
2399 DWORD size;
2400 PTOKEN_USER user;
2402 if (!pConvertSidToStringSidA)
2404 win_skip("ConvertSidToStringSidA is not available\n");
2405 return NULL;
2408 *usersid = NULL;
2409 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
2410 size = sizeof(buf);
2411 GetTokenInformation(token, TokenUser, buf, size, &size);
2412 user = (PTOKEN_USER)buf;
2413 pConvertSidToStringSidA(user->User.Sid, usersid);
2414 ok(*usersid != NULL, "pConvertSidToStringSidA failed lre=%d\n", GetLastError());
2415 CloseHandle(token);
2416 return *usersid;
2419 static BOOL check_record(MSIHANDLE rec, UINT field, LPCSTR val)
2421 CHAR buffer[0x20];
2422 UINT r;
2423 DWORD sz;
2425 sz = sizeof buffer;
2426 r = MsiRecordGetString(rec, field, buffer, &sz);
2427 return (r == ERROR_SUCCESS ) && !strcmp(val, buffer);
2430 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2432 LPSTR tempname;
2434 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2435 GetTempFileNameA(".", "xx", 0, tempname);
2437 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2439 lstrcpyA(pszTempName, tempname);
2440 HeapFree(GetProcessHeap(), 0, tempname);
2441 return TRUE;
2444 HeapFree(GetProcessHeap(), 0, tempname);
2446 return FALSE;
2449 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2450 USHORT *pattribs, int *err, void *pv)
2452 BY_HANDLE_FILE_INFORMATION finfo;
2453 FILETIME filetime;
2454 HANDLE handle;
2455 DWORD attrs;
2456 BOOL res;
2458 handle = CreateFile(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2459 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2461 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2463 res = GetFileInformationByHandle(handle, &finfo);
2464 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2466 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2467 FileTimeToDosDateTime(&filetime, pdate, ptime);
2469 attrs = GetFileAttributes(pszName);
2470 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2472 return (INT_PTR)handle;
2475 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2477 char path[MAX_PATH];
2478 char filename[MAX_PATH];
2480 lstrcpyA(path, CURR_DIR);
2481 lstrcatA(path, "\\");
2482 lstrcatA(path, file);
2484 lstrcpyA(filename, file);
2486 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2487 progress, get_open_info, compress);
2490 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2492 ZeroMemory(pCabParams, sizeof(CCAB));
2494 pCabParams->cb = max_size;
2495 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2496 pCabParams->setID = 0xbeef;
2497 pCabParams->iCab = 1;
2498 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2499 lstrcatA(pCabParams->szCabPath, "\\");
2500 lstrcpyA(pCabParams->szCab, name);
2503 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2505 CCAB cabParams;
2506 LPCSTR ptr;
2507 HFCI hfci;
2508 ERF erf;
2509 BOOL res;
2511 set_cab_parameters(&cabParams, name, max_size);
2513 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2514 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2515 get_temp_file, &cabParams, NULL);
2517 ok(hfci != NULL, "Failed to create an FCI context\n");
2519 ptr = files;
2520 while (*ptr)
2522 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2523 ok(res, "Failed to add file: %s\n", ptr);
2524 ptr += lstrlen(ptr) + 1;
2527 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2528 ok(res, "Failed to flush the cabinet\n");
2530 res = FCIDestroy(hfci);
2531 ok(res, "Failed to destroy the cabinet\n");
2534 static BOOL get_program_files_dir(LPSTR buf, LPSTR buf2)
2536 HKEY hkey;
2537 DWORD type, size;
2539 if (RegOpenKey(HKEY_LOCAL_MACHINE,
2540 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2541 return FALSE;
2543 size = MAX_PATH;
2544 if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) {
2545 RegCloseKey(hkey);
2546 return FALSE;
2549 size = MAX_PATH;
2550 if (RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size)) {
2551 RegCloseKey(hkey);
2552 return FALSE;
2555 RegCloseKey(hkey);
2556 return TRUE;
2559 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2561 HANDLE file;
2562 DWORD written;
2564 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2565 if (file == INVALID_HANDLE_VALUE)
2566 return;
2568 WriteFile(file, data, strlen(data), &written, NULL);
2570 if (size)
2572 SetFilePointer(file, size, NULL, FILE_BEGIN);
2573 SetEndOfFile(file);
2576 CloseHandle(file);
2579 #define create_file(name, size) create_file_data(name, name, size)
2581 static void create_test_files(void)
2583 CreateDirectoryA("msitest", NULL);
2584 create_file("msitest\\one.txt", 100);
2585 CreateDirectoryA("msitest\\first", NULL);
2586 create_file("msitest\\first\\two.txt", 100);
2587 CreateDirectoryA("msitest\\second", NULL);
2588 create_file("msitest\\second\\three.txt", 100);
2590 create_file("four.txt", 100);
2591 create_file("five.txt", 100);
2592 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2594 create_file("msitest\\filename", 100);
2595 create_file("msitest\\service.exe", 100);
2597 DeleteFileA("four.txt");
2598 DeleteFileA("five.txt");
2601 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2603 CHAR path[MAX_PATH];
2605 lstrcpyA(path, PROG_FILES_DIR);
2606 lstrcatA(path, "\\");
2607 lstrcatA(path, rel_path);
2609 if (is_file)
2610 return DeleteFileA(path);
2611 else
2612 return RemoveDirectoryA(path);
2615 static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
2617 CHAR path[MAX_PATH];
2619 lstrcpyA(path, COMMON_FILES_DIR);
2620 lstrcatA(path, "\\");
2621 lstrcatA(path, rel_path);
2623 if (is_file)
2624 return DeleteFileA(path);
2625 else
2626 return RemoveDirectoryA(path);
2629 static void delete_test_files(void)
2631 DeleteFileA("msitest.msi");
2632 DeleteFileA("msitest.cab");
2633 DeleteFileA("msitest\\second\\three.txt");
2634 DeleteFileA("msitest\\first\\two.txt");
2635 DeleteFileA("msitest\\one.txt");
2636 DeleteFileA("msitest\\service.exe");
2637 DeleteFileA("msitest\\filename");
2638 RemoveDirectoryA("msitest\\second");
2639 RemoveDirectoryA("msitest\\first");
2640 RemoveDirectoryA("msitest");
2643 static void write_file(const CHAR *filename, const char *data, int data_size)
2645 DWORD size;
2647 HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL,
2648 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2650 WriteFile(hf, data, data_size, &size, NULL);
2651 CloseHandle(hf);
2654 static void write_msi_summary_info(MSIHANDLE db, INT wordcount)
2656 MSIHANDLE summary;
2657 UINT r;
2659 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2660 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2662 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, ";1033");
2663 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2665 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
2666 "{004757CA-5092-49c2-AD20-28E1CE0DF5F2}");
2667 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2669 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
2670 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2672 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2673 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2675 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2676 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2678 /* write the summary changes back to the stream */
2679 r = MsiSummaryInfoPersist(summary);
2680 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2682 MsiCloseHandle(summary);
2685 #define create_database(name, tables, num_tables) \
2686 create_database_wordcount(name, tables, num_tables, 0);
2688 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2689 int num_tables, INT wordcount)
2691 MSIHANDLE db;
2692 UINT r;
2693 int j;
2695 r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db);
2696 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2698 /* import the tables into the database */
2699 for (j = 0; j < num_tables; j++)
2701 const msi_table *table = &tables[j];
2703 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2705 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2706 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2708 DeleteFileA(table->filename);
2711 write_msi_summary_info(db, wordcount);
2713 r = MsiDatabaseCommit(db);
2714 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2716 MsiCloseHandle(db);
2719 static void check_service_is_installed(void)
2721 SC_HANDLE scm, service;
2722 BOOL res;
2724 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
2725 ok(scm != NULL, "Failed to open the SC Manager\n");
2727 service = OpenService(scm, "TestService", SC_MANAGER_ALL_ACCESS);
2728 ok(service != NULL, "Failed to open TestService\n");
2730 res = DeleteService(service);
2731 ok(res, "Failed to delete TestService\n");
2733 CloseServiceHandle(service);
2734 CloseServiceHandle(scm);
2737 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2739 RESTOREPOINTINFOA spec;
2741 spec.dwEventType = event_type;
2742 spec.dwRestorePtType = APPLICATION_INSTALL;
2743 spec.llSequenceNumber = status->llSequenceNumber;
2744 lstrcpyA(spec.szDescription, "msitest restore point");
2746 return pSRSetRestorePointA(&spec, status);
2749 static void remove_restore_point(DWORD seq_number)
2751 DWORD res;
2753 res = pSRRemoveRestorePoint(seq_number);
2754 if (res != ERROR_SUCCESS)
2755 trace("Failed to remove the restore point : %08x\n", res);
2758 static void test_MsiInstallProduct(void)
2760 UINT r;
2761 CHAR path[MAX_PATH];
2762 LONG res;
2763 HKEY hkey;
2764 DWORD num, size, type;
2766 if (on_win9x)
2768 win_skip("Services are not implemented on Win9x and WinMe\n");
2769 return;
2772 /* szPackagePath is NULL */
2773 r = MsiInstallProductA(NULL, "INSTALL=ALL");
2774 ok(r == ERROR_INVALID_PARAMETER,
2775 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2777 /* both szPackagePath and szCommandLine are NULL */
2778 r = MsiInstallProductA(NULL, NULL);
2779 ok(r == ERROR_INVALID_PARAMETER,
2780 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
2782 /* szPackagePath is empty */
2783 r = MsiInstallProductA("", "INSTALL=ALL");
2784 ok(r == ERROR_PATH_NOT_FOUND,
2785 "Expected ERROR_PATH_NOT_FOUND, got %d\n", r);
2787 create_test_files();
2788 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
2790 /* install, don't publish */
2791 r = MsiInstallProductA(msifile, NULL);
2792 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2794 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2795 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2796 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2797 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2798 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2799 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2800 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2801 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2802 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2803 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2804 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2805 ok(delete_pf("msitest", FALSE), "File not installed\n");
2807 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2808 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2810 size = MAX_PATH;
2811 type = REG_SZ;
2812 res = RegQueryValueExA(hkey, "Name", NULL, &type, (LPBYTE)path, &size);
2813 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2814 ok(!lstrcmpA(path, "imaname"), "Expected imaname, got %s\n", path);
2816 size = MAX_PATH;
2817 type = REG_SZ;
2818 res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size);
2819 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2821 size = sizeof(num);
2822 type = REG_DWORD;
2823 res = RegQueryValueExA(hkey, "number", NULL, &type, (LPBYTE)&num, &size);
2824 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2825 ok(num == 314, "Expected 314, got %d\n", num);
2827 size = MAX_PATH;
2828 type = REG_SZ;
2829 res = RegQueryValueExA(hkey, "OrderTestName", NULL, &type, (LPBYTE)path, &size);
2830 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2831 ok(!lstrcmpA(path, "OrderTestValue"), "Expected OrderTestValue, got %s\n", path);
2833 check_service_is_installed();
2835 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2837 /* not published, reinstall */
2838 r = MsiInstallProductA(msifile, NULL);
2839 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2841 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2842 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2843 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2844 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2845 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2846 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2847 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2848 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2849 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2850 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2851 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2852 ok(delete_pf("msitest", FALSE), "File not installed\n");
2854 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2855 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2856 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2858 create_database(msifile, up_tables, sizeof(up_tables) / sizeof(msi_table));
2860 /* not published, RemovePreviousVersions set */
2861 r = MsiInstallProductA(msifile, NULL);
2862 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2864 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2865 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2866 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2867 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2868 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2869 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2870 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2871 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2872 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2873 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2874 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2875 ok(delete_pf("msitest", FALSE), "File not installed\n");
2877 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2878 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2879 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2881 create_database(msifile, up2_tables, sizeof(up2_tables) / sizeof(msi_table));
2883 /* not published, version number bumped */
2884 r = MsiInstallProductA(msifile, NULL);
2885 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2887 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2888 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2889 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2890 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2891 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2892 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2893 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2894 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2895 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2896 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2897 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2898 ok(delete_pf("msitest", FALSE), "File not installed\n");
2900 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2901 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2902 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2904 create_database(msifile, up3_tables, sizeof(up3_tables) / sizeof(msi_table));
2906 /* not published, RemovePreviousVersions set and version number bumped */
2907 r = MsiInstallProductA(msifile, NULL);
2908 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2910 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2911 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2912 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2913 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2914 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2915 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2916 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2917 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2918 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2919 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2920 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2921 ok(delete_pf("msitest", FALSE), "File not installed\n");
2923 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2924 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2925 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
2927 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2929 /* install, publish product */
2930 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2931 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2933 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2934 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2935 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2936 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2937 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2938 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2939 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2940 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2941 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2942 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2943 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2944 ok(delete_pf("msitest", FALSE), "File not installed\n");
2946 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2947 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2949 create_database(msifile, up4_tables, sizeof(up4_tables) / sizeof(msi_table));
2951 /* published, reinstall */
2952 r = MsiInstallProductA(msifile, NULL);
2953 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2955 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2956 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2957 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2958 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2959 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2960 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2961 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2962 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2963 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2964 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2965 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2966 ok(delete_pf("msitest", FALSE), "File not installed\n");
2968 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2969 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2971 create_database(msifile, up5_tables, sizeof(up5_tables) / sizeof(msi_table));
2973 /* published product, RemovePreviousVersions set */
2974 r = MsiInstallProductA(msifile, NULL);
2975 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2977 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
2978 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
2979 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
2980 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
2981 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
2982 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
2983 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
2984 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
2985 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
2986 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
2987 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
2988 ok(delete_pf("msitest", FALSE), "File not installed\n");
2990 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
2991 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2993 create_database(msifile, up6_tables, sizeof(up6_tables) / sizeof(msi_table));
2995 /* published product, version number bumped */
2996 r = MsiInstallProductA(msifile, NULL);
2997 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2999 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
3000 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
3001 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
3002 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
3003 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
3004 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
3005 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
3006 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
3007 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
3008 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
3009 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
3010 ok(delete_pf("msitest", FALSE), "File not installed\n");
3012 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
3013 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3015 create_database(msifile, up7_tables, sizeof(up7_tables) / sizeof(msi_table));
3017 /* published product, RemovePreviousVersions set and version number bumped */
3018 r = MsiInstallProductA(msifile, NULL);
3019 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3021 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
3022 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
3023 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
3024 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
3025 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
3026 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
3027 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
3028 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
3029 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
3030 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
3031 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
3032 ok(delete_pf("msitest", FALSE), "File not installed\n");
3034 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
3035 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3037 r = MsiInstallProductA(msifile, "REMOVE=ALL");
3038 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3040 delete_test_files();
3043 static void test_MsiSetComponentState(void)
3045 INSTALLSTATE installed, action;
3046 MSIHANDLE package;
3047 char path[MAX_PATH];
3048 UINT r;
3050 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
3052 CoInitialize(NULL);
3054 lstrcpy(path, CURR_DIR);
3055 lstrcat(path, "\\");
3056 lstrcat(path, msifile);
3058 r = MsiOpenPackage(path, &package);
3059 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3061 r = MsiDoAction(package, "CostInitialize");
3062 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3064 r = MsiDoAction(package, "FileCost");
3065 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3067 r = MsiDoAction(package, "CostFinalize");
3068 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3070 r = MsiGetComponentState(package, "dangler", &installed, &action);
3071 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3072 ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed);
3073 ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
3075 r = MsiSetComponentState(package, "dangler", INSTALLSTATE_SOURCE);
3076 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3078 MsiCloseHandle(package);
3079 CoUninitialize();
3081 DeleteFileA(msifile);
3084 static void test_packagecoltypes(void)
3086 MSIHANDLE hdb, view, rec;
3087 char path[MAX_PATH];
3088 LPCSTR query;
3089 UINT r, count;
3091 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
3093 CoInitialize(NULL);
3095 lstrcpy(path, CURR_DIR);
3096 lstrcat(path, "\\");
3097 lstrcat(path, msifile);
3099 r = MsiOpenDatabase(path, MSIDBOPEN_READONLY, &hdb);
3100 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3102 query = "SELECT * FROM `Media`";
3103 r = MsiDatabaseOpenView( hdb, query, &view );
3104 ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
3106 r = MsiViewGetColumnInfo( view, MSICOLINFO_NAMES, &rec );
3107 count = MsiRecordGetFieldCount( rec );
3108 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
3109 ok(count == 6, "Expected 6, got %d\n", count);
3110 ok(check_record(rec, 1, "DiskId"), "wrong column label\n");
3111 ok(check_record(rec, 2, "LastSequence"), "wrong column label\n");
3112 ok(check_record(rec, 3, "DiskPrompt"), "wrong column label\n");
3113 ok(check_record(rec, 4, "Cabinet"), "wrong column label\n");
3114 ok(check_record(rec, 5, "VolumeLabel"), "wrong column label\n");
3115 ok(check_record(rec, 6, "Source"), "wrong column label\n");
3116 MsiCloseHandle(rec);
3118 r = MsiViewGetColumnInfo( view, MSICOLINFO_TYPES, &rec );
3119 count = MsiRecordGetFieldCount( rec );
3120 ok(r == ERROR_SUCCESS, "MsiViewGetColumnInfo failed\n");
3121 ok(count == 6, "Expected 6, got %d\n", count);
3122 ok(check_record(rec, 1, "i2"), "wrong column label\n");
3123 ok(check_record(rec, 2, "i4"), "wrong column label\n");
3124 ok(check_record(rec, 3, "L64"), "wrong column label\n");
3125 ok(check_record(rec, 4, "S255"), "wrong column label\n");
3126 ok(check_record(rec, 5, "S32"), "wrong column label\n");
3127 ok(check_record(rec, 6, "S72"), "wrong column label\n");
3129 MsiCloseHandle(rec);
3130 MsiCloseHandle(view);
3131 MsiCloseHandle(hdb);
3132 CoUninitialize();
3134 DeleteFile(msifile);
3137 static void create_cc_test_files(void)
3139 CCAB cabParams;
3140 HFCI hfci;
3141 ERF erf;
3142 static CHAR cab_context[] = "test%d.cab";
3143 BOOL res;
3145 create_file("maximus", 500);
3146 create_file("augustus", 50000);
3147 create_file("tiberius", 500);
3148 create_file("caesar", 500);
3150 set_cab_parameters(&cabParams, "test1.cab", 40000);
3152 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
3153 fci_read, fci_write, fci_close, fci_seek, fci_delete,
3154 get_temp_file, &cabParams, cab_context);
3155 ok(hfci != NULL, "Failed to create an FCI context\n");
3157 res = add_file(hfci, "maximus", tcompTYPE_NONE);
3158 ok(res, "Failed to add file maximus\n");
3160 res = add_file(hfci, "augustus", tcompTYPE_NONE);
3161 ok(res, "Failed to add file augustus\n");
3163 res = add_file(hfci, "tiberius", tcompTYPE_NONE);
3164 ok(res, "Failed to add file tiberius\n");
3166 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
3167 ok(res, "Failed to flush the cabinet\n");
3169 res = FCIDestroy(hfci);
3170 ok(res, "Failed to destroy the cabinet\n");
3172 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3174 DeleteFile("maximus");
3175 DeleteFile("augustus");
3176 DeleteFile("tiberius");
3177 DeleteFile("caesar");
3180 static void delete_cab_files(void)
3182 SHFILEOPSTRUCT shfl;
3183 CHAR path[MAX_PATH+10];
3185 lstrcpyA(path, CURR_DIR);
3186 lstrcatA(path, "\\*.cab");
3187 path[strlen(path) + 1] = '\0';
3189 shfl.hwnd = NULL;
3190 shfl.wFunc = FO_DELETE;
3191 shfl.pFrom = path;
3192 shfl.pTo = NULL;
3193 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
3195 SHFileOperation(&shfl);
3198 static void test_continuouscabs(void)
3200 UINT r;
3202 create_cc_test_files();
3203 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
3205 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3207 r = MsiInstallProductA(msifile, NULL);
3208 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
3210 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3211 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3212 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3213 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3214 ok(delete_pf("msitest", FALSE), "File not installed\n");
3217 delete_cab_files();
3218 DeleteFile(msifile);
3220 create_cc_test_files();
3221 create_database(msifile, cc2_tables, sizeof(cc2_tables) / sizeof(msi_table));
3223 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3225 r = MsiInstallProductA(msifile, NULL);
3226 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3227 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3228 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3229 ok(delete_pf("msitest\\tiberius", TRUE), "File not installed\n");
3230 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3231 ok(delete_pf("msitest", FALSE), "File not installed\n");
3233 delete_cab_files();
3234 DeleteFile(msifile);
3237 static void test_caborder(void)
3239 UINT r;
3241 create_file("imperator", 100);
3242 create_file("maximus", 500);
3243 create_file("augustus", 50000);
3244 create_file("caesar", 500);
3246 create_database(msifile, cc_tables, sizeof(cc_tables) / sizeof(msi_table));
3248 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3250 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3251 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3252 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3254 r = MsiInstallProductA(msifile, NULL);
3255 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3256 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3257 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3258 todo_wine
3260 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3261 ok(!delete_pf("msitest", FALSE), "File is installed\n");
3264 delete_cab_files();
3266 create_cab_file("test1.cab", MEDIA_SIZE, "imperator\0");
3267 create_cab_file("test2.cab", MEDIA_SIZE, "maximus\0augustus\0");
3268 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3270 r = MsiInstallProductA(msifile, NULL);
3271 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3272 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3273 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3274 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3275 todo_wine
3277 ok(!delete_pf("msitest", FALSE), "File is installed\n");
3280 delete_cab_files();
3281 DeleteFile(msifile);
3283 create_cc_test_files();
3284 create_database(msifile, co_tables, sizeof(co_tables) / sizeof(msi_table));
3286 r = MsiInstallProductA(msifile, NULL);
3287 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3288 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3289 ok(!delete_pf("msitest", FALSE), "File is installed\n");
3290 todo_wine
3292 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3293 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3296 delete_cab_files();
3297 DeleteFile(msifile);
3299 create_cc_test_files();
3300 create_database(msifile, co2_tables, sizeof(co2_tables) / sizeof(msi_table));
3302 r = MsiInstallProductA(msifile, NULL);
3303 ok(!delete_pf("msitest\\caesar", TRUE), "File is installed\n");
3304 todo_wine
3306 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
3307 ok(!delete_pf("msitest\\augustus", TRUE), "File is installed\n");
3308 ok(!delete_pf("msitest\\maximus", TRUE), "File is installed\n");
3309 ok(!delete_pf("msitest", FALSE), "File is installed\n");
3312 delete_cab_files();
3313 DeleteFile("imperator");
3314 DeleteFile("maximus");
3315 DeleteFile("augustus");
3316 DeleteFile("caesar");
3317 DeleteFile(msifile);
3320 static void test_mixedmedia(void)
3322 UINT r;
3324 CreateDirectoryA("msitest", NULL);
3325 create_file("msitest\\maximus", 500);
3326 create_file("msitest\\augustus", 500);
3327 create_file("caesar", 500);
3329 create_database(msifile, mm_tables, sizeof(mm_tables) / sizeof(msi_table));
3331 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3333 create_cab_file("test1.cab", MEDIA_SIZE, "caesar\0");
3335 r = MsiInstallProductA(msifile, NULL);
3336 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3337 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3338 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3339 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3340 ok(delete_pf("msitest", FALSE), "File not installed\n");
3342 /* Delete the files in the temp (current) folder */
3343 DeleteFile("msitest\\maximus");
3344 DeleteFile("msitest\\augustus");
3345 RemoveDirectory("msitest");
3346 DeleteFile("caesar");
3347 DeleteFile("test1.cab");
3348 DeleteFile(msifile);
3351 static void test_samesequence(void)
3353 UINT r;
3355 create_cc_test_files();
3356 create_database(msifile, ss_tables, sizeof(ss_tables) / sizeof(msi_table));
3358 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3360 r = MsiInstallProductA(msifile, NULL);
3361 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
3363 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3364 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3365 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3366 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3367 ok(delete_pf("msitest", FALSE), "File not installed\n");
3370 delete_cab_files();
3371 DeleteFile(msifile);
3374 static void test_uiLevelFlags(void)
3376 UINT r;
3378 create_cc_test_files();
3379 create_database(msifile, ui_tables, sizeof(ui_tables) / sizeof(msi_table));
3381 MsiSetInternalUI(INSTALLUILEVEL_NONE | INSTALLUILEVEL_SOURCERESONLY, NULL);
3383 r = MsiInstallProductA(msifile, NULL);
3384 if (r == ERROR_SUCCESS) /* win9x has a problem with this */
3386 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3387 ok(!delete_pf("msitest\\maximus", TRUE), "UI install occurred, but execute-only was requested.\n");
3388 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3389 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3390 ok(delete_pf("msitest", FALSE), "File not installed\n");
3393 delete_cab_files();
3394 DeleteFile(msifile);
3397 static BOOL file_matches(LPSTR path)
3399 CHAR buf[MAX_PATH];
3400 HANDLE file;
3401 DWORD size;
3403 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3404 NULL, OPEN_EXISTING, 0, NULL);
3406 ZeroMemory(buf, MAX_PATH);
3407 ReadFile(file, buf, 15, &size, NULL);
3408 CloseHandle(file);
3410 return !lstrcmp(buf, "msitest\\maximus");
3413 static void test_readonlyfile(void)
3415 UINT r;
3416 DWORD size;
3417 HANDLE file;
3418 CHAR path[MAX_PATH];
3420 CreateDirectoryA("msitest", NULL);
3421 create_file("msitest\\maximus", 500);
3422 create_database(msifile, rof_tables, sizeof(rof_tables) / sizeof(msi_table));
3424 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3426 lstrcpy(path, PROG_FILES_DIR);
3427 lstrcat(path, "\\msitest");
3428 CreateDirectory(path, NULL);
3430 lstrcat(path, "\\maximus");
3431 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3432 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3434 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3435 CloseHandle(file);
3437 r = MsiInstallProductA(msifile, NULL);
3438 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3439 ok(file_matches(path), "Expected file to be overwritten\n");
3440 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3441 ok(delete_pf("msitest", FALSE), "File not installed\n");
3443 /* Delete the files in the temp (current) folder */
3444 DeleteFile("msitest\\maximus");
3445 RemoveDirectory("msitest");
3446 DeleteFile(msifile);
3449 static void test_readonlyfile_cab(void)
3451 UINT r;
3452 DWORD size;
3453 HANDLE file;
3454 CHAR path[MAX_PATH];
3455 CHAR buf[16];
3457 CreateDirectoryA("msitest", NULL);
3458 create_file("maximus", 500);
3459 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3460 DeleteFile("maximus");
3462 create_database(msifile, rofc_tables, sizeof(rofc_tables) / sizeof(msi_table));
3464 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3466 lstrcpy(path, PROG_FILES_DIR);
3467 lstrcat(path, "\\msitest");
3468 CreateDirectory(path, NULL);
3470 lstrcat(path, "\\maximus");
3471 file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3472 NULL, CREATE_NEW, FILE_ATTRIBUTE_READONLY, NULL);
3474 WriteFile(file, "readonlyfile", strlen("readonlyfile"), &size, NULL);
3475 CloseHandle(file);
3477 r = MsiInstallProductA(msifile, NULL);
3478 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3480 memset( buf, 0, sizeof(buf) );
3481 if ((file = CreateFile(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
3482 NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
3484 ReadFile(file, buf, sizeof(buf) - 1, &size, NULL);
3485 CloseHandle(file);
3487 ok(!memcmp( buf, "maximus", sizeof("maximus")-1 ), "Expected file to be overwritten, got '%s'\n", buf);
3488 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3489 ok(delete_pf("msitest", FALSE), "File not installed\n");
3491 /* Delete the files in the temp (current) folder */
3492 delete_cab_files();
3493 DeleteFile("msitest\\maximus");
3494 RemoveDirectory("msitest");
3495 DeleteFile(msifile);
3498 static BOOL add_cabinet_storage(LPCSTR db, LPCSTR cabinet)
3500 WCHAR dbW[MAX_PATH], cabinetW[MAX_PATH];
3501 IStorage *stg;
3502 IStream *stm;
3503 HRESULT hr;
3504 HANDLE handle;
3506 MultiByteToWideChar(CP_ACP, 0, db, -1, dbW, MAX_PATH);
3507 hr = StgOpenStorage(dbW, NULL, STGM_DIRECT|STGM_READWRITE|STGM_SHARE_EXCLUSIVE, NULL, 0, &stg);
3508 if (FAILED(hr))
3509 return FALSE;
3511 MultiByteToWideChar(CP_ACP, 0, cabinet, -1, cabinetW, MAX_PATH);
3512 hr = IStorage_CreateStream(stg, cabinetW, STGM_WRITE|STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
3513 if (FAILED(hr))
3515 IStorage_Release(stg);
3516 return FALSE;
3519 handle = CreateFileW(cabinetW, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
3520 if (handle != INVALID_HANDLE_VALUE)
3522 DWORD count;
3523 char buffer[1024];
3524 if (ReadFile(handle, buffer, sizeof(buffer), &count, NULL))
3525 IStream_Write(stm, buffer, count, &count);
3526 CloseHandle(handle);
3529 IStream_Release(stm);
3530 IStorage_Release(stg);
3532 return TRUE;
3535 static void test_lastusedsource(void)
3537 static char prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3539 UINT r;
3540 char value[MAX_PATH], path[MAX_PATH];
3541 DWORD size;
3543 if (!pMsiSourceListGetInfoA)
3545 win_skip("MsiSourceListGetInfoA is not available\n");
3546 return;
3549 CreateDirectoryA("msitest", NULL);
3550 create_file("maximus", 500);
3551 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3552 DeleteFile("maximus");
3554 create_database("msifile0.msi", lus0_tables, sizeof(lus0_tables) / sizeof(msi_table));
3555 create_database("msifile1.msi", lus1_tables, sizeof(lus1_tables) / sizeof(msi_table));
3556 create_database("msifile2.msi", lus2_tables, sizeof(lus2_tables) / sizeof(msi_table));
3558 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3560 /* no cabinet file */
3562 size = MAX_PATH;
3563 lstrcpyA(value, "aaa");
3564 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3565 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3566 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
3567 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
3569 r = MsiInstallProductA("msifile0.msi", "PUBLISH_PRODUCT=1");
3570 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3572 lstrcpyA(path, CURR_DIR);
3573 lstrcatA(path, "\\");
3575 size = MAX_PATH;
3576 lstrcpyA(value, "aaa");
3577 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3578 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3579 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3580 todo_wine
3582 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3583 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3586 r = MsiInstallProductA("msifile0.msi", "REMOVE=ALL");
3587 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3589 /* separate cabinet file */
3591 size = MAX_PATH;
3592 lstrcpyA(value, "aaa");
3593 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3594 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3595 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
3596 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
3598 r = MsiInstallProductA("msifile1.msi", "PUBLISH_PRODUCT=1");
3599 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3601 lstrcpyA(path, CURR_DIR);
3602 lstrcatA(path, "\\");
3604 size = MAX_PATH;
3605 lstrcpyA(value, "aaa");
3606 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3607 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3608 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3609 todo_wine
3611 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3612 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3615 r = MsiInstallProductA("msifile1.msi", "REMOVE=ALL");
3616 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3618 size = MAX_PATH;
3619 lstrcpyA(value, "aaa");
3620 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3621 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3622 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
3623 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
3625 /* embedded cabinet stream */
3627 add_cabinet_storage("msifile2.msi", "test1.cab");
3629 r = MsiInstallProductA("msifile2.msi", "PUBLISH_PRODUCT=1");
3630 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3632 size = MAX_PATH;
3633 lstrcpyA(value, "aaa");
3634 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3635 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3636 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3637 todo_wine
3639 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
3640 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
3643 r = MsiInstallProductA("msifile2.msi", "REMOVE=ALL");
3644 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3646 size = MAX_PATH;
3647 lstrcpyA(value, "aaa");
3648 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3649 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
3650 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
3651 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
3653 /* Delete the files in the temp (current) folder */
3654 delete_cab_files();
3655 DeleteFile("msitest\\maximus");
3656 RemoveDirectory("msitest");
3657 DeleteFile("msifile0.msi");
3658 DeleteFile("msifile1.msi");
3659 DeleteFile("msifile2.msi");
3662 static void test_setdirproperty(void)
3664 UINT r;
3666 CreateDirectoryA("msitest", NULL);
3667 create_file("msitest\\maximus", 500);
3668 create_database(msifile, sdp_tables, sizeof(sdp_tables) / sizeof(msi_table));
3670 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3672 r = MsiInstallProductA(msifile, NULL);
3673 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3674 ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
3675 ok(delete_cf("msitest", FALSE), "File not installed\n");
3677 /* Delete the files in the temp (current) folder */
3678 DeleteFile(msifile);
3679 DeleteFile("msitest\\maximus");
3680 RemoveDirectory("msitest");
3683 static void test_cabisextracted(void)
3685 UINT r;
3687 CreateDirectoryA("msitest", NULL);
3688 create_file("msitest\\gaius", 500);
3689 create_file("maximus", 500);
3690 create_file("augustus", 500);
3691 create_file("caesar", 500);
3693 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
3694 create_cab_file("test2.cab", MEDIA_SIZE, "augustus\0");
3695 create_cab_file("test3.cab", MEDIA_SIZE, "caesar\0");
3697 create_database(msifile, cie_tables, sizeof(cie_tables) / sizeof(msi_table));
3699 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3701 r = MsiInstallProductA(msifile, NULL);
3702 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3703 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3704 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
3705 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
3706 ok(delete_pf("msitest\\gaius", TRUE), "File not installed\n");
3707 ok(delete_pf("msitest", FALSE), "File not installed\n");
3709 /* Delete the files in the temp (current) folder */
3710 delete_cab_files();
3711 DeleteFile(msifile);
3712 DeleteFile("maximus");
3713 DeleteFile("augustus");
3714 DeleteFile("caesar");
3715 DeleteFile("msitest\\gaius");
3716 RemoveDirectory("msitest");
3719 static void test_concurrentinstall(void)
3721 UINT r;
3722 CHAR path[MAX_PATH];
3724 CreateDirectoryA("msitest", NULL);
3725 CreateDirectoryA("msitest\\msitest", NULL);
3726 create_file("msitest\\maximus", 500);
3727 create_file("msitest\\msitest\\augustus", 500);
3729 create_database(msifile, ci_tables, sizeof(ci_tables) / sizeof(msi_table));
3731 lstrcpyA(path, CURR_DIR);
3732 lstrcatA(path, "\\msitest\\concurrent.msi");
3733 create_database(path, ci2_tables, sizeof(ci2_tables) / sizeof(msi_table));
3735 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3737 r = MsiInstallProductA(msifile, NULL);
3738 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3739 if (!delete_pf("msitest\\augustus", TRUE))
3740 trace("concurrent installs not supported\n");
3741 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3742 ok(delete_pf("msitest", FALSE), "File not installed\n");
3744 DeleteFile(path);
3746 r = MsiInstallProductA(msifile, NULL);
3747 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3748 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3749 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
3750 ok(delete_pf("msitest", FALSE), "File not installed\n");
3752 DeleteFile(msifile);
3753 DeleteFile("msitest\\msitest\\augustus");
3754 DeleteFile("msitest\\maximus");
3755 RemoveDirectory("msitest\\msitest");
3756 RemoveDirectory("msitest");
3759 static void test_setpropertyfolder(void)
3761 UINT r;
3762 CHAR path[MAX_PATH];
3763 DWORD attr;
3765 lstrcpyA(path, PROG_FILES_DIR);
3766 lstrcatA(path, "\\msitest\\added");
3768 CreateDirectoryA("msitest", NULL);
3769 create_file("msitest\\maximus", 500);
3771 create_database(msifile, spf_tables, sizeof(spf_tables) / sizeof(msi_table));
3773 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3775 r = MsiInstallProductA(msifile, NULL);
3776 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3777 attr = GetFileAttributesA(path);
3778 if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY))
3780 ok(delete_pf("msitest\\added\\maximus", TRUE), "File not installed\n");
3781 ok(delete_pf("msitest\\added", FALSE), "File not installed\n");
3782 ok(delete_pf("msitest", FALSE), "File not installed\n");
3784 else
3786 trace("changing folder property not supported\n");
3787 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3788 ok(delete_pf("msitest", FALSE), "File not installed\n");
3791 /* Delete the files in the temp (current) folder */
3792 DeleteFile(msifile);
3793 DeleteFile("msitest\\maximus");
3794 RemoveDirectory("msitest");
3797 static BOOL file_exists(LPCSTR file)
3799 return GetFileAttributes(file) != INVALID_FILE_ATTRIBUTES;
3802 static BOOL pf_exists(LPCSTR file)
3804 CHAR path[MAX_PATH];
3806 lstrcpyA(path, PROG_FILES_DIR);
3807 lstrcatA(path, "\\");
3808 lstrcatA(path, file);
3810 return file_exists(path);
3813 static void delete_pfmsitest_files(void)
3815 SHFILEOPSTRUCT shfl;
3816 CHAR path[MAX_PATH+11];
3818 lstrcpyA(path, PROG_FILES_DIR);
3819 lstrcatA(path, "\\msitest\\*");
3820 path[strlen(path) + 1] = '\0';
3822 shfl.hwnd = NULL;
3823 shfl.wFunc = FO_DELETE;
3824 shfl.pFrom = path;
3825 shfl.pTo = NULL;
3826 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT;
3828 SHFileOperation(&shfl);
3830 lstrcpyA(path, PROG_FILES_DIR);
3831 lstrcatA(path, "\\msitest");
3832 RemoveDirectoryA(path);
3835 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
3837 char val[MAX_PATH];
3838 DWORD size, type;
3839 LONG res;
3841 size = MAX_PATH;
3842 val[0] = '\0';
3843 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
3845 if (res != ERROR_SUCCESS ||
3846 (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
3848 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3849 return;
3852 if (!expected)
3853 ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val);
3854 else
3856 if (bcase)
3857 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
3858 else
3859 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
3863 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
3865 DWORD val, size, type;
3866 LONG res;
3868 size = sizeof(DWORD);
3869 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
3871 if (res != ERROR_SUCCESS || type != REG_DWORD)
3873 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3874 return;
3877 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
3880 static void check_reg_dword2(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD line)
3882 DWORD val, size, type;
3883 LONG res;
3885 size = sizeof(DWORD);
3886 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
3888 if (res != ERROR_SUCCESS || type != REG_DWORD)
3890 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3891 return;
3894 ok_(__FILE__, line)(val == expected1 || val == expected2, "Expected %d or %d, got %d\n", expected1, expected2, val);
3897 static void check_reg_dword3(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3, DWORD line)
3899 DWORD val, size, type;
3900 LONG res;
3902 size = sizeof(DWORD);
3903 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
3905 if (res != ERROR_SUCCESS || type != REG_DWORD)
3907 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
3908 return;
3911 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3,
3912 "Expected %d, %d or %d, got %d\n", expected1, expected2, expected3, val);
3915 #define CHECK_REG_STR(prodkey, name, expected) \
3916 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
3918 #define CHECK_DEL_REG_STR(prodkey, name, expected) \
3919 check_reg_str(prodkey, name, expected, TRUE, __LINE__); \
3920 RegDeleteValueA(prodkey, name);
3922 #define CHECK_REG_ISTR(prodkey, name, expected) \
3923 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
3925 #define CHECK_DEL_REG_ISTR(prodkey, name, expected) \
3926 check_reg_str(prodkey, name, expected, FALSE, __LINE__); \
3927 RegDeleteValueA(prodkey, name);
3929 #define CHECK_REG_DWORD(prodkey, name, expected) \
3930 check_reg_dword(prodkey, name, expected, __LINE__);
3932 #define CHECK_DEL_REG_DWORD(prodkey, name, expected) \
3933 check_reg_dword(prodkey, name, expected, __LINE__); \
3934 RegDeleteValueA(prodkey, name);
3936 #define CHECK_REG_DWORD2(prodkey, name, expected1, expected2) \
3937 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__);
3939 #define CHECK_DEL_REG_DWORD2(prodkey, name, expected1, expected2) \
3940 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__); \
3941 RegDeleteValueA(prodkey, name);
3943 #define CHECK_REG_DWORD3(prodkey, name, expected1, expected2, expected3) \
3944 check_reg_dword3(prodkey, name, expected1, expected2, expected3, __LINE__);
3946 #define CHECK_DEL_REG_DWORD3(prodkey, name, expected1, expected2, expected3) \
3947 check_reg_dword3(prodkey, name, expected1, expected2, expected3, __LINE__); \
3948 RegDeleteValueA(prodkey, name);
3950 static void get_date_str(LPSTR date)
3952 SYSTEMTIME systime;
3954 static const char date_fmt[] = "%d%02d%02d";
3955 GetLocalTime(&systime);
3956 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
3959 static void test_publish_registerproduct(void)
3961 UINT r;
3962 LONG res;
3963 HKEY hkey;
3964 HKEY props, usage;
3965 LPSTR usersid;
3966 char date[MAX_PATH];
3967 char temp[MAX_PATH];
3968 char keypath[MAX_PATH];
3970 static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3971 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3972 static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
3973 "\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3974 static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
3975 "\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
3976 static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
3977 "\\51AAE0C44620A5E4788506E91F249BD2";
3979 if (!get_user_sid(&usersid))
3980 return;
3982 get_date_str(date);
3983 GetTempPath(MAX_PATH, temp);
3985 CreateDirectoryA("msitest", NULL);
3986 create_file("msitest\\maximus", 500);
3988 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3990 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3992 /* RegisterProduct */
3993 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
3994 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3995 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3996 ok(delete_pf("msitest", FALSE), "File not installed\n");
3998 res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
3999 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4001 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
4002 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4004 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
4005 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
4006 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
4007 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
4008 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4009 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
4010 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4011 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
4012 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
4013 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
4014 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
4015 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
4016 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
4017 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
4018 CHECK_DEL_REG_STR(hkey, "Size", NULL);
4019 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
4020 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
4021 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
4022 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
4023 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
4024 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
4025 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
4026 todo_wine
4028 CHECK_DEL_REG_DWORD3(hkey, "EstimatedSize", 12, -12, 4);
4031 RegDeleteKeyA(hkey, "");
4032 RegCloseKey(hkey);
4034 sprintf(keypath, userdata, usersid);
4035 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
4036 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4038 res = RegOpenKeyA(hkey, "InstallProperties", &props);
4039 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4041 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
4042 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
4043 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
4044 CHECK_DEL_REG_STR(props, "InstallDate", date);
4045 CHECK_DEL_REG_STR(props, "InstallSource", temp);
4046 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4047 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
4048 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4049 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
4050 CHECK_DEL_REG_STR(props, "Comments", NULL);
4051 CHECK_DEL_REG_STR(props, "Contact", NULL);
4052 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
4053 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
4054 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
4055 CHECK_DEL_REG_STR(props, "Readme", NULL);
4056 CHECK_DEL_REG_STR(props, "Size", NULL);
4057 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
4058 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
4059 CHECK_DEL_REG_DWORD(props, "Language", 1033);
4060 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
4061 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
4062 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
4063 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
4064 todo_wine
4066 CHECK_DEL_REG_DWORD3(props, "EstimatedSize", 12, -12, 4);
4069 RegDeleteKeyA(props, "");
4070 RegCloseKey(props);
4072 res = RegOpenKeyA(hkey, "Usage", &usage);
4073 todo_wine
4075 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4078 RegDeleteKeyA(usage, "");
4079 RegCloseKey(usage);
4080 RegDeleteKeyA(hkey, "");
4081 RegCloseKey(hkey);
4083 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
4084 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4086 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
4088 RegDeleteKeyA(hkey, "");
4089 RegCloseKey(hkey);
4091 /* RegisterProduct, machine */
4092 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 ALLUSERS=1");
4093 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4094 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4095 ok(delete_pf("msitest", FALSE), "File not installed\n");
4097 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, userugkey, &hkey);
4098 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4100 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, uninstall, &hkey);
4101 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4103 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
4104 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
4105 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
4106 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
4107 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4108 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
4109 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4110 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
4111 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
4112 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
4113 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
4114 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
4115 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
4116 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
4117 CHECK_DEL_REG_STR(hkey, "Size", NULL);
4118 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
4119 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
4120 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
4121 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
4122 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
4123 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
4124 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
4125 todo_wine
4127 CHECK_DEL_REG_DWORD3(hkey, "EstimatedSize", 12, -12, 4);
4130 RegDeleteKeyA(hkey, "");
4131 RegCloseKey(hkey);
4133 sprintf(keypath, userdata, "S-1-5-18");
4134 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
4135 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4137 res = RegOpenKeyA(hkey, "InstallProperties", &props);
4138 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4140 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
4141 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
4142 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
4143 CHECK_DEL_REG_STR(props, "InstallDate", date);
4144 CHECK_DEL_REG_STR(props, "InstallSource", temp);
4145 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4146 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
4147 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4148 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
4149 CHECK_DEL_REG_STR(props, "Comments", NULL);
4150 CHECK_DEL_REG_STR(props, "Contact", NULL);
4151 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
4152 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
4153 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
4154 CHECK_DEL_REG_STR(props, "Readme", NULL);
4155 CHECK_DEL_REG_STR(props, "Size", NULL);
4156 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
4157 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
4158 CHECK_DEL_REG_DWORD(props, "Language", 1033);
4159 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
4160 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
4161 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
4162 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
4163 todo_wine
4165 CHECK_DEL_REG_DWORD3(props, "EstimatedSize", 12, -12, 4);
4168 RegDeleteKeyA(props, "");
4169 RegCloseKey(props);
4171 res = RegOpenKeyA(hkey, "Usage", &usage);
4172 todo_wine
4174 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4177 RegDeleteKeyA(usage, "");
4178 RegCloseKey(usage);
4179 RegDeleteKeyA(hkey, "");
4180 RegCloseKey(hkey);
4182 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, ugkey, &hkey);
4183 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4185 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
4187 RegDeleteKeyA(hkey, "");
4188 RegCloseKey(hkey);
4190 DeleteFile(msifile);
4191 DeleteFile("msitest\\maximus");
4192 RemoveDirectory("msitest");
4193 HeapFree(GetProcessHeap(), 0, usersid);
4196 static void test_publish_publishproduct(void)
4198 UINT r;
4199 LONG res;
4200 LPSTR usersid;
4201 HKEY sourcelist, net, props;
4202 HKEY hkey, patches, media;
4203 CHAR keypath[MAX_PATH];
4204 CHAR temp[MAX_PATH];
4205 CHAR path[MAX_PATH];
4207 static const CHAR prodpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
4208 "\\Installer\\UserData\\%s\\Products"
4209 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
4210 static const CHAR cuprodpath[] = "Software\\Microsoft\\Installer\\Products"
4211 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
4212 static const CHAR cuupgrades[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
4213 "\\51AAE0C44620A5E4788506E91F249BD2";
4214 static const CHAR badprod[] = "Software\\Microsoft\\Windows\\CurrentVersion"
4215 "\\Installer\\Products"
4216 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
4217 static const CHAR machprod[] = "Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
4218 static const CHAR machup[] = "Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
4220 if (!get_user_sid(&usersid))
4221 return;
4223 GetTempPath(MAX_PATH, temp);
4225 CreateDirectoryA("msitest", NULL);
4226 create_file("msitest\\maximus", 500);
4228 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4230 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4232 /* PublishProduct, current user */
4233 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
4234 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4235 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4236 ok(delete_pf("msitest", FALSE), "File not installed\n");
4238 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
4239 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4241 sprintf(keypath, prodpath, usersid);
4242 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
4243 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4245 res = RegOpenKeyA(hkey, "InstallProperties", &props);
4246 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4248 res = RegOpenKeyA(hkey, "Patches", &patches);
4249 todo_wine
4251 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4253 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
4256 RegDeleteKeyA(patches, "");
4257 RegCloseKey(patches);
4258 RegDeleteKeyA(hkey, "");
4259 RegCloseKey(hkey);
4261 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
4262 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4264 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
4265 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
4266 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
4267 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
4268 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
4269 CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
4270 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
4271 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
4272 CHECK_DEL_REG_STR(hkey, "Clients", ":");
4274 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
4275 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4277 lstrcpyA(path, "n;1;");
4278 lstrcatA(path, temp);
4279 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
4280 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
4282 res = RegOpenKeyA(sourcelist, "Net", &net);
4283 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4285 CHECK_DEL_REG_STR(net, "1", temp);
4287 RegDeleteKeyA(net, "");
4288 RegCloseKey(net);
4290 res = RegOpenKeyA(sourcelist, "Media", &media);
4291 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4293 CHECK_DEL_REG_STR(media, "1", "DISK1;");
4295 RegDeleteKeyA(media, "");
4296 RegCloseKey(media);
4297 RegDeleteKeyA(sourcelist, "");
4298 RegCloseKey(sourcelist);
4299 RegDeleteKeyA(hkey, "");
4300 RegCloseKey(hkey);
4302 res = RegOpenKeyA(HKEY_CURRENT_USER, cuupgrades, &hkey);
4303 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4305 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
4307 RegDeleteKeyA(hkey, "");
4308 RegCloseKey(hkey);
4310 /* PublishProduct, machine */
4311 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
4312 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4313 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4314 ok(delete_pf("msitest", FALSE), "File not installed\n");
4316 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, badprod, &hkey);
4317 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4319 sprintf(keypath, prodpath, "S-1-5-18");
4320 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
4321 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4323 res = RegOpenKeyA(hkey, "InstallProperties", &props);
4324 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4326 res = RegOpenKeyA(hkey, "Patches", &patches);
4327 todo_wine
4329 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4331 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
4334 RegDeleteKeyA(patches, "");
4335 RegCloseKey(patches);
4336 RegDeleteKeyA(hkey, "");
4337 RegCloseKey(hkey);
4339 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machprod, &hkey);
4340 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4342 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
4343 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052c94DA02821EECD05F2F");
4344 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
4345 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
4346 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
4347 todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
4348 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
4349 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
4350 CHECK_DEL_REG_STR(hkey, "Clients", ":");
4352 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
4353 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4355 lstrcpyA(path, "n;1;");
4356 lstrcatA(path, temp);
4357 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
4358 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
4360 res = RegOpenKeyA(sourcelist, "Net", &net);
4361 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4363 CHECK_DEL_REG_STR(net, "1", temp);
4365 RegDeleteKeyA(net, "");
4366 RegCloseKey(net);
4368 res = RegOpenKeyA(sourcelist, "Media", &media);
4369 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4371 CHECK_DEL_REG_STR(media, "1", "DISK1;");
4373 RegDeleteKeyA(media, "");
4374 RegCloseKey(media);
4375 RegDeleteKeyA(sourcelist, "");
4376 RegCloseKey(sourcelist);
4377 RegDeleteKeyA(hkey, "");
4378 RegCloseKey(hkey);
4380 res = RegOpenKeyA(HKEY_CLASSES_ROOT, machup, &hkey);
4381 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4383 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
4385 RegDeleteKeyA(hkey, "");
4386 RegCloseKey(hkey);
4388 DeleteFile(msifile);
4389 DeleteFile("msitest\\maximus");
4390 RemoveDirectory("msitest");
4391 HeapFree(GetProcessHeap(), 0, usersid);
4394 static void test_publish_publishfeatures(void)
4396 UINT r;
4397 LONG res;
4398 HKEY hkey;
4399 LPSTR usersid;
4400 CHAR keypath[MAX_PATH];
4402 static const CHAR cupath[] = "Software\\Microsoft\\Installer\\Features"
4403 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
4404 static const CHAR udpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
4405 "\\Installer\\UserData\\%s\\Products"
4406 "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
4407 static const CHAR featkey[] = "Software\\Microsoft\\Windows\\CurrentVersion"
4408 "\\Installer\\Features";
4409 static const CHAR classfeat[] = "Software\\Classes\\Installer\\Features"
4410 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
4412 if (!get_user_sid(&usersid))
4413 return;
4415 CreateDirectoryA("msitest", NULL);
4416 create_file("msitest\\maximus", 500);
4418 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4420 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4422 /* PublishFeatures, current user */
4423 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
4424 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4425 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4426 ok(delete_pf("msitest", FALSE), "File not installed\n");
4428 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
4429 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4431 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
4432 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4434 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
4435 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4437 CHECK_REG_STR(hkey, "feature", "");
4438 CHECK_REG_STR(hkey, "montecristo", "");
4440 RegDeleteValueA(hkey, "feature");
4441 RegDeleteValueA(hkey, "montecristo");
4442 RegDeleteKeyA(hkey, "");
4443 RegCloseKey(hkey);
4445 sprintf(keypath, udpath, usersid);
4446 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
4447 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4449 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
4450 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
4452 RegDeleteValueA(hkey, "feature");
4453 RegDeleteValueA(hkey, "montecristo");
4454 RegDeleteKeyA(hkey, "");
4455 RegCloseKey(hkey);
4457 /* PublishFeatures, machine */
4458 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
4459 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4460 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4461 ok(delete_pf("msitest", FALSE), "File not installed\n");
4463 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, featkey, &hkey);
4464 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4466 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
4467 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4469 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, classfeat, &hkey);
4470 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4472 CHECK_REG_STR(hkey, "feature", "");
4473 CHECK_REG_STR(hkey, "montecristo", "");
4475 RegDeleteValueA(hkey, "feature");
4476 RegDeleteValueA(hkey, "montecristo");
4477 RegDeleteKeyA(hkey, "");
4478 RegCloseKey(hkey);
4480 sprintf(keypath, udpath, "S-1-5-18");
4481 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &hkey);
4482 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4484 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
4485 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
4487 RegDeleteValueA(hkey, "feature");
4488 RegDeleteValueA(hkey, "montecristo");
4489 RegDeleteKeyA(hkey, "");
4490 RegCloseKey(hkey);
4492 DeleteFile(msifile);
4493 DeleteFile("msitest\\maximus");
4494 RemoveDirectory("msitest");
4495 HeapFree(GetProcessHeap(), 0, usersid);
4498 static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
4500 DWORD len = 0;
4501 LPSTR val;
4502 LONG r;
4504 r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
4505 if (r != ERROR_SUCCESS)
4506 return NULL;
4508 len += sizeof (WCHAR);
4509 val = HeapAlloc(GetProcessHeap(), 0, len);
4510 if (!val) return NULL;
4511 val[0] = 0;
4512 RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
4513 return val;
4516 static void get_owner_company(LPSTR *owner, LPSTR *company)
4518 LONG res;
4519 HKEY hkey;
4521 *owner = *company = NULL;
4523 res = RegOpenKeyA(HKEY_CURRENT_USER,
4524 "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
4525 if (res == ERROR_SUCCESS)
4527 *owner = reg_get_val_str(hkey, "DefName");
4528 *company = reg_get_val_str(hkey, "DefCompany");
4529 RegCloseKey(hkey);
4532 if (!*owner || !*company)
4534 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
4535 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey);
4536 if (res == ERROR_SUCCESS)
4538 *owner = reg_get_val_str(hkey, "RegisteredOwner");
4539 *company = reg_get_val_str(hkey, "RegisteredOrganization");
4540 RegCloseKey(hkey);
4544 if (!*owner || !*company)
4546 res = RegOpenKeyA(HKEY_LOCAL_MACHINE,
4547 "Software\\Microsoft\\Windows NT\\CurrentVersion", &hkey);
4548 if (res == ERROR_SUCCESS)
4550 *owner = reg_get_val_str(hkey, "RegisteredOwner");
4551 *company = reg_get_val_str(hkey, "RegisteredOrganization");
4552 RegCloseKey(hkey);
4557 static void test_publish_registeruser(void)
4559 UINT r;
4560 LONG res;
4561 HKEY props;
4562 LPSTR usersid;
4563 LPSTR owner, company;
4564 CHAR keypath[MAX_PATH];
4566 static const CHAR keyfmt[] =
4567 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
4568 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
4570 if (!get_user_sid(&usersid))
4571 return;
4573 get_owner_company(&owner, &company);
4575 CreateDirectoryA("msitest", NULL);
4576 create_file("msitest\\maximus", 500);
4578 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4580 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4582 /* RegisterUser, per-user */
4583 r = MsiInstallProductA(msifile, "REGISTER_USER=1");
4584 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4585 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4586 ok(delete_pf("msitest", FALSE), "File not installed\n");
4588 sprintf(keypath, keyfmt, usersid);
4590 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
4591 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4593 CHECK_REG_STR(props, "ProductID", "none");
4594 CHECK_REG_STR(props, "RegCompany", company);
4595 CHECK_REG_STR(props, "RegOwner", owner);
4597 RegDeleteValueA(props, "ProductID");
4598 RegDeleteValueA(props, "RegCompany");
4599 RegDeleteValueA(props, "RegOwner");
4600 RegDeleteKeyA(props, "");
4601 RegCloseKey(props);
4603 /* RegisterUser, machine */
4604 r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
4605 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4606 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4607 ok(delete_pf("msitest", FALSE), "File not installed\n");
4609 sprintf(keypath, keyfmt, "S-1-5-18");
4611 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
4612 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4614 CHECK_REG_STR(props, "ProductID", "none");
4615 CHECK_REG_STR(props, "RegCompany", company);
4616 CHECK_REG_STR(props, "RegOwner", owner);
4618 RegDeleteValueA(props, "ProductID");
4619 RegDeleteValueA(props, "RegCompany");
4620 RegDeleteValueA(props, "RegOwner");
4621 RegDeleteKeyA(props, "");
4622 RegCloseKey(props);
4624 HeapFree(GetProcessHeap(), 0, company);
4625 HeapFree(GetProcessHeap(), 0, owner);
4627 DeleteFile(msifile);
4628 DeleteFile("msitest\\maximus");
4629 RemoveDirectory("msitest");
4630 LocalFree(usersid);
4633 static void test_publish_processcomponents(void)
4635 UINT r;
4636 LONG res;
4637 DWORD size;
4638 HKEY comp, hkey;
4639 LPSTR usersid;
4640 CHAR val[MAX_PATH];
4641 CHAR keypath[MAX_PATH];
4642 CHAR program_files_maximus[MAX_PATH];
4644 static const CHAR keyfmt[] =
4645 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
4646 "UserData\\%s\\Components\\%s";
4647 static const CHAR compkey[] =
4648 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
4650 if (!get_user_sid(&usersid))
4651 return;
4653 CreateDirectoryA("msitest", NULL);
4654 create_file("msitest\\maximus", 500);
4656 create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table));
4658 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4660 /* ProcessComponents, per-user */
4661 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
4662 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4663 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4664 ok(delete_pf("msitest", FALSE), "File not installed\n");
4666 sprintf(keypath, keyfmt, usersid, "CBABC2FDCCB35E749A8944D8C1C098B5");
4668 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4669 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4671 size = MAX_PATH;
4672 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4673 NULL, NULL, (LPBYTE)val, &size);
4674 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4676 lstrcpyA(program_files_maximus,PROG_FILES_DIR);
4677 lstrcatA(program_files_maximus,"\\msitest\\maximus");
4679 ok(!lstrcmpiA(val, program_files_maximus),
4680 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
4682 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4683 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4685 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4686 RegDeleteKeyA(comp, "");
4687 RegCloseKey(comp);
4689 sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
4691 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4692 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4694 size = MAX_PATH;
4695 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4696 NULL, NULL, (LPBYTE)val, &size);
4697 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4698 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
4699 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
4701 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4702 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4704 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4705 RegDeleteKeyA(comp, "");
4706 RegCloseKey(comp);
4708 /* ProcessComponents, machine */
4709 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
4710 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4711 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4712 ok(delete_pf("msitest", FALSE), "File not installed\n");
4714 sprintf(keypath, keyfmt, "S-1-5-18", "CBABC2FDCCB35E749A8944D8C1C098B5");
4716 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4717 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4719 size = MAX_PATH;
4720 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4721 NULL, NULL, (LPBYTE)val, &size);
4722 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4723 ok(!lstrcmpiA(val, program_files_maximus),
4724 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
4726 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4727 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4729 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4730 RegDeleteKeyA(comp, "");
4731 RegCloseKey(comp);
4733 sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
4735 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &comp);
4736 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4738 size = MAX_PATH;
4739 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
4740 NULL, NULL, (LPBYTE)val, &size);
4741 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4742 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
4743 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
4745 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, compkey, &hkey);
4746 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4748 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
4749 RegDeleteKeyA(comp, "");
4750 RegCloseKey(comp);
4752 DeleteFile(msifile);
4753 DeleteFile("msitest\\maximus");
4754 RemoveDirectory("msitest");
4755 LocalFree(usersid);
4758 static void test_publish(void)
4760 UINT r;
4761 LONG res;
4762 HKEY uninstall, prodkey;
4763 INSTALLSTATE state;
4764 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
4765 char date[MAX_PATH];
4766 char temp[MAX_PATH];
4768 static const CHAR subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
4770 if (!pMsiQueryComponentStateA)
4772 win_skip("MsiQueryComponentStateA is not available\n");
4773 return;
4776 get_date_str(date);
4777 GetTempPath(MAX_PATH, temp);
4779 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, subkey, &uninstall);
4780 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4782 CreateDirectoryA("msitest", NULL);
4783 create_file("msitest\\maximus", 500);
4785 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4787 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
4789 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4790 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4792 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4793 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4795 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4796 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4798 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4799 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4800 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4801 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4803 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4804 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4806 /* nothing published */
4807 r = MsiInstallProductA(msifile, NULL);
4808 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4809 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4810 ok(pf_exists("msitest"), "File not installed\n");
4812 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4813 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4815 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4816 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4818 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4819 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4821 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4822 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4823 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4824 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4826 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4827 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4829 /* PublishProduct and RegisterProduct */
4830 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
4831 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4832 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4833 ok(pf_exists("msitest"), "File not installed\n");
4835 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4836 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4838 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4839 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4841 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4842 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4844 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4845 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4846 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
4847 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4849 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4850 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4852 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4853 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4854 CHECK_REG_STR(prodkey, "InstallDate", date);
4855 CHECK_REG_STR(prodkey, "InstallSource", temp);
4856 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4857 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4858 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4859 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4860 CHECK_REG_STR(prodkey, "Comments", NULL);
4861 CHECK_REG_STR(prodkey, "Contact", NULL);
4862 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4863 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4864 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4865 CHECK_REG_STR(prodkey, "Readme", NULL);
4866 CHECK_REG_STR(prodkey, "Size", NULL);
4867 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4868 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4869 CHECK_REG_DWORD(prodkey, "Language", 1033);
4870 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4871 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4872 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4873 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4874 todo_wine
4876 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4879 RegCloseKey(prodkey);
4881 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4882 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4883 ok(pf_exists("msitest\\maximus"), "File deleted\n");
4884 ok(pf_exists("msitest"), "File deleted\n");
4886 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4887 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4889 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4890 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4892 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4893 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4895 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4896 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4897 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4898 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4900 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4901 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4903 /* complete install */
4904 r = MsiInstallProductA(msifile, "FULL=1");
4905 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4906 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4907 ok(pf_exists("msitest"), "File not installed\n");
4909 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4910 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4912 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4913 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4915 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4916 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4918 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4919 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4920 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4921 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4923 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4924 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4926 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4927 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4928 CHECK_REG_STR(prodkey, "InstallDate", date);
4929 CHECK_REG_STR(prodkey, "InstallSource", temp);
4930 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4931 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4932 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4933 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4934 CHECK_REG_STR(prodkey, "Comments", NULL);
4935 CHECK_REG_STR(prodkey, "Contact", NULL);
4936 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4937 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4938 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4939 CHECK_REG_STR(prodkey, "Readme", NULL);
4940 CHECK_REG_STR(prodkey, "Size", NULL);
4941 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4942 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4943 CHECK_REG_DWORD(prodkey, "Language", 1033);
4944 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4945 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4946 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4947 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4948 todo_wine
4950 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
4953 RegCloseKey(prodkey);
4955 /* no UnpublishFeatures */
4956 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4957 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4958 ok(!pf_exists("msitest\\maximus"), "File deleted\n");
4959 todo_wine
4961 ok(!pf_exists("msitest"), "File deleted\n");
4964 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4965 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4967 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4968 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4970 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4971 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4973 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4974 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4975 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4976 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4978 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
4979 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4981 /* complete install */
4982 r = MsiInstallProductA(msifile, "FULL=1");
4983 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4984 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4985 ok(pf_exists("msitest"), "File not installed\n");
4987 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4988 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4990 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4991 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4993 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4994 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4996 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4997 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4998 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4999 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5001 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
5002 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5004 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
5005 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
5006 CHECK_REG_STR(prodkey, "InstallDate", date);
5007 CHECK_REG_STR(prodkey, "InstallSource", temp);
5008 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
5009 CHECK_REG_STR(prodkey, "Publisher", "Wine");
5010 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
5011 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
5012 CHECK_REG_STR(prodkey, "Comments", NULL);
5013 CHECK_REG_STR(prodkey, "Contact", NULL);
5014 CHECK_REG_STR(prodkey, "HelpLink", NULL);
5015 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
5016 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
5017 CHECK_REG_STR(prodkey, "Readme", NULL);
5018 CHECK_REG_STR(prodkey, "Size", NULL);
5019 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
5020 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
5021 CHECK_REG_DWORD(prodkey, "Language", 1033);
5022 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
5023 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
5024 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
5025 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
5026 todo_wine
5028 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
5031 RegCloseKey(prodkey);
5033 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
5034 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
5035 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5036 todo_wine ok(pf_exists("msitest\\maximus"), "File deleted\n");
5037 ok(pf_exists("msitest"), "File deleted\n");
5039 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
5040 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
5042 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
5043 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5045 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
5046 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5048 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5049 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
5050 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5051 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5053 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
5054 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5056 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
5057 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
5058 CHECK_REG_STR(prodkey, "InstallDate", date);
5059 CHECK_REG_STR(prodkey, "InstallSource", temp);
5060 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
5061 CHECK_REG_STR(prodkey, "Publisher", "Wine");
5062 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
5063 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
5064 CHECK_REG_STR(prodkey, "Comments", NULL);
5065 CHECK_REG_STR(prodkey, "Contact", NULL);
5066 CHECK_REG_STR(prodkey, "HelpLink", NULL);
5067 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
5068 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
5069 CHECK_REG_STR(prodkey, "Readme", NULL);
5070 CHECK_REG_STR(prodkey, "Size", NULL);
5071 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
5072 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
5073 CHECK_REG_DWORD(prodkey, "Language", 1033);
5074 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
5075 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
5076 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
5077 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
5078 todo_wine
5080 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
5083 RegCloseKey(prodkey);
5085 /* complete install */
5086 r = MsiInstallProductA(msifile, "FULL=1");
5087 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5088 ok(pf_exists("msitest\\maximus"), "File not installed\n");
5089 ok(pf_exists("msitest"), "File not installed\n");
5091 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
5092 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
5094 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
5095 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5097 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
5098 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5100 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5101 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
5102 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5103 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5105 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
5106 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5108 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
5109 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
5110 CHECK_REG_STR(prodkey, "InstallDate", date);
5111 CHECK_REG_STR(prodkey, "InstallSource", temp);
5112 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
5113 CHECK_REG_STR(prodkey, "Publisher", "Wine");
5114 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
5115 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
5116 CHECK_REG_STR(prodkey, "Comments", NULL);
5117 CHECK_REG_STR(prodkey, "Contact", NULL);
5118 CHECK_REG_STR(prodkey, "HelpLink", NULL);
5119 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
5120 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
5121 CHECK_REG_STR(prodkey, "Readme", NULL);
5122 CHECK_REG_STR(prodkey, "Size", NULL);
5123 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
5124 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
5125 CHECK_REG_DWORD(prodkey, "Language", 1033);
5126 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
5127 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
5128 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
5129 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
5130 todo_wine
5132 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -20);
5135 RegCloseKey(prodkey);
5137 /* UnpublishFeatures, both features removed */
5138 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
5139 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5140 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
5141 todo_wine
5143 ok(!pf_exists("msitest"), "File not deleted\n");
5146 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
5147 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5149 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
5150 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5152 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
5153 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5155 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5156 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
5157 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5158 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5160 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
5161 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5163 /* complete install */
5164 r = MsiInstallProductA(msifile, "FULL=1");
5165 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5166 ok(pf_exists("msitest\\maximus"), "File not installed\n");
5167 ok(pf_exists("msitest"), "File not installed\n");
5169 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
5170 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
5172 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
5173 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5175 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
5176 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5178 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5179 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
5180 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5181 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
5183 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
5184 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5186 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
5187 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
5188 CHECK_REG_STR(prodkey, "InstallDate", date);
5189 CHECK_REG_STR(prodkey, "InstallSource", temp);
5190 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
5191 CHECK_REG_STR(prodkey, "Publisher", "Wine");
5192 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
5193 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
5194 CHECK_REG_STR(prodkey, "Comments", NULL);
5195 CHECK_REG_STR(prodkey, "Contact", NULL);
5196 CHECK_REG_STR(prodkey, "HelpLink", NULL);
5197 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
5198 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
5199 CHECK_REG_STR(prodkey, "Readme", NULL);
5200 CHECK_REG_STR(prodkey, "Size", NULL);
5201 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
5202 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
5203 CHECK_REG_DWORD(prodkey, "Language", 1033);
5204 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
5205 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
5206 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
5207 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
5208 todo_wine
5210 CHECK_REG_DWORD2(prodkey, "EstimatedSize", 12, -12);
5213 RegCloseKey(prodkey);
5215 /* complete uninstall */
5216 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
5217 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5218 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
5219 todo_wine
5221 ok(!pf_exists("msitest"), "File not deleted\n");
5224 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
5225 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5227 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
5228 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5230 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
5231 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5233 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5234 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
5235 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5236 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
5238 res = RegOpenKeyA(uninstall, prodcode, &prodkey);
5239 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5241 /* make sure 'Program Files\msitest' is removed */
5242 delete_pfmsitest_files();
5244 RegCloseKey(uninstall);
5245 DeleteFile(msifile);
5246 DeleteFile("msitest\\maximus");
5247 RemoveDirectory("msitest");
5250 static void test_publishsourcelist(void)
5252 UINT r;
5253 DWORD size;
5254 CHAR value[MAX_PATH];
5255 CHAR path[MAX_PATH];
5256 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
5258 if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
5260 win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
5261 return;
5264 CreateDirectoryA("msitest", NULL);
5265 create_file("msitest\\maximus", 500);
5267 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
5269 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
5271 r = MsiInstallProductA(msifile, NULL);
5272 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5273 ok(pf_exists("msitest\\maximus"), "File not installed\n");
5274 ok(pf_exists("msitest"), "File not installed\n");
5276 /* nothing published */
5277 size = MAX_PATH;
5278 lstrcpyA(value, "aaa");
5279 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5280 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
5281 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5282 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5283 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5285 size = MAX_PATH;
5286 lstrcpyA(value, "aaa");
5287 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5288 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
5289 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5290 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5291 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5293 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
5294 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5295 ok(pf_exists("msitest\\maximus"), "File not installed\n");
5296 ok(pf_exists("msitest"), "File not installed\n");
5298 /* after RegisterProduct */
5299 size = MAX_PATH;
5300 lstrcpyA(value, "aaa");
5301 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5302 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
5303 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5304 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5305 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5307 size = MAX_PATH;
5308 lstrcpyA(value, "aaa");
5309 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5310 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
5311 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5312 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5313 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5315 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
5316 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5317 ok(pf_exists("msitest\\maximus"), "File not installed\n");
5318 ok(pf_exists("msitest"), "File not installed\n");
5320 /* after ProcessComponents */
5321 size = MAX_PATH;
5322 lstrcpyA(value, "aaa");
5323 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5324 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
5325 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5326 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5327 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5329 size = MAX_PATH;
5330 lstrcpyA(value, "aaa");
5331 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5332 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
5333 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5334 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5335 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5337 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
5338 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5339 ok(pf_exists("msitest\\maximus"), "File not installed\n");
5340 ok(pf_exists("msitest"), "File not installed\n");
5342 /* after PublishFeatures */
5343 size = MAX_PATH;
5344 lstrcpyA(value, "aaa");
5345 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5346 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
5347 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5348 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5349 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5351 size = MAX_PATH;
5352 lstrcpyA(value, "aaa");
5353 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5354 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
5355 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
5356 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
5357 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
5359 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
5360 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5361 ok(pf_exists("msitest\\maximus"), "File not installed\n");
5362 ok(pf_exists("msitest"), "File not installed\n");
5364 /* after PublishProduct */
5365 size = MAX_PATH;
5366 lstrcpyA(value, "aaa");
5367 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5368 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
5369 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5370 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
5371 ok(size == 11, "Expected 11, got %d\n", size);
5373 size = MAX_PATH;
5374 lstrcpyA(value, "aaa");
5375 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5376 MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATH, value, &size);
5377 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5378 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
5379 ok(size == 0, "Expected 0, got %d\n", size);
5381 size = MAX_PATH;
5382 lstrcpyA(value, "aaa");
5383 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5384 MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPT, value, &size);
5385 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5386 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
5387 ok(size == 0, "Expected 0, got %d\n", size);
5389 lstrcpyA(path, CURR_DIR);
5390 lstrcatA(path, "\\");
5392 size = MAX_PATH;
5393 lstrcpyA(value, "aaa");
5394 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5395 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
5396 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5397 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
5398 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
5400 size = MAX_PATH;
5401 lstrcpyA(value, "aaa");
5402 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5403 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE, value, &size);
5404 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5405 ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
5406 ok(size == 1, "Expected 1, got %d\n", size);
5408 size = MAX_PATH;
5409 lstrcpyA(value, "aaa");
5410 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5411 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
5412 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
5413 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
5414 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
5416 size = MAX_PATH;
5417 lstrcpyA(value, "aaa");
5418 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5419 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
5420 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5421 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
5422 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
5424 size = MAX_PATH;
5425 lstrcpyA(value, "aaa");
5426 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
5427 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
5428 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
5429 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
5430 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
5432 /* complete uninstall */
5433 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
5434 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5435 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
5436 todo_wine
5438 ok(!pf_exists("msitest"), "File not deleted\n");
5441 /* make sure 'Program Files\msitest' is removed */
5442 delete_pfmsitest_files();
5444 DeleteFile(msifile);
5445 DeleteFile("msitest\\maximus");
5446 RemoveDirectory("msitest");
5449 static UINT run_query(MSIHANDLE hdb, MSIHANDLE hrec, const char *query)
5451 MSIHANDLE hview = 0;
5452 UINT r;
5454 r = MsiDatabaseOpenView(hdb, query, &hview);
5455 if(r != ERROR_SUCCESS)
5456 return r;
5458 r = MsiViewExecute(hview, hrec);
5459 if(r == ERROR_SUCCESS)
5460 r = MsiViewClose(hview);
5461 MsiCloseHandle(hview);
5462 return r;
5465 static void set_transform_summary_info(void)
5467 UINT r;
5468 MSIHANDLE suminfo = 0;
5470 /* build summary info */
5471 r = MsiGetSummaryInformation(0, mstfile, 3, &suminfo);
5472 ok(r == ERROR_SUCCESS , "Failed to open summaryinfo\n");
5474 r = MsiSummaryInfoSetProperty(suminfo, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
5475 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
5477 r = MsiSummaryInfoSetProperty(suminfo, PID_REVNUMBER, VT_LPSTR, 0, NULL,
5478 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
5479 "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}1.1.1;"
5480 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}");
5481 ok(r == ERROR_SUCCESS , "Failed to set summary info\n");
5483 r = MsiSummaryInfoSetProperty(suminfo, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
5484 ok(r == ERROR_SUCCESS, "Failed to set summary info\n");
5486 r = MsiSummaryInfoPersist(suminfo);
5487 ok(r == ERROR_SUCCESS , "Failed to make summary info persist\n");
5489 r = MsiCloseHandle(suminfo);
5490 ok(r == ERROR_SUCCESS , "Failed to close suminfo\n");
5493 static void generate_transform(void)
5495 MSIHANDLE hdb1, hdb2;
5496 LPCSTR query;
5497 UINT r;
5499 /* start with two identical databases */
5500 CopyFile(msifile, msifile2, FALSE);
5502 r = MsiOpenDatabase(msifile2, MSIDBOPEN_TRANSACT, &hdb1);
5503 ok(r == ERROR_SUCCESS , "Failed to create database\n");
5505 r = MsiDatabaseCommit(hdb1);
5506 ok(r == ERROR_SUCCESS , "Failed to commit database\n");
5508 r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb2);
5509 ok(r == ERROR_SUCCESS , "Failed to create database\n");
5511 query = "INSERT INTO `Property` ( `Property`, `Value` ) VALUES ( 'prop', 'val' )";
5512 r = run_query(hdb1, 0, query);
5513 ok(r == ERROR_SUCCESS, "failed to add property\n");
5515 /* database needs to be committed */
5516 MsiDatabaseCommit(hdb1);
5518 r = MsiDatabaseGenerateTransform(hdb1, hdb2, mstfile, 0, 0);
5519 ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r);
5521 #if 0 /* not implemented in wine yet */
5522 r = MsiCreateTransformSummaryInfo(hdb2, hdb2, mstfile, 0, 0);
5523 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
5524 #endif
5526 MsiCloseHandle(hdb1);
5527 MsiCloseHandle(hdb2);
5530 /* data for generating a transform */
5532 /* tables transform names - encoded as they would be in an msi database file */
5533 static const WCHAR name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
5534 static const WCHAR name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
5535 static const WCHAR name3[] = { 0x4840, 0x4559, 0x44f2, 0x4568, 0x4737, 0 }; /* Property */
5537 /* data in each table */
5538 static const char data1[] = /* _StringData */
5539 "propval"; /* all the strings squashed together */
5541 static const WCHAR data2[] = { /* _StringPool */
5542 /* len, refs */
5543 0, 0, /* string 0 '' */
5544 4, 1, /* string 1 'prop' */
5545 3, 1, /* string 2 'val' */
5548 static const WCHAR data3[] = { /* Property */
5549 0x0201, 0x0001, 0x0002,
5552 static const struct {
5553 LPCWSTR name;
5554 const void *data;
5555 DWORD size;
5556 } table_transform_data[] =
5558 { name1, data1, sizeof data1 - 1 },
5559 { name2, data2, sizeof data2 },
5560 { name3, data3, sizeof data3 },
5563 #define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
5565 static void generate_transform_manual(void)
5567 IStorage *stg = NULL;
5568 IStream *stm;
5569 WCHAR name[0x20];
5570 HRESULT r;
5571 DWORD i, count;
5572 const DWORD mode = STGM_CREATE|STGM_READWRITE|STGM_DIRECT|STGM_SHARE_EXCLUSIVE;
5574 const CLSID CLSID_MsiTransform = { 0xc1082,0,0,{0xc0,0,0,0,0,0,0,0x46}};
5576 MultiByteToWideChar(CP_ACP, 0, mstfile, -1, name, 0x20);
5578 r = StgCreateDocfile(name, mode, 0, &stg);
5579 ok(r == S_OK, "failed to create storage\n");
5580 if (!stg)
5581 return;
5583 r = IStorage_SetClass(stg, &CLSID_MsiTransform);
5584 ok(r == S_OK, "failed to set storage type\n");
5586 for (i=0; i<NUM_TRANSFORM_TABLES; i++)
5588 r = IStorage_CreateStream(stg, table_transform_data[i].name,
5589 STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
5590 if (FAILED(r))
5592 ok(0, "failed to create stream %08x\n", r);
5593 continue;
5596 r = IStream_Write(stm, table_transform_data[i].data,
5597 table_transform_data[i].size, &count);
5598 if (FAILED(r) || count != table_transform_data[i].size)
5599 ok(0, "failed to write stream\n");
5600 IStream_Release(stm);
5603 IStorage_Release(stg);
5605 set_transform_summary_info();
5608 static void test_transformprop(void)
5610 UINT r;
5612 CreateDirectoryA("msitest", NULL);
5613 create_file("msitest\\augustus", 500);
5615 create_database(msifile, tp_tables, sizeof(tp_tables) / sizeof(msi_table));
5617 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5619 r = MsiInstallProductA(msifile, NULL);
5620 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5621 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5622 ok(!delete_pf("msitest", FALSE), "File installed\n");
5624 if (0)
5625 generate_transform();
5626 else
5627 generate_transform_manual();
5629 r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
5630 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5631 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5632 ok(delete_pf("msitest", FALSE), "File not installed\n");
5634 /* Delete the files in the temp (current) folder */
5635 DeleteFile(msifile);
5636 DeleteFile(msifile2);
5637 DeleteFile(mstfile);
5638 DeleteFile("msitest\\augustus");
5639 RemoveDirectory("msitest");
5642 static void test_currentworkingdir(void)
5644 UINT r;
5645 CHAR drive[MAX_PATH], path[MAX_PATH];
5646 LPSTR ptr;
5648 CreateDirectoryA("msitest", NULL);
5649 create_file("msitest\\augustus", 500);
5651 create_database(msifile, cwd_tables, sizeof(cwd_tables) / sizeof(msi_table));
5653 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5655 CreateDirectoryA("diffdir", NULL);
5656 SetCurrentDirectoryA("diffdir");
5658 sprintf(path, "..\\%s", msifile);
5659 r = MsiInstallProductA(path, NULL);
5660 todo_wine
5662 ok(r == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %u\n", r);
5663 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5664 ok(!delete_pf("msitest", FALSE), "File installed\n");
5667 sprintf(path, "%s\\%s", CURR_DIR, msifile);
5668 r = MsiInstallProductA(path, NULL);
5669 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5670 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5671 ok(delete_pf("msitest", FALSE), "File not installed\n");
5673 lstrcpyA(drive, CURR_DIR);
5674 drive[2] = '\\';
5675 drive[3] = '\0';
5676 SetCurrentDirectoryA(drive);
5678 lstrcpy(path, CURR_DIR);
5679 if (path[lstrlenA(path) - 1] != '\\')
5680 lstrcatA(path, "\\");
5681 lstrcatA(path, msifile);
5682 ptr = strchr(path, ':');
5683 ptr +=2;
5685 r = MsiInstallProductA(ptr, NULL);
5686 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5687 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5688 ok(delete_pf("msitest", FALSE), "File not installed\n");
5690 SetCurrentDirectoryA(CURR_DIR);
5692 DeleteFile(msifile);
5693 DeleteFile("msitest\\augustus");
5694 RemoveDirectory("msitest");
5695 RemoveDirectory("diffdir");
5698 static void set_admin_summary_info(const CHAR *name)
5700 MSIHANDLE db, summary;
5701 UINT r;
5703 r = MsiOpenDatabaseA(name, MSIDBOPEN_DIRECT, &db);
5704 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5706 r = MsiGetSummaryInformationA(db, NULL, 1, &summary);
5707 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5709 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 5, NULL, NULL);
5710 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5712 /* write the summary changes back to the stream */
5713 r = MsiSummaryInfoPersist(summary);
5714 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5716 MsiCloseHandle(summary);
5718 r = MsiDatabaseCommit(db);
5719 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5721 MsiCloseHandle(db);
5724 static void test_admin(void)
5726 UINT r;
5728 CreateDirectoryA("msitest", NULL);
5729 create_file("msitest\\augustus", 500);
5731 create_database(msifile, adm_tables, sizeof(adm_tables) / sizeof(msi_table));
5732 set_admin_summary_info(msifile);
5734 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5736 r = MsiInstallProductA(msifile, NULL);
5737 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5738 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5739 ok(!delete_pf("msitest", FALSE), "File installed\n");
5740 ok(!DeleteFile("c:\\msitest\\augustus"), "File installed\n");
5741 ok(!RemoveDirectory("c:\\msitest"), "File installed\n");
5743 r = MsiInstallProductA(msifile, "ACTION=ADMIN");
5744 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5745 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
5746 ok(!delete_pf("msitest", FALSE), "File installed\n");
5747 todo_wine
5749 ok(DeleteFile("c:\\msitest\\augustus"), "File not installed\n");
5750 ok(RemoveDirectory("c:\\msitest"), "File not installed\n");
5753 DeleteFile(msifile);
5754 DeleteFile("msitest\\augustus");
5755 RemoveDirectory("msitest");
5758 static void set_admin_property_stream(LPCSTR file)
5760 IStorage *stg;
5761 IStream *stm;
5762 WCHAR fileW[MAX_PATH];
5763 HRESULT hr;
5764 DWORD count;
5765 const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
5767 /* AdminProperties */
5768 static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
5769 static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',' ',
5770 'M','y','P','r','o','p','=','4','2',0};
5772 MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
5774 hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
5775 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
5776 if (!stg)
5777 return;
5779 hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
5780 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
5782 hr = IStream_Write(stm, data, sizeof(data), &count);
5783 ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
5785 IStream_Release(stm);
5786 IStorage_Release(stg);
5789 static void test_adminprops(void)
5791 UINT r;
5793 CreateDirectoryA("msitest", NULL);
5794 create_file("msitest\\augustus", 500);
5796 create_database(msifile, amp_tables, sizeof(amp_tables) / sizeof(msi_table));
5797 set_admin_summary_info(msifile);
5798 set_admin_property_stream(msifile);
5800 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5802 r = MsiInstallProductA(msifile, NULL);
5803 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5804 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
5805 ok(delete_pf("msitest", FALSE), "File installed\n");
5807 DeleteFile(msifile);
5808 DeleteFile("msitest\\augustus");
5809 RemoveDirectory("msitest");
5812 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
5814 CHAR path[MAX_PATH];
5816 lstrcpyA(path, PROG_FILES_DIR);
5817 lstrcatA(path, "\\");
5818 lstrcatA(path, file);
5820 if (is_file)
5821 create_file_data(path, data, 500);
5822 else
5823 CreateDirectoryA(path, NULL);
5826 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
5828 static void test_removefiles(void)
5830 UINT r;
5832 CreateDirectoryA("msitest", NULL);
5833 create_file("msitest\\hydrogen", 500);
5834 create_file("msitest\\helium", 500);
5835 create_file("msitest\\lithium", 500);
5837 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
5839 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
5841 r = MsiInstallProductA(msifile, NULL);
5842 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5843 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5844 ok(!pf_exists("msitest\\helium"), "File installed\n");
5845 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5846 ok(pf_exists("msitest"), "File not installed\n");
5848 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5849 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5850 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
5851 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
5852 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
5853 ok(delete_pf("msitest", FALSE), "File deleted\n");
5855 create_pf("msitest", FALSE);
5856 create_pf("msitest\\hydrogen", TRUE);
5857 create_pf("msitest\\helium", TRUE);
5858 create_pf("msitest\\lithium", TRUE);
5860 r = MsiInstallProductA(msifile, NULL);
5861 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5862 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5863 ok(pf_exists("msitest\\helium"), "File not installed\n");
5864 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5865 ok(pf_exists("msitest"), "File not installed\n");
5867 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5868 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5869 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
5870 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
5871 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
5872 ok(delete_pf("msitest", FALSE), "File deleted\n");
5874 create_pf("msitest", FALSE);
5875 create_pf("msitest\\furlong", TRUE);
5876 create_pf("msitest\\firkin", TRUE);
5877 create_pf("msitest\\fortnight", TRUE);
5878 create_pf("msitest\\becquerel", TRUE);
5879 create_pf("msitest\\dioptre", TRUE);
5880 create_pf("msitest\\attoparsec", TRUE);
5881 create_pf("msitest\\storeys", TRUE);
5882 create_pf("msitest\\block", TRUE);
5883 create_pf("msitest\\siriometer", TRUE);
5884 create_pf("msitest\\cabout", FALSE);
5885 create_pf("msitest\\cabout\\blocker", TRUE);
5887 r = MsiInstallProductA(msifile, NULL);
5888 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5889 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
5890 ok(!pf_exists("msitest\\helium"), "File installed\n");
5891 ok(pf_exists("msitest\\lithium"), "File not installed\n");
5892 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
5893 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
5894 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
5895 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
5896 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
5897 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
5898 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
5899 ok(!pf_exists("msitest\\block"), "File not deleted\n");
5900 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
5901 ok(pf_exists("msitest\\cabout"), "Directory removed\n");
5902 ok(pf_exists("msitest"), "File not installed\n");
5904 create_pf("msitest\\furlong", TRUE);
5905 create_pf("msitest\\firkin", TRUE);
5906 create_pf("msitest\\fortnight", TRUE);
5907 create_pf("msitest\\storeys", TRUE);
5908 create_pf("msitest\\block", TRUE);
5909 create_pf("msitest\\siriometer", TRUE);
5911 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5912 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5913 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
5914 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
5915 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
5916 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
5917 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
5918 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
5919 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
5920 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
5921 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
5922 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
5923 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
5924 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
5925 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
5926 ok(pf_exists("msitest"), "Directory deleted\n");
5928 r = MsiInstallProductA(msifile, NULL);
5929 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5930 ok(delete_pf("msitest\\hydrogen", TRUE), "File not installed\n");
5931 ok(!delete_pf("msitest\\helium", TRUE), "File installed\n");
5932 ok(delete_pf("msitest\\lithium", TRUE), "File not installed\n");
5933 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
5934 ok(pf_exists("msitest"), "Directory deleted\n");
5936 delete_pf("msitest\\cabout\\blocker", TRUE);
5938 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5939 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5940 ok(!delete_pf("msitest\\cabout", FALSE), "Directory not deleted\n");
5941 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
5943 DeleteFile(msifile);
5944 DeleteFile("msitest\\hydrogen");
5945 DeleteFile("msitest\\helium");
5946 DeleteFile("msitest\\lithium");
5947 RemoveDirectory("msitest");
5950 static void test_movefiles(void)
5952 UINT r;
5953 char props[MAX_PATH];
5955 CreateDirectoryA("msitest", NULL);
5956 create_file("msitest\\augustus", 100);
5957 create_file("cameroon", 100);
5958 create_file("djibouti", 100);
5959 create_file("egypt", 100);
5960 create_file("finland", 100);
5961 create_file("gambai", 100);
5962 create_file("honduras", 100);
5963 create_file("msitest\\india", 100);
5964 create_file("japan", 100);
5965 create_file("kenya", 100);
5966 CreateDirectoryA("latvia", NULL);
5967 create_file("nauru", 100);
5968 create_file("peru", 100);
5969 create_file("apple", 100);
5970 create_file("application", 100);
5971 create_file("ape", 100);
5972 create_file("foo", 100);
5973 create_file("fao", 100);
5974 create_file("fbod", 100);
5975 create_file("budding", 100);
5976 create_file("buddy", 100);
5977 create_file("bud", 100);
5978 create_file("bar", 100);
5979 create_file("bur", 100);
5980 create_file("bird", 100);
5982 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
5984 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
5986 /* if the source or dest property is not a full path,
5987 * windows tries to access it as a network resource
5990 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
5991 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
5992 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
5994 r = MsiInstallProductA(msifile, props);
5995 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5996 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
5997 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
5998 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
5999 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
6000 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
6001 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
6002 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
6003 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
6004 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
6005 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
6006 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
6007 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
6008 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
6009 ok(delete_pf("msitest\\poland", TRUE), "File not moved\n");
6010 /* either apple or application will be moved depending on directory order */
6011 if (!delete_pf("msitest\\apple", TRUE))
6012 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
6013 else
6014 ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
6015 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
6016 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
6017 /* either fao or foo will be moved depending on directory order */
6018 if (delete_pf("msitest\\foo", TRUE))
6019 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
6020 else
6021 ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
6022 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
6023 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
6024 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
6025 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
6026 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
6027 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
6028 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
6029 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
6030 ok(delete_pf("msitest", FALSE), "File not installed\n");
6031 ok(DeleteFileA("cameroon"), "File moved\n");
6032 ok(!DeleteFileA("djibouti"), "File not moved\n");
6033 ok(DeleteFileA("egypt"), "File moved\n");
6034 ok(DeleteFileA("finland"), "File moved\n");
6035 ok(DeleteFileA("gambai"), "File moved\n");
6036 ok(!DeleteFileA("honduras"), "File not moved\n");
6037 ok(DeleteFileA("msitest\\india"), "File moved\n");
6038 ok(DeleteFileA("japan"), "File moved\n");
6039 ok(!DeleteFileA("kenya"), "File not moved\n");
6040 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
6041 ok(!DeleteFileA("nauru"), "File not moved\n");
6042 ok(!DeleteFileA("peru"), "File not moved\n");
6043 ok(!DeleteFileA("apple"), "File not moved\n");
6044 ok(!DeleteFileA("application"), "File not moved\n");
6045 ok(DeleteFileA("ape"), "File moved\n");
6046 ok(!DeleteFileA("foo"), "File not moved\n");
6047 ok(!DeleteFileA("fao"), "File not moved\n");
6048 ok(DeleteFileA("fbod"), "File moved\n");
6049 ok(!DeleteFileA("budding"), "File not moved\n");
6050 ok(!DeleteFileA("buddy"), "File not moved\n");
6051 ok(DeleteFileA("bud"), "File moved\n");
6052 ok(!DeleteFileA("bar"), "File not moved\n");
6053 ok(!DeleteFileA("bur"), "File not moved\n");
6054 ok(DeleteFileA("bird"), "File moved\n");
6056 DeleteFile("msitest\\augustus");
6057 RemoveDirectory("msitest");
6058 DeleteFile(msifile);
6061 static void test_missingcab(void)
6063 UINT r;
6065 CreateDirectoryA("msitest", NULL);
6066 create_file("msitest\\augustus", 500);
6067 create_file("maximus", 500);
6069 create_database(msifile, mc_tables, sizeof(mc_tables) / sizeof(msi_table));
6071 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6073 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
6075 create_pf("msitest", FALSE);
6076 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
6078 r = MsiInstallProductA(msifile, NULL);
6079 ok(r == ERROR_SUCCESS ||
6080 broken(r == ERROR_INSTALL_FAILURE), /* win9x */
6081 "Expected ERROR_SUCCESS, got %u\n", r);
6082 if (r == ERROR_SUCCESS)
6084 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
6085 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
6087 ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
6088 ok(!delete_pf("msitest\\gaius", TRUE), "File installed\n");
6089 ok(delete_pf("msitest", FALSE), "File not installed\n");
6091 create_pf("msitest", FALSE);
6092 create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
6093 create_pf("msitest\\gaius", TRUE);
6095 r = MsiInstallProductA(msifile, "GAIUS=1");
6096 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
6097 todo_wine
6099 ok(!delete_pf("msitest\\maximus", TRUE), "File installed\n");
6100 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
6102 ok(delete_pf("msitest\\caesar", TRUE), "File removed\n");
6103 ok(delete_pf("msitest\\gaius", TRUE), "File removed\n");
6104 ok(delete_pf("msitest", FALSE), "File not installed\n");
6106 DeleteFile("msitest\\augustus");
6107 RemoveDirectory("msitest");
6108 DeleteFile("maximus");
6109 DeleteFile("test1.cab");
6110 DeleteFile(msifile);
6113 static void test_duplicatefiles(void)
6115 UINT r;
6117 CreateDirectoryA("msitest", NULL);
6118 create_file("msitest\\maximus", 500);
6119 create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
6121 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6123 /* fails if the destination folder is not a valid property */
6125 r = MsiInstallProductA(msifile, NULL);
6126 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6127 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
6128 ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
6129 ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
6130 ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "File not duplicated\n");
6131 ok(delete_pf("msitest\\this\\doesnot", FALSE), "File not duplicated\n");
6132 ok(delete_pf("msitest\\this", FALSE), "File not duplicated\n");
6133 ok(delete_pf("msitest", FALSE), "File not installed\n");
6135 DeleteFile("msitest\\maximus");
6136 RemoveDirectory("msitest");
6137 DeleteFile(msifile);
6140 static void test_writeregistryvalues(void)
6142 UINT r;
6143 LONG res;
6144 HKEY hkey;
6145 DWORD type, size;
6146 CHAR path[MAX_PATH];
6148 CreateDirectoryA("msitest", NULL);
6149 create_file("msitest\\augustus", 500);
6151 create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
6153 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6155 r = MsiInstallProductA(msifile, NULL);
6156 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6157 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
6158 ok(delete_pf("msitest", FALSE), "File installed\n");
6160 res = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", &hkey);
6161 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6163 size = MAX_PATH;
6164 type = REG_MULTI_SZ;
6165 memset(path, 'a', MAX_PATH);
6166 res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size);
6167 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6168 ok(!memcmp(path, "one\0two\0three\0\0", size), "Wrong multi-sz data\n");
6169 ok(size == 15, "Expected 15, got %d\n", size);
6170 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
6172 DeleteFile(msifile);
6173 DeleteFile("msitest\\augustus");
6174 RemoveDirectory("msitest");
6176 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
6177 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine");
6180 static void test_sourcefolder(void)
6182 UINT r;
6184 CreateDirectoryA("msitest", NULL);
6185 create_file("augustus", 500);
6187 create_database(msifile, sf_tables, sizeof(sf_tables) / sizeof(msi_table));
6189 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6191 r = MsiInstallProductA(msifile, NULL);
6192 ok(r == ERROR_INSTALL_FAILURE,
6193 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
6194 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
6195 todo_wine
6197 ok(!delete_pf("msitest", FALSE), "File installed\n");
6200 RemoveDirectoryA("msitest");
6202 r = MsiInstallProductA(msifile, NULL);
6203 ok(r == ERROR_INSTALL_FAILURE,
6204 "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
6205 ok(!delete_pf("msitest\\augustus", TRUE), "File installed\n");
6206 todo_wine
6208 ok(!delete_pf("msitest", FALSE), "File installed\n");
6211 DeleteFile(msifile);
6212 DeleteFile("augustus");
6215 static void test_customaction51(void)
6217 UINT r;
6219 CreateDirectoryA("msitest", NULL);
6220 create_file("msitest\\augustus", 500);
6222 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
6224 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6226 r = MsiInstallProductA(msifile, NULL);
6227 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6228 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
6229 ok(delete_pf("msitest", FALSE), "File installed\n");
6231 DeleteFile(msifile);
6232 DeleteFile("msitest\\augustus");
6233 RemoveDirectory("msitest");
6236 static void test_installstate(void)
6238 UINT r;
6240 CreateDirectoryA("msitest", NULL);
6241 create_file("msitest\\alpha", 500);
6242 create_file("msitest\\beta", 500);
6243 create_file("msitest\\gamma", 500);
6244 create_file("msitest\\theta", 500);
6245 create_file("msitest\\delta", 500);
6246 create_file("msitest\\epsilon", 500);
6247 create_file("msitest\\zeta", 500);
6248 create_file("msitest\\iota", 500);
6249 create_file("msitest\\eta", 500);
6250 create_file("msitest\\kappa", 500);
6251 create_file("msitest\\lambda", 500);
6252 create_file("msitest\\mu", 500);
6254 create_database(msifile, is_tables, sizeof(is_tables) / sizeof(msi_table));
6256 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6258 r = MsiInstallProductA(msifile, NULL);
6259 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6260 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
6261 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
6262 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
6263 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
6264 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
6265 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
6266 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
6267 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
6268 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
6269 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
6270 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
6271 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
6272 ok(delete_pf("msitest", FALSE), "File not installed\n");
6274 r = MsiInstallProductA(msifile, "ADDLOCAL=\"one,two,three,four\"");
6275 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6276 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
6277 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
6278 ok(delete_pf("msitest\\gamma", TRUE), "File not installed\n");
6279 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
6280 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
6281 ok(delete_pf("msitest\\epsilon", TRUE), "File not installed\n");
6282 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
6283 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
6284 ok(delete_pf("msitest\\eta", TRUE), "File not installed\n");
6285 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
6286 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
6287 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
6288 ok(delete_pf("msitest", FALSE), "File not installed\n");
6290 r = MsiInstallProductA(msifile, "ADDSOURCE=\"one,two,three,four\"");
6291 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6292 ok(delete_pf("msitest\\alpha", TRUE), "File not installed\n");
6293 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
6294 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
6295 ok(delete_pf("msitest\\theta", TRUE), "File not installed\n");
6296 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
6297 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
6298 ok(delete_pf("msitest\\zeta", TRUE), "File not installed\n");
6299 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
6300 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
6301 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
6302 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
6303 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
6304 ok(delete_pf("msitest", FALSE), "File not installed\n");
6306 r = MsiInstallProductA(msifile, "REMOVE=\"one,two,three,four\"");
6307 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6308 ok(!delete_pf("msitest\\alpha", TRUE), "File installed\n");
6309 ok(!delete_pf("msitest\\beta", TRUE), "File installed\n");
6310 ok(!delete_pf("msitest\\gamma", TRUE), "File installed\n");
6311 ok(!delete_pf("msitest\\theta", TRUE), "File installed\n");
6312 ok(!delete_pf("msitest\\delta", TRUE), "File installed\n");
6313 ok(!delete_pf("msitest\\epsilon", TRUE), "File installed\n");
6314 ok(!delete_pf("msitest\\zeta", TRUE), "File installed\n");
6315 ok(!delete_pf("msitest\\iota", TRUE), "File installed\n");
6316 ok(!delete_pf("msitest\\eta", TRUE), "File installed\n");
6317 ok(!delete_pf("msitest\\kappa", TRUE), "File installed\n");
6318 ok(!delete_pf("msitest\\lambda", TRUE), "File installed\n");
6319 ok(!delete_pf("msitest\\mu", TRUE), "File installed\n");
6320 ok(!delete_pf("msitest", FALSE), "File installed\n");
6322 DeleteFile(msifile);
6323 DeleteFile("msitest\\alpha");
6324 DeleteFile("msitest\\beta");
6325 DeleteFile("msitest\\gamma");
6326 DeleteFile("msitest\\theta");
6327 DeleteFile("msitest\\delta");
6328 DeleteFile("msitest\\epsilon");
6329 DeleteFile("msitest\\zeta");
6330 DeleteFile("msitest\\iota");
6331 DeleteFile("msitest\\eta");
6332 DeleteFile("msitest\\kappa");
6333 DeleteFile("msitest\\lambda");
6334 DeleteFile("msitest\\mu");
6335 RemoveDirectory("msitest");
6338 struct sourcepathmap
6340 BOOL sost; /* shortone\shorttwo */
6341 BOOL solt; /* shortone\longtwo */
6342 BOOL lost; /* longone\shorttwo */
6343 BOOL lolt; /* longone\longtwo */
6344 BOOL soste; /* shortone\shorttwo source exists */
6345 BOOL solte; /* shortone\longtwo source exists */
6346 BOOL loste; /* longone\shorttwo source exists */
6347 BOOL lolte; /* longone\longtwo source exists */
6348 UINT err;
6349 DWORD size;
6350 } spmap[256] =
6352 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6353 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6354 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6355 {TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6356 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6357 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6358 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6359 {TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6360 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6361 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6362 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6363 {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6364 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6365 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6366 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6367 {TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6368 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6369 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6370 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6371 {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6372 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6373 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6374 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6375 {TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6376 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6377 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6378 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6379 {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6380 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6381 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6382 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6383 {TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6384 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6385 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6386 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6387 {TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6388 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6389 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6390 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6391 {TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6392 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6393 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6394 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6395 {TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6396 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6397 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6398 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6399 {TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6400 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6401 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6402 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6403 {TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6404 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6405 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6406 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6407 {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6408 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6409 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6410 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6411 {TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6412 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6413 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6414 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6415 {TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6416 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6417 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6418 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6419 {TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6420 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6421 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6422 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6423 {TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6424 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6425 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6426 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6427 {TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6428 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6429 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6430 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6431 {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6432 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6433 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6434 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6435 {TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6436 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6437 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6438 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6439 {TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6440 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6441 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6442 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6443 {TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6444 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6445 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6446 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6447 {TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6448 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6449 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6450 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6451 {TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6452 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6453 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6454 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6455 {TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6456 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6457 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6458 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6459 {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6460 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6461 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6462 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6463 {TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6464 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6465 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6466 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6467 {TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6468 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6469 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6470 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6471 {TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6472 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6473 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6474 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6475 {TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6476 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6477 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6478 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6479 {TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6480 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6481 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6482 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6483 {FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6484 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6485 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6486 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6487 {FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6488 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6489 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6490 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6491 {FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6492 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6493 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6494 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6495 {FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6496 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6497 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6498 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6499 {FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6500 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6501 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6502 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6503 {FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6504 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6505 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6506 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6507 {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6508 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6509 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6510 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6511 {FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6512 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6513 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6514 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6515 {FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6516 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6517 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6518 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6519 {FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6520 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6521 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6522 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6523 {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6524 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6525 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6526 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6527 {FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6528 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6529 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6530 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6531 {FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6532 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6533 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6534 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6535 {FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6536 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6537 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6538 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6539 {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6540 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6541 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6542 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6543 {FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6544 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6545 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6546 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6547 {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6548 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6549 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6550 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6551 {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6552 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6553 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6554 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6555 {FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6556 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6557 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6558 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6559 {FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6560 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6561 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6562 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6563 {FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6564 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6565 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6566 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6567 {FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6568 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6569 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6570 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6571 {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6572 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6573 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6574 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6575 {FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6576 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6577 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6578 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6579 {FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6580 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6581 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6582 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6583 {FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6584 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, ERROR_SUCCESS, 200},
6585 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6586 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, ERROR_SUCCESS, 200},
6587 {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6588 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, ERROR_SUCCESS, 200},
6589 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6590 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, ERROR_SUCCESS, 200},
6591 {FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6592 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6593 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6594 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6595 {FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6596 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6597 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6598 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6599 {FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6600 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6601 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6602 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6603 {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6604 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, ERROR_INSTALL_FAILURE, 0},
6605 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, ERROR_INSTALL_FAILURE, 0},
6606 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, ERROR_INSTALL_FAILURE, 0},
6607 {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, ERROR_INSTALL_FAILURE, 0},
6610 static DWORD get_pf_file_size(LPCSTR file)
6612 CHAR path[MAX_PATH];
6613 HANDLE hfile;
6614 DWORD size;
6616 lstrcpyA(path, PROG_FILES_DIR);
6617 lstrcatA(path, "\\");
6618 lstrcatA(path, file);
6620 hfile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
6621 if (hfile == INVALID_HANDLE_VALUE)
6622 return 0;
6624 size = GetFileSize(hfile, NULL);
6625 CloseHandle(hfile);
6626 return size;
6629 static void test_sourcepath(void)
6631 UINT r, i;
6633 if (!winetest_interactive)
6635 skip("Run in interactive mode to run source path tests.\n");
6636 return;
6639 create_database(msifile, sp_tables, sizeof(sp_tables) / sizeof(msi_table));
6641 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6643 for (i = 0; i < sizeof(spmap) / sizeof(spmap[0]); i++)
6645 if (spmap[i].sost)
6647 CreateDirectoryA("shortone", NULL);
6648 CreateDirectoryA("shortone\\shorttwo", NULL);
6651 if (spmap[i].solt)
6653 CreateDirectoryA("shortone", NULL);
6654 CreateDirectoryA("shortone\\longtwo", NULL);
6657 if (spmap[i].lost)
6659 CreateDirectoryA("longone", NULL);
6660 CreateDirectoryA("longone\\shorttwo", NULL);
6663 if (spmap[i].lolt)
6665 CreateDirectoryA("longone", NULL);
6666 CreateDirectoryA("longone\\longtwo", NULL);
6669 if (spmap[i].soste)
6670 create_file("shortone\\shorttwo\\augustus", 50);
6671 if (spmap[i].solte)
6672 create_file("shortone\\longtwo\\augustus", 100);
6673 if (spmap[i].loste)
6674 create_file("longone\\shorttwo\\augustus", 150);
6675 if (spmap[i].lolte)
6676 create_file("longone\\longtwo\\augustus", 200);
6678 r = MsiInstallProductA(msifile, NULL);
6679 ok(r == spmap[i].err, "%d: Expected %d, got %d\n", i, spmap[i].err, r);
6680 ok(get_pf_file_size("msitest\\augustus") == spmap[i].size,
6681 "%d: Expected %d, got %d\n", i, spmap[i].size,
6682 get_pf_file_size("msitest\\augustus"));
6684 if (r == ERROR_SUCCESS)
6686 ok(delete_pf("msitest\\augustus", TRUE), "%d: File not installed\n", i);
6687 ok(delete_pf("msitest", FALSE), "%d: File not installed\n", i);
6689 else
6691 ok(!delete_pf("msitest\\augustus", TRUE), "%d: File installed\n", i);
6692 todo_wine ok(!delete_pf("msitest", FALSE), "%d: File installed\n", i);
6695 DeleteFileA("shortone\\shorttwo\\augustus");
6696 DeleteFileA("shortone\\longtwo\\augustus");
6697 DeleteFileA("longone\\shorttwo\\augustus");
6698 DeleteFileA("longone\\longtwo\\augustus");
6699 RemoveDirectoryA("shortone\\shorttwo");
6700 RemoveDirectoryA("shortone\\longtwo");
6701 RemoveDirectoryA("longone\\shorttwo");
6702 RemoveDirectoryA("longone\\longtwo");
6703 RemoveDirectoryA("shortone");
6704 RemoveDirectoryA("longone");
6707 DeleteFileA(msifile);
6710 static void test_MsiConfigureProductEx(void)
6712 UINT r;
6713 LONG res;
6714 DWORD type, size;
6715 HKEY props, source;
6716 CHAR keypath[MAX_PATH * 2];
6717 CHAR localpack[MAX_PATH];
6719 if (on_win9x)
6721 win_skip("Different registry keys on Win9x and WinMe\n");
6722 return;
6725 CreateDirectoryA("msitest", NULL);
6726 create_file("msitest\\hydrogen", 500);
6727 create_file("msitest\\helium", 500);
6728 create_file("msitest\\lithium", 500);
6730 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
6732 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6734 /* NULL szProduct */
6735 r = MsiConfigureProductExA(NULL, INSTALLLEVEL_DEFAULT,
6736 INSTALLSTATE_DEFAULT, "PROPVAR=42");
6737 ok(r == ERROR_INVALID_PARAMETER,
6738 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6740 /* empty szProduct */
6741 r = MsiConfigureProductExA("", INSTALLLEVEL_DEFAULT,
6742 INSTALLSTATE_DEFAULT, "PROPVAR=42");
6743 ok(r == ERROR_INVALID_PARAMETER,
6744 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6746 /* garbage szProduct */
6747 r = MsiConfigureProductExA("garbage", INSTALLLEVEL_DEFAULT,
6748 INSTALLSTATE_DEFAULT, "PROPVAR=42");
6749 ok(r == ERROR_INVALID_PARAMETER,
6750 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6752 /* guid without brackets */
6753 r = MsiConfigureProductExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D",
6754 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6755 "PROPVAR=42");
6756 ok(r == ERROR_INVALID_PARAMETER,
6757 "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
6759 /* guid with brackets */
6760 r = MsiConfigureProductExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}",
6761 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6762 "PROPVAR=42");
6763 ok(r == ERROR_UNKNOWN_PRODUCT,
6764 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
6766 /* same length as guid, but random */
6767 r = MsiConfigureProductExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93",
6768 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6769 "PROPVAR=42");
6770 ok(r == ERROR_UNKNOWN_PRODUCT,
6771 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
6773 /* product not installed yet */
6774 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6775 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6776 "PROPVAR=42");
6777 ok(r == ERROR_UNKNOWN_PRODUCT,
6778 "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
6780 /* install the product, per-user unmanaged */
6781 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
6782 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6783 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6784 ok(pf_exists("msitest\\helium"), "File not installed\n");
6785 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6786 ok(pf_exists("msitest"), "File not installed\n");
6788 /* product is installed per-user managed, remove it */
6789 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6790 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6791 "PROPVAR=42");
6792 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6793 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6794 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6795 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6796 todo_wine
6798 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6801 /* product has been removed */
6802 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6803 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6804 "PROPVAR=42");
6805 ok(r == ERROR_UNKNOWN_PRODUCT,
6806 "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
6808 /* install the product, machine */
6809 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6810 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6811 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6812 ok(pf_exists("msitest\\helium"), "File not installed\n");
6813 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6814 ok(pf_exists("msitest"), "File not installed\n");
6816 /* product is installed machine, remove it */
6817 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6818 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6819 "PROPVAR=42");
6820 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6821 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6822 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6823 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6824 todo_wine
6826 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6829 /* product has been removed */
6830 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6831 INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT,
6832 "PROPVAR=42");
6833 ok(r == ERROR_UNKNOWN_PRODUCT,
6834 "Expected ERROR_UNKNOWN_PRODUCT, got %u\n", r);
6836 /* install the product, machine */
6837 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6838 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6839 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6840 ok(pf_exists("msitest\\helium"), "File not installed\n");
6841 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6842 ok(pf_exists("msitest"), "File not installed\n");
6844 DeleteFileA(msifile);
6846 /* local msifile is removed */
6847 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6848 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6849 "PROPVAR=42");
6850 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6851 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6852 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6853 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6854 todo_wine
6856 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6859 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
6861 /* install the product, machine */
6862 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6863 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6864 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6865 ok(pf_exists("msitest\\helium"), "File not installed\n");
6866 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6867 ok(pf_exists("msitest"), "File not installed\n");
6869 DeleteFileA(msifile);
6871 lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
6872 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
6873 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties");
6875 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
6876 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6878 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
6879 (const BYTE *)"C:\\idontexist.msi", 18);
6880 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6882 /* LocalPackage is used to find the cached msi package */
6883 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6884 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6885 "PROPVAR=42");
6886 ok(r == ERROR_INSTALL_SOURCE_ABSENT,
6887 "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
6888 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6889 ok(pf_exists("msitest\\helium"), "File not installed\n");
6890 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6891 ok(pf_exists("msitest"), "File not installed\n");
6893 RegCloseKey(props);
6894 create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
6896 /* LastUsedSource (local msi package) can be used as a last resort */
6897 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6898 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6899 "PROPVAR=42");
6900 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6901 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6902 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6903 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6904 todo_wine
6906 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6909 /* install the product, machine */
6910 r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
6911 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6912 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6913 ok(pf_exists("msitest\\helium"), "File not installed\n");
6914 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6915 ok(pf_exists("msitest"), "File not installed\n");
6917 lstrcpyA(keypath, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\");
6918 lstrcatA(keypath, "Installer\\UserData\\S-1-5-18\\Products\\");
6919 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties");
6921 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &props);
6922 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6924 res = RegSetValueExA(props, "LocalPackage", 0, REG_SZ,
6925 (const BYTE *)"C:\\idontexist.msi", 18);
6926 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6928 lstrcpyA(keypath, "SOFTWARE\\Classes\\Installer\\Products\\");
6929 lstrcatA(keypath, "84A88FD7F6998CE40A22FB59F6B9C2BB\\SourceList");
6931 res = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &source);
6932 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6934 type = REG_SZ;
6935 size = MAX_PATH;
6936 res = RegQueryValueExA(source, "PackageName", NULL, &type,
6937 (LPBYTE)localpack, &size);
6938 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6940 res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
6941 (const BYTE *)"idontexist.msi", 15);
6942 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6944 /* SourceList is altered */
6945 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6946 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6947 "PROPVAR=42");
6948 ok(r == ERROR_INSTALL_SOURCE_ABSENT,
6949 "Expected ERROR_INSTALL_SOURCE_ABSENT, got %d\n", r);
6950 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6951 ok(pf_exists("msitest\\helium"), "File not installed\n");
6952 ok(pf_exists("msitest\\lithium"), "File not installed\n");
6953 ok(pf_exists("msitest"), "File not installed\n");
6955 /* restore the SourceList */
6956 res = RegSetValueExA(source, "PackageName", 0, REG_SZ,
6957 (const BYTE *)localpack, lstrlenA(localpack) + 1);
6958 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6960 /* finally remove the product */
6961 r = MsiConfigureProductExA("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}",
6962 INSTALLLEVEL_DEFAULT, INSTALLSTATE_ABSENT,
6963 "PROPVAR=42");
6964 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
6965 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
6966 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
6967 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
6968 todo_wine
6970 ok(!delete_pf("msitest", FALSE), "File not removed\n");
6973 DeleteFileA(msifile);
6974 RegCloseKey(source);
6975 RegCloseKey(props);
6976 DeleteFileA("msitest\\hydrogen");
6977 DeleteFileA("msitest\\helium");
6978 DeleteFileA("msitest\\lithium");
6979 RemoveDirectoryA("msitest");
6982 static void test_missingcomponent(void)
6984 UINT r;
6986 CreateDirectoryA("msitest", NULL);
6987 create_file("msitest\\hydrogen", 500);
6988 create_file("msitest\\helium", 500);
6989 create_file("msitest\\lithium", 500);
6990 create_file("beryllium", 500);
6992 create_database(msifile, mcomp_tables, sizeof(mcomp_tables) / sizeof(msi_table));
6994 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6996 r = MsiInstallProductA(msifile, "INSTALLLEVEL=10 PROPVAR=42");
6997 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6998 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
6999 ok(pf_exists("msitest\\helium"), "File not installed\n");
7000 ok(pf_exists("msitest\\lithium"), "File not installed\n");
7001 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
7002 ok(pf_exists("msitest"), "File not installed\n");
7004 r = MsiInstallProductA(msifile, "REMOVE=ALL INSTALLLEVEL=10 PROPVAR=42");
7005 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7006 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not removed\n");
7007 ok(!delete_pf("msitest\\helium", TRUE), "File not removed\n");
7008 ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
7009 ok(!pf_exists("msitest\\beryllium"), "File installed\n");
7010 todo_wine
7012 ok(!delete_pf("msitest", FALSE), "File not removed\n");
7015 DeleteFileA(msifile);
7016 DeleteFileA("msitest\\hydrogen");
7017 DeleteFileA("msitest\\helium");
7018 DeleteFileA("msitest\\lithium");
7019 DeleteFileA("beryllium");
7020 RemoveDirectoryA("msitest");
7023 static void test_sourcedirprop(void)
7025 UINT r;
7026 CHAR props[MAX_PATH];
7028 CreateDirectoryA("msitest", NULL);
7029 create_file("msitest\\augustus", 500);
7031 create_database(msifile, ca51_tables, sizeof(ca51_tables) / sizeof(msi_table));
7033 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7035 r = MsiInstallProductA(msifile, NULL);
7036 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7037 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
7038 ok(delete_pf("msitest", FALSE), "File installed\n");
7040 DeleteFile("msitest\\augustus");
7041 RemoveDirectory("msitest");
7043 CreateDirectoryA("altsource", NULL);
7044 CreateDirectoryA("altsource\\msitest", NULL);
7045 create_file("altsource\\msitest\\augustus", 500);
7047 sprintf(props, "SRCDIR=%s\\altsource\\", CURR_DIR);
7049 r = MsiInstallProductA(msifile, props);
7050 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7051 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
7052 ok(delete_pf("msitest", FALSE), "File installed\n");
7054 DeleteFile(msifile);
7055 DeleteFile("altsource\\msitest\\augustus");
7056 RemoveDirectory("altsource\\msitest");
7057 RemoveDirectory("altsource");
7060 static void test_adminimage(void)
7062 UINT r;
7064 CreateDirectoryA("msitest", NULL);
7065 CreateDirectoryA("msitest\\first", NULL);
7066 CreateDirectoryA("msitest\\second", NULL);
7067 CreateDirectoryA("msitest\\cabout", NULL);
7068 CreateDirectoryA("msitest\\cabout\\new", NULL);
7069 create_file("msitest\\one.txt", 100);
7070 create_file("msitest\\first\\two.txt", 100);
7071 create_file("msitest\\second\\three.txt", 100);
7072 create_file("msitest\\cabout\\four.txt", 100);
7073 create_file("msitest\\cabout\\new\\five.txt", 100);
7074 create_file("msitest\\filename", 100);
7075 create_file("msitest\\service.exe", 100);
7077 create_database_wordcount(msifile, ai_tables,
7078 sizeof(ai_tables) / sizeof(msi_table),
7079 msidbSumInfoSourceTypeAdminImage);
7081 r = MsiInstallProductA(msifile, NULL);
7082 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7084 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7085 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7086 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7087 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7088 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7089 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7090 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7091 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7092 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
7093 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7094 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7095 ok(delete_pf("msitest", FALSE), "File not installed\n");
7097 DeleteFileA("msitest.msi");
7098 DeleteFileA("msitest\\cabout\\new\\five.txt");
7099 DeleteFileA("msitest\\cabout\\four.txt");
7100 DeleteFileA("msitest\\second\\three.txt");
7101 DeleteFileA("msitest\\first\\two.txt");
7102 DeleteFileA("msitest\\one.txt");
7103 DeleteFileA("msitest\\service.exe");
7104 DeleteFileA("msitest\\filename");
7105 RemoveDirectoryA("msitest\\cabout\\new");
7106 RemoveDirectoryA("msitest\\cabout");
7107 RemoveDirectoryA("msitest\\second");
7108 RemoveDirectoryA("msitest\\first");
7109 RemoveDirectoryA("msitest");
7112 static void test_propcase(void)
7114 UINT r;
7116 CreateDirectoryA("msitest", NULL);
7117 create_file("msitest\\augustus", 500);
7119 create_database(msifile, pc_tables, sizeof(pc_tables) / sizeof(msi_table));
7121 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7123 r = MsiInstallProductA(msifile, "MyProp=42");
7124 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7125 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
7126 ok(delete_pf("msitest", FALSE), "File not installed\n");
7128 DeleteFile(msifile);
7129 DeleteFile("msitest\\augustus");
7130 RemoveDirectory("msitest");
7133 static void test_int_widths( void )
7135 static const char int0[] = "int0\ni0\nint0\tint0\n1";
7136 static const char int1[] = "int1\ni1\nint1\tint1\n1";
7137 static const char int2[] = "int2\ni2\nint2\tint2\n1";
7138 static const char int3[] = "int3\ni3\nint3\tint3\n1";
7139 static const char int4[] = "int4\ni4\nint4\tint4\n1";
7140 static const char int5[] = "int5\ni5\nint5\tint5\n1";
7141 static const char int8[] = "int8\ni8\nint8\tint8\n1";
7143 static const struct
7145 const char *data;
7146 unsigned int size;
7147 UINT ret;
7149 tests[] =
7151 { int0, sizeof(int0) - 1, ERROR_SUCCESS },
7152 { int1, sizeof(int1) - 1, ERROR_SUCCESS },
7153 { int2, sizeof(int2) - 1, ERROR_SUCCESS },
7154 { int3, sizeof(int3) - 1, ERROR_FUNCTION_FAILED },
7155 { int4, sizeof(int4) - 1, ERROR_SUCCESS },
7156 { int5, sizeof(int5) - 1, ERROR_FUNCTION_FAILED },
7157 { int8, sizeof(int8) - 1, ERROR_FUNCTION_FAILED }
7160 char tmpdir[MAX_PATH], msitable[MAX_PATH], msidb[MAX_PATH];
7161 MSIHANDLE db;
7162 UINT r, i;
7164 GetTempPathA(MAX_PATH, tmpdir);
7165 CreateDirectoryA(tmpdir, NULL);
7167 strcpy(msitable, tmpdir);
7168 strcat(msitable, "\\msitable.idt");
7170 strcpy(msidb, tmpdir);
7171 strcat(msidb, "\\msitest.msi");
7173 r = MsiOpenDatabaseA(msidb, MSIDBOPEN_CREATE, &db);
7174 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7176 for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
7178 write_file(msitable, tests[i].data, tests[i].size);
7180 r = MsiDatabaseImportA(db, tmpdir, "msitable.idt");
7181 ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r);
7183 r = MsiDatabaseCommit(db);
7184 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7185 DeleteFileA(msitable);
7188 MsiCloseHandle(db);
7189 DeleteFileA(msidb);
7190 RemoveDirectoryA(tmpdir);
7193 static void test_shortcut(void)
7195 UINT r;
7196 HRESULT hr;
7198 create_test_files();
7199 create_database(msifile, sc_tables, sizeof(sc_tables) / sizeof(msi_table));
7201 r = MsiInstallProductA(msifile, NULL);
7202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7204 hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
7205 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
7207 r = MsiInstallProductA(msifile, NULL);
7208 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7210 CoUninitialize();
7212 hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
7213 ok(SUCCEEDED(hr), "CoInitialize failed 0x%08x\n", hr);
7215 r = MsiInstallProductA(msifile, NULL);
7216 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7218 CoUninitialize();
7220 delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
7221 delete_pf("msitest\\cabout\\new", FALSE);
7222 delete_pf("msitest\\cabout\\four.txt", TRUE);
7223 delete_pf("msitest\\cabout", FALSE);
7224 delete_pf("msitest\\changed\\three.txt", TRUE);
7225 delete_pf("msitest\\changed", FALSE);
7226 delete_pf("msitest\\first\\two.txt", TRUE);
7227 delete_pf("msitest\\first", FALSE);
7228 delete_pf("msitest\\filename", TRUE);
7229 delete_pf("msitest\\one.txt", TRUE);
7230 delete_pf("msitest\\service.exe", TRUE);
7231 delete_pf("msitest\\Shortcut.lnk", TRUE);
7232 delete_pf("msitest", FALSE);
7233 delete_test_files();
7236 static void test_envvar(void)
7238 UINT r;
7239 HKEY env;
7240 LONG res;
7241 DWORD type, size;
7242 char buffer[16];
7243 UINT i;
7245 if (on_win9x)
7247 win_skip("Environment variables are handled differently on Win9x and WinMe\n");
7248 return;
7251 create_test_files();
7252 create_database(msifile, env_tables, sizeof(env_tables) / sizeof(msi_table));
7254 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Environment", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &env, NULL);
7255 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7257 res = RegSetValueExA(env, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"0", 2);
7258 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7260 res = RegSetValueExA(env, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"0", 2);
7261 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7263 r = MsiInstallProductA(msifile, NULL);
7264 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7266 type = REG_NONE;
7267 size = sizeof(buffer);
7268 buffer[0] = 0;
7269 res = RegQueryValueExA(env, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
7270 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7271 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
7272 ok(!lstrcmp(buffer, "1"), "Expected \"1\", got %s\n", buffer);
7274 res = RegDeleteValueA(env, "MSITESTVAR1");
7275 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7277 type = REG_NONE;
7278 size = sizeof(buffer);
7279 buffer[0] = 0;
7280 res = RegQueryValueExA(env, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
7281 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7282 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
7283 ok(!lstrcmp(buffer, "1"), "Expected \"1\", got %s\n", buffer);
7285 res = RegDeleteValueA(env, "MSITESTVAR2");
7286 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7288 res = RegDeleteValueA(env, "MSITESTVAR3");
7289 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7291 res = RegDeleteValueA(env, "MSITESTVAR4");
7292 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
7294 res = RegDeleteValueA(env, "MSITESTVAR5");
7295 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
7297 res = RegDeleteValueA(env, "MSITESTVAR6");
7298 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
7300 res = RegDeleteValueA(env, "MSITESTVAR7");
7301 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
7303 res = RegDeleteValueA(env, "MSITESTVAR8");
7304 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
7306 res = RegDeleteValueA(env, "MSITESTVAR9");
7307 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
7309 res = RegDeleteValueA(env, "MSITESTVAR10");
7310 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
7312 i = 11;
7313 while (environment_dat_results[(i-11)]) {
7314 char name[20];
7315 sprintf(name, "MSITESTVAR%d", i);
7317 type = REG_NONE;
7318 size = sizeof(buffer);
7319 buffer[0] = 0;
7320 res = RegQueryValueExA(env, name, NULL, &type, (LPBYTE)buffer, &size);
7321 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
7322 ok(type == REG_SZ, "%d: Expected REG_SZ, got %u\n", i, type);
7323 ok(!lstrcmp(buffer, environment_dat_results[(i-11)]), "%d: Expected %s, got %s\n",
7324 i, environment_dat_results[(i-11)], buffer);
7326 res = RegDeleteValueA(env, name);
7327 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
7328 i++;
7332 RegCloseKey(env);
7333 delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
7334 delete_pf("msitest\\cabout\\new", FALSE);
7335 delete_pf("msitest\\cabout\\four.txt", TRUE);
7336 delete_pf("msitest\\cabout", FALSE);
7337 delete_pf("msitest\\changed\\three.txt", TRUE);
7338 delete_pf("msitest\\changed", FALSE);
7339 delete_pf("msitest\\first\\two.txt", TRUE);
7340 delete_pf("msitest\\first", FALSE);
7341 delete_pf("msitest\\filename", TRUE);
7342 delete_pf("msitest\\one.txt", TRUE);
7343 delete_pf("msitest\\service.exe", TRUE);
7344 delete_pf("msitest", FALSE);
7345 delete_test_files();
7348 static void test_preselected(void)
7350 UINT r;
7352 create_test_files();
7353 create_database(msifile, ps_tables, sizeof(ps_tables) / sizeof(msi_table));
7355 r = MsiInstallProductA(msifile, "ADDLOCAL=One");
7356 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7358 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
7359 ok(!delete_pf("msitest\\cabout\\new", FALSE), "File installed\n");
7360 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
7361 ok(!delete_pf("msitest\\cabout", FALSE), "File installed\n");
7362 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
7363 ok(!delete_pf("msitest\\changed", FALSE), "File installed\n");
7364 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
7365 ok(!delete_pf("msitest\\first", FALSE), "File installed\n");
7366 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
7367 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
7368 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
7369 ok(delete_pf("msitest", FALSE), "File not installed\n");
7371 r = MsiInstallProductA(msifile, NULL);
7372 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7374 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7375 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7376 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7377 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7378 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7379 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7380 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7381 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7382 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7383 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7384 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7385 ok(delete_pf("msitest", FALSE), "File not installed\n");
7386 delete_test_files();
7389 static void test_installed_prop(void)
7391 static char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}";
7392 UINT r;
7394 create_test_files();
7395 create_database(msifile, ip_tables, sizeof(ip_tables) / sizeof(msi_table));
7397 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7399 r = MsiInstallProductA(msifile, "FULL=1");
7400 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7402 r = MsiInstallProductA(msifile, "FULL=1");
7403 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7405 r = MsiConfigureProductExA(prodcode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, "FULL=1");
7406 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7408 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7409 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7410 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7411 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7412 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7413 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7414 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7415 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7416 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7417 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7418 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7419 ok(delete_pf("msitest", FALSE), "File not installed\n");
7421 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7422 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7424 delete_test_files();
7427 static void test_allusers_prop(void)
7429 UINT r;
7431 create_test_files();
7432 create_database(msifile, aup_tables, sizeof(aup_tables) / sizeof(msi_table));
7434 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7436 /* ALLUSERS property unset */
7437 r = MsiInstallProductA(msifile, "FULL=1");
7438 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7440 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7441 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7442 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7443 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7444 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7445 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7446 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7447 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7448 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7449 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7450 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7451 ok(delete_pf("msitest", FALSE), "File not installed\n");
7453 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7454 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7456 delete_test_files();
7458 create_test_files();
7459 create_database(msifile, aup2_tables, sizeof(aup2_tables) / sizeof(msi_table));
7461 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7463 /* ALLUSERS property set to 1 */
7464 r = MsiInstallProductA(msifile, "FULL=1");
7465 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7467 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7468 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7469 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7470 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7471 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7472 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7473 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7474 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7475 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7476 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7477 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7478 ok(delete_pf("msitest", FALSE), "File not installed\n");
7480 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7481 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7483 delete_test_files();
7485 create_test_files();
7486 create_database(msifile, aup3_tables, sizeof(aup3_tables) / sizeof(msi_table));
7488 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7490 /* ALLUSERS property set to 2 */
7491 r = MsiInstallProductA(msifile, "FULL=1");
7492 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7494 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7495 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7496 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7497 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7498 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7499 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7500 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7501 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7502 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7503 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7504 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7505 ok(delete_pf("msitest", FALSE), "File not installed\n");
7507 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7508 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7510 delete_test_files();
7512 create_test_files();
7513 create_database(msifile, aup4_tables, sizeof(aup4_tables) / sizeof(msi_table));
7515 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7517 /* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */
7518 r = MsiInstallProductA(msifile, "FULL=1");
7519 if (r == ERROR_SUCCESS)
7521 /* Win9x/WinMe */
7522 win_skip("Win9x and WinMe act differently with respect to ALLUSERS\n");
7524 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7525 ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n");
7526 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7527 ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n");
7528 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7529 ok(delete_pf("msitest\\changed", FALSE), "File not installed\n");
7530 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7531 ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
7532 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7533 ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7534 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7535 ok(delete_pf("msitest", FALSE), "File not installed\n");
7537 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7538 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7540 delete_test_files();
7542 else
7543 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7546 static char session_manager[] = "System\\CurrentControlSet\\Control\\Session Manager";
7547 static char rename_ops[] = "PendingFileRenameOperations";
7549 static void process_pending_renames(HKEY hkey)
7551 char *buf, *src, *dst, *buf2, *buf2ptr;
7552 DWORD size, buf2len = 0;
7553 LONG ret;
7554 BOOL found = FALSE;
7556 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size);
7557 buf = HeapAlloc(GetProcessHeap(), 0, size);
7558 buf2ptr = buf2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
7559 buf[0] = 0;
7561 ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size);
7562 ok(!ret, "RegQueryValueExA failed %d (%u)\n", ret, GetLastError());
7564 for (src = buf; *src; src = dst + strlen(dst) + 1)
7566 DWORD flags = MOVEFILE_COPY_ALLOWED;
7568 dst = src + strlen(src) + 1;
7570 if (!strstr(src, "msitest"))
7572 lstrcpyA(buf2ptr, src);
7573 buf2len += strlen(src) + 1;
7574 buf2ptr += strlen(src) + 1;
7575 if (*dst)
7577 lstrcpyA(buf2ptr, dst);
7578 buf2ptr += strlen(dst) + 1;
7579 buf2len += strlen(dst) + 1;
7581 buf2ptr++;
7582 buf2len++;
7583 continue;
7586 found = TRUE;
7588 if (*dst == '!')
7590 flags |= MOVEFILE_REPLACE_EXISTING;
7591 dst++;
7593 if (src[0] == '\\' && src[1] == '?' && src[2] == '?' && src[3] == '\\') src += 4;
7594 if (*dst)
7596 if (dst[0] == '\\' && dst[1] == '?' && dst[2] == '?' && dst[3] == '\\') dst += 4;
7597 ok(MoveFileExA(src, dst, flags), "Failed to move file %s -> %s (%u)\n", src, dst, GetLastError());
7599 else
7600 ok(DeleteFileA(src), "Failed to delete file %s (%u)\n", src, GetLastError());
7603 ok(found, "Expected a 'msitest' entry\n");
7605 if (*buf2)
7607 buf2len++;
7608 RegSetValueExA(hkey, rename_ops, 0, REG_MULTI_SZ, (LPBYTE)buf2, buf2len);
7610 else
7611 RegDeleteValueA(hkey, rename_ops);
7613 HeapFree(GetProcessHeap(), 0, buf);
7614 HeapFree(GetProcessHeap(), 0, buf2);
7617 static BOOL file_matches_data(LPCSTR file, LPCSTR data)
7619 DWORD len, data_len = strlen(data);
7620 HANDLE handle;
7621 char buf[128];
7623 handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
7624 ok(handle != INVALID_HANDLE_VALUE, "failed to open %s (%u)\n", file, GetLastError());
7626 if (ReadFile(handle, buf, sizeof(buf), &len, NULL) && len >= data_len)
7628 CloseHandle(handle);
7629 return !memcmp(buf, data, data_len);
7631 CloseHandle(handle);
7632 return FALSE;
7635 static void test_file_in_use(void)
7637 UINT r;
7638 HANDLE file;
7639 HKEY hkey;
7640 char path[MAX_PATH];
7642 if (on_win9x)
7644 win_skip("Pending file renaming is implemented differently on Win9x and WinMe\n");
7645 return;
7648 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
7650 CreateDirectoryA("msitest", NULL);
7651 create_file("msitest\\maximus", 500);
7652 create_database(msifile, fiu_tables, sizeof(fiu_tables) / sizeof(msi_table));
7654 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7656 lstrcpy(path, PROG_FILES_DIR);
7657 lstrcat(path, "\\msitest");
7658 CreateDirectoryA(path, NULL);
7660 lstrcat(path, "\\maximus");
7661 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
7663 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
7664 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
7665 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
7666 CloseHandle(file);
7667 ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n");
7669 process_pending_renames(hkey);
7670 RegCloseKey(hkey);
7672 ok(file_matches_data(path, "msitest\\maximus"), "Expected file to match\n");
7673 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
7674 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
7676 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7677 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7679 delete_test_files();
7682 static void test_file_in_use_cab(void)
7684 UINT r;
7685 HANDLE file;
7686 HKEY hkey;
7687 char path[MAX_PATH];
7689 if (on_win9x)
7691 win_skip("Pending file renaming is implemented differently on Win9x and WinMe\n");
7692 return;
7695 RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey);
7697 CreateDirectoryA("msitest", NULL);
7698 create_file("maximus", 500);
7699 create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
7700 DeleteFile("maximus");
7702 create_database(msifile, fiuc_tables, sizeof(fiuc_tables) / sizeof(msi_table));
7704 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7706 lstrcpy(path, PROG_FILES_DIR);
7707 lstrcat(path, "\\msitest");
7708 CreateDirectoryA(path, NULL);
7710 lstrcat(path, "\\maximus");
7711 file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
7713 r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1");
7714 ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r);
7715 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
7716 CloseHandle(file);
7717 ok(!file_matches_data(path, "maximus"), "Expected file not to match\n");
7719 process_pending_renames(hkey);
7720 RegCloseKey(hkey);
7722 ok(file_matches_data(path, "maximus"), "Expected file to match\n");
7723 ok(delete_pf("msitest\\maximus", TRUE), "File not present\n");
7724 ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n");
7726 r = MsiInstallProductA(msifile, "REMOVE=ALL");
7727 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7729 delete_cab_files();
7730 delete_test_files();
7733 static INT CALLBACK handler_a(LPVOID context, UINT type, LPCSTR msg)
7735 return IDOK;
7738 static INT CALLBACK handler_w(LPVOID context, UINT type, LPCWSTR msg)
7740 return IDOK;
7743 static INT CALLBACK handler_record(LPVOID context, UINT type, MSIHANDLE record)
7745 return IDOK;
7748 static void test_MsiSetExternalUI(void)
7750 INSTALLUI_HANDLERA ret_a;
7751 INSTALLUI_HANDLERW ret_w;
7752 INSTALLUI_HANDLER_RECORD prev;
7753 UINT error;
7755 ret_a = MsiSetExternalUIA(handler_a, INSTALLLOGMODE_ERROR, NULL);
7756 ok(ret_a == NULL, "expected NULL, got %p\n", ret_a);
7758 ret_a = MsiSetExternalUIA(NULL, 0, NULL);
7759 ok(ret_a == handler_a, "expected %p, got %p\n", handler_a, ret_a);
7761 /* Not present before Installer 3.1 */
7762 if (!pMsiSetExternalUIRecord) {
7763 win_skip("MsiSetExternalUIRecord is not available\n");
7764 return;
7767 error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev);
7768 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7769 ok(prev == NULL, "expected NULL, got %p\n", prev);
7771 prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
7772 error = pMsiSetExternalUIRecord(NULL, INSTALLLOGMODE_ERROR, NULL, &prev);
7773 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7774 ok(prev == handler_record, "expected %p, got %p\n", handler_record, prev);
7776 ret_w = MsiSetExternalUIW(handler_w, INSTALLLOGMODE_ERROR, NULL);
7777 ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
7779 ret_w = MsiSetExternalUIW(NULL, 0, NULL);
7780 ok(ret_w == handler_w, "expected %p, got %p\n", handler_w, ret_w);
7782 ret_a = MsiSetExternalUIA(handler_a, INSTALLLOGMODE_ERROR, NULL);
7783 ok(ret_a == NULL, "expected NULL, got %p\n", ret_a);
7785 ret_w = MsiSetExternalUIW(handler_w, INSTALLLOGMODE_ERROR, NULL);
7786 ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
7788 prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
7789 error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev);
7790 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7791 ok(prev == NULL, "expected NULL, got %p\n", prev);
7793 ret_a = MsiSetExternalUIA(NULL, 0, NULL);
7794 ok(ret_a == NULL, "expected NULL, got %p\n", ret_a);
7796 ret_w = MsiSetExternalUIW(NULL, 0, NULL);
7797 ok(ret_w == NULL, "expected NULL, got %p\n", ret_w);
7799 prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef;
7800 error = pMsiSetExternalUIRecord(NULL, 0, NULL, &prev);
7801 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7802 ok(prev == handler_record, "expected %p, got %p\n", handler_record, prev);
7804 error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, NULL);
7805 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7807 error = pMsiSetExternalUIRecord(NULL, 0, NULL, NULL);
7808 ok(!error, "MsiSetExternalUIRecord failed %u\n", error);
7811 static void test_feature_override(void)
7813 UINT r;
7815 create_test_files();
7816 create_database(msifile, tables, sizeof(tables) / sizeof(msi_table));
7818 r = MsiInstallProductA(msifile, "ADDLOCAL=One");
7819 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7821 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
7822 ok(!delete_pf("msitest\\cabout\\new", FALSE), "File installed\n");
7823 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
7824 ok(!delete_pf("msitest\\cabout", FALSE), "File installed\n");
7825 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
7826 ok(!delete_pf("msitest\\changed", FALSE), "File installed\n");
7827 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
7828 ok(!delete_pf("msitest\\first", FALSE), "File installed\n");
7829 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
7830 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
7831 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
7832 ok(delete_pf("msitest", FALSE), "File not installed\n");
7834 delete_test_files();
7837 static void test_create_folder(void)
7839 UINT r;
7841 create_test_files();
7842 create_database(msifile, cf_tables, sizeof(cf_tables) / sizeof(msi_table));
7844 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7846 r = MsiInstallProductA(msifile, NULL);
7847 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7849 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
7850 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
7851 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
7852 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
7853 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
7854 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
7855 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
7856 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
7857 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
7858 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7859 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
7860 ok(!delete_pf("msitest", FALSE), "Directory created\n");
7862 r = MsiInstallProductA(msifile, "LOCAL=Two");
7863 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7865 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
7866 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
7867 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
7868 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
7869 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
7870 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
7871 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
7872 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
7873 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
7874 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7875 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
7876 ok(!delete_pf("msitest", FALSE), "Directory created\n");
7878 delete_test_files();
7881 static void test_remove_folder(void)
7883 UINT r;
7885 create_test_files();
7886 create_database(msifile, rf_tables, sizeof(rf_tables) / sizeof(msi_table));
7888 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7890 r = MsiInstallProductA(msifile, NULL);
7891 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7893 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
7894 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
7895 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
7896 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
7897 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
7898 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
7899 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
7900 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
7901 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
7902 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7903 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
7904 ok(!delete_pf("msitest", FALSE), "Directory created\n");
7906 r = MsiInstallProductA(msifile, "LOCAL=Two");
7907 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
7909 ok(!delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File installed\n");
7910 ok(!delete_pf("msitest\\cabout\\new", FALSE), "Directory created\n");
7911 ok(!delete_pf("msitest\\cabout\\four.txt", TRUE), "File installed\n");
7912 ok(!delete_pf("msitest\\cabout", FALSE), "Directory created\n");
7913 ok(!delete_pf("msitest\\changed\\three.txt", TRUE), "File installed\n");
7914 ok(!delete_pf("msitest\\changed", FALSE), "Directory created\n");
7915 ok(!delete_pf("msitest\\first\\two.txt", TRUE), "File installed\n");
7916 ok(!delete_pf("msitest\\first", FALSE), "Directory created\n");
7917 ok(!delete_pf("msitest\\filename", TRUE), "File installed\n");
7918 ok(!delete_pf("msitest\\one.txt", TRUE), "File installed\n");
7919 ok(!delete_pf("msitest\\service.exe", TRUE), "File installed\n");
7920 ok(!delete_pf("msitest", FALSE), "Directory created\n");
7922 delete_test_files();
7925 static void test_start_services(void)
7927 UINT r;
7928 SC_HANDLE scm, service;
7929 BOOL ret;
7930 DWORD error = ERROR_SUCCESS;
7932 if (on_win9x)
7934 win_skip("Services are not implemented on Win9x and WinMe\n");
7935 return;
7937 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
7938 ok(scm != NULL, "Failed to open the SC Manager\n");
7939 if (!scm) return;
7941 service = OpenService(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
7942 if (!service && GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST)
7944 win_skip("The 'Spooler' service does not exist\n");
7945 CloseServiceHandle(scm);
7946 return;
7948 ok(service != NULL, "Failed to open Spooler, error %d\n", GetLastError());
7949 if (!service) {
7950 CloseServiceHandle(scm);
7951 return;
7954 ret = StartService(service, 0, NULL);
7955 if (!ret && (error = GetLastError()) != ERROR_SERVICE_ALREADY_RUNNING)
7957 skip("Terminal service not available, skipping test\n");
7958 CloseServiceHandle(service);
7959 CloseServiceHandle(scm);
7960 return;
7963 CloseServiceHandle(service);
7964 CloseServiceHandle(scm);
7966 create_test_files();
7967 create_database(msifile, sss_tables, sizeof(sss_tables) / sizeof(msi_table));
7969 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
7971 r = MsiInstallProductA(msifile, NULL);
7972 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
7974 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
7975 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
7976 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
7977 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
7978 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
7979 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
7980 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
7981 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
7982 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
7983 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
7984 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
7985 ok(delete_pf("msitest", FALSE), "Directory not created\n");
7987 delete_test_files();
7989 if (error == ERROR_SUCCESS)
7991 SERVICE_STATUS status;
7993 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
7994 service = OpenService(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
7996 ret = ControlService(service, SERVICE_CONTROL_STOP, &status);
7997 ok(ret, "ControlService failed %u\n", GetLastError());
7999 CloseServiceHandle(service);
8000 CloseServiceHandle(scm);
8004 static void test_delete_services(void)
8006 UINT r;
8008 create_test_files();
8009 create_database(msifile, sds_tables, sizeof(sds_tables) / sizeof(msi_table));
8011 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
8013 r = MsiInstallProductA(msifile, NULL);
8014 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8016 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
8017 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
8018 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
8019 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
8020 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
8021 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
8022 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
8023 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
8024 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
8025 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
8026 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
8027 ok(delete_pf("msitest", FALSE), "Directory not created\n");
8029 delete_test_files();
8032 static void test_self_registration(void)
8034 UINT r;
8036 create_test_files();
8037 create_database(msifile, sr_tables, sizeof(sr_tables) / sizeof(msi_table));
8039 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
8041 r = MsiInstallProductA(msifile, NULL);
8042 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8044 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
8045 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
8046 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
8047 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
8048 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
8049 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
8050 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
8051 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
8052 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
8053 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
8054 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
8055 ok(delete_pf("msitest", FALSE), "Directory not created\n");
8057 delete_test_files();
8060 static void test_register_font(void)
8062 static const char regfont1[] = "Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
8063 static const char regfont2[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Fonts";
8064 LONG ret;
8065 HKEY key;
8066 UINT r;
8068 create_test_files();
8069 create_file("msitest\\font.ttf", 1000);
8070 create_database(msifile, font_tables, sizeof(font_tables) / sizeof(msi_table));
8072 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
8074 r = MsiInstallProductA(msifile, NULL);
8075 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8077 ret = RegOpenKeyA(HKEY_LOCAL_MACHINE, regfont1, &key);
8078 if (ret)
8079 RegOpenKeyA(HKEY_LOCAL_MACHINE, regfont2, &key);
8081 ret = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
8082 ok(ret != ERROR_FILE_NOT_FOUND, "unexpected result %d\n", ret);
8084 r = MsiInstallProductA(msifile, "REMOVE=ALL");
8085 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8087 todo_wine ok(!delete_pf("msitest", FALSE), "directory not removed\n");
8089 ret = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
8090 ok(ret == ERROR_FILE_NOT_FOUND, "unexpected result %d\n", ret);
8092 RegDeleteValueA(key, "msi test font");
8093 RegCloseKey(key);
8094 delete_test_files();
8097 static void test_validate_product_id(void)
8099 UINT r;
8101 create_test_files();
8102 create_database(msifile, vp_tables, sizeof(vp_tables) / sizeof(msi_table));
8104 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
8106 r = MsiInstallProductA(msifile, NULL);
8107 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8109 r = MsiInstallProductA(msifile, "SET_PRODUCT_ID=1");
8110 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
8112 r = MsiInstallProductA(msifile, "SET_PRODUCT_ID=2");
8113 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8115 r = MsiInstallProductA(msifile, "PIDKEY=123-1234567");
8116 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
8118 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
8119 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
8120 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
8121 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
8122 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
8123 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
8124 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
8125 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
8126 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
8127 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
8128 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
8129 ok(delete_pf("msitest", FALSE), "Directory not created\n");
8131 delete_test_files();
8134 static void test_install_remove_odbc(void)
8136 UINT r;
8138 create_test_files();
8139 create_file("msitest\\ODBCdriver.dll", 1000);
8140 create_file("msitest\\ODBCdriver2.dll", 1000);
8141 create_file("msitest\\ODBCtranslator.dll", 1000);
8142 create_file("msitest\\ODBCtranslator2.dll", 1000);
8143 create_file("msitest\\ODBCsetup.dll", 1000);
8144 create_database(msifile, odbc_tables, sizeof(odbc_tables) / sizeof(msi_table));
8146 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
8148 r = MsiInstallProductA(msifile, NULL);
8149 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8151 ok(delete_pf("msitest\\ODBCdriver.dll", TRUE), "file not created\n");
8152 ok(delete_pf("msitest\\ODBCdriver2.dll", TRUE), "file not created\n");
8153 ok(delete_pf("msitest\\ODBCtranslator.dll", TRUE), "file not created\n");
8154 ok(delete_pf("msitest\\ODBCtranslator2.dll", TRUE), "file not created\n");
8155 ok(delete_pf("msitest\\ODBCsetup.dll", TRUE), "file not created\n");
8156 ok(delete_pf("msitest", FALSE), "directory not created\n");
8158 delete_test_files();
8161 static void test_register_typelib(void)
8163 UINT r;
8165 create_test_files();
8166 create_file("msitest\\typelib.dll", 1000);
8167 create_database(msifile, tl_tables, sizeof(tl_tables) / sizeof(msi_table));
8169 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
8171 r = MsiInstallProductA(msifile, "REGISTER_TYPELIB=1");
8172 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
8174 r = MsiInstallProductA(msifile, NULL);
8175 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8177 r = MsiInstallProductA(msifile, "REMOVE=ALL");
8178 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8180 ok(!delete_pf("msitest\\typelib.dll", TRUE), "file not removed\n");
8181 todo_wine ok(!delete_pf("msitest", FALSE), "directory not removed\n");
8183 delete_test_files();
8186 static void test_create_remove_shortcut(void)
8188 UINT r;
8190 create_test_files();
8191 create_file("msitest\\target.txt", 1000);
8192 create_database(msifile, crs_tables, sizeof(crs_tables) / sizeof(msi_table));
8194 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
8196 r = MsiInstallProductA(msifile, NULL);
8197 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8199 ok(pf_exists("msitest\\target.txt"), "file not created\n");
8200 ok(pf_exists("msitest\\shortcut.lnk"), "file not created\n");
8202 r = MsiInstallProductA(msifile, "REMOVE=ALL");
8203 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
8205 ok(!delete_pf("msitest\\shortcut.lnk", TRUE), "file not removed\n");
8206 ok(!delete_pf("msitest\\target.txt", TRUE), "file not removed\n");
8207 todo_wine ok(!delete_pf("msitest", FALSE), "directory not removed\n");
8209 delete_test_files();
8212 START_TEST(install)
8214 DWORD len;
8215 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
8216 STATEMGRSTATUS status;
8217 BOOL ret = FALSE;
8219 init_functionpointers();
8221 on_win9x = check_win9x();
8223 GetCurrentDirectoryA(MAX_PATH, prev_path);
8224 GetTempPath(MAX_PATH, temp_path);
8225 SetCurrentDirectoryA(temp_path);
8227 lstrcpyA(CURR_DIR, temp_path);
8228 len = lstrlenA(CURR_DIR);
8230 if(len && (CURR_DIR[len - 1] == '\\'))
8231 CURR_DIR[len - 1] = 0;
8233 get_program_files_dir(PROG_FILES_DIR, COMMON_FILES_DIR);
8235 /* Create a restore point ourselves so we circumvent the multitude of restore points
8236 * that would have been created by all the installation and removal tests.
8238 if (pSRSetRestorePointA)
8240 memset(&status, 0, sizeof(status));
8241 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
8244 /* Create only one log file and don't append. We have to pass something
8245 * for the log mode for this to work. The logfile needs to have an absolute
8246 * path otherwise we still end up with some extra logfiles as some tests
8247 * change the current directory.
8249 lstrcpyA(log_file, temp_path);
8250 lstrcatA(log_file, "\\msitest.log");
8251 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
8253 test_MsiInstallProduct();
8254 test_MsiSetComponentState();
8255 test_packagecoltypes();
8256 test_continuouscabs();
8257 test_caborder();
8258 test_mixedmedia();
8259 test_samesequence();
8260 test_uiLevelFlags();
8261 test_readonlyfile();
8262 test_readonlyfile_cab();
8263 test_setdirproperty();
8264 test_cabisextracted();
8265 test_concurrentinstall();
8266 test_setpropertyfolder();
8267 test_publish_registerproduct();
8268 test_publish_publishproduct();
8269 test_publish_publishfeatures();
8270 test_publish_registeruser();
8271 test_publish_processcomponents();
8272 test_publish();
8273 test_publishsourcelist();
8274 test_transformprop();
8275 test_currentworkingdir();
8276 test_admin();
8277 test_adminprops();
8278 test_removefiles();
8279 test_movefiles();
8280 test_missingcab();
8281 test_duplicatefiles();
8282 test_writeregistryvalues();
8283 test_sourcefolder();
8284 test_customaction51();
8285 test_installstate();
8286 test_sourcepath();
8287 test_MsiConfigureProductEx();
8288 test_missingcomponent();
8289 test_sourcedirprop();
8290 test_adminimage();
8291 test_propcase();
8292 test_int_widths();
8293 test_shortcut();
8294 test_envvar();
8295 test_lastusedsource();
8296 test_preselected();
8297 test_installed_prop();
8298 test_file_in_use();
8299 test_file_in_use_cab();
8300 test_MsiSetExternalUI();
8301 test_allusers_prop();
8302 test_feature_override();
8303 test_create_folder();
8304 test_remove_folder();
8305 test_start_services();
8306 test_delete_services();
8307 test_self_registration();
8308 test_register_font();
8309 test_validate_product_id();
8310 test_install_remove_odbc();
8311 test_register_typelib();
8312 test_create_remove_shortcut();
8314 DeleteFileA(log_file);
8316 if (pSRSetRestorePointA && ret)
8318 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
8319 if (ret)
8320 remove_restore_point(status.llSequenceNumber);
8322 FreeLibrary(hsrclient);
8324 SetCurrentDirectoryA(prev_path);