Add AppDefaults app selection to control panel
[wine/gsoc-2012-control.git] / dlls / msi / tests / action.c
blob814b49c8bbf18bd04927f2863b92648703bf143c
1 /*
2 * Copyright (C) 2006 James Hawkins
3 * Copyright 2010 Hans Leidekker for CodeWeavers
5 * Tests concentrating on standard actions
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define _WIN32_MSI 300
23 #include <stdio.h>
25 #include <windows.h>
26 #include <msiquery.h>
27 #include <msidefs.h>
28 #include <msi.h>
29 #include <fci.h>
30 #include <srrestoreptapi.h>
32 #include "wine/test.h"
34 static UINT (WINAPI *pMsiQueryComponentStateA)
35 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *);
36 static UINT (WINAPI *pMsiSourceListEnumSourcesA)
37 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
38 static UINT (WINAPI *pMsiSourceListGetInfoA)
39 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD);
40 static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
41 (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
43 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR *);
44 static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE);
45 static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
46 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
48 static HMODULE hsrclient;
49 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
50 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA *, STATEMGRSTATUS *);
52 static BOOL is_wow64;
53 static const BOOL is_64bit = sizeof(void *) > sizeof(int);
55 static const char *msifile = "msitest.msi";
56 static CHAR CURR_DIR[MAX_PATH];
57 static CHAR PROG_FILES_DIR[MAX_PATH];
58 static CHAR COMMON_FILES_DIR[MAX_PATH];
59 static CHAR APP_DATA_DIR[MAX_PATH];
60 static CHAR WINDOWS_DIR[MAX_PATH];
62 /* msi database data */
64 static const char component_dat[] =
65 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
66 "s72\tS38\ts72\ti2\tS255\tS72\n"
67 "Component\tComponent\n"
68 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
69 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
70 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n"
71 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
72 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
73 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
74 "component\t\tMSITESTDIR\t0\t1\tfile\n"
75 "service_comp\t{935A0A91-22A3-4F87-BCA8-928FFDFE2353}\tMSITESTDIR\t0\t\tservice_file\n"
76 "service_comp2\t{3F7B04A4-9521-4649-BDC9-0C8722740A49}\tMSITESTDIR\t0\t\tservice_file2";
78 static const char directory_dat[] =
79 "Directory\tDirectory_Parent\tDefaultDir\n"
80 "s72\tS72\tl255\n"
81 "Directory\tDirectory\n"
82 "CABOUTDIR\tMSITESTDIR\tcabout\n"
83 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
84 "FIRSTDIR\tMSITESTDIR\tfirst\n"
85 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
86 "NEWDIR\tCABOUTDIR\tnew\n"
87 "ProgramFilesFolder\tTARGETDIR\t.\n"
88 "TARGETDIR\t\tSourceDir";
90 static const char feature_dat[] =
91 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
92 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
93 "Feature\tFeature\n"
94 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
95 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
96 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
97 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
98 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
99 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
100 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
102 static const char feature_comp_dat[] =
103 "Feature_\tComponent_\n"
104 "s38\ts72\n"
105 "FeatureComponents\tFeature_\tComponent_\n"
106 "Five\tFive\n"
107 "Four\tFour\n"
108 "One\tOne\n"
109 "Three\tThree\n"
110 "Two\tTwo\n"
111 "feature\tcomponent\n"
112 "service_feature\tservice_comp\n"
113 "service_feature\tservice_comp2";
115 static const char file_dat[] =
116 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
117 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
118 "File\tFile\n"
119 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
120 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
121 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
122 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
123 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
124 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
125 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t6\n"
126 "service_file2\tservice_comp2\tservice2.exe\t100\t\t\t8192\t7";
128 static const char install_exec_seq_dat[] =
129 "Action\tCondition\tSequence\n"
130 "s72\tS255\tI2\n"
131 "InstallExecuteSequence\tAction\n"
132 "AllocateRegistrySpace\tNOT Installed\t1550\n"
133 "CostFinalize\t\t1000\n"
134 "CostInitialize\t\t800\n"
135 "FileCost\t\t900\n"
136 "ResolveSource\t\t950\n"
137 "MoveFiles\t\t1700\n"
138 "InstallFiles\t\t4000\n"
139 "DuplicateFiles\t\t4500\n"
140 "WriteEnvironmentStrings\t\t4550\n"
141 "CreateShortcuts\t\t4600\n"
142 "InstallServices\t\t5000\n"
143 "InstallFinalize\t\t6600\n"
144 "InstallInitialize\t\t1500\n"
145 "InstallValidate\t\t1400\n"
146 "LaunchConditions\t\t100\n"
147 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
149 static const char media_dat[] =
150 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
151 "i2\ti4\tL64\tS255\tS32\tS72\n"
152 "Media\tDiskId\n"
153 "1\t3\t\t\tDISK1\t\n"
154 "2\t7\t\tmsitest.cab\tDISK2\t\n";
156 static const char property_dat[] =
157 "Property\tValue\n"
158 "s72\tl0\n"
159 "Property\tProperty\n"
160 "DefaultUIFont\tDlgFont8\n"
161 "HASUIRUN\t0\n"
162 "INSTALLLEVEL\t3\n"
163 "InstallMode\tTypical\n"
164 "Manufacturer\tWine\n"
165 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
166 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
167 "ProductID\tnone\n"
168 "ProductLanguage\t1033\n"
169 "ProductName\tMSITEST\n"
170 "ProductVersion\t1.1.1\n"
171 "PROMPTROLLBACKCOST\tP\n"
172 "Setup\tSetup\n"
173 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
174 "AdminProperties\tPOSTADMIN\n"
175 "ROOTDRIVE\tC:\\\n"
176 "SERVNAME\tTestService\n"
177 "SERVNAME2\tTestService2\n"
178 "SERVDISP\tTestServiceDisp\n"
179 "SERVDISP2\tTestServiceDisp2\n"
180 "MSIFASTINSTALL\t1\n";
182 static const char environment_dat[] =
183 "Environment\tName\tValue\tComponent_\n"
184 "s72\tl255\tL255\ts72\n"
185 "Environment\tEnvironment\n"
186 "Var1\t=-MSITESTVAR1\t1\tOne\n"
187 "Var2\tMSITESTVAR2\t1\tOne\n"
188 "Var3\t=-MSITESTVAR3\t1\tOne\n"
189 "Var4\tMSITESTVAR4\t1\tOne\n"
190 "Var5\t-MSITESTVAR5\t\tOne\n"
191 "Var6\tMSITESTVAR6\t\tOne\n"
192 "Var7\t!-MSITESTVAR7\t\tOne\n"
193 "Var8\t!-*MSITESTVAR8\t\tOne\n"
194 "Var9\t=-MSITESTVAR9\t\tOne\n"
195 "Var10\t=MSITESTVAR10\t\tOne\n"
196 "Var11\t+-MSITESTVAR11\t[~];1\tOne\n"
197 "Var12\t+-MSITESTVAR11\t[~];2\tOne\n"
198 "Var13\t+-MSITESTVAR12\t[~];1\tOne\n"
199 "Var14\t=MSITESTVAR13\t[~];1\tOne\n"
200 "Var15\t=MSITESTVAR13\t[~];2\tOne\n"
201 "Var16\t=MSITESTVAR14\t;1;\tOne\n"
202 "Var17\t=MSITESTVAR15\t;;1;;\tOne\n"
203 "Var18\t=MSITESTVAR16\t 1 \tOne\n"
204 "Var19\t+-MSITESTVAR17\t1\tOne\n"
205 "Var20\t+-MSITESTVAR17\t;;2;;[~]\tOne\n"
206 "Var21\t+-MSITESTVAR18\t1\tOne\n"
207 "Var22\t+-MSITESTVAR18\t[~];;2;;\tOne\n"
208 "Var23\t+-MSITESTVAR19\t1\tOne\n"
209 "Var24\t+-MSITESTVAR19\t[~]2\tOne\n"
210 "Var25\t+-MSITESTVAR20\t1\tOne\n"
211 "Var26\t+-MSITESTVAR20\t2[~]\tOne\n";
213 static const char service_install_dat[] =
214 "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
215 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
216 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
217 "ServiceInstall\tServiceInstall\n"
218 "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService\t\t-a arg\tservice_comp\tdescription\n"
219 "TestService2\tSERVNAME2]\t[SERVDISP2]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService2\t\t-a arg\tservice_comp2\tdescription";
221 static const char service_control_dat[] =
222 "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
223 "s72\tl255\ti2\tL255\tI2\ts72\n"
224 "ServiceControl\tServiceControl\n"
225 "ServiceControl\tTestService3\t8\t\t0\tservice_comp\n"
226 "ServiceControl2\tTestService3\t128\t\t0\tservice_comp2";
228 static const char sss_service_control_dat[] =
229 "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
230 "s72\tl255\ti2\tL255\tI2\ts72\n"
231 "ServiceControl\tServiceControl\n"
232 "ServiceControl\tSpooler\t1\t\t0\tservice_comp";
234 static const char sss_install_exec_seq_dat[] =
235 "Action\tCondition\tSequence\n"
236 "s72\tS255\tI2\n"
237 "InstallExecuteSequence\tAction\n"
238 "LaunchConditions\t\t100\n"
239 "CostInitialize\t\t800\n"
240 "FileCost\t\t900\n"
241 "ResolveSource\t\t950\n"
242 "CostFinalize\t\t1000\n"
243 "InstallValidate\t\t1400\n"
244 "InstallInitialize\t\t1500\n"
245 "DeleteServices\t\t5000\n"
246 "MoveFiles\t\t5100\n"
247 "InstallFiles\t\t5200\n"
248 "DuplicateFiles\t\t5300\n"
249 "StartServices\t\t5400\n"
250 "InstallFinalize\t\t6000\n";
252 static const char sds_install_exec_seq_dat[] =
253 "Action\tCondition\tSequence\n"
254 "s72\tS255\tI2\n"
255 "InstallExecuteSequence\tAction\n"
256 "LaunchConditions\t\t100\n"
257 "CostInitialize\t\t800\n"
258 "FileCost\t\t900\n"
259 "ResolveSource\t\t950\n"
260 "CostFinalize\t\t1000\n"
261 "InstallValidate\t\t1400\n"
262 "InstallInitialize\t\t1500\n"
263 "StopServices\t\t5000\n"
264 "DeleteServices\t\t5050\n"
265 "MoveFiles\t\t5100\n"
266 "InstallFiles\t\t5200\n"
267 "DuplicateFiles\t\t5300\n"
268 "InstallServices\t\t5400\n"
269 "StartServices\t\t5450\n"
270 "RegisterProduct\t\t5500\n"
271 "PublishFeatures\t\t5600\n"
272 "PublishProduct\t\t5700\n"
273 "InstallFinalize\t\t6000\n";
275 static const char rof_component_dat[] =
276 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
277 "s72\tS38\ts72\ti2\tS255\tS72\n"
278 "Component\tComponent\n"
279 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
281 static const char rof_feature_dat[] =
282 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
283 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
284 "Feature\tFeature\n"
285 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
286 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
288 static const char rof_feature_comp_dat[] =
289 "Feature_\tComponent_\n"
290 "s38\ts72\n"
291 "FeatureComponents\tFeature_\tComponent_\n"
292 "feature\tmaximus\n"
293 "montecristo\tmaximus";
295 static const char rof_file_dat[] =
296 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
297 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
298 "File\tFile\n"
299 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
301 static const char rof_media_dat[] =
302 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
303 "i2\ti4\tL64\tS255\tS32\tS72\n"
304 "Media\tDiskId\n"
305 "1\t1\t\t\tDISK1\t\n";
307 static const char ci2_feature_comp_dat[] =
308 "Feature_\tComponent_\n"
309 "s38\ts72\n"
310 "FeatureComponents\tFeature_\tComponent_\n"
311 "feature\taugustus";
313 static const char ci2_file_dat[] =
314 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
315 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
316 "File\tFile\n"
317 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
319 static const char pp_install_exec_seq_dat[] =
320 "Action\tCondition\tSequence\n"
321 "s72\tS255\tI2\n"
322 "InstallExecuteSequence\tAction\n"
323 "ValidateProductID\t\t700\n"
324 "CostInitialize\t\t800\n"
325 "FileCost\t\t900\n"
326 "CostFinalize\t\t1000\n"
327 "InstallValidate\t\t1400\n"
328 "InstallInitialize\t\t1500\n"
329 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
330 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
331 "RemoveFiles\t\t3500\n"
332 "InstallFiles\t\t4000\n"
333 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
334 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
335 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
336 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
337 "InstallFinalize\t\t6600";
339 static const char pp_component_dat[] =
340 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
341 "s72\tS38\ts72\ti2\tS255\tS72\n"
342 "Component\tComponent\n"
343 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\t\tmaximus\n";
345 static const char ppc_component_dat[] =
346 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
347 "s72\tS38\ts72\ti2\tS255\tS72\n"
348 "Component\tComponent\n"
349 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\t\tmaximus\n"
350 "augustus\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\taugustus\n";
352 static const char ppc_file_dat[] =
353 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
354 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
355 "File\tFile\n"
356 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1\n"
357 "augustus\taugustus\taugustus\t500\t\t\t8192\t2";
359 static const char ppc_media_dat[] =
360 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
361 "i2\ti4\tL64\tS255\tS32\tS72\n"
362 "Media\tDiskId\n"
363 "1\t2\t\t\tDISK1\t\n";
365 static const char ppc_feature_comp_dat[] =
366 "Feature_\tComponent_\n"
367 "s38\ts72\n"
368 "FeatureComponents\tFeature_\tComponent_\n"
369 "feature\tmaximus\n"
370 "feature\taugustus\n"
371 "montecristo\tmaximus";
373 static const char cwd_component_dat[] =
374 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
375 "s72\tS38\ts72\ti2\tS255\tS72\n"
376 "Component\tComponent\n"
377 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
379 static const char rem_component_dat[] =
380 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
381 "s72\tS38\ts72\ti2\tS255\tS72\n"
382 "Component\tComponent\n"
383 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t0\t\thydrogen\n"
384 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\thelium\n"
385 "lithium\t\tMSITESTDIR\t2\t\tlithium\n";
387 static const char rem_feature_comp_dat[] =
388 "Feature_\tComponent_\n"
389 "s38\ts72\n"
390 "FeatureComponents\tFeature_\tComponent_\n"
391 "feature\thydrogen\n"
392 "feature\thelium\n"
393 "feature\tlithium";
395 static const char rem_file_dat[] =
396 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
397 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
398 "File\tFile\n"
399 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
400 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
401 "lithium\tlithium\tlithium\t0\t\t\t8192\t1";
403 static const char rem_install_exec_seq_dat[] =
404 "Action\tCondition\tSequence\n"
405 "s72\tS255\tI2\n"
406 "InstallExecuteSequence\tAction\n"
407 "ValidateProductID\t\t700\n"
408 "CostInitialize\t\t800\n"
409 "FileCost\t\t900\n"
410 "CostFinalize\t\t1000\n"
411 "InstallValidate\t\t1400\n"
412 "InstallInitialize\t\t1500\n"
413 "ProcessComponents\t\t1600\n"
414 "UnpublishFeatures\t\t1800\n"
415 "RemoveFiles\t\t3500\n"
416 "InstallFiles\t\t4000\n"
417 "RegisterProduct\t\t6100\n"
418 "PublishFeatures\t\t6300\n"
419 "PublishProduct\t\t6400\n"
420 "InstallFinalize\t\t6600";
422 static const char rem_remove_files_dat[] =
423 "FileKey\tComponent_\tFileName\tDirProperty\tInstallMode\n"
424 "s72\ts72\tS255\ts72\tI2\n"
425 "RemoveFile\tFileKey\n"
426 "furlong\thydrogen\tfurlong\tMSITESTDIR\t1\n"
427 "firkin\thelium\tfirkin\tMSITESTDIR\t1\n"
428 "fortnight\tlithium\tfortnight\tMSITESTDIR\t1\n"
429 "becquerel\thydrogen\tbecquerel\tMSITESTDIR\t2\n"
430 "dioptre\thelium\tdioptre\tMSITESTDIR\t2\n"
431 "attoparsec\tlithium\tattoparsec\tMSITESTDIR\t2\n"
432 "storeys\thydrogen\tstoreys\tMSITESTDIR\t3\n"
433 "block\thelium\tblock\tMSITESTDIR\t3\n"
434 "siriometer\tlithium\tsiriometer\tMSITESTDIR\t3\n"
435 "nanoacre\thydrogen\t\tCABOUTDIR\t3\n";
437 static const char mov_move_file_dat[] =
438 "FileKey\tComponent_\tSourceName\tDestName\tSourceFolder\tDestFolder\tOptions\n"
439 "s72\ts72\tS255\tS255\tS72\ts72\ti2\n"
440 "MoveFile\tFileKey\n"
441 "abkhazia\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t0\n"
442 "bahamas\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t1\n"
443 "cambodia\taugustus\tcameroon\tcanada\tSourceDir\tMSITESTDIR\t0\n"
444 "denmark\taugustus\tdjibouti\tdominica\tSourceDir\tMSITESTDIR\t1\n"
445 "ecuador\taugustus\tegypt\telsalvador\tNotAProp\tMSITESTDIR\t1\n"
446 "fiji\taugustus\tfinland\tfrance\tSourceDir\tNotAProp\t1\n"
447 "gabon\taugustus\tgambia\tgeorgia\tSOURCEFULL\tMSITESTDIR\t1\n"
448 "haiti\taugustus\thonduras\thungary\tSourceDir\tDESTFULL\t1\n"
449 "iceland\taugustus\tindia\tindonesia\tMSITESTDIR\tMSITESTDIR\t1\n"
450 "jamaica\taugustus\tjapan\tjordan\tFILEPATHBAD\tMSITESTDIR\t1\n"
451 "kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n"
452 "laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n"
453 "namibia\taugustus\tnauru\tkiribati\tSourceDir\tMSITESTDIR\t1\n"
454 "pakistan\taugustus\tperu\tsfn|poland\tSourceDir\tMSITESTDIR\t1\n"
455 "wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
456 "single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
457 "wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
458 "singlenodest\taugustus\tb?r\t\tSourceDir\tMSITESTDIR\t1\n";
460 static const char df_directory_dat[] =
461 "Directory\tDirectory_Parent\tDefaultDir\n"
462 "s72\tS72\tl255\n"
463 "Directory\tDirectory\n"
464 "THIS\tMSITESTDIR\tthis\n"
465 "DOESNOT\tTHIS\tdoesnot\n"
466 "NONEXISTENT\tDOESNOT\texist\n"
467 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
468 "ProgramFilesFolder\tTARGETDIR\t.\n"
469 "TARGETDIR\t\tSourceDir";
471 static const char df_duplicate_file_dat[] =
472 "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
473 "s72\ts72\ts72\tS255\tS72\n"
474 "DuplicateFile\tFileKey\n"
475 "maximus\tmaximus\tmaximus\taugustus\t\n"
476 "caesar\tmaximus\tmaximus\t\tNONEXISTENT\n"
477 "augustus\tnosuchcomponent\tmaximus\t\tMSITESTDIR\n";
479 static const char wrv_component_dat[] =
480 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
481 "s72\tS38\ts72\ti2\tS255\tS72\n"
482 "Component\tComponent\n"
483 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
485 static const char wrv_registry_dat[] =
486 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
487 "s72\ti2\tl255\tL255\tL0\ts72\n"
488 "Registry\tRegistry\n"
489 "regdata\t2\tSOFTWARE\\Wine\\msitest\tValue\t[~]one[~]two[~]three\taugustus\n"
490 "regdata1\t2\tSOFTWARE\\Wine\\msitest\t*\t\taugustus\n"
491 "regdata2\t2\tSOFTWARE\\Wine\\msitest\t*\t#%\taugustus\n"
492 "regdata3\t2\tSOFTWARE\\Wine\\msitest\t*\t#x\taugustus\n"
493 "regdata4\t2\tSOFTWARE\\Wine\\msitest\\VisualStudio\\10.0\\AD7Metrics\\Exception\\{049EC4CC-30D2-4032-9256-EE18EB41B62B}\\Common Language Runtime Exceptions\\System.Workflow.ComponentModel.Serialization\\System.Workflow.ComponentModel.Serialization.WorkflowMarkupSerializationException\tlong\tkey\taugustus\n";
495 static const char cf_directory_dat[] =
496 "Directory\tDirectory_Parent\tDefaultDir\n"
497 "s72\tS72\tl255\n"
498 "Directory\tDirectory\n"
499 "FIRSTDIR\tMSITESTDIR\tfirst\n"
500 "SECONDDIR\tMSITESTDIR\tsecond\n"
501 "THIRDDIR\tMSITESTDIR\tthird\n"
502 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
503 "ProgramFilesFolder\tTARGETDIR\t.\n"
504 "TARGETDIR\t\tSourceDir";
506 static const char cf_component_dat[] =
507 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
508 "s72\tS38\ts72\ti2\tS255\tS72\n"
509 "Component\tComponent\n"
510 "One\t{F8CD42AC-9C38-48FE-8664-B35FD121012A}\tFIRSTDIR\t0\t\tone.txt\n"
511 "Two\t{DE2DB02E-2DDF-4E34-8CF6-DCA13E29DF52}\tSECONDDIR\t0\t\ttwo.txt\n";
513 static const char cf_feature_dat[] =
514 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
515 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
516 "Feature\tFeature\n"
517 "One\t\tOne\tThe One Feature\t1\t3\tFIRSTDIR\t0\n"
518 "Two\t\tTwo\tThe Two Feature\t1\t3\tSECONDDIR\t0\n";
520 static const char cf_feature_comp_dat[] =
521 "Feature_\tComponent_\n"
522 "s38\ts72\n"
523 "FeatureComponents\tFeature_\tComponent_\n"
524 "One\tOne\n"
525 "Two\tTwo\n";
527 static const char cf_file_dat[] =
528 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
529 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
530 "File\tFile\n"
531 "one.txt\tOne\tone.txt\t0\t\t\t0\t1\n"
532 "two.txt\tTwo\ttwo.txt\t0\t\t\t0\t2\n";
534 static const char cf_create_folders_dat[] =
535 "Directory_\tComponent_\n"
536 "s72\ts72\n"
537 "CreateFolder\tDirectory_\tComponent_\n"
538 "FIRSTDIR\tOne\n"
539 "SECONDDIR\tTwo\n"
540 "THIRDDIR\tTwo\n";
542 static const char cf_install_exec_seq_dat[] =
543 "Action\tCondition\tSequence\n"
544 "s72\tS255\tI2\n"
545 "InstallExecuteSequence\tAction\n"
546 "CostFinalize\t\t1000\n"
547 "ValidateProductID\t\t700\n"
548 "CostInitialize\t\t800\n"
549 "FileCost\t\t900\n"
550 "RemoveFiles\t\t3500\n"
551 "CreateFolders\t\t3700\n"
552 "RemoveFolders\t\t3800\n"
553 "InstallFiles\t\t4000\n"
554 "RegisterUser\t\t6000\n"
555 "RegisterProduct\t\t6100\n"
556 "PublishFeatures\t\t6300\n"
557 "PublishProduct\t\t6400\n"
558 "InstallFinalize\t\t6600\n"
559 "InstallInitialize\t\t1500\n"
560 "ProcessComponents\t\t1600\n"
561 "UnpublishFeatures\t\t1800\n"
562 "InstallValidate\t\t1400\n"
563 "LaunchConditions\t\t100\n";
565 static const char sr_selfreg_dat[] =
566 "File_\tCost\n"
567 "s72\tI2\n"
568 "SelfReg\tFile_\n"
569 "one.txt\t1\n";
571 static const char sr_install_exec_seq_dat[] =
572 "Action\tCondition\tSequence\n"
573 "s72\tS255\tI2\n"
574 "InstallExecuteSequence\tAction\n"
575 "CostFinalize\t\t1000\n"
576 "CostInitialize\t\t800\n"
577 "FileCost\t\t900\n"
578 "ResolveSource\t\t950\n"
579 "MoveFiles\t\t1700\n"
580 "SelfUnregModules\t\t3900\n"
581 "InstallFiles\t\t4000\n"
582 "DuplicateFiles\t\t4500\n"
583 "WriteEnvironmentStrings\t\t4550\n"
584 "CreateShortcuts\t\t4600\n"
585 "InstallFinalize\t\t6600\n"
586 "InstallInitialize\t\t1500\n"
587 "InstallValidate\t\t1400\n"
588 "LaunchConditions\t\t100\n";
590 static const char font_media_dat[] =
591 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
592 "i2\ti4\tL64\tS255\tS32\tS72\n"
593 "Media\tDiskId\n"
594 "1\t3\t\t\tDISK1\t\n";
596 static const char font_file_dat[] =
597 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
598 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
599 "File\tFile\n"
600 "font.ttf\tfonts\tfont.ttf\t1000\t\t\t8192\t1\n";
602 static const char font_feature_dat[] =
603 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
604 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
605 "Feature\tFeature\n"
606 "fonts\t\t\tfont feature\t1\t2\tMSITESTDIR\t0\n";
608 static const char font_component_dat[] =
609 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
610 "s72\tS38\ts72\ti2\tS255\tS72\n"
611 "Component\tComponent\n"
612 "fonts\t{F5920ED0-1183-4B8F-9330-86CE56557C05}\tMSITESTDIR\t0\t\tfont.ttf\n";
614 static const char font_feature_comp_dat[] =
615 "Feature_\tComponent_\n"
616 "s38\ts72\n"
617 "FeatureComponents\tFeature_\tComponent_\n"
618 "fonts\tfonts\n";
620 static const char font_dat[] =
621 "File_\tFontTitle\n"
622 "s72\tS128\n"
623 "Font\tFile_\n"
624 "font.ttf\tmsi test font\n";
626 static const char font_install_exec_seq_dat[] =
627 "Action\tCondition\tSequence\n"
628 "s72\tS255\tI2\n"
629 "InstallExecuteSequence\tAction\n"
630 "ValidateProductID\t\t700\n"
631 "CostInitialize\t\t800\n"
632 "FileCost\t\t900\n"
633 "CostFinalize\t\t1000\n"
634 "InstallValidate\t\t1400\n"
635 "InstallInitialize\t\t1500\n"
636 "ProcessComponents\t\t1600\n"
637 "UnpublishFeatures\t\t1800\n"
638 "RemoveFiles\t\t3500\n"
639 "InstallFiles\t\t4000\n"
640 "RegisterFonts\t\t4100\n"
641 "UnregisterFonts\t\t4200\n"
642 "RegisterUser\t\t6000\n"
643 "RegisterProduct\t\t6100\n"
644 "PublishFeatures\t\t6300\n"
645 "PublishProduct\t\t6400\n"
646 "InstallFinalize\t\t6600";
648 static const char vp_property_dat[] =
649 "Property\tValue\n"
650 "s72\tl0\n"
651 "Property\tProperty\n"
652 "HASUIRUN\t0\n"
653 "INSTALLLEVEL\t3\n"
654 "InstallMode\tTypical\n"
655 "Manufacturer\tWine\n"
656 "PIDTemplate\t###-#######\n"
657 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
658 "ProductLanguage\t1033\n"
659 "ProductName\tMSITEST\n"
660 "ProductVersion\t1.1.1\n"
661 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
662 "MSIFASTINSTALL\t1\n";
664 static const char vp_custom_action_dat[] =
665 "Action\tType\tSource\tTarget\tISComments\n"
666 "s72\ti2\tS64\tS0\tS255\n"
667 "CustomAction\tAction\n"
668 "SetProductID1\t51\tProductID\t1\t\n"
669 "SetProductID2\t51\tProductID\t2\t\n"
670 "TestProductID1\t19\t\t\tHalts installation\n"
671 "TestProductID2\t19\t\t\tHalts installation\n";
673 static const char vp_install_exec_seq_dat[] =
674 "Action\tCondition\tSequence\n"
675 "s72\tS255\tI2\n"
676 "InstallExecuteSequence\tAction\n"
677 "LaunchConditions\t\t100\n"
678 "CostInitialize\t\t800\n"
679 "FileCost\t\t900\n"
680 "CostFinalize\t\t1000\n"
681 "InstallValidate\t\t1400\n"
682 "InstallInitialize\t\t1500\n"
683 "SetProductID1\tSET_PRODUCT_ID=1\t3000\n"
684 "SetProductID2\tSET_PRODUCT_ID=2\t3100\n"
685 "ValidateProductID\t\t3200\n"
686 "InstallExecute\t\t3300\n"
687 "TestProductID1\tProductID=1\t3400\n"
688 "TestProductID2\tProductID=\"123-1234567\"\t3500\n"
689 "InstallFiles\t\t4000\n"
690 "InstallFinalize\t\t6000\n";
692 static const char odbc_file_dat[] =
693 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
694 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
695 "File\tFile\n"
696 "ODBCdriver.dll\todbc\tODBCdriver.dll\t1000\t\t\t8192\t1\n"
697 "ODBCdriver2.dll\todbc\tODBCdriver2.dll\t1000\t\t\t8192\t2\n"
698 "ODBCtranslator.dll\todbc\tODBCtranslator.dll\t1000\t\t\t8192\t3\n"
699 "ODBCtranslator2.dll\todbc\tODBCtranslator2.dll\t1000\t\t\t8192\t4\n"
700 "ODBCsetup.dll\todbc\tODBCsetup.dll\t1000\t\t\t8192\t5\n";
702 static const char odbc_feature_dat[] =
703 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
704 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
705 "Feature\tFeature\n"
706 "odbc\t\t\todbc feature\t1\t2\tMSITESTDIR\t0\n";
708 static const char odbc_feature_comp_dat[] =
709 "Feature_\tComponent_\n"
710 "s38\ts72\n"
711 "FeatureComponents\tFeature_\tComponent_\n"
712 "odbc\todbc\n";
714 static const char odbc_component_dat[] =
715 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
716 "s72\tS38\ts72\ti2\tS255\tS72\n"
717 "Component\tComponent\n"
718 "odbc\t{B6F3E4AE-35D1-4B72-9044-989F03E20A43}\tMSITESTDIR\t0\t\tODBCdriver.dll\n";
720 static const char odbc_driver_dat[] =
721 "Driver\tComponent_\tDescription\tFile_\tFile_Setup\n"
722 "s72\ts72\ts255\ts72\tS72\n"
723 "ODBCDriver\tDriver\n"
724 "ODBC test driver\todbc\tODBC test driver\tODBCdriver.dll\t\n"
725 "ODBC test driver2\todbc\tODBC test driver2\tODBCdriver2.dll\tODBCsetup.dll\n";
727 static const char odbc_translator_dat[] =
728 "Translator\tComponent_\tDescription\tFile_\tFile_Setup\n"
729 "s72\ts72\ts255\ts72\tS72\n"
730 "ODBCTranslator\tTranslator\n"
731 "ODBC test translator\todbc\tODBC test translator\tODBCtranslator.dll\t\n"
732 "ODBC test translator2\todbc\tODBC test translator2\tODBCtranslator2.dll\tODBCsetup.dll\n";
734 static const char odbc_datasource_dat[] =
735 "DataSource\tComponent_\tDescription\tDriverDescription\tRegistration\n"
736 "s72\ts72\ts255\ts255\ti2\n"
737 "ODBCDataSource\tDataSource\n"
738 "ODBC data source\todbc\tODBC data source\tODBC driver\t0\n";
740 static const char odbc_install_exec_seq_dat[] =
741 "Action\tCondition\tSequence\n"
742 "s72\tS255\tI2\n"
743 "InstallExecuteSequence\tAction\n"
744 "LaunchConditions\t\t100\n"
745 "CostInitialize\t\t800\n"
746 "FileCost\t\t900\n"
747 "CostFinalize\t\t1000\n"
748 "InstallValidate\t\t1400\n"
749 "InstallInitialize\t\t1500\n"
750 "ProcessComponents\t\t1600\n"
751 "InstallODBC\t\t3000\n"
752 "RemoveODBC\t\t3100\n"
753 "RemoveFiles\t\t3900\n"
754 "InstallFiles\t\t4000\n"
755 "RegisterProduct\t\t5000\n"
756 "PublishFeatures\t\t5100\n"
757 "PublishProduct\t\t5200\n"
758 "InstallFinalize\t\t6000\n";
760 static const char odbc_media_dat[] =
761 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
762 "i2\ti4\tL64\tS255\tS32\tS72\n"
763 "Media\tDiskId\n"
764 "1\t5\t\t\tDISK1\t\n";
766 static const char tl_file_dat[] =
767 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
768 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
769 "File\tFile\n"
770 "typelib.dll\ttypelib\ttypelib.dll\t1000\t\t\t8192\t1\n";
772 static const char tl_feature_dat[] =
773 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
774 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
775 "Feature\tFeature\n"
776 "typelib\t\t\ttypelib feature\t1\t2\tMSITESTDIR\t0\n";
778 static const char tl_feature_comp_dat[] =
779 "Feature_\tComponent_\n"
780 "s38\ts72\n"
781 "FeatureComponents\tFeature_\tComponent_\n"
782 "typelib\ttypelib\n";
784 static const char tl_component_dat[] =
785 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
786 "s72\tS38\ts72\ti2\tS255\tS72\n"
787 "Component\tComponent\n"
788 "typelib\t{BB4C26FD-89D8-4E49-AF1C-DB4DCB5BF1B0}\tMSITESTDIR\t0\t\ttypelib.dll\n";
790 static const char tl_typelib_dat[] =
791 "LibID\tLanguage\tComponent_\tVersion\tDescription\tDirectory_\tFeature_\tCost\n"
792 "s38\ti2\ts72\tI4\tL128\tS72\ts38\tI4\n"
793 "TypeLib\tLibID\tLanguage\tComponent_\n"
794 "{EAC5166A-9734-4D91-878F-1DD02304C66C}\t0\ttypelib\t1793\t\tMSITESTDIR\ttypelib\t\n";
796 static const char tl_install_exec_seq_dat[] =
797 "Action\tCondition\tSequence\n"
798 "s72\tS255\tI2\n"
799 "InstallExecuteSequence\tAction\n"
800 "LaunchConditions\t\t100\n"
801 "CostInitialize\t\t800\n"
802 "FileCost\t\t900\n"
803 "CostFinalize\t\t1000\n"
804 "InstallValidate\t\t1400\n"
805 "InstallInitialize\t\t1500\n"
806 "ProcessComponents\t\t1600\n"
807 "RemoveFiles\t\t1700\n"
808 "InstallFiles\t\t2000\n"
809 "RegisterTypeLibraries\tREGISTER_TYPELIB=1\t3000\n"
810 "UnregisterTypeLibraries\t\t3100\n"
811 "RegisterProduct\t\t5100\n"
812 "PublishFeatures\t\t5200\n"
813 "PublishProduct\t\t5300\n"
814 "InstallFinalize\t\t6000\n";
816 static const char crs_file_dat[] =
817 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
818 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
819 "File\tFile\n"
820 "target.txt\tshortcut\ttarget.txt\t1000\t\t\t8192\t1\n";
822 static const char crs_feature_dat[] =
823 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
824 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
825 "Feature\tFeature\n"
826 "shortcut\t\t\tshortcut feature\t1\t2\tMSITESTDIR\t0\n";
828 static const char crs_feature_comp_dat[] =
829 "Feature_\tComponent_\n"
830 "s38\ts72\n"
831 "FeatureComponents\tFeature_\tComponent_\n"
832 "shortcut\tshortcut\n";
834 static const char crs_component_dat[] =
835 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
836 "s72\tS38\ts72\ti2\tS255\tS72\n"
837 "Component\tComponent\n"
838 "shortcut\t{5D20E3C6-7206-498F-AC28-87AF2F9AD4CC}\tMSITESTDIR\t0\t\ttarget.txt\n";
840 static const char crs_shortcut_dat[] =
841 "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
842 "s72\ts72\tl128\ts72\ts72\tL255\tL255\tI2\tS72\tI2\tI2\tS72\n"
843 "Shortcut\tShortcut\n"
844 "shortcut\tMSITESTDIR\tshortcut\tshortcut\t[MSITESTDIR]target.txt\t\t\t\t\t\t\t\n";
846 static const char crs_install_exec_seq_dat[] =
847 "Action\tCondition\tSequence\n"
848 "s72\tS255\tI2\n"
849 "InstallExecuteSequence\tAction\n"
850 "LaunchConditions\t\t100\n"
851 "CostInitialize\t\t800\n"
852 "FileCost\t\t900\n"
853 "CostFinalize\t\t1000\n"
854 "InstallValidate\t\t1400\n"
855 "InstallInitialize\t\t1500\n"
856 "ProcessComponents\t\t1600\n"
857 "RemoveFiles\t\t1700\n"
858 "InstallFiles\t\t2000\n"
859 "RemoveShortcuts\t\t3000\n"
860 "CreateShortcuts\t\t3100\n"
861 "RegisterProduct\t\t5000\n"
862 "PublishFeatures\t\t5100\n"
863 "PublishProduct\t\t5200\n"
864 "InstallFinalize\t\t6000\n";
866 static const char pub_file_dat[] =
867 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
868 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
869 "File\tFile\n"
870 "english.txt\tpublish\tenglish.txt\t1000\t\t\t8192\t1\n";
872 static const char pub_feature_dat[] =
873 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
874 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
875 "Feature\tFeature\n"
876 "publish\t\t\tpublish feature\t1\t2\tMSITESTDIR\t0\n";
878 static const char pub_feature_comp_dat[] =
879 "Feature_\tComponent_\n"
880 "s38\ts72\n"
881 "FeatureComponents\tFeature_\tComponent_\n"
882 "publish\tpublish\n";
884 static const char pub_component_dat[] =
885 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
886 "s72\tS38\ts72\ti2\tS255\tS72\n"
887 "Component\tComponent\n"
888 "publish\t{B4EA0ACF-6238-426E-9C6D-7869F0F9C768}\tMSITESTDIR\t0\t\tenglish.txt\n";
890 static const char pub_publish_component_dat[] =
891 "ComponentId\tQualifier\tComponent_\tAppData\tFeature_\n"
892 "s38\ts255\ts72\tL255\ts38\n"
893 "PublishComponent\tComponentId\tQualifier\tComponent_\n"
894 "{92AFCBC0-9CA6-4270-8454-47C5EE2B8FAA}\tenglish.txt\tpublish\t\tpublish\n";
896 static const char pub_install_exec_seq_dat[] =
897 "Action\tCondition\tSequence\n"
898 "s72\tS255\tI2\n"
899 "InstallExecuteSequence\tAction\n"
900 "LaunchConditions\t\t100\n"
901 "CostInitialize\t\t800\n"
902 "FileCost\t\t900\n"
903 "CostFinalize\t\t1000\n"
904 "InstallValidate\t\t1400\n"
905 "InstallInitialize\t\t1500\n"
906 "ProcessComponents\t\t1600\n"
907 "RemoveFiles\t\t1700\n"
908 "InstallFiles\t\t2000\n"
909 "PublishComponents\t\t3000\n"
910 "UnpublishComponents\t\t3100\n"
911 "RegisterProduct\t\t5000\n"
912 "PublishFeatures\t\t5100\n"
913 "PublishProduct\t\t5200\n"
914 "InstallFinalize\t\t6000\n";
916 static const char rd_file_dat[] =
917 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
918 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
919 "File\tFile\n"
920 "original.txt\tduplicate\toriginal.txt\t1000\t\t\t8192\t1\n"
921 "original2.txt\tduplicate\toriginal2.txt\t1000\t\t\t8192\t2\n"
922 "original3.txt\tduplicate2\toriginal3.txt\t1000\t\t\t8192\t3\n";
924 static const char rd_feature_dat[] =
925 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
926 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
927 "Feature\tFeature\n"
928 "duplicate\t\t\tduplicate feature\t1\t2\tMSITESTDIR\t0\n";
930 static const char rd_feature_comp_dat[] =
931 "Feature_\tComponent_\n"
932 "s38\ts72\n"
933 "FeatureComponents\tFeature_\tComponent_\n"
934 "duplicate\tduplicate\n";
936 static const char rd_component_dat[] =
937 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
938 "s72\tS38\ts72\ti2\tS255\tS72\n"
939 "Component\tComponent\n"
940 "duplicate\t{EB45D06A-ADFE-44E3-8D41-B7DE150E41AD}\tMSITESTDIR\t0\t\toriginal.txt\n"
941 "duplicate2\t{B8BA60E0-B2E9-488E-9D0E-E60F25F04F97}\tMSITESTDIR\t0\tDUPLICATE2=1\toriginal3.txt\n";
943 static const char rd_duplicate_file_dat[] =
944 "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
945 "s72\ts72\ts72\tS255\tS72\n"
946 "DuplicateFile\tFileKey\n"
947 "duplicate\tduplicate\toriginal.txt\tduplicate.txt\t\n"
948 "duplicate2\tduplicate\toriginal2.txt\t\tMSITESTDIR\n"
949 "duplicate3\tduplicate2\toriginal3.txt\tduplicate2.txt\t\n";
951 static const char rd_install_exec_seq_dat[] =
952 "Action\tCondition\tSequence\n"
953 "s72\tS255\tI2\n"
954 "InstallExecuteSequence\tAction\n"
955 "LaunchConditions\t\t100\n"
956 "CostInitialize\t\t800\n"
957 "FileCost\t\t900\n"
958 "CostFinalize\t\t1000\n"
959 "InstallValidate\t\t1400\n"
960 "InstallInitialize\t\t1500\n"
961 "ProcessComponents\t\t1600\n"
962 "RemoveDuplicateFiles\t\t1900\n"
963 "InstallFiles\t\t2000\n"
964 "DuplicateFiles\t\t2100\n"
965 "RegisterProduct\t\t5000\n"
966 "PublishFeatures\t\t5100\n"
967 "PublishProduct\t\t5200\n"
968 "InstallFinalize\t\t6000\n";
970 static const char rrv_file_dat[] =
971 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
972 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
973 "File\tFile\n"
974 "registry.txt\tregistry\tregistry.txt\t1000\t\t\t8192\t1\n";
976 static const char rrv_feature_dat[] =
977 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
978 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
979 "Feature\tFeature\n"
980 "registry\t\t\tregistry feature\t1\t2\tMSITESTDIR\t0\n";
982 static const char rrv_feature_comp_dat[] =
983 "Feature_\tComponent_\n"
984 "s38\ts72\n"
985 "FeatureComponents\tFeature_\tComponent_\n"
986 "registry\tregistry\n";
988 static const char rrv_component_dat[] =
989 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
990 "s72\tS38\ts72\ti2\tS255\tS72\n"
991 "Component\tComponent\n"
992 "registry\t{DA97585B-962D-45EB-AD32-DA15E60CA9EE}\tMSITESTDIR\t0\t\tregistry.txt\n";
994 static const char rrv_registry_dat[] =
995 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
996 "s72\ti2\tl255\tL255\tL0\ts72\n"
997 "Registry\tRegistry\n"
998 "reg1\t2\tSOFTWARE\\Wine\\keyA\t\tA\tregistry\n"
999 "reg2\t2\tSOFTWARE\\Wine\\keyA\tvalueA\tA\tregistry\n"
1000 "reg3\t2\tSOFTWARE\\Wine\\key1\t-\t\tregistry\n";
1002 static const char rrv_remove_registry_dat[] =
1003 "RemoveRegistry\tRoot\tKey\tName\tComponent_\n"
1004 "s72\ti2\tl255\tL255\ts72\n"
1005 "RemoveRegistry\tRemoveRegistry\n"
1006 "reg1\t2\tSOFTWARE\\Wine\\keyB\t\tregistry\n"
1007 "reg2\t2\tSOFTWARE\\Wine\\keyB\tValueB\tregistry\n"
1008 "reg3\t2\tSOFTWARE\\Wine\\key2\t-\tregistry\n";
1010 static const char rrv_install_exec_seq_dat[] =
1011 "Action\tCondition\tSequence\n"
1012 "s72\tS255\tI2\n"
1013 "InstallExecuteSequence\tAction\n"
1014 "LaunchConditions\t\t100\n"
1015 "CostInitialize\t\t800\n"
1016 "FileCost\t\t900\n"
1017 "CostFinalize\t\t1000\n"
1018 "InstallValidate\t\t1400\n"
1019 "InstallInitialize\t\t1500\n"
1020 "ProcessComponents\t\t1600\n"
1021 "RemoveFiles\t\t1700\n"
1022 "InstallFiles\t\t2000\n"
1023 "RemoveRegistryValues\t\t3000\n"
1024 "RegisterProduct\t\t5000\n"
1025 "PublishFeatures\t\t5100\n"
1026 "PublishProduct\t\t5200\n"
1027 "InstallFinalize\t\t6000\n";
1029 static const char frp_file_dat[] =
1030 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1031 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1032 "File\tFile\n"
1033 "product.txt\tproduct\tproduct.txt\t1000\t\t\t8192\t1\n";
1035 static const char frp_feature_dat[] =
1036 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1037 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1038 "Feature\tFeature\n"
1039 "product\t\t\tproduct feature\t1\t2\tMSITESTDIR\t0\n";
1041 static const char frp_feature_comp_dat[] =
1042 "Feature_\tComponent_\n"
1043 "s38\ts72\n"
1044 "FeatureComponents\tFeature_\tComponent_\n"
1045 "product\tproduct\n";
1047 static const char frp_component_dat[] =
1048 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1049 "s72\tS38\ts72\ti2\tS255\tS72\n"
1050 "Component\tComponent\n"
1051 "product\t{44725EE0-EEA8-40BD-8162-A48224A2FEA1}\tMSITESTDIR\t0\t\tproduct.txt\n";
1053 static const char frp_custom_action_dat[] =
1054 "Action\tType\tSource\tTarget\tISComments\n"
1055 "s72\ti2\tS64\tS0\tS255\n"
1056 "CustomAction\tAction\n"
1057 "TestProp\t19\t\t\tPROP set\n";
1059 static const char frp_upgrade_dat[] =
1060 "UpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\tRemove\tActionProperty\n"
1061 "s38\tS20\tS20\tS255\ti4\tS255\ts72\n"
1062 "Upgrade\tUpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\n"
1063 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}\t1.1.1\t2.2.2\t\t768\t\tPROP\n";
1065 static const char frp_install_exec_seq_dat[] =
1066 "Action\tCondition\tSequence\n"
1067 "s72\tS255\tI2\n"
1068 "InstallExecuteSequence\tAction\n"
1069 "FindRelatedProducts\t\t50\n"
1070 "TestProp\tPROP AND NOT REMOVE\t51\n"
1071 "LaunchConditions\t\t100\n"
1072 "CostInitialize\t\t800\n"
1073 "FileCost\t\t900\n"
1074 "CostFinalize\t\t1000\n"
1075 "InstallValidate\t\t1400\n"
1076 "InstallInitialize\t\t1500\n"
1077 "ProcessComponents\t\t1600\n"
1078 "RemoveFiles\t\t1700\n"
1079 "InstallFiles\t\t2000\n"
1080 "RegisterProduct\t\t5000\n"
1081 "PublishFeatures\t\t5100\n"
1082 "PublishProduct\t\t5200\n"
1083 "InstallFinalize\t\t6000\n";
1085 static const char riv_file_dat[] =
1086 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1087 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1088 "File\tFile\n"
1089 "inifile.txt\tinifile\tinifile.txt\t1000\t\t\t8192\t1\n";
1091 static const char riv_feature_dat[] =
1092 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1093 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1094 "Feature\tFeature\n"
1095 "inifile\t\t\tinifile feature\t1\t2\tMSITESTDIR\t0\n";
1097 static const char riv_feature_comp_dat[] =
1098 "Feature_\tComponent_\n"
1099 "s38\ts72\n"
1100 "FeatureComponents\tFeature_\tComponent_\n"
1101 "inifile\tinifile\n";
1103 static const char riv_component_dat[] =
1104 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1105 "s72\tS38\ts72\ti2\tS255\tS72\n"
1106 "Component\tComponent\n"
1107 "inifile\t{A0F15705-4F57-4437-88C4-6C8B37ACC6DE}\tMSITESTDIR\t0\t\tinifile.txt\n";
1109 static const char riv_ini_file_dat[] =
1110 "IniFile\tFileName\tDirProperty\tSection\tKey\tValue\tAction\tComponent_\n"
1111 "s72\tl255\tS72\tl96\tl128\tl255\ti2\ts72\n"
1112 "IniFile\tIniFile\n"
1113 "inifile1\ttest.ini\tMSITESTDIR\tsection1\tkey1\tvalue1\t0\tinifile\n";
1115 static const char riv_remove_ini_file_dat[] =
1116 "RemoveIniFile\tFileName\tDirProperty\tSection\tKey\tValue\tAction\tComponent_\n"
1117 "s72\tl255\tS72\tl96\tl128\tL255\ti2\ts72\n"
1118 "RemoveIniFile\tRemoveIniFile\n"
1119 "inifile1\ttest.ini\tMSITESTDIR\tsectionA\tkeyA\tvalueA\t2\tinifile\n";
1121 static const char riv_install_exec_seq_dat[] =
1122 "Action\tCondition\tSequence\n"
1123 "s72\tS255\tI2\n"
1124 "InstallExecuteSequence\tAction\n"
1125 "LaunchConditions\t\t100\n"
1126 "CostInitialize\t\t800\n"
1127 "FileCost\t\t900\n"
1128 "CostFinalize\t\t1000\n"
1129 "InstallValidate\t\t1400\n"
1130 "InstallInitialize\t\t1500\n"
1131 "ProcessComponents\t\t1600\n"
1132 "RemoveFiles\t\t1700\n"
1133 "InstallFiles\t\t2000\n"
1134 "RemoveIniValues\t\t3000\n"
1135 "RegisterProduct\t\t5000\n"
1136 "PublishFeatures\t\t5100\n"
1137 "PublishProduct\t\t5200\n"
1138 "InstallFinalize\t\t6000\n";
1140 static const char res_file_dat[] =
1141 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1142 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1143 "File\tFile\n"
1144 "envvar.txt\tenvvar\tenvvar.txt\t1000\t\t\t8192\t1\n";
1146 static const char res_feature_dat[] =
1147 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1148 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1149 "Feature\tFeature\n"
1150 "envvar\t\t\tenvvar feature\t1\t2\tMSITESTDIR\t0\n";
1152 static const char res_feature_comp_dat[] =
1153 "Feature_\tComponent_\n"
1154 "s38\ts72\n"
1155 "FeatureComponents\tFeature_\tComponent_\n"
1156 "envvar\tenvvar\n";
1158 static const char res_component_dat[] =
1159 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1160 "s72\tS38\ts72\ti2\tS255\tS72\n"
1161 "Component\tComponent\n"
1162 "envvar\t{45EE9AF4-E5D1-445F-8BB7-B22D4EEBD29E}\tMSITESTDIR\t0\t\tenvvar.txt\n";
1164 static const char res_environment_dat[] =
1165 "Environment\tName\tValue\tComponent_\n"
1166 "s72\tl255\tL255\ts72\n"
1167 "Environment\tEnvironment\n"
1168 "var1\t=-MSITESTVAR1\t1\tenvvar\n"
1169 "var2\t=+-MSITESTVAR2\t1\tenvvar\n"
1170 "var3\t=MSITESTVAR3\t1\tenvvar\n"
1171 "var4\t=-MSITESTVAR4\t\tenvvar\n"
1172 "var5\t=MSITESTVAR5\t\tenvvar\n";
1174 static const char res_install_exec_seq_dat[] =
1175 "Action\tCondition\tSequence\n"
1176 "s72\tS255\tI2\n"
1177 "InstallExecuteSequence\tAction\n"
1178 "LaunchConditions\t\t100\n"
1179 "CostInitialize\t\t800\n"
1180 "FileCost\t\t900\n"
1181 "CostFinalize\t\t1000\n"
1182 "InstallValidate\t\t1400\n"
1183 "InstallInitialize\t\t1500\n"
1184 "ProcessComponents\t\t1600\n"
1185 "RemoveFiles\t\t1700\n"
1186 "InstallFiles\t\t2000\n"
1187 "RemoveEnvironmentStrings\t\t3000\n"
1188 "RegisterProduct\t\t5000\n"
1189 "PublishFeatures\t\t5100\n"
1190 "PublishProduct\t\t5200\n"
1191 "InstallFinalize\t\t6000\n";
1193 static const char rci_file_dat[] =
1194 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1195 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1196 "File\tFile\n"
1197 "class.txt\tclass\tclass.txt\t1000\t\t\t8192\t1\n";
1199 static const char rci_feature_dat[] =
1200 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1201 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1202 "Feature\tFeature\n"
1203 "class\t\t\tclass feature\t1\t2\tMSITESTDIR\t0\n";
1205 static const char rci_feature_comp_dat[] =
1206 "Feature_\tComponent_\n"
1207 "s38\ts72\n"
1208 "FeatureComponents\tFeature_\tComponent_\n"
1209 "class\tclass\n";
1211 static const char rci_component_dat[] =
1212 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1213 "s72\tS38\ts72\ti2\tS255\tS72\n"
1214 "Component\tComponent\n"
1215 "class\t{89A98345-F8A1-422E-A48B-0250B5809F2D}\tMSITESTDIR\t0\t\tclass.txt\n";
1217 static const char rci_appid_dat[] =
1218 "AppId\tRemoteServerName\tLocalService\tServiceParameters\tDllSurrogate\tActivateAtStorage\tRunAsInteractiveUser\n"
1219 "s38\tS255\tS255\tS255\tS255\tI2\tI2\n"
1220 "AppId\tAppId\n"
1221 "{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\t\t\t\t\t\t\n";
1223 static const char rci_class_dat[] =
1224 "CLSID\tContext\tComponent_\tProgId_Default\tDescription\tAppId_\tFileTypeMask\tIcon_\tIconIndex\tDefInprocHandler\tArgument\tFeature_\tAttributes\n"
1225 "s38\ts32\ts72\tS255\tL255\tS38\tS255\tS72\tI2\tS32\tS255\ts38\tI2\n"
1226 "Class\tCLSID\tContext\tComponent_\n"
1227 "{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tLocalServer\tclass\t\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tclass\t\n";
1229 static const char rci_install_exec_seq_dat[] =
1230 "Action\tCondition\tSequence\n"
1231 "s72\tS255\tI2\n"
1232 "InstallExecuteSequence\tAction\n"
1233 "LaunchConditions\t\t100\n"
1234 "CostInitialize\t\t800\n"
1235 "FileCost\t\t900\n"
1236 "CostFinalize\t\t1000\n"
1237 "InstallValidate\t\t1400\n"
1238 "InstallInitialize\t\t1500\n"
1239 "ProcessComponents\t\t1600\n"
1240 "RemoveFiles\t\t1700\n"
1241 "InstallFiles\t\t2000\n"
1242 "UnregisterClassInfo\t\t3000\n"
1243 "RegisterClassInfo\t\t4000\n"
1244 "RegisterProduct\t\t5000\n"
1245 "PublishFeatures\t\t5100\n"
1246 "PublishProduct\t\t5200\n"
1247 "InstallFinalize\t\t6000\n";
1249 static const char rei_file_dat[] =
1250 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1251 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1252 "File\tFile\n"
1253 "extension.txt\textension\textension.txt\t1000\t\t\t8192\t1\n";
1255 static const char rei_feature_dat[] =
1256 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1257 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1258 "Feature\tFeature\n"
1259 "extension\t\t\textension feature\t1\t2\tMSITESTDIR\t0\n";
1261 static const char rei_feature_comp_dat[] =
1262 "Feature_\tComponent_\n"
1263 "s38\ts72\n"
1264 "FeatureComponents\tFeature_\tComponent_\n"
1265 "extension\textension\n";
1267 static const char rei_component_dat[] =
1268 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1269 "s72\tS38\ts72\ti2\tS255\tS72\n"
1270 "Component\tComponent\n"
1271 "extension\t{9A3060D4-60BA-4A82-AB55-9FB148AD013C}\tMSITESTDIR\t0\t\textension.txt\n";
1273 static const char rei_extension_dat[] =
1274 "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n"
1275 "s255\ts72\tS255\tS64\ts38\n"
1276 "Extension\tExtension\tComponent_\n"
1277 "extension\textension\tProg.Id.1\t\textension\n";
1279 static const char rei_verb_dat[] =
1280 "Extension_\tVerb\tSequence\tCommand\tArgument\n"
1281 "s255\ts32\tI2\tL255\tL255\n"
1282 "Verb\tExtension_\tVerb\n"
1283 "extension\tOpen\t1\t&Open\t/argument\n";
1285 static const char rei_progid_dat[] =
1286 "ProgId\tProgId_Parent\tClass_\tDescription\tIcon_\tIconIndex\n"
1287 "s255\tS255\tS38\tL255\tS72\tI2\n"
1288 "ProgId\tProgId\n"
1289 "Prog.Id.1\t\t\tdescription\t\t\n";
1291 static const char rei_install_exec_seq_dat[] =
1292 "Action\tCondition\tSequence\n"
1293 "s72\tS255\tI2\n"
1294 "InstallExecuteSequence\tAction\n"
1295 "LaunchConditions\t\t100\n"
1296 "CostInitialize\t\t800\n"
1297 "FileCost\t\t900\n"
1298 "CostFinalize\t\t1000\n"
1299 "InstallValidate\t\t1400\n"
1300 "InstallInitialize\t\t1500\n"
1301 "ProcessComponents\t\t1600\n"
1302 "RemoveFiles\t\t1700\n"
1303 "InstallFiles\t\t2000\n"
1304 "UnregisterExtensionInfo\t\t3000\n"
1305 "RegisterExtensionInfo\t\t4000\n"
1306 "RegisterProduct\t\t5000\n"
1307 "PublishFeatures\t\t5100\n"
1308 "PublishProduct\t\t5200\n"
1309 "InstallFinalize\t\t6000\n";
1311 static const char rmi_file_dat[] =
1312 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1313 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1314 "File\tFile\n"
1315 "mime.txt\tmime\tmime.txt\t1000\t\t\t8192\t1\n";
1317 static const char rmi_feature_dat[] =
1318 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1319 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1320 "Feature\tFeature\n"
1321 "mime\t\t\tmime feature\t1\t2\tMSITESTDIR\t0\n";
1323 static const char rmi_feature_comp_dat[] =
1324 "Feature_\tComponent_\n"
1325 "s38\ts72\n"
1326 "FeatureComponents\tFeature_\tComponent_\n"
1327 "mime\tmime\n";
1329 static const char rmi_component_dat[] =
1330 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1331 "s72\tS38\ts72\ti2\tS255\tS72\n"
1332 "Component\tComponent\n"
1333 "mime\t{A1D630CE-13A7-4882-AFDD-148E2BBAFC6D}\tMSITESTDIR\t0\t\tmime.txt\n";
1335 static const char rmi_extension_dat[] =
1336 "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n"
1337 "s255\ts72\tS255\tS64\ts38\n"
1338 "Extension\tExtension\tComponent_\n"
1339 "mime\tmime\t\tmime/type\tmime\n";
1341 static const char rmi_verb_dat[] =
1342 "Extension_\tVerb\tSequence\tCommand\tArgument\n"
1343 "s255\ts32\tI2\tL255\tL255\n"
1344 "Verb\tExtension_\tVerb\n"
1345 "mime\tOpen\t1\t&Open\t/argument\n";
1347 static const char rmi_mime_dat[] =
1348 "ContentType\tExtension_\tCLSID\n"
1349 "s64\ts255\tS38\n"
1350 "MIME\tContentType\n"
1351 "mime/type\tmime\t\n";
1353 static const char rmi_install_exec_seq_dat[] =
1354 "Action\tCondition\tSequence\n"
1355 "s72\tS255\tI2\n"
1356 "InstallExecuteSequence\tAction\n"
1357 "LaunchConditions\t\t100\n"
1358 "CostInitialize\t\t800\n"
1359 "FileCost\t\t900\n"
1360 "CostFinalize\t\t1000\n"
1361 "InstallValidate\t\t1400\n"
1362 "InstallInitialize\t\t1500\n"
1363 "ProcessComponents\t\t1600\n"
1364 "RemoveFiles\t\t1700\n"
1365 "InstallFiles\t\t2000\n"
1366 "UnregisterExtensionInfo\t\t3000\n"
1367 "UnregisterMIMEInfo\t\t3500\n"
1368 "RegisterExtensionInfo\t\t4000\n"
1369 "RegisterMIMEInfo\t\t4500\n"
1370 "RegisterProduct\t\t5000\n"
1371 "PublishFeatures\t\t5100\n"
1372 "PublishProduct\t\t5200\n"
1373 "InstallFinalize\t\t6000\n";
1375 static const char pa_file_dat[] =
1376 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1377 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1378 "File\tFile\n"
1379 "win32.txt\twin32\twin32.txt\t1000\t\t\t8192\t1\n"
1380 "manifest.txt\twin32\tmanifest.txt\t1000\t\t\t8192\t1\n"
1381 "win32_local.txt\twin32_local\twin32_local.txt\t1000\t\t\t8192\t1\n"
1382 "manifest_local.txt\twin32_local\tmanifest_local.txt\t1000\t\t\t8192\t1\n"
1383 "dotnet.txt\tdotnet\tdotnet.txt\t1000\t\t\t8192\t1\n"
1384 "dotnet_local.txt\tdotnet_local\tdotnet_local.txt\t1000\t\t\t8192\t1\n"
1385 "application_win32.txt\twin32_local\tapplication_win32.txt\t1000\t\t\t8192\t1\n"
1386 "application_dotnet.txt\tdotnet_local\tapplication_dotnet.txt\t1000\t\t\t8192\t1\n";
1388 static const char pa_feature_dat[] =
1389 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1390 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1391 "Feature\tFeature\n"
1392 "assembly\t\t\tassembly feature\t1\t2\tMSITESTDIR\t0\n";
1394 static const char pa_feature_comp_dat[] =
1395 "Feature_\tComponent_\n"
1396 "s38\ts72\n"
1397 "FeatureComponents\tFeature_\tComponent_\n"
1398 "assembly\twin32\n"
1399 "assembly\twin32_local\n"
1400 "assembly\tdotnet\n"
1401 "assembly\tdotnet_local\n";
1403 static const char pa_component_dat[] =
1404 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1405 "s72\tS38\ts72\ti2\tS255\tS72\n"
1406 "Component\tComponent\n"
1407 "win32\t{F515549E-7E61-425D-AAC1-9BEF2E066D06}\tMSITESTDIR\t0\t\twin32.txt\n"
1408 "win32_local\t{D34D3FBA-6789-4E57-AD1A-1281297DC201}\tMSITESTDIR\t0\t\twin32_local.txt\n"
1409 "dotnet\t{8943164F-2B31-4C09-A894-493A8CBDE0A4}\tMSITESTDIR\t0\t\tdotnet.txt\n"
1410 "dotnet_local\t{4E8567E8-8EAE-4E36-90F1-B99D33C663F8}\tMSITESTDIR\t0\t\tdotnet_local.txt\n";
1412 static const char pa_msi_assembly_dat[] =
1413 "Component_\tFeature_\tFile_Manifest\tFile_Application\tAttributes\n"
1414 "s72\ts38\tS72\tS72\tI2\n"
1415 "MsiAssembly\tComponent_\n"
1416 "win32\tassembly\tmanifest.txt\t\t1\n"
1417 "win32_local\tassembly\tmanifest_local.txt\tapplication_win32.txt\t1\n"
1418 "dotnet\tassembly\t\t\t0\n"
1419 "dotnet_local\tassembly\t\tapplication_dotnet.txt\t0\n";
1421 static const char pa_msi_assembly_name_dat[] =
1422 "Component_\tName\tValue\n"
1423 "s72\ts255\ts255\n"
1424 "MsiAssemblyName\tComponent_\tName\n"
1425 "win32\tName\tWine.Win32.Assembly\n"
1426 "win32\tprocessorArchitecture\tx86\n"
1427 "win32\tpublicKeyToken\tabcdef0123456789\n"
1428 "win32\ttype\twin32\n"
1429 "win32\tversion\t1.0.0.0\n"
1430 "win32_local\tName\tWine.Win32.Local.Assembly\n"
1431 "win32_local\tprocessorArchitecture\tx86\n"
1432 "win32_local\tpublicKeyToken\tabcdef0123456789\n"
1433 "win32_local\ttype\twin32\n"
1434 "win32_local\tversion\t1.0.0.0\n"
1435 "dotnet\tName\tWine.Dotnet.Assembly\n"
1436 "dotnet\tprocessorArchitecture\tMSIL\n"
1437 "dotnet\tpublicKeyToken\tabcdef0123456789\n"
1438 "dotnet\tculture\tneutral\n"
1439 "dotnet\tversion\t1.0.0.0\n"
1440 "dotnet_local\tName\tWine.Dotnet.Local.Assembly\n"
1441 "dotnet_local\tprocessorArchitecture\tMSIL\n"
1442 "dotnet_local\tpublicKeyToken\tabcdef0123456789\n"
1443 "dotnet_local\tculture\tneutral\n"
1444 "dotnet_local\tversion\t1.0.0.0\n";
1446 static const char pa_install_exec_seq_dat[] =
1447 "Action\tCondition\tSequence\n"
1448 "s72\tS255\tI2\n"
1449 "InstallExecuteSequence\tAction\n"
1450 "LaunchConditions\t\t100\n"
1451 "CostInitialize\t\t800\n"
1452 "FileCost\t\t900\n"
1453 "CostFinalize\t\t1000\n"
1454 "InstallValidate\t\t1400\n"
1455 "InstallInitialize\t\t1500\n"
1456 "ProcessComponents\t\t1600\n"
1457 "MsiPublishAssemblies\t\t3000\n"
1458 "MsiUnpublishAssemblies\t\t4000\n"
1459 "RegisterProduct\t\t5000\n"
1460 "PublishFeatures\t\t5100\n"
1461 "PublishProduct\t\t5200\n"
1462 "InstallFinalize\t\t6000\n";
1464 typedef struct _msi_table
1466 const char *filename;
1467 const char *data;
1468 unsigned int size;
1469 } msi_table;
1471 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
1473 static const msi_table env_tables[] =
1475 ADD_TABLE(component),
1476 ADD_TABLE(directory),
1477 ADD_TABLE(feature),
1478 ADD_TABLE(feature_comp),
1479 ADD_TABLE(file),
1480 ADD_TABLE(install_exec_seq),
1481 ADD_TABLE(media),
1482 ADD_TABLE(property),
1483 ADD_TABLE(environment)
1486 static const msi_table pp_tables[] =
1488 ADD_TABLE(pp_component),
1489 ADD_TABLE(directory),
1490 ADD_TABLE(rof_feature),
1491 ADD_TABLE(rof_feature_comp),
1492 ADD_TABLE(rof_file),
1493 ADD_TABLE(pp_install_exec_seq),
1494 ADD_TABLE(rof_media),
1495 ADD_TABLE(property),
1498 static const msi_table ppc_tables[] =
1500 ADD_TABLE(ppc_component),
1501 ADD_TABLE(directory),
1502 ADD_TABLE(rof_feature),
1503 ADD_TABLE(ppc_feature_comp),
1504 ADD_TABLE(ppc_file),
1505 ADD_TABLE(pp_install_exec_seq),
1506 ADD_TABLE(ppc_media),
1507 ADD_TABLE(property),
1510 static const msi_table rem_tables[] =
1512 ADD_TABLE(rem_component),
1513 ADD_TABLE(directory),
1514 ADD_TABLE(rof_feature),
1515 ADD_TABLE(rem_feature_comp),
1516 ADD_TABLE(rem_file),
1517 ADD_TABLE(rem_install_exec_seq),
1518 ADD_TABLE(rof_media),
1519 ADD_TABLE(property),
1520 ADD_TABLE(rem_remove_files),
1523 static const msi_table mov_tables[] =
1525 ADD_TABLE(cwd_component),
1526 ADD_TABLE(directory),
1527 ADD_TABLE(rof_feature),
1528 ADD_TABLE(ci2_feature_comp),
1529 ADD_TABLE(ci2_file),
1530 ADD_TABLE(install_exec_seq),
1531 ADD_TABLE(rof_media),
1532 ADD_TABLE(property),
1533 ADD_TABLE(mov_move_file),
1536 static const msi_table df_tables[] =
1538 ADD_TABLE(rof_component),
1539 ADD_TABLE(df_directory),
1540 ADD_TABLE(rof_feature),
1541 ADD_TABLE(rof_feature_comp),
1542 ADD_TABLE(rof_file),
1543 ADD_TABLE(install_exec_seq),
1544 ADD_TABLE(rof_media),
1545 ADD_TABLE(property),
1546 ADD_TABLE(df_duplicate_file),
1549 static const msi_table wrv_tables[] =
1551 ADD_TABLE(wrv_component),
1552 ADD_TABLE(directory),
1553 ADD_TABLE(rof_feature),
1554 ADD_TABLE(ci2_feature_comp),
1555 ADD_TABLE(ci2_file),
1556 ADD_TABLE(install_exec_seq),
1557 ADD_TABLE(rof_media),
1558 ADD_TABLE(property),
1559 ADD_TABLE(wrv_registry),
1562 static const msi_table cf_tables[] =
1564 ADD_TABLE(cf_component),
1565 ADD_TABLE(cf_directory),
1566 ADD_TABLE(cf_feature),
1567 ADD_TABLE(cf_feature_comp),
1568 ADD_TABLE(cf_file),
1569 ADD_TABLE(cf_create_folders),
1570 ADD_TABLE(cf_install_exec_seq),
1571 ADD_TABLE(media),
1572 ADD_TABLE(property)
1575 static const msi_table sss_tables[] =
1577 ADD_TABLE(component),
1578 ADD_TABLE(directory),
1579 ADD_TABLE(feature),
1580 ADD_TABLE(feature_comp),
1581 ADD_TABLE(file),
1582 ADD_TABLE(sss_install_exec_seq),
1583 ADD_TABLE(sss_service_control),
1584 ADD_TABLE(media),
1585 ADD_TABLE(property)
1588 static const msi_table sds_tables[] =
1590 ADD_TABLE(component),
1591 ADD_TABLE(directory),
1592 ADD_TABLE(feature),
1593 ADD_TABLE(feature_comp),
1594 ADD_TABLE(file),
1595 ADD_TABLE(sds_install_exec_seq),
1596 ADD_TABLE(service_control),
1597 ADD_TABLE(service_install),
1598 ADD_TABLE(media),
1599 ADD_TABLE(property)
1602 static const msi_table sr_tables[] =
1604 ADD_TABLE(component),
1605 ADD_TABLE(directory),
1606 ADD_TABLE(feature),
1607 ADD_TABLE(feature_comp),
1608 ADD_TABLE(file),
1609 ADD_TABLE(sr_selfreg),
1610 ADD_TABLE(sr_install_exec_seq),
1611 ADD_TABLE(media),
1612 ADD_TABLE(property)
1615 static const msi_table font_tables[] =
1617 ADD_TABLE(font_component),
1618 ADD_TABLE(directory),
1619 ADD_TABLE(font_feature),
1620 ADD_TABLE(font_feature_comp),
1621 ADD_TABLE(font_file),
1622 ADD_TABLE(font),
1623 ADD_TABLE(font_install_exec_seq),
1624 ADD_TABLE(font_media),
1625 ADD_TABLE(property)
1628 static const msi_table vp_tables[] =
1630 ADD_TABLE(component),
1631 ADD_TABLE(directory),
1632 ADD_TABLE(feature),
1633 ADD_TABLE(feature_comp),
1634 ADD_TABLE(file),
1635 ADD_TABLE(vp_custom_action),
1636 ADD_TABLE(vp_install_exec_seq),
1637 ADD_TABLE(media),
1638 ADD_TABLE(vp_property)
1641 static const msi_table odbc_tables[] =
1643 ADD_TABLE(odbc_component),
1644 ADD_TABLE(directory),
1645 ADD_TABLE(odbc_feature),
1646 ADD_TABLE(odbc_feature_comp),
1647 ADD_TABLE(odbc_file),
1648 ADD_TABLE(odbc_driver),
1649 ADD_TABLE(odbc_translator),
1650 ADD_TABLE(odbc_datasource),
1651 ADD_TABLE(odbc_install_exec_seq),
1652 ADD_TABLE(odbc_media),
1653 ADD_TABLE(property)
1656 static const msi_table tl_tables[] =
1658 ADD_TABLE(tl_component),
1659 ADD_TABLE(directory),
1660 ADD_TABLE(tl_feature),
1661 ADD_TABLE(tl_feature_comp),
1662 ADD_TABLE(tl_file),
1663 ADD_TABLE(tl_typelib),
1664 ADD_TABLE(tl_install_exec_seq),
1665 ADD_TABLE(media),
1666 ADD_TABLE(property)
1669 static const msi_table crs_tables[] =
1671 ADD_TABLE(crs_component),
1672 ADD_TABLE(directory),
1673 ADD_TABLE(crs_feature),
1674 ADD_TABLE(crs_feature_comp),
1675 ADD_TABLE(crs_file),
1676 ADD_TABLE(crs_shortcut),
1677 ADD_TABLE(crs_install_exec_seq),
1678 ADD_TABLE(media),
1679 ADD_TABLE(property)
1682 static const msi_table pub_tables[] =
1684 ADD_TABLE(directory),
1685 ADD_TABLE(pub_component),
1686 ADD_TABLE(pub_feature),
1687 ADD_TABLE(pub_feature_comp),
1688 ADD_TABLE(pub_file),
1689 ADD_TABLE(pub_publish_component),
1690 ADD_TABLE(pub_install_exec_seq),
1691 ADD_TABLE(media),
1692 ADD_TABLE(property)
1695 static const msi_table rd_tables[] =
1697 ADD_TABLE(directory),
1698 ADD_TABLE(rd_component),
1699 ADD_TABLE(rd_feature),
1700 ADD_TABLE(rd_feature_comp),
1701 ADD_TABLE(rd_file),
1702 ADD_TABLE(rd_duplicate_file),
1703 ADD_TABLE(rd_install_exec_seq),
1704 ADD_TABLE(media),
1705 ADD_TABLE(property)
1708 static const msi_table rrv_tables[] =
1710 ADD_TABLE(directory),
1711 ADD_TABLE(rrv_component),
1712 ADD_TABLE(rrv_feature),
1713 ADD_TABLE(rrv_feature_comp),
1714 ADD_TABLE(rrv_file),
1715 ADD_TABLE(rrv_registry),
1716 ADD_TABLE(rrv_remove_registry),
1717 ADD_TABLE(rrv_install_exec_seq),
1718 ADD_TABLE(media),
1719 ADD_TABLE(property)
1722 static const msi_table frp_tables[] =
1724 ADD_TABLE(directory),
1725 ADD_TABLE(frp_component),
1726 ADD_TABLE(frp_feature),
1727 ADD_TABLE(frp_feature_comp),
1728 ADD_TABLE(frp_file),
1729 ADD_TABLE(frp_upgrade),
1730 ADD_TABLE(frp_custom_action),
1731 ADD_TABLE(frp_install_exec_seq),
1732 ADD_TABLE(media),
1733 ADD_TABLE(property)
1736 static const msi_table riv_tables[] =
1738 ADD_TABLE(directory),
1739 ADD_TABLE(riv_component),
1740 ADD_TABLE(riv_feature),
1741 ADD_TABLE(riv_feature_comp),
1742 ADD_TABLE(riv_file),
1743 ADD_TABLE(riv_ini_file),
1744 ADD_TABLE(riv_remove_ini_file),
1745 ADD_TABLE(riv_install_exec_seq),
1746 ADD_TABLE(media),
1747 ADD_TABLE(property)
1750 static const msi_table res_tables[] =
1752 ADD_TABLE(directory),
1753 ADD_TABLE(res_component),
1754 ADD_TABLE(res_feature),
1755 ADD_TABLE(res_feature_comp),
1756 ADD_TABLE(res_file),
1757 ADD_TABLE(res_environment),
1758 ADD_TABLE(res_install_exec_seq),
1759 ADD_TABLE(media),
1760 ADD_TABLE(property)
1763 static const msi_table rci_tables[] =
1765 ADD_TABLE(directory),
1766 ADD_TABLE(rci_component),
1767 ADD_TABLE(rci_feature),
1768 ADD_TABLE(rci_feature_comp),
1769 ADD_TABLE(rci_file),
1770 ADD_TABLE(rci_appid),
1771 ADD_TABLE(rci_class),
1772 ADD_TABLE(rci_install_exec_seq),
1773 ADD_TABLE(media),
1774 ADD_TABLE(property)
1777 static const msi_table rei_tables[] =
1779 ADD_TABLE(directory),
1780 ADD_TABLE(rei_component),
1781 ADD_TABLE(rei_feature),
1782 ADD_TABLE(rei_feature_comp),
1783 ADD_TABLE(rei_file),
1784 ADD_TABLE(rei_extension),
1785 ADD_TABLE(rei_verb),
1786 ADD_TABLE(rei_progid),
1787 ADD_TABLE(rei_install_exec_seq),
1788 ADD_TABLE(media),
1789 ADD_TABLE(property)
1792 static const msi_table rmi_tables[] =
1794 ADD_TABLE(directory),
1795 ADD_TABLE(rmi_component),
1796 ADD_TABLE(rmi_feature),
1797 ADD_TABLE(rmi_feature_comp),
1798 ADD_TABLE(rmi_file),
1799 ADD_TABLE(rmi_extension),
1800 ADD_TABLE(rmi_verb),
1801 ADD_TABLE(rmi_mime),
1802 ADD_TABLE(rmi_install_exec_seq),
1803 ADD_TABLE(media),
1804 ADD_TABLE(property)
1807 static const msi_table pa_tables[] =
1809 ADD_TABLE(directory),
1810 ADD_TABLE(pa_component),
1811 ADD_TABLE(pa_feature),
1812 ADD_TABLE(pa_feature_comp),
1813 ADD_TABLE(pa_file),
1814 ADD_TABLE(pa_msi_assembly),
1815 ADD_TABLE(pa_msi_assembly_name),
1816 ADD_TABLE(pa_install_exec_seq),
1817 ADD_TABLE(media),
1818 ADD_TABLE(property)
1821 /* based on RegDeleteTreeW from dlls/advapi32/registry.c */
1822 static LSTATUS action_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey, REGSAM access)
1824 LONG ret;
1825 DWORD dwMaxSubkeyLen, dwMaxValueLen;
1826 DWORD dwMaxLen, dwSize;
1827 char szNameBuf[MAX_PATH], *lpszName = szNameBuf;
1828 HKEY hSubKey = hKey;
1830 if(lpszSubKey)
1832 ret = RegOpenKeyExA(hKey, lpszSubKey, 0, access, &hSubKey);
1833 if (ret) return ret;
1836 ret = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, NULL,
1837 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
1838 if (ret) goto cleanup;
1840 dwMaxSubkeyLen++;
1841 dwMaxValueLen++;
1842 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
1843 if (dwMaxLen > sizeof(szNameBuf))
1845 /* Name too big: alloc a buffer for it */
1846 if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen)))
1848 ret = ERROR_NOT_ENOUGH_MEMORY;
1849 goto cleanup;
1853 /* Recursively delete all the subkeys */
1854 while (TRUE)
1856 dwSize = dwMaxLen;
1857 if (RegEnumKeyExA(hSubKey, 0, lpszName, &dwSize, NULL,
1858 NULL, NULL, NULL)) break;
1860 ret = action_RegDeleteTreeA(hSubKey, lpszName, access);
1861 if (ret) goto cleanup;
1864 if (lpszSubKey)
1866 if (pRegDeleteKeyExA)
1867 ret = pRegDeleteKeyExA(hKey, lpszSubKey, access, 0);
1868 else
1869 ret = RegDeleteKeyA(hKey, lpszSubKey);
1871 else
1872 while (TRUE)
1874 dwSize = dwMaxLen;
1875 if (RegEnumValueA(hKey, 0, lpszName, &dwSize,
1876 NULL, NULL, NULL, NULL)) break;
1878 ret = RegDeleteValueA(hKey, lpszName);
1879 if (ret) goto cleanup;
1882 cleanup:
1883 if (lpszName != szNameBuf)
1884 HeapFree(GetProcessHeap(), 0, lpszName);
1885 if(lpszSubKey)
1886 RegCloseKey(hSubKey);
1887 return ret;
1890 /* cabinet definitions */
1892 /* make the max size large so there is only one cab file */
1893 #define MEDIA_SIZE 0x7FFFFFFF
1894 #define FOLDER_THRESHOLD 900000
1896 /* the FCI callbacks */
1898 static void * CDECL mem_alloc(ULONG cb)
1900 return HeapAlloc(GetProcessHeap(), 0, cb);
1903 static void CDECL mem_free(void *memory)
1905 HeapFree(GetProcessHeap(), 0, memory);
1908 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
1910 sprintf(pccab->szCab, pv, pccab->iCab);
1911 return TRUE;
1914 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
1916 return 0;
1919 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
1920 BOOL fContinuation, void *pv)
1922 return 0;
1925 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
1927 HANDLE handle;
1928 DWORD dwAccess = 0;
1929 DWORD dwShareMode = 0;
1930 DWORD dwCreateDisposition = OPEN_EXISTING;
1932 dwAccess = GENERIC_READ | GENERIC_WRITE;
1933 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
1935 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
1936 dwCreateDisposition = OPEN_EXISTING;
1937 else
1938 dwCreateDisposition = CREATE_NEW;
1940 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
1941 dwCreateDisposition, 0, NULL);
1943 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
1945 return (INT_PTR)handle;
1948 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1950 HANDLE handle = (HANDLE)hf;
1951 DWORD dwRead;
1952 BOOL res;
1954 res = ReadFile(handle, memory, cb, &dwRead, NULL);
1955 ok(res, "Failed to ReadFile\n");
1957 return dwRead;
1960 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
1962 HANDLE handle = (HANDLE)hf;
1963 DWORD dwWritten;
1964 BOOL res;
1966 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
1967 ok(res, "Failed to WriteFile\n");
1969 return dwWritten;
1972 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
1974 HANDLE handle = (HANDLE)hf;
1975 ok(CloseHandle(handle), "Failed to CloseHandle\n");
1977 return 0;
1980 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
1982 HANDLE handle = (HANDLE)hf;
1983 DWORD ret;
1985 ret = SetFilePointer(handle, dist, NULL, seektype);
1986 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
1988 return ret;
1991 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
1993 BOOL ret = DeleteFileA(pszFile);
1994 ok(ret, "Failed to DeleteFile %s\n", pszFile);
1996 return 0;
1999 static void init_functionpointers(void)
2001 HMODULE hmsi = GetModuleHandleA("msi.dll");
2002 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2003 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2005 #define GET_PROC(mod, func) \
2006 p ## func = (void*)GetProcAddress(mod, #func); \
2007 if(!p ## func) \
2008 trace("GetProcAddress(%s) failed\n", #func);
2010 GET_PROC(hmsi, MsiQueryComponentStateA);
2011 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
2012 GET_PROC(hmsi, MsiSourceListGetInfoA);
2013 GET_PROC(hmsi, MsiGetComponentPathExA);
2015 GET_PROC(hadvapi32, ConvertSidToStringSidA);
2016 GET_PROC(hadvapi32, OpenProcessToken);
2017 GET_PROC(hadvapi32, RegDeleteKeyExA)
2018 GET_PROC(hkernel32, IsWow64Process)
2020 hsrclient = LoadLibraryA("srclient.dll");
2021 GET_PROC(hsrclient, SRRemoveRestorePoint);
2022 GET_PROC(hsrclient, SRSetRestorePointA);
2024 #undef GET_PROC
2027 static BOOL is_process_limited(void)
2029 HANDLE token;
2031 if (!pOpenProcessToken) return FALSE;
2033 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2035 BOOL ret;
2036 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
2037 DWORD size;
2039 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2040 CloseHandle(token);
2041 return (ret && type == TokenElevationTypeLimited);
2043 return FALSE;
2046 static char *get_user_sid(void)
2048 HANDLE token;
2049 DWORD size = 0;
2050 TOKEN_USER *user;
2051 char *usersid = NULL;
2053 if (!pConvertSidToStringSidA)
2055 win_skip("ConvertSidToStringSidA is not available\n");
2056 return NULL;
2058 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
2059 GetTokenInformation(token, TokenUser, NULL, size, &size);
2061 user = HeapAlloc(GetProcessHeap(), 0, size);
2062 GetTokenInformation(token, TokenUser, user, size, &size);
2063 pConvertSidToStringSidA(user->User.Sid, &usersid);
2064 HeapFree(GetProcessHeap(), 0, user);
2066 CloseHandle(token);
2067 return usersid;
2070 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2072 LPSTR tempname;
2074 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2075 GetTempFileNameA(".", "xx", 0, tempname);
2077 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2079 lstrcpyA(pszTempName, tempname);
2080 HeapFree(GetProcessHeap(), 0, tempname);
2081 return TRUE;
2084 HeapFree(GetProcessHeap(), 0, tempname);
2086 return FALSE;
2089 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2090 USHORT *pattribs, int *err, void *pv)
2092 BY_HANDLE_FILE_INFORMATION finfo;
2093 FILETIME filetime;
2094 HANDLE handle;
2095 DWORD attrs;
2096 BOOL res;
2098 handle = CreateFile(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2099 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2101 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2103 res = GetFileInformationByHandle(handle, &finfo);
2104 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2106 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2107 FileTimeToDosDateTime(&filetime, pdate, ptime);
2109 attrs = GetFileAttributes(pszName);
2110 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2112 return (INT_PTR)handle;
2115 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2117 char path[MAX_PATH];
2118 char filename[MAX_PATH];
2120 lstrcpyA(path, CURR_DIR);
2121 lstrcatA(path, "\\");
2122 lstrcatA(path, file);
2124 lstrcpyA(filename, file);
2126 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2127 progress, get_open_info, compress);
2130 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2132 ZeroMemory(pCabParams, sizeof(CCAB));
2134 pCabParams->cb = max_size;
2135 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2136 pCabParams->setID = 0xbeef;
2137 pCabParams->iCab = 1;
2138 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2139 lstrcatA(pCabParams->szCabPath, "\\");
2140 lstrcpyA(pCabParams->szCab, name);
2143 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2145 CCAB cabParams;
2146 LPCSTR ptr;
2147 HFCI hfci;
2148 ERF erf;
2149 BOOL res;
2151 set_cab_parameters(&cabParams, name, max_size);
2153 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2154 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2155 get_temp_file, &cabParams, NULL);
2157 ok(hfci != NULL, "Failed to create an FCI context\n");
2159 ptr = files;
2160 while (*ptr)
2162 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2163 ok(res, "Failed to add file: %s\n", ptr);
2164 ptr += lstrlen(ptr) + 1;
2167 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2168 ok(res, "Failed to flush the cabinet\n");
2170 res = FCIDestroy(hfci);
2171 ok(res, "Failed to destroy the cabinet\n");
2174 static BOOL get_user_dirs(void)
2176 HKEY hkey;
2177 DWORD type, size;
2179 if (RegOpenKey(HKEY_CURRENT_USER,
2180 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2181 return FALSE;
2183 size = MAX_PATH;
2184 if (RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size))
2186 RegCloseKey(hkey);
2187 return FALSE;
2190 RegCloseKey(hkey);
2191 return TRUE;
2194 static BOOL get_system_dirs(void)
2196 HKEY hkey;
2197 DWORD type, size;
2199 if (RegOpenKey(HKEY_LOCAL_MACHINE,
2200 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2201 return FALSE;
2203 size = MAX_PATH;
2204 if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2205 RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size))
2207 RegCloseKey(hkey);
2208 return FALSE;
2211 size = MAX_PATH;
2212 if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2213 RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size))
2215 RegCloseKey(hkey);
2216 return FALSE;
2219 RegCloseKey(hkey);
2221 if (!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH))
2222 return FALSE;
2224 return TRUE;
2227 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2229 HANDLE file;
2230 DWORD written;
2232 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2233 if (file == INVALID_HANDLE_VALUE)
2234 return;
2236 WriteFile(file, data, strlen(data), &written, NULL);
2238 if (size)
2240 SetFilePointer(file, size, NULL, FILE_BEGIN);
2241 SetEndOfFile(file);
2244 CloseHandle(file);
2247 #define create_file(name, size) create_file_data(name, name, size)
2249 static void create_test_files(void)
2251 CreateDirectoryA("msitest", NULL);
2252 create_file("msitest\\one.txt", 100);
2253 CreateDirectoryA("msitest\\first", NULL);
2254 create_file("msitest\\first\\two.txt", 100);
2255 CreateDirectoryA("msitest\\second", NULL);
2256 create_file("msitest\\second\\three.txt", 100);
2258 create_file("four.txt", 100);
2259 create_file("five.txt", 100);
2260 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2262 create_file("msitest\\filename", 100);
2263 create_file("msitest\\service.exe", 100);
2264 create_file("msitest\\service2.exe", 100);
2266 DeleteFileA("four.txt");
2267 DeleteFileA("five.txt");
2270 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2272 CHAR path[MAX_PATH];
2274 lstrcpyA(path, PROG_FILES_DIR);
2275 lstrcatA(path, "\\");
2276 lstrcatA(path, rel_path);
2278 if (is_file)
2279 return DeleteFileA(path);
2280 else
2281 return RemoveDirectoryA(path);
2284 static void delete_test_files(void)
2286 DeleteFileA("msitest.msi");
2287 DeleteFileA("msitest.cab");
2288 DeleteFileA("msitest\\second\\three.txt");
2289 DeleteFileA("msitest\\first\\two.txt");
2290 DeleteFileA("msitest\\one.txt");
2291 DeleteFileA("msitest\\service.exe");
2292 DeleteFileA("msitest\\service2.exe");
2293 DeleteFileA("msitest\\filename");
2294 RemoveDirectoryA("msitest\\second");
2295 RemoveDirectoryA("msitest\\first");
2296 RemoveDirectoryA("msitest");
2299 static void write_file(const CHAR *filename, const char *data, int data_size)
2301 DWORD size;
2302 HANDLE hf = CreateFile(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2303 WriteFile(hf, data, data_size, &size, NULL);
2304 CloseHandle(hf);
2307 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, const char *template)
2309 MSIHANDLE summary;
2310 UINT r;
2312 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2313 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2315 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2316 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2318 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
2319 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2320 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2322 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL);
2323 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2325 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2326 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2328 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2329 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2331 /* write the summary changes back to the stream */
2332 r = MsiSummaryInfoPersist(summary);
2333 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2335 MsiCloseHandle(summary);
2338 #define create_database(name, tables, num_tables) \
2339 create_database_wordcount(name, tables, num_tables, 100, 0, ";1033");
2341 #define create_database_template(name, tables, num_tables, version, template) \
2342 create_database_wordcount(name, tables, num_tables, version, 0, template);
2344 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2345 int num_tables, INT version, INT wordcount,
2346 const char *template)
2348 MSIHANDLE db;
2349 UINT r;
2350 int j;
2352 r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db);
2353 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2355 /* import the tables into the database */
2356 for (j = 0; j < num_tables; j++)
2358 const msi_table *table = &tables[j];
2360 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2362 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2363 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2365 DeleteFileA(table->filename);
2368 write_msi_summary_info(db, version, wordcount, template);
2370 r = MsiDatabaseCommit(db);
2371 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2373 MsiCloseHandle(db);
2376 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2378 RESTOREPOINTINFOA spec;
2380 spec.dwEventType = event_type;
2381 spec.dwRestorePtType = APPLICATION_INSTALL;
2382 spec.llSequenceNumber = status->llSequenceNumber;
2383 lstrcpyA(spec.szDescription, "msitest restore point");
2385 return pSRSetRestorePointA(&spec, status);
2388 static void remove_restore_point(DWORD seq_number)
2390 DWORD res;
2392 res = pSRRemoveRestorePoint(seq_number);
2393 if (res != ERROR_SUCCESS)
2394 trace("Failed to remove the restore point : %08x\n", res);
2397 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
2399 if (pRegDeleteKeyExA)
2400 return pRegDeleteKeyExA( key, subkey, access, 0 );
2401 return RegDeleteKeyA( key, subkey );
2404 static BOOL file_exists(LPCSTR file)
2406 return GetFileAttributes(file) != INVALID_FILE_ATTRIBUTES;
2409 static BOOL pf_exists(LPCSTR file)
2411 CHAR path[MAX_PATH];
2413 lstrcpyA(path, PROG_FILES_DIR);
2414 lstrcatA(path, "\\");
2415 lstrcatA(path, file);
2417 return file_exists(path);
2420 static void delete_pfmsitest_files(void)
2422 SHFILEOPSTRUCT shfl;
2423 CHAR path[MAX_PATH+11];
2425 lstrcpyA(path, PROG_FILES_DIR);
2426 lstrcatA(path, "\\msitest\\*");
2427 path[strlen(path) + 1] = '\0';
2429 shfl.hwnd = NULL;
2430 shfl.wFunc = FO_DELETE;
2431 shfl.pFrom = path;
2432 shfl.pTo = NULL;
2433 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT | FOF_NOERRORUI;
2435 SHFileOperation(&shfl);
2437 lstrcpyA(path, PROG_FILES_DIR);
2438 lstrcatA(path, "\\msitest");
2439 RemoveDirectoryA(path);
2442 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
2444 char val[MAX_PATH];
2445 DWORD size, type;
2446 LONG res;
2448 size = MAX_PATH;
2449 val[0] = '\0';
2450 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
2452 if (res != ERROR_SUCCESS ||
2453 (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
2455 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2456 return;
2459 if (!expected)
2460 ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val);
2461 else
2463 if (bcase)
2464 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
2465 else
2466 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
2470 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
2472 DWORD val, size, type;
2473 LONG res;
2475 size = sizeof(DWORD);
2476 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2478 if (res != ERROR_SUCCESS || type != REG_DWORD)
2480 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2481 return;
2484 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
2487 static void check_reg_dword4(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3,
2488 DWORD expected4, DWORD line)
2490 DWORD val, size, type;
2491 LONG res;
2493 size = sizeof(DWORD);
2494 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2496 if (res != ERROR_SUCCESS || type != REG_DWORD)
2498 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2499 return;
2502 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4,
2503 "Expected %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, val);
2506 static void check_reg_dword5(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3,
2507 DWORD expected4, DWORD expected5, DWORD line)
2509 DWORD val, size, type;
2510 LONG res;
2512 size = sizeof(DWORD);
2513 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2515 if (res != ERROR_SUCCESS || type != REG_DWORD)
2517 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2518 return;
2521 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4 ||
2522 val == expected5,
2523 "Expected %d, %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, expected5, val);
2526 #define CHECK_REG_STR(prodkey, name, expected) \
2527 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
2529 #define CHECK_DEL_REG_STR(prodkey, name, expected) \
2530 check_reg_str(prodkey, name, expected, TRUE, __LINE__); \
2531 RegDeleteValueA(prodkey, name);
2533 #define CHECK_REG_ISTR(prodkey, name, expected) \
2534 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
2536 #define CHECK_DEL_REG_ISTR(prodkey, name, expected) \
2537 check_reg_str(prodkey, name, expected, FALSE, __LINE__); \
2538 RegDeleteValueA(prodkey, name);
2540 #define CHECK_REG_DWORD(prodkey, name, expected) \
2541 check_reg_dword(prodkey, name, expected, __LINE__);
2543 #define CHECK_DEL_REG_DWORD(prodkey, name, expected) \
2544 check_reg_dword(prodkey, name, expected, __LINE__); \
2545 RegDeleteValueA(prodkey, name);
2547 #define CHECK_REG_DWORD2(prodkey, name, expected1, expected2) \
2548 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__);
2550 #define CHECK_DEL_REG_DWORD2(prodkey, name, expected1, expected2) \
2551 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__); \
2552 RegDeleteValueA(prodkey, name);
2554 #define CHECK_REG_DWORD4(prodkey, name, expected1, expected2, expected3, expected4) \
2555 check_reg_dword4(prodkey, name, expected1, expected2, expected3, expected4, __LINE__);
2557 #define CHECK_DEL_REG_DWORD5(prodkey, name, expected1, expected2, expected3, expected4 ,expected5) \
2558 check_reg_dword5(prodkey, name, expected1, expected2, expected3, expected4, expected5, __LINE__); \
2559 RegDeleteValueA(prodkey, name);
2561 static void get_date_str(LPSTR date)
2563 SYSTEMTIME systime;
2565 static const char date_fmt[] = "%d%02d%02d";
2566 GetLocalTime(&systime);
2567 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
2570 static void test_register_product(void)
2572 UINT r;
2573 LONG res;
2574 HKEY hkey, props, usage;
2575 LPSTR usersid;
2576 char date[MAX_PATH], temp[MAX_PATH], keypath[MAX_PATH], path[MAX_PATH];
2577 DWORD size, type;
2578 REGSAM access = KEY_ALL_ACCESS;
2580 static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2581 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2582 static const CHAR uninstall_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion"
2583 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2584 static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2585 "\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2586 static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2587 "\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2588 static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2589 "\\51AAE0C44620A5E4788506E91F249BD2";
2591 if (is_process_limited())
2593 skip("process is limited\n");
2594 return;
2597 if (!(usersid = get_user_sid()))
2598 return;
2600 get_date_str(date);
2601 GetTempPath(MAX_PATH, temp);
2603 CreateDirectoryA("msitest", NULL);
2604 create_file("msitest\\maximus", 500);
2606 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2608 if (is_wow64)
2609 access |= KEY_WOW64_64KEY;
2611 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2613 /* RegisterProduct */
2614 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
2615 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2617 skip("Not enough rights to perform tests\n");
2618 goto error;
2620 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2621 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2622 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2624 res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
2625 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2627 if (is_64bit)
2629 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey);
2630 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2632 else
2634 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_ALL_ACCESS, &hkey);
2635 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2638 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2639 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2640 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2641 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2642 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2643 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2644 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2645 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2646 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2647 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2648 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2649 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2650 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2651 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2652 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2653 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2654 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2655 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2656 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2657 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2658 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2659 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2660 todo_wine
2662 CHECK_DEL_REG_DWORD5(hkey, "EstimatedSize", 12, -12, 4, 10, 24);
2665 delete_key(hkey, "", access);
2666 RegCloseKey(hkey);
2668 sprintf(keypath, userdata, usersid);
2669 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
2670 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2672 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
2673 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2675 size = sizeof(path);
2676 RegQueryValueExA(props, "LocalPackage", NULL, &type, (LPBYTE)path, &size);
2677 DeleteFileA(path);
2678 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2680 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2681 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2682 CHECK_DEL_REG_STR(props, "InstallDate", date);
2683 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2684 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2685 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2686 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2687 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2688 CHECK_DEL_REG_STR(props, "Comments", NULL);
2689 CHECK_DEL_REG_STR(props, "Contact", NULL);
2690 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2691 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2692 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2693 CHECK_DEL_REG_STR(props, "Readme", NULL);
2694 CHECK_DEL_REG_STR(props, "Size", NULL);
2695 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2696 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2697 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2698 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2699 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2700 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2701 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2702 todo_wine
2704 CHECK_DEL_REG_DWORD5(props, "EstimatedSize", 12, -12, 4, 10, 24);
2707 delete_key(props, "", access);
2708 RegCloseKey(props);
2710 res = RegOpenKeyExA(hkey, "Usage", 0, access, &usage);
2711 todo_wine
2713 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2716 delete_key(usage, "", access);
2717 RegCloseKey(usage);
2718 delete_key(hkey, "", access);
2719 RegCloseKey(hkey);
2721 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, access, &hkey);
2722 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2724 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2726 delete_key(hkey, "", access);
2727 RegCloseKey(hkey);
2729 /* RegisterProduct, machine */
2730 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 ALLUSERS=1");
2731 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2732 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2733 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2735 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, userugkey, 0, access, &hkey);
2736 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2738 if (is_64bit)
2740 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey);
2741 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2743 else
2745 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_ALL_ACCESS, &hkey);
2746 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2749 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2750 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2751 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2752 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2753 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2754 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2755 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2756 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2757 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2758 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2759 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2760 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2761 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2762 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2763 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2764 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2765 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2766 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2767 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2768 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2769 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2770 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2771 todo_wine
2773 CHECK_DEL_REG_DWORD5(hkey, "EstimatedSize", 12, -12, 4, 10, 24);
2776 delete_key(hkey, "", access);
2777 RegCloseKey(hkey);
2779 sprintf(keypath, userdata, "S-1-5-18");
2780 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
2781 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2783 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
2784 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2786 size = sizeof(path);
2787 RegQueryValueExA(props, "LocalPackage", NULL, &type, (LPBYTE)path, &size);
2788 DeleteFileA(path);
2789 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2791 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2792 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2793 CHECK_DEL_REG_STR(props, "InstallDate", date);
2794 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2795 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2796 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2797 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2798 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2799 CHECK_DEL_REG_STR(props, "Comments", NULL);
2800 CHECK_DEL_REG_STR(props, "Contact", NULL);
2801 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2802 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2803 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2804 CHECK_DEL_REG_STR(props, "Readme", NULL);
2805 CHECK_DEL_REG_STR(props, "Size", NULL);
2806 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2807 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2808 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2809 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2810 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2811 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2812 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2813 todo_wine
2815 CHECK_DEL_REG_DWORD5(props, "EstimatedSize", 12, -12, 4, 10, 24);
2818 delete_key(props, "", access);
2819 RegCloseKey(props);
2821 res = RegOpenKeyExA(hkey, "Usage", 0, access, &usage);
2822 todo_wine
2824 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2827 delete_key(usage, "", access);
2828 RegCloseKey(usage);
2829 delete_key(hkey, "", access);
2830 RegCloseKey(hkey);
2832 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, access, &hkey);
2833 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2835 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2837 delete_key(hkey, "", access);
2838 RegCloseKey(hkey);
2840 error:
2841 DeleteFile(msifile);
2842 DeleteFile("msitest\\maximus");
2843 RemoveDirectory("msitest");
2844 HeapFree(GetProcessHeap(), 0, usersid);
2847 static void test_publish_product(void)
2849 UINT r;
2850 LONG res;
2851 LPSTR usersid;
2852 HKEY sourcelist, net, props;
2853 HKEY hkey, patches, media;
2854 CHAR keypath[MAX_PATH];
2855 CHAR temp[MAX_PATH];
2856 CHAR path[MAX_PATH];
2857 BOOL old_installer = FALSE;
2858 REGSAM access = KEY_ALL_ACCESS;
2860 static const CHAR prodpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2861 "\\Installer\\UserData\\%s\\Products"
2862 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2863 static const CHAR cuprodpath[] = "Software\\Microsoft\\Installer\\Products"
2864 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2865 static const CHAR cuupgrades[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2866 "\\51AAE0C44620A5E4788506E91F249BD2";
2867 static const CHAR badprod[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2868 "\\Installer\\Products"
2869 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2870 static const CHAR machprod[] = "Software\\Classes\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2871 static const CHAR machup[] = "Software\\Classes\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2873 if (is_process_limited())
2875 skip("process is limited\n");
2876 return;
2879 if (!(usersid = get_user_sid()))
2880 return;
2882 GetTempPath(MAX_PATH, temp);
2884 CreateDirectoryA("msitest", NULL);
2885 create_file("msitest\\maximus", 500);
2887 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2889 if (is_wow64)
2890 access |= KEY_WOW64_64KEY;
2892 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2894 /* PublishProduct, current user */
2895 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
2896 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2898 skip("Not enough rights to perform tests\n");
2899 goto error;
2901 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2902 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2903 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2905 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, badprod, 0, access, &hkey);
2906 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2908 sprintf(keypath, prodpath, usersid);
2909 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
2910 if (res == ERROR_FILE_NOT_FOUND)
2912 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
2913 if (res == ERROR_SUCCESS)
2915 win_skip("Windows Installer < 3.0 detected\n");
2916 RegCloseKey(hkey);
2917 old_installer = TRUE;
2918 goto currentuser;
2920 else
2922 win_skip("Install failed, no need to continue\n");
2923 return;
2926 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2928 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
2929 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2931 res = RegOpenKeyExA(hkey, "Patches", 0, access, &patches);
2932 todo_wine
2934 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2935 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
2938 delete_key(patches, "", access);
2939 RegCloseKey(patches);
2940 delete_key(hkey, "", access);
2941 RegCloseKey(hkey);
2943 currentuser:
2944 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
2945 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2947 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
2948 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052C94DA02821EECD05F2F");
2949 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2950 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2951 if (!old_installer)
2952 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
2953 CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
2954 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
2955 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
2956 CHECK_DEL_REG_STR(hkey, "Clients", ":");
2958 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
2959 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2961 lstrcpyA(path, "n;1;");
2962 lstrcatA(path, temp);
2963 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
2964 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
2966 res = RegOpenKeyA(sourcelist, "Net", &net);
2967 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2969 CHECK_DEL_REG_STR(net, "1", temp);
2971 RegDeleteKeyA(net, "");
2972 RegCloseKey(net);
2974 res = RegOpenKeyA(sourcelist, "Media", &media);
2975 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2977 CHECK_DEL_REG_STR(media, "1", "DISK1;");
2979 RegDeleteKeyA(media, "");
2980 RegCloseKey(media);
2981 RegDeleteKeyA(sourcelist, "");
2982 RegCloseKey(sourcelist);
2983 RegDeleteKeyA(hkey, "");
2984 RegCloseKey(hkey);
2986 res = RegOpenKeyA(HKEY_CURRENT_USER, cuupgrades, &hkey);
2987 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2989 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2991 RegDeleteKeyA(hkey, "");
2992 RegCloseKey(hkey);
2994 /* PublishProduct, machine */
2995 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
2996 if (old_installer)
2997 goto machprod;
2998 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2999 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3000 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3002 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, badprod, 0, access, &hkey);
3003 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3005 sprintf(keypath, prodpath, "S-1-5-18");
3006 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3007 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3009 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
3010 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3012 res = RegOpenKeyExA(hkey, "Patches", 0, access, &patches);
3013 todo_wine
3015 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3016 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3019 delete_key(patches, "", access);
3020 RegCloseKey(patches);
3021 delete_key(hkey, "", access);
3022 RegCloseKey(hkey);
3024 machprod:
3025 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, machprod, 0, access, &hkey);
3026 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3028 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3029 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052C94DA02821EECD05F2F");
3030 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3031 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3032 if (!old_installer)
3033 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3034 todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
3035 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3036 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3037 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3039 res = RegOpenKeyExA(hkey, "SourceList", 0, access, &sourcelist);
3040 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3042 lstrcpyA(path, "n;1;");
3043 lstrcatA(path, temp);
3044 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3045 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3047 res = RegOpenKeyExA(sourcelist, "Net", 0, access, &net);
3048 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3050 CHECK_DEL_REG_STR(net, "1", temp);
3052 res = delete_key(net, "", access);
3053 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3054 RegCloseKey(net);
3056 res = RegOpenKeyExA(sourcelist, "Media", 0, access, &media);
3057 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3059 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3061 res = delete_key(media, "", access);
3062 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3063 RegCloseKey(media);
3064 res = delete_key(sourcelist, "", access);
3065 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3066 RegCloseKey(sourcelist);
3067 res = delete_key(hkey, "", access);
3068 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3069 RegCloseKey(hkey);
3071 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, machup, 0, access, &hkey);
3072 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3074 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3076 res = delete_key(hkey, "", access);
3077 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3078 RegCloseKey(hkey);
3080 error:
3081 DeleteFile(msifile);
3082 DeleteFile("msitest\\maximus");
3083 RemoveDirectory("msitest");
3084 HeapFree(GetProcessHeap(), 0, usersid);
3087 static void test_publish_features(void)
3089 UINT r;
3090 LONG res;
3091 HKEY hkey;
3092 LPSTR usersid;
3093 CHAR keypath[MAX_PATH];
3094 REGSAM access = KEY_ALL_ACCESS;
3096 static const CHAR cupath[] = "Software\\Microsoft\\Installer\\Features"
3097 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3098 static const CHAR udfeatpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3099 "\\Installer\\UserData\\%s\\Products"
3100 "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
3101 static const CHAR udpridpath[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3102 "\\Installer\\UserData\\%s\\Products"
3103 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3104 static const CHAR featkey[] = "Software\\Microsoft\\Windows\\CurrentVersion"
3105 "\\Installer\\Features";
3106 static const CHAR classfeat[] = "Software\\Classes\\Installer\\Features"
3107 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3109 if (is_process_limited())
3111 skip("process is limited\n");
3112 return;
3115 if (!(usersid = get_user_sid()))
3116 return;
3118 CreateDirectoryA("msitest", NULL);
3119 create_file("msitest\\maximus", 500);
3121 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3123 if (is_wow64)
3124 access |= KEY_WOW64_64KEY;
3126 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3128 /* PublishFeatures, current user */
3129 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
3130 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3132 skip("Not enough rights to perform tests\n");
3133 goto error;
3135 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3136 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3137 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3139 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, featkey, 0, access, &hkey);
3140 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3142 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, classfeat, 0, access, &hkey);
3143 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3145 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
3146 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3148 CHECK_REG_STR(hkey, "feature", "");
3149 CHECK_REG_STR(hkey, "montecristo", "");
3151 RegDeleteValueA(hkey, "feature");
3152 RegDeleteValueA(hkey, "montecristo");
3153 delete_key(hkey, "", access);
3154 RegCloseKey(hkey);
3156 sprintf(keypath, udfeatpath, usersid);
3157 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3158 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3160 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
3161 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
3163 RegDeleteValueA(hkey, "feature");
3164 RegDeleteValueA(hkey, "montecristo");
3165 delete_key(hkey, "", access);
3166 RegCloseKey(hkey);
3167 sprintf(keypath, udpridpath, usersid);
3168 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3170 /* PublishFeatures, machine */
3171 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
3172 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3173 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3174 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3176 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, featkey, 0, access, &hkey);
3177 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3179 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
3180 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3181 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, classfeat, 0, access, &hkey);
3182 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3184 CHECK_REG_STR(hkey, "feature", "");
3185 CHECK_REG_STR(hkey, "montecristo", "");
3187 RegDeleteValueA(hkey, "feature");
3188 RegDeleteValueA(hkey, "montecristo");
3189 delete_key(hkey, "", access);
3190 RegCloseKey(hkey);
3192 sprintf(keypath, udfeatpath, "S-1-5-18");
3193 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3194 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3196 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
3197 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
3199 RegDeleteValueA(hkey, "feature");
3200 RegDeleteValueA(hkey, "montecristo");
3201 delete_key(hkey, "", access);
3202 RegCloseKey(hkey);
3203 sprintf(keypath, udpridpath, "S-1-5-18");
3204 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3206 error:
3207 DeleteFile(msifile);
3208 DeleteFile("msitest\\maximus");
3209 RemoveDirectory("msitest");
3210 HeapFree(GetProcessHeap(), 0, usersid);
3213 static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
3215 DWORD len = 0;
3216 LPSTR val;
3217 LONG r;
3219 r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
3220 if (r != ERROR_SUCCESS)
3221 return NULL;
3223 len += sizeof (WCHAR);
3224 val = HeapAlloc(GetProcessHeap(), 0, len);
3225 if (!val) return NULL;
3226 val[0] = 0;
3227 RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
3228 return val;
3231 static void get_owner_company(LPSTR *owner, LPSTR *company)
3233 LONG res;
3234 HKEY hkey;
3235 REGSAM access = KEY_ALL_ACCESS;
3237 *owner = *company = NULL;
3239 if (is_wow64)
3240 access |= KEY_WOW64_64KEY;
3242 res = RegOpenKeyA(HKEY_CURRENT_USER,
3243 "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
3244 if (res == ERROR_SUCCESS)
3246 *owner = reg_get_val_str(hkey, "DefName");
3247 *company = reg_get_val_str(hkey, "DefCompany");
3248 RegCloseKey(hkey);
3251 if (!*owner || !*company)
3253 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
3254 "Software\\Microsoft\\Windows\\CurrentVersion", 0, access, &hkey);
3255 if (res == ERROR_SUCCESS)
3257 *owner = reg_get_val_str(hkey, "RegisteredOwner");
3258 *company = reg_get_val_str(hkey, "RegisteredOrganization");
3259 RegCloseKey(hkey);
3263 if (!*owner || !*company)
3265 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
3266 "Software\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey);
3267 if (res == ERROR_SUCCESS)
3269 *owner = reg_get_val_str(hkey, "RegisteredOwner");
3270 *company = reg_get_val_str(hkey, "RegisteredOrganization");
3271 RegCloseKey(hkey);
3276 static void test_register_user(void)
3278 UINT r;
3279 LONG res;
3280 HKEY props;
3281 LPSTR usersid;
3282 LPSTR owner, company;
3283 CHAR keypath[MAX_PATH];
3284 REGSAM access = KEY_ALL_ACCESS;
3286 static const CHAR keypropsfmt[] =
3287 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3288 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
3289 static const CHAR keypridfmt[] =
3290 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3291 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3293 if (is_process_limited())
3295 skip("process is limited\n");
3296 return;
3299 if (!(usersid = get_user_sid()))
3300 return;
3302 get_owner_company(&owner, &company);
3304 CreateDirectoryA("msitest", NULL);
3305 create_file("msitest\\maximus", 500);
3307 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3309 if (is_wow64)
3310 access |= KEY_WOW64_64KEY;
3312 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3314 /* RegisterUser, per-user */
3315 r = MsiInstallProductA(msifile, "REGISTER_USER=1");
3316 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3318 skip("Not enough rights to perform tests\n");
3319 goto error;
3321 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3322 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3323 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3325 sprintf(keypath, keypropsfmt, usersid);
3326 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
3327 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3329 CHECK_REG_STR(props, "ProductID", "none");
3330 CHECK_REG_STR(props, "RegCompany", company);
3331 CHECK_REG_STR(props, "RegOwner", owner);
3333 RegDeleteValueA(props, "ProductID");
3334 RegDeleteValueA(props, "RegCompany");
3335 RegDeleteValueA(props, "RegOwner");
3336 delete_key(props, "", access);
3337 RegCloseKey(props);
3338 sprintf(keypath, keypridfmt, usersid);
3339 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3341 /* RegisterUser, machine */
3342 r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
3343 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3344 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3345 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3347 sprintf(keypath, keypropsfmt, "S-1-5-18");
3348 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
3349 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3351 CHECK_REG_STR(props, "ProductID", "none");
3352 CHECK_REG_STR(props, "RegCompany", company);
3353 CHECK_REG_STR(props, "RegOwner", owner);
3355 RegDeleteValueA(props, "ProductID");
3356 RegDeleteValueA(props, "RegCompany");
3357 RegDeleteValueA(props, "RegOwner");
3358 delete_key(props, "", access);
3359 RegCloseKey(props);
3360 sprintf(keypath, keypridfmt, "S-1-5-18");
3361 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3363 error:
3364 HeapFree(GetProcessHeap(), 0, company);
3365 HeapFree(GetProcessHeap(), 0, owner);
3367 DeleteFile(msifile);
3368 DeleteFile("msitest\\maximus");
3369 RemoveDirectory("msitest");
3370 LocalFree(usersid);
3373 static void test_process_components(void)
3375 UINT r;
3376 LONG res;
3377 DWORD size;
3378 HKEY comp, hkey;
3379 LPSTR usersid;
3380 CHAR val[MAX_PATH];
3381 CHAR keypath[MAX_PATH];
3382 CHAR program_files_maximus[MAX_PATH];
3383 REGSAM access = KEY_ALL_ACCESS;
3385 static const CHAR keyfmt[] =
3386 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3387 "UserData\\%s\\Components\\%s";
3388 static const CHAR compkey[] =
3389 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
3391 if (is_process_limited())
3393 skip("process is limited\n");
3394 return;
3397 if (!(usersid = get_user_sid()))
3398 return;
3400 CreateDirectoryA("msitest", NULL);
3401 create_file("msitest\\maximus", 500);
3403 create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table));
3405 if (is_wow64)
3406 access |= KEY_WOW64_64KEY;
3408 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3410 /* ProcessComponents, per-user */
3411 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3412 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3414 skip("Not enough rights to perform tests\n");
3415 goto error;
3417 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3418 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3419 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3421 sprintf(keypath, keyfmt, usersid, "CBABC2FDCCB35E749A8944D8C1C098B5");
3422 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3423 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3425 size = MAX_PATH;
3426 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3427 NULL, NULL, (LPBYTE)val, &size);
3428 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3430 lstrcpyA(program_files_maximus,PROG_FILES_DIR);
3431 lstrcatA(program_files_maximus,"\\msitest\\maximus");
3433 ok(!lstrcmpiA(val, program_files_maximus),
3434 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3436 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3437 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3439 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3440 delete_key(comp, "", access);
3441 RegCloseKey(comp);
3443 sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
3444 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3445 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3447 size = MAX_PATH;
3448 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3449 NULL, NULL, (LPBYTE)val, &size);
3450 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3451 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3452 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3454 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3455 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3457 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3458 delete_key(comp, "", access);
3459 RegCloseKey(comp);
3461 /* ProcessComponents, machine */
3462 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
3463 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3464 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3465 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3467 sprintf(keypath, keyfmt, "S-1-5-18", "CBABC2FDCCB35E749A8944D8C1C098B5");
3468 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3469 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3471 size = MAX_PATH;
3472 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3473 NULL, NULL, (LPBYTE)val, &size);
3474 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3475 ok(!lstrcmpiA(val, program_files_maximus),
3476 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3478 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3479 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3481 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3482 delete_key(comp, "", access);
3483 RegCloseKey(comp);
3485 sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
3486 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3487 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3489 size = MAX_PATH;
3490 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3491 NULL, NULL, (LPBYTE)val, &size);
3492 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3493 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3494 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3496 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3497 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3499 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3500 delete_key(comp, "", access);
3501 RegCloseKey(comp);
3503 error:
3504 DeleteFile(msifile);
3505 DeleteFile("msitest\\maximus");
3506 RemoveDirectory("msitest");
3507 LocalFree(usersid);
3510 static void test_publish(void)
3512 UINT r;
3513 LONG res;
3514 HKEY uninstall, prodkey, uninstall_32node = NULL;
3515 INSTALLSTATE state;
3516 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3517 char date[MAX_PATH], temp[MAX_PATH];
3518 REGSAM access = KEY_ALL_ACCESS;
3520 static const CHAR subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3521 static const CHAR subkey_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3523 if (!pMsiQueryComponentStateA)
3525 win_skip("MsiQueryComponentStateA is not available\n");
3526 return;
3528 if (is_process_limited())
3530 skip("process is limited\n");
3531 return;
3534 get_date_str(date);
3535 GetTempPath(MAX_PATH, temp);
3537 if (is_wow64)
3538 access |= KEY_WOW64_64KEY;
3540 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey, 0, KEY_ALL_ACCESS, &uninstall);
3541 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3543 if (is_64bit)
3545 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey_32node, 0, KEY_ALL_ACCESS, &uninstall_32node);
3546 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3549 CreateDirectoryA("msitest", NULL);
3550 create_file("msitest\\maximus", 500);
3552 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3554 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3556 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3557 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3559 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3560 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3562 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3563 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3565 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3566 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3567 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3568 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3570 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3571 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3573 /* nothing published */
3574 r = MsiInstallProductA(msifile, NULL);
3575 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3577 skip("Not enough rights to perform tests\n");
3578 goto error;
3580 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3581 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3582 ok(pf_exists("msitest"), "File not installed\n");
3584 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3585 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3587 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3588 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3590 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3591 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3593 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3594 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3595 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3596 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3598 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3599 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3601 /* PublishProduct and RegisterProduct */
3602 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
3603 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3604 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3605 ok(pf_exists("msitest"), "File not installed\n");
3607 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3608 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3610 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3611 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3613 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3614 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3616 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3617 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3618 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
3619 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3621 if (is_64bit)
3623 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3624 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3626 else
3628 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3629 if (is_wow64 && res == ERROR_FILE_NOT_FOUND) /* XP - Vista, Wow64 */
3630 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3631 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3634 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3635 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3636 CHECK_REG_STR(prodkey, "InstallDate", date);
3637 CHECK_REG_STR(prodkey, "InstallSource", temp);
3638 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3639 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3640 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3641 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3642 CHECK_REG_STR(prodkey, "Comments", NULL);
3643 CHECK_REG_STR(prodkey, "Contact", NULL);
3644 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3645 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3646 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3647 CHECK_REG_STR(prodkey, "Readme", NULL);
3648 CHECK_REG_STR(prodkey, "Size", NULL);
3649 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3650 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3651 CHECK_REG_DWORD(prodkey, "Language", 1033);
3652 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3653 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3654 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3655 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3656 todo_wine
3658 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
3661 RegCloseKey(prodkey);
3663 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3664 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3665 ok(pf_exists("msitest\\maximus"), "File deleted\n");
3666 ok(pf_exists("msitest"), "File deleted\n");
3668 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3669 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3671 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3672 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3674 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3675 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3677 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3678 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3679 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3680 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3682 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3683 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3685 /* complete install */
3686 r = MsiInstallProductA(msifile, "FULL=1");
3687 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3688 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3689 ok(pf_exists("msitest"), "File not installed\n");
3691 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3692 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3694 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3695 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3697 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3698 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3700 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3701 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3702 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3703 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3705 if (is_64bit)
3707 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3708 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3710 else
3712 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3713 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3716 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3717 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3718 CHECK_REG_STR(prodkey, "InstallDate", date);
3719 CHECK_REG_STR(prodkey, "InstallSource", temp);
3720 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3721 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3722 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3723 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3724 CHECK_REG_STR(prodkey, "Comments", NULL);
3725 CHECK_REG_STR(prodkey, "Contact", NULL);
3726 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3727 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3728 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3729 CHECK_REG_STR(prodkey, "Readme", NULL);
3730 CHECK_REG_STR(prodkey, "Size", NULL);
3731 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3732 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3733 CHECK_REG_DWORD(prodkey, "Language", 1033);
3734 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3735 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3736 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3737 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3738 todo_wine
3740 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
3743 RegCloseKey(prodkey);
3745 /* no UnpublishFeatures */
3746 r = MsiInstallProductA(msifile, "REMOVE=ALL");
3747 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3748 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3749 ok(!pf_exists("msitest"), "Directory not deleted\n");
3751 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3752 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3754 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3755 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3757 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3758 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3760 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3761 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3762 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3763 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3765 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3766 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3768 /* complete install */
3769 r = MsiInstallProductA(msifile, "FULL=1");
3770 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3771 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3772 ok(pf_exists("msitest"), "File not installed\n");
3774 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3775 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3777 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3778 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3780 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3781 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3783 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3784 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3785 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3786 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3788 if (is_64bit)
3790 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3791 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3793 else
3795 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3796 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3799 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3800 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3801 CHECK_REG_STR(prodkey, "InstallDate", date);
3802 CHECK_REG_STR(prodkey, "InstallSource", temp);
3803 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3804 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3805 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3806 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3807 CHECK_REG_STR(prodkey, "Comments", NULL);
3808 CHECK_REG_STR(prodkey, "Contact", NULL);
3809 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3810 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3811 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3812 CHECK_REG_STR(prodkey, "Readme", NULL);
3813 CHECK_REG_STR(prodkey, "Size", NULL);
3814 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3815 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3816 CHECK_REG_DWORD(prodkey, "Language", 1033);
3817 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3818 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3819 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3820 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3821 todo_wine
3823 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
3826 RegCloseKey(prodkey);
3828 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
3829 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
3830 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3831 ok(pf_exists("msitest\\maximus"), "File deleted\n");
3832 ok(pf_exists("msitest"), "Directory deleted\n");
3834 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3835 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3837 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3838 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3840 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3841 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3843 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3844 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3845 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3846 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3848 if (is_64bit)
3850 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3851 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3853 else
3855 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3856 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3859 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3860 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3861 CHECK_REG_STR(prodkey, "InstallDate", date);
3862 CHECK_REG_STR(prodkey, "InstallSource", temp);
3863 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3864 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3865 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3866 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3867 CHECK_REG_STR(prodkey, "Comments", NULL);
3868 CHECK_REG_STR(prodkey, "Contact", NULL);
3869 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3870 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3871 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3872 CHECK_REG_STR(prodkey, "Readme", NULL);
3873 CHECK_REG_STR(prodkey, "Size", NULL);
3874 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3875 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3876 CHECK_REG_DWORD(prodkey, "Language", 1033);
3877 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3878 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3879 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3880 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3881 todo_wine
3883 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
3886 RegCloseKey(prodkey);
3888 /* complete install */
3889 r = MsiInstallProductA(msifile, "FULL=1");
3890 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3891 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3892 ok(pf_exists("msitest"), "File not installed\n");
3894 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3895 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3897 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3898 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3900 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3901 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3903 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3904 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3905 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3906 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3908 if (is_64bit)
3910 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3911 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3913 else
3915 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3916 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3919 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3920 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3921 CHECK_REG_STR(prodkey, "InstallDate", date);
3922 CHECK_REG_STR(prodkey, "InstallSource", temp);
3923 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3924 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3925 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3926 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3927 CHECK_REG_STR(prodkey, "Comments", NULL);
3928 CHECK_REG_STR(prodkey, "Contact", NULL);
3929 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3930 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3931 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3932 CHECK_REG_STR(prodkey, "Readme", NULL);
3933 CHECK_REG_STR(prodkey, "Size", NULL);
3934 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3935 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3936 CHECK_REG_DWORD(prodkey, "Language", 1033);
3937 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3938 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3939 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3940 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3941 todo_wine
3943 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -20, 10, 24);
3946 RegCloseKey(prodkey);
3948 /* UnpublishFeatures, both features removed */
3949 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
3950 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3951 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3952 ok(!pf_exists("msitest"), "Directory not deleted\n");
3954 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3955 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3957 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3958 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3960 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3961 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3963 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3964 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3965 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3966 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3968 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3969 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3971 /* complete install */
3972 r = MsiInstallProductA(msifile, "FULL=1");
3973 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3974 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3975 ok(pf_exists("msitest"), "File not installed\n");
3977 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3978 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3980 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
3981 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3983 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
3984 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3986 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3987 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3988 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3989 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3991 if (is_64bit)
3993 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3994 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3996 else
3998 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3999 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4002 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4003 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4004 CHECK_REG_STR(prodkey, "InstallDate", date);
4005 CHECK_REG_STR(prodkey, "InstallSource", temp);
4006 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4007 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4008 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4009 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4010 CHECK_REG_STR(prodkey, "Comments", NULL);
4011 CHECK_REG_STR(prodkey, "Contact", NULL);
4012 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4013 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4014 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4015 CHECK_REG_STR(prodkey, "Readme", NULL);
4016 CHECK_REG_STR(prodkey, "Size", NULL);
4017 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4018 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4019 CHECK_REG_DWORD(prodkey, "Language", 1033);
4020 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4021 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4022 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4023 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4024 todo_wine
4026 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4029 RegCloseKey(prodkey);
4031 /* complete uninstall */
4032 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4034 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4035 ok(!pf_exists("msitest"), "Directory not deleted\n");
4037 state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4038 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4040 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "feature");
4041 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4043 state = MsiQueryFeatureState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}", "montecristo");
4044 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4046 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4047 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4048 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4049 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4051 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
4052 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4054 /* make sure 'Program Files\msitest' is removed */
4055 delete_pfmsitest_files();
4057 error:
4058 RegCloseKey(uninstall);
4059 RegCloseKey(uninstall_32node);
4060 DeleteFile(msifile);
4061 DeleteFile("msitest\\maximus");
4062 RemoveDirectory("msitest");
4065 static void test_publish_sourcelist(void)
4067 UINT r;
4068 DWORD size;
4069 CHAR value[MAX_PATH];
4070 CHAR path[MAX_PATH];
4071 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
4073 if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
4075 win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
4076 return;
4078 if (is_process_limited())
4080 skip("process is limited\n");
4081 return;
4084 CreateDirectoryA("msitest", NULL);
4085 create_file("msitest\\maximus", 500);
4087 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4089 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4091 r = MsiInstallProductA(msifile, NULL);
4092 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4094 skip("Not enough rights to perform tests\n");
4095 goto error;
4097 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4098 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4099 ok(pf_exists("msitest"), "File not installed\n");
4101 /* nothing published */
4102 size = MAX_PATH;
4103 lstrcpyA(value, "aaa");
4104 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4105 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4106 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4107 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4108 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4110 size = MAX_PATH;
4111 lstrcpyA(value, "aaa");
4112 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4113 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4114 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4115 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4116 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4118 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
4119 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4120 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4121 ok(pf_exists("msitest"), "File not installed\n");
4123 /* after RegisterProduct */
4124 size = MAX_PATH;
4125 lstrcpyA(value, "aaa");
4126 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4127 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4128 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4129 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4130 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4132 size = MAX_PATH;
4133 lstrcpyA(value, "aaa");
4134 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4135 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4136 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4137 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4138 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4140 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
4141 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4142 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4143 ok(pf_exists("msitest"), "File not installed\n");
4145 /* after ProcessComponents */
4146 size = MAX_PATH;
4147 lstrcpyA(value, "aaa");
4148 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4149 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4150 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4151 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4152 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4154 size = MAX_PATH;
4155 lstrcpyA(value, "aaa");
4156 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4157 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4158 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4159 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4160 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4162 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
4163 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4164 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4165 ok(pf_exists("msitest"), "File not installed\n");
4167 /* after PublishFeatures */
4168 size = MAX_PATH;
4169 lstrcpyA(value, "aaa");
4170 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4171 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4172 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4173 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4174 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4176 size = MAX_PATH;
4177 lstrcpyA(value, "aaa");
4178 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4179 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4180 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4181 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4182 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4184 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
4185 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4186 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4187 ok(pf_exists("msitest"), "File not installed\n");
4189 /* after PublishProduct */
4190 size = MAX_PATH;
4191 lstrcpyA(value, "aaa");
4192 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4193 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAME, value, &size);
4194 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4195 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
4196 ok(size == 11, "Expected 11, got %d\n", size);
4198 size = MAX_PATH;
4199 lstrcpyA(value, "aaa");
4200 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4201 MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATH, value, &size);
4202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4203 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
4204 ok(size == 0, "Expected 0, got %d\n", size);
4206 size = MAX_PATH;
4207 lstrcpyA(value, "aaa");
4208 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4209 MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPT, value, &size);
4210 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4211 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
4212 ok(size == 0, "Expected 0, got %d\n", size);
4214 lstrcpyA(path, CURR_DIR);
4215 lstrcatA(path, "\\");
4217 size = MAX_PATH;
4218 lstrcpyA(value, "aaa");
4219 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4220 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCE, value, &size);
4221 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4222 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
4223 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
4225 size = MAX_PATH;
4226 lstrcpyA(value, "aaa");
4227 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4228 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPE, value, &size);
4229 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4230 ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
4231 ok(size == 1, "Expected 1, got %d\n", size);
4233 size = MAX_PATH;
4234 lstrcpyA(value, "aaa");
4235 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4236 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4237 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4238 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
4239 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
4241 size = MAX_PATH;
4242 lstrcpyA(value, "aaa");
4243 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4244 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
4245 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4246 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
4247 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
4249 size = MAX_PATH;
4250 lstrcpyA(value, "aaa");
4251 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4252 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
4253 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4254 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
4255 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
4257 /* complete uninstall */
4258 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4259 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4260 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4261 ok(!pf_exists("msitest"), "Directory not deleted\n");
4263 /* make sure 'Program Files\msitest' is removed */
4264 delete_pfmsitest_files();
4266 error:
4267 DeleteFile(msifile);
4268 DeleteFile("msitest\\maximus");
4269 RemoveDirectory("msitest");
4272 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
4274 CHAR path[MAX_PATH];
4276 lstrcpyA(path, PROG_FILES_DIR);
4277 lstrcatA(path, "\\");
4278 lstrcatA(path, file);
4280 if (is_file)
4281 create_file_data(path, data, 500);
4282 else
4283 CreateDirectoryA(path, NULL);
4286 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
4288 static void test_remove_files(void)
4290 UINT r;
4292 if (is_process_limited())
4294 skip("process is limited\n");
4295 return;
4298 CreateDirectoryA("msitest", NULL);
4299 create_file("msitest\\hydrogen", 500);
4300 create_file("msitest\\helium", 500);
4301 create_file("msitest\\lithium", 500);
4303 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
4305 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4307 r = MsiInstallProductA(msifile, NULL);
4308 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4310 skip("Not enough rights to perform tests\n");
4311 goto error;
4313 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4314 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4315 ok(!pf_exists("msitest\\helium"), "File installed\n");
4316 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4317 ok(pf_exists("msitest"), "File not installed\n");
4319 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4320 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4321 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4322 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
4323 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4324 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4326 create_pf("msitest", FALSE);
4327 create_pf("msitest\\hydrogen", TRUE);
4328 create_pf("msitest\\helium", TRUE);
4329 create_pf("msitest\\lithium", TRUE);
4331 r = MsiInstallProductA(msifile, NULL);
4332 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4333 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4334 ok(pf_exists("msitest\\helium"), "File not installed\n");
4335 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4336 ok(pf_exists("msitest"), "File not installed\n");
4338 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4339 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4340 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4341 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
4342 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4343 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4345 create_pf("msitest", FALSE);
4346 create_pf("msitest\\furlong", TRUE);
4347 create_pf("msitest\\firkin", TRUE);
4348 create_pf("msitest\\fortnight", TRUE);
4349 create_pf("msitest\\becquerel", TRUE);
4350 create_pf("msitest\\dioptre", TRUE);
4351 create_pf("msitest\\attoparsec", TRUE);
4352 create_pf("msitest\\storeys", TRUE);
4353 create_pf("msitest\\block", TRUE);
4354 create_pf("msitest\\siriometer", TRUE);
4355 create_pf("msitest\\cabout", FALSE);
4356 create_pf("msitest\\cabout\\blocker", TRUE);
4358 r = MsiInstallProductA(msifile, NULL);
4359 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4360 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4361 ok(!pf_exists("msitest\\helium"), "File installed\n");
4362 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4363 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
4364 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
4365 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
4366 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
4367 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
4368 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
4369 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
4370 ok(!pf_exists("msitest\\block"), "File not deleted\n");
4371 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
4372 ok(pf_exists("msitest\\cabout"), "Directory removed\n");
4373 ok(pf_exists("msitest"), "File not installed\n");
4375 create_pf("msitest\\furlong", TRUE);
4376 create_pf("msitest\\firkin", TRUE);
4377 create_pf("msitest\\fortnight", TRUE);
4378 create_pf("msitest\\storeys", TRUE);
4379 create_pf("msitest\\block", TRUE);
4380 create_pf("msitest\\siriometer", TRUE);
4382 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4383 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4384 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
4385 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
4386 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4387 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
4388 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
4389 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
4390 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
4391 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
4392 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
4393 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
4394 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
4395 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
4396 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4397 ok(pf_exists("msitest"), "Directory deleted\n");
4399 r = MsiInstallProductA(msifile, NULL);
4400 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4401 ok(delete_pf("msitest\\hydrogen", TRUE), "File not installed\n");
4402 ok(!delete_pf("msitest\\helium", TRUE), "File installed\n");
4403 ok(delete_pf("msitest\\lithium", TRUE), "File not installed\n");
4404 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4405 ok(pf_exists("msitest"), "Directory deleted\n");
4407 delete_pf("msitest\\cabout\\blocker", TRUE);
4409 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4410 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4411 ok(!delete_pf("msitest\\cabout", FALSE), "Directory not deleted\n");
4412 delete_pf("msitest", FALSE);
4414 error:
4415 DeleteFile(msifile);
4416 DeleteFile("msitest\\hydrogen");
4417 DeleteFile("msitest\\helium");
4418 DeleteFile("msitest\\lithium");
4419 RemoveDirectory("msitest");
4422 static void test_move_files(void)
4424 UINT r;
4425 char props[MAX_PATH];
4427 if (is_process_limited())
4429 skip("process is limited\n");
4430 return;
4433 CreateDirectoryA("msitest", NULL);
4434 create_file("msitest\\augustus", 100);
4435 create_file("cameroon", 100);
4436 create_file("djibouti", 100);
4437 create_file("egypt", 100);
4438 create_file("finland", 100);
4439 create_file("gambai", 100);
4440 create_file("honduras", 100);
4441 create_file("msitest\\india", 100);
4442 create_file("japan", 100);
4443 create_file("kenya", 100);
4444 CreateDirectoryA("latvia", NULL);
4445 create_file("nauru", 100);
4446 create_file("peru", 100);
4447 create_file("apple", 100);
4448 create_file("application", 100);
4449 create_file("ape", 100);
4450 create_file("foo", 100);
4451 create_file("fao", 100);
4452 create_file("fbod", 100);
4453 create_file("budding", 100);
4454 create_file("buddy", 100);
4455 create_file("bud", 100);
4456 create_file("bar", 100);
4457 create_file("bur", 100);
4458 create_file("bird", 100);
4460 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
4462 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4464 /* if the source or dest property is not a full path,
4465 * windows tries to access it as a network resource
4468 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
4469 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
4470 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
4472 r = MsiInstallProductA(msifile, props);
4473 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4475 skip("Not enough rights to perform tests\n");
4476 goto error;
4478 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4479 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4480 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
4481 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
4482 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
4483 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
4484 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
4485 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
4486 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
4487 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
4488 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
4489 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
4490 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
4491 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
4492 ok(delete_pf("msitest\\poland", TRUE), "File not moved\n");
4493 /* either apple or application will be moved depending on directory order */
4494 if (!delete_pf("msitest\\apple", TRUE))
4495 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
4496 else
4497 ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
4498 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
4499 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
4500 /* either fao or foo will be moved depending on directory order */
4501 if (delete_pf("msitest\\foo", TRUE))
4502 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
4503 else
4504 ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
4505 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
4506 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
4507 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
4508 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
4509 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
4510 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
4511 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
4512 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
4513 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4514 ok(DeleteFileA("cameroon"), "File moved\n");
4515 ok(!DeleteFileA("djibouti"), "File not moved\n");
4516 ok(DeleteFileA("egypt"), "File moved\n");
4517 ok(DeleteFileA("finland"), "File moved\n");
4518 ok(DeleteFileA("gambai"), "File moved\n");
4519 ok(!DeleteFileA("honduras"), "File not moved\n");
4520 ok(DeleteFileA("msitest\\india"), "File moved\n");
4521 ok(DeleteFileA("japan"), "File moved\n");
4522 ok(!DeleteFileA("kenya"), "File not moved\n");
4523 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
4524 ok(!DeleteFileA("nauru"), "File not moved\n");
4525 ok(!DeleteFileA("peru"), "File not moved\n");
4526 ok(!DeleteFileA("apple"), "File not moved\n");
4527 ok(!DeleteFileA("application"), "File not moved\n");
4528 ok(DeleteFileA("ape"), "File moved\n");
4529 ok(!DeleteFileA("foo"), "File not moved\n");
4530 ok(!DeleteFileA("fao"), "File not moved\n");
4531 ok(DeleteFileA("fbod"), "File moved\n");
4532 ok(!DeleteFileA("budding"), "File not moved\n");
4533 ok(!DeleteFileA("buddy"), "File not moved\n");
4534 ok(DeleteFileA("bud"), "File moved\n");
4535 ok(!DeleteFileA("bar"), "File not moved\n");
4536 ok(!DeleteFileA("bur"), "File not moved\n");
4537 ok(DeleteFileA("bird"), "File moved\n");
4539 error:
4540 DeleteFile("cameroon");
4541 DeleteFile("djibouti");
4542 DeleteFile("egypt");
4543 DeleteFile("finland");
4544 DeleteFile("gambai");
4545 DeleteFile("honduras");
4546 DeleteFile("japan");
4547 DeleteFile("kenya");
4548 DeleteFile("nauru");
4549 DeleteFile("peru");
4550 DeleteFile("apple");
4551 DeleteFile("application");
4552 DeleteFile("ape");
4553 DeleteFile("foo");
4554 DeleteFile("fao");
4555 DeleteFile("fbod");
4556 DeleteFile("budding");
4557 DeleteFile("buddy");
4558 DeleteFile("bud");
4559 DeleteFile("bar");
4560 DeleteFile("bur");
4561 DeleteFile("bird");
4562 DeleteFile("msitest\\india");
4563 DeleteFile("msitest\\augustus");
4564 RemoveDirectory("latvia");
4565 RemoveDirectory("msitest");
4566 DeleteFile(msifile);
4569 static void test_duplicate_files(void)
4571 UINT r;
4573 if (is_process_limited())
4575 skip("process is limited\n");
4576 return;
4579 CreateDirectoryA("msitest", NULL);
4580 create_file("msitest\\maximus", 500);
4581 create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
4583 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4585 /* fails if the destination folder is not a valid property */
4587 r = MsiInstallProductA(msifile, NULL);
4588 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4590 skip("Not enough rights to perform tests\n");
4591 goto error;
4593 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4594 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4595 ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
4596 ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
4597 ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "Directory not created\n");
4598 ok(delete_pf("msitest\\this\\doesnot", FALSE), "Directory not created\n");
4599 ok(delete_pf("msitest\\this", FALSE), "Directory not created\n");
4600 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4602 error:
4603 DeleteFile("msitest\\maximus");
4604 RemoveDirectory("msitest");
4605 DeleteFile(msifile);
4608 static void test_write_registry_values(void)
4610 UINT r;
4611 LONG res;
4612 HKEY hkey;
4613 DWORD type, size;
4614 CHAR path[MAX_PATH];
4616 if (is_process_limited())
4618 skip("process is limited\n");
4619 return;
4622 CreateDirectoryA("msitest", NULL);
4623 create_file("msitest\\augustus", 500);
4625 create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
4627 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4629 r = MsiInstallProductA(msifile, NULL);
4630 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4632 skip("Not enough rights to perform tests\n");
4633 goto error;
4635 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4636 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4637 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4639 if (is_64bit)
4640 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Wine\\msitest", 0, KEY_ALL_ACCESS, &hkey);
4641 else
4642 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", 0, KEY_ALL_ACCESS, &hkey);
4643 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4645 size = MAX_PATH;
4646 type = 0xdeadbeef;
4647 memset(path, 'a', MAX_PATH);
4648 res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size);
4649 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4650 ok(!memcmp(path, "one\0two\0three\0\0", size), "Wrong multi-sz data\n");
4651 ok(size == 15, "Expected 15, got %d\n", size);
4652 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4654 res = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL);
4655 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4657 res = action_RegDeleteTreeA(hkey, "VisualStudio", KEY_ALL_ACCESS);
4658 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4660 RegDeleteValueA(hkey, "Value");
4661 RegCloseKey(hkey);
4662 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
4664 error:
4665 DeleteFile(msifile);
4666 DeleteFile("msitest\\augustus");
4667 RemoveDirectory("msitest");
4670 static void test_envvar(void)
4672 static const char *results[] =
4674 "1;2", /* MSITESTVAR11 */
4675 "1", /* MSITESTVAR12 */
4676 "1;2", /* MSITESTVAR13 */
4677 ";1;", /* MSITESTVAR14 */
4678 ";;1;;", /* MSITESTVAR15 */
4679 " 1 ", /* MSITESTVAR16 */
4680 ";;2;;1", /* MSITESTVAR17 */
4681 "1;;2;;", /* MSITESTVAR18 */
4682 "1", /* MSITESTVAR19 */
4683 "1", /* MSITESTVAR20 */
4684 NULL
4686 UINT r;
4687 HKEY env;
4688 LONG res;
4689 DWORD type, size;
4690 char buffer[16];
4691 UINT i;
4693 if (is_process_limited())
4695 skip("process is limited\n");
4696 return;
4699 create_test_files();
4700 create_database(msifile, env_tables, sizeof(env_tables) / sizeof(msi_table));
4702 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Environment", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &env, NULL);
4703 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4705 res = RegSetValueExA(env, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"0", 2);
4706 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4708 res = RegSetValueExA(env, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"0", 2);
4709 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4711 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4713 r = MsiInstallProductA(msifile, NULL);
4714 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4716 skip("Not enough rights to perform tests\n");
4717 goto error;
4719 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4721 type = REG_NONE;
4722 size = sizeof(buffer);
4723 buffer[0] = 0;
4724 res = RegQueryValueExA(env, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
4725 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4726 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
4727 ok(!lstrcmp(buffer, "1"), "Expected \"1\", got %s\n", buffer);
4729 res = RegDeleteValueA(env, "MSITESTVAR1");
4730 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4732 type = REG_NONE;
4733 size = sizeof(buffer);
4734 buffer[0] = 0;
4735 res = RegQueryValueExA(env, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
4736 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4737 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
4738 ok(!lstrcmp(buffer, "1"), "Expected \"1\", got %s\n", buffer);
4740 res = RegDeleteValueA(env, "MSITESTVAR2");
4741 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4743 res = RegDeleteValueA(env, "MSITESTVAR3");
4744 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4746 res = RegDeleteValueA(env, "MSITESTVAR4");
4747 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4749 res = RegDeleteValueA(env, "MSITESTVAR5");
4750 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4752 res = RegDeleteValueA(env, "MSITESTVAR6");
4753 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4755 res = RegDeleteValueA(env, "MSITESTVAR7");
4756 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4758 res = RegDeleteValueA(env, "MSITESTVAR8");
4759 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4761 res = RegDeleteValueA(env, "MSITESTVAR9");
4762 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4764 res = RegDeleteValueA(env, "MSITESTVAR10");
4765 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4767 i = 11;
4768 while (results[i - 11])
4770 char name[20];
4771 sprintf(name, "MSITESTVAR%d", i);
4773 type = REG_NONE;
4774 size = sizeof(buffer);
4775 buffer[0] = 0;
4776 res = RegQueryValueExA(env, name, NULL, &type, (LPBYTE)buffer, &size);
4777 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
4778 ok(type == REG_SZ, "%d: Expected REG_SZ, got %u\n", i, type);
4779 ok(!lstrcmp(buffer, results[i - 11]), "%d: Expected %s, got %s\n", i, results[i - 11], buffer);
4781 res = RegDeleteValueA(env, name);
4782 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
4783 i++;
4786 delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
4787 delete_pf("msitest\\cabout\\new", FALSE);
4788 delete_pf("msitest\\cabout\\four.txt", TRUE);
4789 delete_pf("msitest\\cabout", FALSE);
4790 delete_pf("msitest\\changed\\three.txt", TRUE);
4791 delete_pf("msitest\\changed", FALSE);
4792 delete_pf("msitest\\first\\two.txt", TRUE);
4793 delete_pf("msitest\\first", FALSE);
4794 delete_pf("msitest\\filename", TRUE);
4795 delete_pf("msitest\\one.txt", TRUE);
4796 delete_pf("msitest\\service.exe", TRUE);
4797 delete_pf("msitest\\service2.exe", TRUE);
4798 delete_pf("msitest", FALSE);
4800 error:
4801 RegDeleteValueA(env, "MSITESTVAR1");
4802 RegDeleteValueA(env, "MSITESTVAR2");
4803 RegCloseKey(env);
4805 delete_test_files();
4806 DeleteFile(msifile);
4809 static void test_create_remove_folder(void)
4811 UINT r;
4813 if (is_process_limited())
4815 skip("process is limited\n");
4816 return;
4819 CreateDirectoryA("msitest", NULL);
4820 CreateDirectoryA("msitest\\first", NULL);
4821 CreateDirectoryA("msitest\\second", NULL);
4822 create_file("msitest\\first\\one.txt", 1000);
4823 create_file("msitest\\second\\two.txt", 1000);
4824 create_database(msifile, cf_tables, sizeof(cf_tables) / sizeof(msi_table));
4826 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4828 r = MsiInstallProductA(msifile, NULL);
4829 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4831 skip("Not enough rights to perform tests\n");
4832 goto error;
4834 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4836 ok(pf_exists("msitest\\first\\one.txt"), "file not installed\n");
4837 ok(pf_exists("msitest\\first"), "directory not created\n");
4838 ok(pf_exists("msitest\\second\\two.txt"), "file not installed\n");
4839 ok(pf_exists("msitest\\second"), "directory not created\n");
4840 ok(pf_exists("msitest\\third"), "directory not created\n");
4841 ok(pf_exists("msitest"), "directory not created\n");
4843 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4844 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4846 ok(!pf_exists("msitest\\first\\one.txt"), "file not removed\n");
4847 ok(!pf_exists("msitest\\first"), "directory not removed\n");
4848 ok(!pf_exists("msitest\\second\\two.txt"), "file not removed\n");
4849 ok(!pf_exists("msitest\\second"), "directory not removed\n");
4850 ok(!pf_exists("msitest\\third"), "directory not removed\n");
4851 todo_wine ok(!pf_exists("msitest"), "directory not removed\n");
4853 error:
4854 DeleteFileA("msitest\\first\\one.txt");
4855 DeleteFileA("msitest\\second\\two.txt");
4856 RemoveDirectoryA("msitest\\first");
4857 RemoveDirectoryA("msitest\\second");
4858 RemoveDirectoryA("msitest");
4859 DeleteFile(msifile);
4862 static void test_start_services(void)
4864 UINT r;
4865 SC_HANDLE scm, service;
4866 BOOL ret;
4867 DWORD error = ERROR_SUCCESS;
4869 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
4870 if (!scm && GetLastError() == ERROR_ACCESS_DENIED)
4872 skip("Not enough rights to perform tests\n");
4873 return;
4875 ok(scm != NULL, "Failed to open the SC Manager\n");
4876 if (!scm) return;
4878 service = OpenService(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
4879 if (!service && GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST)
4881 win_skip("The 'Spooler' service does not exist\n");
4882 CloseServiceHandle(scm);
4883 return;
4885 ok(service != NULL, "Failed to open Spooler, error %d\n", GetLastError());
4886 if (!service) {
4887 CloseServiceHandle(scm);
4888 return;
4891 ret = StartService(service, 0, NULL);
4892 if (!ret && (error = GetLastError()) != ERROR_SERVICE_ALREADY_RUNNING)
4894 skip("Spooler service not available, skipping test\n");
4895 CloseServiceHandle(service);
4896 CloseServiceHandle(scm);
4897 return;
4900 CloseServiceHandle(service);
4901 CloseServiceHandle(scm);
4903 create_test_files();
4904 create_database(msifile, sss_tables, sizeof(sss_tables) / sizeof(msi_table));
4906 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4908 r = MsiInstallProductA(msifile, NULL);
4909 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4911 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4912 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4913 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4914 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4915 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4916 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4917 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
4918 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
4919 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
4920 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
4921 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
4922 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
4923 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4925 delete_test_files();
4926 DeleteFile(msifile);
4928 if (error == ERROR_SUCCESS)
4930 SERVICE_STATUS status;
4932 scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
4933 service = OpenService(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
4935 ret = ControlService(service, SERVICE_CONTROL_STOP, &status);
4936 ok(ret, "ControlService failed %u\n", GetLastError());
4938 CloseServiceHandle(service);
4939 CloseServiceHandle(scm);
4943 static void test_delete_services(void)
4945 UINT r;
4946 SC_HANDLE manager, service;
4947 DWORD error;
4949 if (is_process_limited())
4951 skip("process is limited\n");
4952 return;
4955 manager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
4956 ok(manager != NULL, "can't open service manager %u\n", GetLastError());
4957 if (!manager) return;
4959 service = CreateServiceA(manager, "TestService3", "TestService3",
4960 SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_DEMAND_START,
4961 SERVICE_ERROR_NORMAL, "C:\\doesnt_exist.exe", NULL, NULL, NULL, NULL, NULL);
4962 ok(service != NULL, "can't create service %u\n", GetLastError());
4963 CloseServiceHandle(service);
4964 CloseServiceHandle(manager);
4965 if (!service) goto error;
4967 create_test_files();
4968 create_database(msifile, sds_tables, sizeof(sds_tables) / sizeof(msi_table));
4970 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4972 r = MsiInstallProductA(msifile, NULL);
4973 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4975 skip("Not enough rights to perform tests\n");
4976 goto error;
4978 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4980 manager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
4981 ok(manager != NULL, "can't open service manager\n");
4982 if (!manager) goto error;
4984 service = OpenServiceA(manager, "TestService3", GENERIC_ALL);
4985 error = GetLastError();
4986 ok(service == NULL, "TestService3 not deleted\n");
4987 ok(error == ERROR_SERVICE_DOES_NOT_EXIST, "wrong error %u\n", error);
4988 CloseServiceHandle(manager);
4990 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4991 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4993 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
4994 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
4995 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
4996 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
4997 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
4998 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
4999 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5000 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5001 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5002 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5003 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5004 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5005 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5007 error:
5008 delete_test_files();
5009 DeleteFile(msifile);
5012 static void test_self_registration(void)
5014 UINT r;
5016 if (is_process_limited())
5018 skip("process is limited\n");
5019 return;
5022 create_test_files();
5023 create_database(msifile, sr_tables, sizeof(sr_tables) / sizeof(msi_table));
5025 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5027 r = MsiInstallProductA(msifile, NULL);
5028 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5030 skip("Not enough rights to perform tests\n");
5031 goto error;
5033 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5035 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5036 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5037 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5038 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5039 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5040 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5041 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5042 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5043 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5044 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5045 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5046 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5047 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5049 error:
5050 delete_test_files();
5051 DeleteFile(msifile);
5054 static void test_register_font(void)
5056 static const char regfont1[] = "Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
5057 static const char regfont2[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Fonts";
5058 LONG ret;
5059 HKEY key;
5060 UINT r;
5061 REGSAM access = KEY_ALL_ACCESS;
5063 if (is_process_limited())
5065 skip("process is limited\n");
5066 return;
5069 create_test_files();
5070 create_file("msitest\\font.ttf", 1000);
5071 create_database(msifile, font_tables, sizeof(font_tables) / sizeof(msi_table));
5073 if (is_wow64)
5074 access |= KEY_WOW64_64KEY;
5076 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5078 r = MsiInstallProductA(msifile, NULL);
5079 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5081 skip("Not enough rights to perform tests\n");
5082 goto error;
5084 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5086 ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, regfont1, 0, access, &key);
5087 if (ret)
5088 RegOpenKeyExA(HKEY_LOCAL_MACHINE, regfont2, 0, access, &key);
5090 ret = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
5091 ok(ret != ERROR_FILE_NOT_FOUND, "unexpected result %d\n", ret);
5093 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5094 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5096 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5098 ret = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
5099 ok(ret == ERROR_FILE_NOT_FOUND, "unexpected result %d\n", ret);
5101 RegDeleteValueA(key, "msi test font");
5102 RegCloseKey(key);
5104 error:
5105 DeleteFileA("msitest\\font.ttf");
5106 delete_test_files();
5107 DeleteFile(msifile);
5110 static void test_validate_product_id(void)
5112 UINT r;
5114 if (is_process_limited())
5116 skip("process is limited\n");
5117 return;
5120 create_test_files();
5121 create_database(msifile, vp_tables, sizeof(vp_tables) / sizeof(msi_table));
5123 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5125 r = MsiInstallProductA(msifile, NULL);
5126 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5128 skip("Not enough rights to perform tests\n");
5129 goto error;
5131 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5133 r = MsiInstallProductA(msifile, "SET_PRODUCT_ID=1");
5134 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5136 r = MsiInstallProductA(msifile, "SET_PRODUCT_ID=2");
5137 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5139 r = MsiInstallProductA(msifile, "PIDKEY=123-1234567");
5140 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5142 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5143 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5144 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5145 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5146 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5147 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5148 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5149 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5150 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5151 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5152 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5153 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5154 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5156 error:
5157 delete_test_files();
5158 DeleteFile(msifile);
5161 static void test_install_remove_odbc(void)
5163 UINT r;
5165 if (is_process_limited())
5167 skip("process is limited\n");
5168 return;
5171 create_test_files();
5172 create_file("msitest\\ODBCdriver.dll", 1000);
5173 create_file("msitest\\ODBCdriver2.dll", 1000);
5174 create_file("msitest\\ODBCtranslator.dll", 1000);
5175 create_file("msitest\\ODBCtranslator2.dll", 1000);
5176 create_file("msitest\\ODBCsetup.dll", 1000);
5177 create_database(msifile, odbc_tables, sizeof(odbc_tables) / sizeof(msi_table));
5179 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5181 r = MsiInstallProductA(msifile, NULL);
5182 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5184 skip("Not enough rights to perform tests\n");
5185 goto error;
5187 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5189 ok(pf_exists("msitest\\ODBCdriver.dll"), "file not created\n");
5190 ok(pf_exists("msitest\\ODBCdriver2.dll"), "file not created\n");
5191 ok(pf_exists("msitest\\ODBCtranslator.dll"), "file not created\n");
5192 ok(pf_exists("msitest\\ODBCtranslator2.dll"), "file not created\n");
5193 ok(pf_exists("msitest\\ODBCsetup.dll"), "file not created\n");
5195 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5196 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5198 ok(!delete_pf("msitest\\ODBCdriver.dll", TRUE), "file not removed\n");
5199 ok(!delete_pf("msitest\\ODBCdriver2.dll", TRUE), "file not removed\n");
5200 ok(!delete_pf("msitest\\ODBCtranslator.dll", TRUE), "file not removed\n");
5201 ok(!delete_pf("msitest\\ODBCtranslator2.dll", TRUE), "file not removed\n");
5202 ok(!delete_pf("msitest\\ODBCsetup.dll", TRUE), "file not removed\n");
5203 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5205 error:
5206 DeleteFileA("msitest\\ODBCdriver.dll");
5207 DeleteFileA("msitest\\ODBCdriver2.dll");
5208 DeleteFileA("msitest\\ODBCtranslator.dll");
5209 DeleteFileA("msitest\\ODBCtranslator2.dll");
5210 DeleteFileA("msitest\\ODBCsetup.dll");
5211 delete_test_files();
5212 DeleteFile(msifile);
5215 static void test_register_typelib(void)
5217 UINT r;
5219 if (is_process_limited())
5221 skip("process is limited\n");
5222 return;
5225 create_test_files();
5226 create_file("msitest\\typelib.dll", 1000);
5227 create_database(msifile, tl_tables, sizeof(tl_tables) / sizeof(msi_table));
5229 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5231 r = MsiInstallProductA(msifile, "REGISTER_TYPELIB=1");
5232 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5234 skip("Not enough rights to perform tests\n");
5235 goto error;
5237 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5239 r = MsiInstallProductA(msifile, NULL);
5240 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5242 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5243 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5245 ok(!delete_pf("msitest\\typelib.dll", TRUE), "file not removed\n");
5246 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5248 error:
5249 DeleteFileA("msitest\\typelib.dll");
5250 delete_test_files();
5251 DeleteFile(msifile);
5254 static void test_create_remove_shortcut(void)
5256 UINT r;
5258 if (is_process_limited())
5260 skip("process is limited\n");
5261 return;
5264 create_test_files();
5265 create_file("msitest\\target.txt", 1000);
5266 create_database(msifile, crs_tables, sizeof(crs_tables) / sizeof(msi_table));
5268 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5270 r = MsiInstallProductA(msifile, NULL);
5271 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5273 skip("Not enough rights to perform tests\n");
5274 goto error;
5276 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5278 ok(pf_exists("msitest\\target.txt"), "file not created\n");
5279 ok(pf_exists("msitest\\shortcut.lnk"), "file not created\n");
5281 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5282 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5284 ok(!delete_pf("msitest\\shortcut.lnk", TRUE), "file not removed\n");
5285 ok(!delete_pf("msitest\\target.txt", TRUE), "file not removed\n");
5286 todo_wine ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5288 error:
5289 DeleteFileA("msitest\\target.txt");
5290 delete_test_files();
5291 DeleteFile(msifile);
5294 static void test_publish_components(void)
5296 static char keypath[] =
5297 "Software\\Microsoft\\Installer\\Components\\0CBCFA296AC907244845745CEEB2F8AA";
5299 UINT r;
5300 LONG res;
5301 HKEY key;
5303 if (is_process_limited())
5305 skip("process is limited\n");
5306 return;
5309 create_test_files();
5310 create_file("msitest\\english.txt", 1000);
5311 create_database(msifile, pub_tables, sizeof(pub_tables) / sizeof(msi_table));
5313 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5315 r = MsiInstallProductA(msifile, NULL);
5316 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5318 skip("Not enough rights to perform tests\n");
5319 goto error;
5321 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5323 res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
5324 ok(res == ERROR_SUCCESS, "components key not created %d\n", res);
5326 res = RegQueryValueExA(key, "english.txt", NULL, NULL, NULL, NULL);
5327 ok(res == ERROR_SUCCESS, "value not found %d\n", res);
5328 RegCloseKey(key);
5330 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5331 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5333 res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
5334 ok(res == ERROR_FILE_NOT_FOUND, "unexpected result %d\n", res);
5336 ok(!delete_pf("msitest\\english.txt", TRUE), "file not removed\n");
5337 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5339 error:
5340 DeleteFileA("msitest\\english.txt");
5341 delete_test_files();
5342 DeleteFile(msifile);
5345 static void test_remove_duplicate_files(void)
5347 UINT r;
5349 if (is_process_limited())
5351 skip("process is limited\n");
5352 return;
5355 create_test_files();
5356 create_file("msitest\\original.txt", 1000);
5357 create_file("msitest\\original2.txt", 1000);
5358 create_file("msitest\\original3.txt", 1000);
5359 create_database(msifile, rd_tables, sizeof(rd_tables) / sizeof(msi_table));
5361 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5363 r = MsiInstallProductA(msifile, NULL);
5364 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5366 skip("Not enough rights to perform tests\n");
5367 goto error;
5369 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5371 ok(pf_exists("msitest\\original.txt"), "file not created\n");
5372 ok(pf_exists("msitest\\original2.txt"), "file not created\n");
5373 ok(!pf_exists("msitest\\original3.txt"), "file created\n");
5374 ok(pf_exists("msitest\\duplicate.txt"), "file not created\n");
5375 ok(!pf_exists("msitest\\duplicate2.txt"), "file created\n");
5377 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5378 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5380 ok(delete_pf("msitest\\original.txt", TRUE), "file removed\n");
5381 ok(!delete_pf("msitest\\original2.txt", TRUE), "file not removed\n");
5382 ok(!delete_pf("msitest\\original3.txt", TRUE), "file not removed\n");
5383 ok(!delete_pf("msitest\\duplicate.txt", TRUE), "file not removed\n");
5384 ok(!delete_pf("msitest\\duplicate2.txt", TRUE), "file not removed\n");
5385 ok(delete_pf("msitest", FALSE), "directory removed\n");
5387 error:
5388 DeleteFileA("msitest\\original.txt");
5389 DeleteFileA("msitest\\original2.txt");
5390 DeleteFileA("msitest\\original3.txt");
5391 delete_test_files();
5392 DeleteFile(msifile);
5395 static void test_remove_registry_values(void)
5397 UINT r;
5398 LONG res;
5399 HKEY key;
5400 REGSAM access = KEY_ALL_ACCESS;
5402 if (is_process_limited())
5404 skip("process is limited\n");
5405 return;
5408 create_test_files();
5409 create_file("msitest\\registry.txt", 1000);
5410 create_database(msifile, rrv_tables, sizeof(rrv_tables) / sizeof(msi_table));
5412 if (is_wow64)
5413 access |= KEY_WOW64_64KEY;
5415 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5417 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, NULL, 0, access, NULL, &key, NULL);
5418 RegSetValueExA(key, "value1", 0, REG_SZ, (const BYTE *)"1", 2);
5419 RegCloseKey(key);
5421 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, NULL, 0, access, NULL, &key, NULL);
5422 RegSetValueExA(key, "value2", 0, REG_SZ, (const BYTE *)"2", 2);
5423 RegCloseKey(key);
5425 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", 0, NULL, 0, access, NULL, &key, NULL);
5426 RegSetValueExA(key, "", 0, REG_SZ, (const BYTE *)"default", 8);
5427 RegSetValueExA(key, "valueA", 0, REG_SZ, (const BYTE *)"A", 2);
5428 RegSetValueExA(key, "valueB", 0, REG_SZ, (const BYTE *)"B", 2);
5429 RegCloseKey(key);
5431 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", 0, NULL, 0, access, NULL, &key, NULL);
5432 RegSetValueExA(key, "", 0, REG_SZ, (const BYTE *)"default", 8);
5433 RegSetValueExA(key, "valueB", 0, REG_SZ, (const BYTE *)"B", 2);
5434 RegCloseKey(key);
5436 r = MsiInstallProductA(msifile, NULL);
5437 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5439 skip("Not enough rights to perform tests\n");
5440 goto error;
5442 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5444 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, access, &key);
5445 ok(res == ERROR_SUCCESS, "key removed\n");
5446 RegCloseKey(key);
5448 if (is_64bit)
5450 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\key2", 0, KEY_ALL_ACCESS, &key);
5451 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5453 else
5455 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, KEY_ALL_ACCESS, &key);
5456 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5459 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, NULL, 0, access, NULL, &key, NULL);
5460 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5461 RegCloseKey(key);
5463 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5464 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5466 if (is_64bit)
5468 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\key1", 0, KEY_ALL_ACCESS, &key);
5469 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5471 else
5473 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, KEY_ALL_ACCESS, &key);
5474 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5477 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, access, &key);
5478 ok(res == ERROR_SUCCESS, "key removed\n");
5479 RegCloseKey(key);
5481 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", 0, access, &key);
5482 ok(res == ERROR_SUCCESS, "key removed\n");
5483 RegCloseKey(key);
5485 if (is_64bit)
5487 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\keyB", 0, KEY_ALL_ACCESS, &key);
5488 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5490 else
5492 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", 0, KEY_ALL_ACCESS, &key);
5493 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5496 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", access);
5497 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", access);
5498 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine", access);
5500 ok(!delete_pf("msitest\\registry.txt", TRUE), "file not removed\n");
5501 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5503 error:
5504 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", access);
5505 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", access);
5506 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", access);
5507 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", access);
5509 DeleteFileA("msitest\\registry.txt");
5510 delete_test_files();
5511 DeleteFile(msifile);
5514 static void test_find_related_products(void)
5516 UINT r;
5518 if (is_process_limited())
5520 skip("process is limited\n");
5521 return;
5524 create_test_files();
5525 create_file("msitest\\product.txt", 1000);
5526 create_database(msifile, frp_tables, sizeof(frp_tables) / sizeof(msi_table));
5528 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5530 r = MsiInstallProductA(msifile, NULL);
5531 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5533 skip("Not enough rights to perform tests\n");
5534 goto error;
5536 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5538 /* install again, so it finds the upgrade code */
5539 r = MsiInstallProductA(msifile, NULL);
5540 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5542 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5543 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5545 ok(!delete_pf("msitest\\product.txt", TRUE), "file not removed\n");
5546 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5548 error:
5549 DeleteFileA("msitest\\product.txt");
5550 delete_test_files();
5551 DeleteFile(msifile);
5554 static void test_remove_ini_values(void)
5556 UINT r;
5557 DWORD len;
5558 char inifile[MAX_PATH], buf[0x10];
5559 HANDLE file;
5560 BOOL ret;
5562 if (is_process_limited())
5564 skip("process is limited\n");
5565 return;
5568 create_test_files();
5569 create_file("msitest\\inifile.txt", 1000);
5570 create_database(msifile, riv_tables, sizeof(riv_tables) / sizeof(msi_table));
5572 lstrcpyA(inifile, PROG_FILES_DIR);
5573 lstrcatA(inifile, "\\msitest");
5574 ret = CreateDirectoryA(inifile, NULL);
5575 if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
5577 skip("Not enough rights to perform tests\n");
5578 goto error;
5580 lstrcatA(inifile, "\\test.ini");
5581 file = CreateFileA(inifile, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS, 0, NULL);
5582 CloseHandle(file);
5584 ret = WritePrivateProfileStringA("section1", "key1", "value1", inifile);
5585 ok(ret, "failed to write profile string %u\n", GetLastError());
5587 ret = WritePrivateProfileStringA("sectionA", "keyA", "valueA", inifile);
5588 ok(ret, "failed to write profile string %u\n", GetLastError());
5590 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5592 r = MsiInstallProductA(msifile, NULL);
5593 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5595 len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), inifile);
5596 ok(len == 6, "got %u expected 6\n", len);
5598 len = GetPrivateProfileStringA("sectionA", "keyA", NULL, buf, sizeof(buf), inifile);
5599 ok(!len, "got %u expected 0\n", len);
5601 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5602 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5604 len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), inifile);
5605 ok(!len, "got %u expected 0\n", len);
5607 len = GetPrivateProfileStringA("sectionA", "keyA", NULL, buf, sizeof(buf), inifile);
5608 ok(!len, "got %u expected 0\n", len);
5610 todo_wine ok(!delete_pf("msitest\\test.ini", TRUE), "file removed\n");
5611 ok(!delete_pf("msitest\\inifile.txt", TRUE), "file not removed\n");
5612 ok(delete_pf("msitest", FALSE), "directory removed\n");
5614 error:
5615 DeleteFileA("msitest\\inifile.txt");
5616 delete_test_files();
5617 DeleteFile(msifile);
5620 static void test_remove_env_strings(void)
5622 UINT r;
5623 LONG res;
5624 HKEY key;
5625 DWORD type, size;
5626 char buffer[0x10];
5628 if (is_process_limited())
5630 skip("process is limited\n");
5631 return;
5634 create_test_files();
5635 create_file("msitest\\envvar.txt", 1000);
5636 create_database(msifile, res_tables, sizeof(res_tables) / sizeof(msi_table));
5638 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5640 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
5641 ok(!res, "failed to open environment key %d\n", res);
5643 RegSetValueExA(key, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"1", 2);
5644 RegSetValueExA(key, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"1", 2);
5645 RegSetValueExA(key, "MSITESTVAR3", 0, REG_SZ, (const BYTE *)"1", 2);
5646 RegSetValueExA(key, "MSITESTVAR4", 0, REG_SZ, (const BYTE *)"1", 2);
5647 RegSetValueExA(key, "MSITESTVAR5", 0, REG_SZ, (const BYTE *)"1", 2);
5649 RegCloseKey(key);
5651 r = MsiInstallProductA(msifile, NULL);
5652 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5654 skip("Not enough rights to perform tests\n");
5655 goto error;
5657 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5659 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
5660 ok(!res, "failed to open environment key %d\n", res);
5662 type = REG_NONE;
5663 buffer[0] = 0;
5664 size = sizeof(buffer);
5665 res = RegQueryValueExA(key, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
5666 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5667 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
5668 ok(!lstrcmp(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
5670 type = REG_NONE;
5671 buffer[0] = 0;
5672 size = sizeof(buffer);
5673 res = RegQueryValueExA(key, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
5674 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5675 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
5676 ok(!lstrcmp(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
5678 type = REG_NONE;
5679 buffer[0] = 0;
5680 size = sizeof(buffer);
5681 res = RegQueryValueExA(key, "MSITESTVAR3", NULL, &type, (LPBYTE)buffer, &size);
5682 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5683 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
5684 ok(!lstrcmp(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
5686 type = REG_NONE;
5687 buffer[0] = 0;
5688 size = sizeof(buffer);
5689 res = RegQueryValueExA(key, "MSITESTVAR4", NULL, &type, (LPBYTE)buffer, &size);
5690 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5691 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
5692 ok(!lstrcmp(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
5694 type = REG_NONE;
5695 buffer[0] = 0;
5696 size = sizeof(buffer);
5697 res = RegQueryValueExA(key, "MSITESTVAR5", NULL, &type, (LPBYTE)buffer, &size);
5698 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5699 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
5700 ok(!lstrcmp(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
5702 RegCloseKey(key);
5704 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5705 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5707 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
5708 ok(!res, "failed to open environment key %d\n", res);
5710 res = RegQueryValueExA(key, "MSITESTVAR1", NULL, NULL, NULL, NULL);
5711 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5713 res = RegQueryValueExA(key, "MSITESTVAR2", NULL, NULL, NULL, NULL);
5714 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5716 type = REG_NONE;
5717 buffer[0] = 0;
5718 size = sizeof(buffer);
5719 res = RegQueryValueExA(key, "MSITESTVAR3", NULL, &type, (LPBYTE)buffer, &size);
5720 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5721 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
5722 ok(!lstrcmp(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
5723 RegDeleteValueA(key, "MSITESTVAR3");
5725 res = RegQueryValueExA(key, "MSITESTVAR4", NULL, NULL, NULL, NULL);
5726 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5728 type = REG_NONE;
5729 buffer[0] = 0;
5730 size = sizeof(buffer);
5731 res = RegQueryValueExA(key, "MSITESTVAR5", NULL, &type, (LPBYTE)buffer, &size);
5732 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5733 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
5734 ok(!lstrcmp(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
5735 RegDeleteValueA(key, "MSITESTVAR5");
5737 ok(!delete_pf("msitest\\envvar.txt", TRUE), "file not removed\n");
5738 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5740 error:
5741 RegDeleteValueA(key, "MSITESTVAR1");
5742 RegDeleteValueA(key, "MSITESTVAR2");
5743 RegDeleteValueA(key, "MSITESTVAR3");
5744 RegDeleteValueA(key, "MSITESTVAR4");
5745 RegDeleteValueA(key, "MSITESTVAR5");
5746 RegCloseKey(key);
5748 DeleteFileA("msitest\\envvar.txt");
5749 delete_test_files();
5750 DeleteFile(msifile);
5753 static void test_register_class_info(void)
5755 UINT r;
5756 LONG res;
5757 HKEY hkey;
5759 if (is_process_limited())
5761 skip("process is limited\n");
5762 return;
5765 create_test_files();
5766 create_file("msitest\\class.txt", 1000);
5767 create_database(msifile, rci_tables, sizeof(rci_tables) / sizeof(msi_table));
5769 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5771 r = MsiInstallProductA(msifile, NULL);
5772 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5774 skip("Not enough rights to perform tests\n");
5775 goto error;
5777 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5779 if (is_64bit)
5780 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
5781 else
5782 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
5783 ok(res == ERROR_SUCCESS, "key not created\n");
5784 RegCloseKey(hkey);
5786 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
5787 ok(res == ERROR_SUCCESS, "key not created\n");
5788 RegCloseKey(hkey);
5790 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &hkey);
5791 ok(res == ERROR_SUCCESS, "key not created\n");
5792 RegCloseKey(hkey);
5794 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5795 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5797 if (is_64bit)
5798 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
5799 else
5800 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
5801 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5803 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
5804 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5806 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &hkey);
5807 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5809 ok(!delete_pf("msitest\\class.txt", TRUE), "file not removed\n");
5810 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5812 error:
5813 DeleteFileA("msitest\\class.txt");
5814 delete_test_files();
5815 DeleteFile(msifile);
5818 static void test_register_extension_info(void)
5820 UINT r;
5821 LONG res;
5822 HKEY hkey;
5824 if (is_process_limited())
5826 skip("process is limited\n");
5827 return;
5830 create_test_files();
5831 create_file("msitest\\extension.txt", 1000);
5832 create_database(msifile, rei_tables, sizeof(rei_tables) / sizeof(msi_table));
5834 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5836 r = MsiInstallProductA(msifile, NULL);
5837 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5839 skip("Not enough rights to perform tests\n");
5840 goto error;
5842 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5844 res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &hkey);
5845 ok(res == ERROR_SUCCESS, "key not created\n");
5846 RegCloseKey(hkey);
5848 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1\\shell\\Open\\command", &hkey);
5849 ok(res == ERROR_SUCCESS, "key not created\n");
5850 RegCloseKey(hkey);
5852 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5853 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5855 res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &hkey);
5856 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5858 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1", &hkey);
5859 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5861 ok(!delete_pf("msitest\\extension.txt", TRUE), "file not removed\n");
5862 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5864 error:
5865 DeleteFileA("msitest\\extension.txt");
5866 delete_test_files();
5867 DeleteFile(msifile);
5870 static void test_register_mime_info(void)
5872 UINT r;
5873 LONG res;
5874 HKEY hkey;
5876 if (is_process_limited())
5878 skip("process is limited\n");
5879 return;
5882 create_test_files();
5883 create_file("msitest\\mime.txt", 1000);
5884 create_database(msifile, rmi_tables, sizeof(rmi_tables) / sizeof(msi_table));
5886 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5888 r = MsiInstallProductA(msifile, NULL);
5889 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5891 skip("Not enough rights to perform tests\n");
5892 goto error;
5894 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5896 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &hkey);
5897 ok(res == ERROR_SUCCESS, "key not created\n");
5898 RegCloseKey(hkey);
5900 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5901 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5903 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &hkey);
5904 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5906 ok(!delete_pf("msitest\\mime.txt", TRUE), "file not removed\n");
5907 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5909 error:
5910 DeleteFileA("msitest\\mime.txt");
5911 delete_test_files();
5912 DeleteFile(msifile);
5915 static void test_publish_assemblies(void)
5917 static const char manifest[] =
5918 "<assemblyIdentity type=\"win32\" name=\"Wine.Win32.Assembly\" "
5919 "version=\"1.0.0.0\" publicKeyToken=\"abcdef0123456789\" "
5920 "processorArchitecture=\"x86\"/>";
5921 static const char manifest_local[] =
5922 "<assemblyIdentity type=\"win32\" name=\"Wine.Win32.Local.Assembly\" "
5923 "version=\"1.0.0.0\" publicKeyToken=\"abcdef0123456789\" "
5924 "processorArchitecture=\"x86\"/>";
5925 static const char classes_path_dotnet[] =
5926 "Installer\\Assemblies\\Global";
5927 static const char classes_path_dotnet_local[] =
5928 "Installer\\Assemblies\\C:|Program Files|msitest|application_dotnet.txt";
5929 static const char classes_path_dotnet_local_wow64[] =
5930 "Installer\\Assemblies\\C:|Program Files (x86)|msitest|application_dotnet.txt";
5931 static const char classes_path_win32[] =
5932 "Installer\\Win32Assemblies\\Global";
5933 static const char classes_path_win32_local[] =
5934 "Installer\\Win32Assemblies\\C:|Program Files|msitest|application_win32.txt";
5935 static const char classes_path_win32_local_wow64[] =
5936 "Installer\\Win32Assemblies\\C:|Program Files (x86)|msitest|application_win32.txt";
5937 static const char path_dotnet[] =
5938 "Software\\Microsoft\\Installer\\Assemblies\\Global";
5939 static const char path_dotnet_local[] =
5940 "Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files|msitest|application_dotnet.txt";
5941 static const char path_dotnet_local_wow64[] =
5942 "Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files (x86)|msitest|application_dotnet.txt";
5943 static const char path_win32[] =
5944 "Software\\Microsoft\\Installer\\Win32Assemblies\\Global";
5945 static const char path_win32_local[] =
5946 "Software\\Microsoft\\Installer\\Win32Assemblies\\C:|Program Files|msitest|application_win32.txt";
5947 static const char path_win32_local_wow64[] =
5948 "Software\\Microsoft\\Installer\\Win32Assemblies\\C:|Program Files (x86)|msitest|application_win32.txt";
5949 static const char name_dotnet[] =
5950 "Wine.Dotnet.Assembly,processorArchitecture=\"MSIL\",publicKeyToken=\"abcdef0123456789\","
5951 "version=\"1.0.0.0\",culture=\"neutral\"";
5952 static const char name_dotnet_local[] =
5953 "Wine.Dotnet.Local.Assembly,processorArchitecture=\"MSIL\",publicKeyToken=\"abcdef0123456789\","
5954 "version=\"1.0.0.0\",culture=\"neutral\"";
5955 static const char name_win32[] =
5956 "Wine.Win32.Assembly,processorArchitecture=\"x86\",publicKeyToken=\"abcdef0123456789\","
5957 "type=\"win32\",version=\"1.0.0.0\"";
5958 static const char name_win32_local[] =
5959 "Wine.Win32.Local.Assembly,processorArchitecture=\"x86\",publicKeyToken=\"abcdef0123456789\","
5960 "type=\"win32\",version=\"1.0.0.0\"";
5961 UINT r;
5962 LONG res;
5963 HKEY hkey;
5964 const char *path;
5965 int access;
5967 if (is_process_limited())
5969 skip("process is limited\n");
5970 return;
5973 create_test_files();
5974 create_file("msitest\\win32.txt", 1000);
5975 create_file("msitest\\win32_local.txt", 1000);
5976 create_file("msitest\\dotnet.txt", 1000);
5977 create_file("msitest\\dotnet_local.txt", 1000);
5978 create_file_data("msitest\\manifest.txt", manifest, 0);
5979 create_file_data("msitest\\manifest_local.txt", manifest_local, 0);
5980 create_file("msitest\\application_win32.txt", 1000);
5981 create_file("msitest\\application_dotnet.txt", 1000);
5982 create_database(msifile, pa_tables, sizeof(pa_tables) / sizeof(msi_table));
5984 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5986 r = MsiInstallProductA(msifile, NULL);
5987 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5989 skip("Not enough rights to perform tests\n");
5990 goto done;
5992 if (r == ERROR_INSTALL_FAILURE)
5994 skip("No support for installing side-by-side assemblies\n");
5995 goto done;
5997 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5999 res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &hkey);
6000 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6001 CHECK_REG_STR(hkey, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
6002 RegCloseKey(hkey);
6004 path = (is_wow64 || is_64bit) ? path_dotnet_local_wow64 : path_dotnet_local;
6005 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6006 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6007 CHECK_REG_STR(hkey, name_dotnet_local, "rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox");
6008 RegCloseKey(hkey);
6010 res = RegOpenKeyA(HKEY_CURRENT_USER, path_win32, &hkey);
6011 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6012 "Expected ERROR_SUCCESS, got %d\n", res);
6013 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32, "rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%");
6014 RegCloseKey(hkey);
6016 path = (is_wow64 || is_64bit) ? path_win32_local_wow64 : path_win32_local;
6017 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6018 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6019 "Expected ERROR_SUCCESS, got %d\n", res);
6020 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32_local, "rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
6021 RegCloseKey(hkey);
6023 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6024 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6026 res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &hkey);
6027 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6028 if (res == ERROR_SUCCESS)
6030 res = RegDeleteValueA(hkey, name_dotnet);
6031 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6032 RegCloseKey(hkey);
6035 path = (is_wow64 || is_64bit) ? path_dotnet_local_wow64 : path_dotnet_local;
6036 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6037 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6039 res = RegOpenKeyA(HKEY_CURRENT_USER, path_win32, &hkey);
6040 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6041 if (res == ERROR_SUCCESS)
6043 res = RegDeleteValueA(hkey, name_win32);
6044 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6045 RegCloseKey(hkey);
6048 path = (is_wow64 || is_64bit) ? path_win32_local_wow64 : path_win32_local;
6049 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6050 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6052 r = MsiInstallProductA(msifile, "ALLUSERS=1");
6053 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6055 access = KEY_QUERY_VALUE;
6056 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_dotnet, 0, access, &hkey);
6057 if (res == ERROR_FILE_NOT_FOUND && is_wow64) /* Vista WOW64 */
6059 trace("Using 64-bit registry view for HKCR\\Installer\n");
6060 access = KEY_QUERY_VALUE | KEY_WOW64_64KEY;
6061 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_dotnet, 0, access, &hkey);
6063 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6064 CHECK_REG_STR(hkey, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
6065 RegCloseKey(hkey);
6067 path = (is_wow64 || is_64bit) ? classes_path_dotnet_local_wow64 : classes_path_dotnet_local;
6068 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
6069 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6070 CHECK_REG_STR(hkey, name_dotnet_local, "rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox");
6071 RegCloseKey(hkey);
6073 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_win32, 0, access, &hkey);
6074 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6075 "Expected ERROR_SUCCESS, got %d\n", res);
6076 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32, "rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%");
6077 RegCloseKey(hkey);
6079 path = (is_wow64 || is_64bit) ? classes_path_win32_local_wow64 : classes_path_win32_local;
6080 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
6081 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6082 "Expected ERROR_SUCCESS, got %d\n", res);
6083 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32_local, "rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
6084 RegCloseKey(hkey);
6086 r = MsiInstallProductA(msifile, "REMOVE=ALL ALLUSERS=1");
6087 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6089 res = RegOpenKeyA(HKEY_CLASSES_ROOT, classes_path_dotnet, &hkey);
6090 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6091 if (res == ERROR_SUCCESS)
6093 res = RegDeleteValueA(hkey, name_dotnet);
6094 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6095 RegCloseKey(hkey);
6098 path = (is_wow64 || is_64bit) ? classes_path_dotnet_local_wow64 : classes_path_dotnet_local;
6099 res = RegOpenKeyA(HKEY_CLASSES_ROOT, path, &hkey);
6100 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6102 res = RegOpenKeyA(HKEY_CLASSES_ROOT, classes_path_win32, &hkey);
6103 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6104 if (res == ERROR_SUCCESS)
6106 res = RegDeleteValueA(hkey, name_win32);
6107 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6108 RegCloseKey(hkey);
6111 path = (is_wow64 || is_64bit) ? classes_path_win32_local_wow64 : classes_path_win32_local;
6112 res = RegOpenKeyA(HKEY_CLASSES_ROOT, path, &hkey);
6113 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6115 done:
6116 DeleteFileA("msitest\\win32.txt");
6117 DeleteFileA("msitest\\win32_local.txt");
6118 DeleteFileA("msitest\\dotnet.txt");
6119 DeleteFileA("msitest\\dotnet_local.txt");
6120 DeleteFileA("msitest\\manifest.txt");
6121 DeleteFileA("msitest\\manifest_local.txt");
6122 DeleteFileA("msitest\\application_win32.txt");
6123 DeleteFileA("msitest\\application_dotnet.txt");
6124 delete_test_files();
6125 DeleteFile(msifile);
6128 START_TEST(action)
6130 DWORD len;
6131 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6132 STATEMGRSTATUS status;
6133 BOOL ret = FALSE;
6135 init_functionpointers();
6137 if (pIsWow64Process)
6138 pIsWow64Process(GetCurrentProcess(), &is_wow64);
6140 GetCurrentDirectoryA(MAX_PATH, prev_path);
6141 GetTempPath(MAX_PATH, temp_path);
6142 SetCurrentDirectoryA(temp_path);
6144 lstrcpyA(CURR_DIR, temp_path);
6145 len = lstrlenA(CURR_DIR);
6147 if(len && (CURR_DIR[len - 1] == '\\'))
6148 CURR_DIR[len - 1] = 0;
6150 ok(get_system_dirs(), "failed to retrieve system dirs\n");
6151 ok(get_user_dirs(), "failed to retrieve user dirs\n");
6153 /* Create a restore point ourselves so we circumvent the multitude of restore points
6154 * that would have been created by all the installation and removal tests.
6156 * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
6157 * creation of restore points.
6159 if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
6161 memset(&status, 0, sizeof(status));
6162 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
6165 /* Create only one log file and don't append. We have to pass something
6166 * for the log mode for this to work. The logfile needs to have an absolute
6167 * path otherwise we still end up with some extra logfiles as some tests
6168 * change the current directory.
6170 lstrcpyA(log_file, temp_path);
6171 lstrcatA(log_file, "\\msitest.log");
6172 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
6174 test_register_product();
6175 test_publish_product();
6176 test_publish_features();
6177 test_register_user();
6178 test_process_components();
6179 test_publish();
6180 test_publish_sourcelist();
6181 test_remove_files();
6182 test_move_files();
6183 test_duplicate_files();
6184 test_write_registry_values();
6185 test_envvar();
6186 test_create_remove_folder();
6187 test_start_services();
6188 test_delete_services();
6189 test_self_registration();
6190 test_register_font();
6191 test_validate_product_id();
6192 test_install_remove_odbc();
6193 test_register_typelib();
6194 test_create_remove_shortcut();
6195 test_publish_components();
6196 test_remove_duplicate_files();
6197 test_remove_registry_values();
6198 test_find_related_products();
6199 test_remove_ini_values();
6200 test_remove_env_strings();
6201 test_register_class_info();
6202 test_register_extension_info();
6203 test_register_mime_info();
6204 test_publish_assemblies();
6206 DeleteFileA(log_file);
6208 if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
6210 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
6211 if (ret)
6212 remove_restore_point(status.llSequenceNumber);
6214 FreeLibrary(hsrclient);
6216 SetCurrentDirectoryA(prev_path);