msi: Don't install services without an image path.
[wine/wine-gecko.git] / dlls / msi / tests / action.c
blob4d1af0538a8c2158bdd09688bd712611d4c582c1
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>
31 #include <wtypes.h>
32 #include <shellapi.h>
33 #include <winsvc.h>
35 #include "wine/test.h"
37 static UINT (WINAPI *pMsiQueryComponentStateA)
38 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *);
39 static UINT (WINAPI *pMsiSourceListEnumSourcesA)
40 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
41 static UINT (WINAPI *pMsiSourceListGetInfoA)
42 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD);
43 static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
44 (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
45 static UINT (WINAPI *pMsiQueryFeatureStateExA)
46 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *);
48 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR *);
49 static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE);
50 static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
51 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
53 static HMODULE hsrclient;
54 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
55 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA *, STATEMGRSTATUS *);
57 static BOOL is_wow64;
58 static const BOOL is_64bit = sizeof(void *) > sizeof(int);
60 static const char *msifile = "msitest.msi";
61 static CHAR CURR_DIR[MAX_PATH];
62 static CHAR PROG_FILES_DIR[MAX_PATH];
63 static CHAR COMMON_FILES_DIR[MAX_PATH];
64 static CHAR APP_DATA_DIR[MAX_PATH];
65 static CHAR WINDOWS_DIR[MAX_PATH];
67 /* msi database data */
69 static const char component_dat[] =
70 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
71 "s72\tS38\ts72\ti2\tS255\tS72\n"
72 "Component\tComponent\n"
73 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
74 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
75 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n"
76 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
77 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
78 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
79 "component\t\tMSITESTDIR\t0\t1\tfile\n"
80 "service_comp\t{935A0A91-22A3-4F87-BCA8-928FFDFE2353}\tMSITESTDIR\t0\t\tservice_file\n"
81 "service_comp2\t{3F7B04A4-9521-4649-BDC9-0C8722740A49}\tMSITESTDIR\t0\t\tservice_file2\n"
82 "service_comp3\t{DBCD1502-20E3-423F-B53E-F37E263CDC7E}\tMSITESTDIR\t0\t\t\n";
84 static const char directory_dat[] =
85 "Directory\tDirectory_Parent\tDefaultDir\n"
86 "s72\tS72\tl255\n"
87 "Directory\tDirectory\n"
88 "CABOUTDIR\tMSITESTDIR\tcabout\n"
89 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
90 "FIRSTDIR\tMSITESTDIR\tfirst\n"
91 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
92 "NEWDIR\tCABOUTDIR\tnew\n"
93 "ProgramFilesFolder\tTARGETDIR\t.\n"
94 "TARGETDIR\t\tSourceDir";
96 static const char feature_dat[] =
97 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
98 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
99 "Feature\tFeature\n"
100 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
101 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
102 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
103 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
104 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
105 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
106 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
108 static const char feature_comp_dat[] =
109 "Feature_\tComponent_\n"
110 "s38\ts72\n"
111 "FeatureComponents\tFeature_\tComponent_\n"
112 "Five\tFive\n"
113 "Four\tFour\n"
114 "One\tOne\n"
115 "Three\tThree\n"
116 "Two\tTwo\n"
117 "feature\tcomponent\n"
118 "service_feature\tservice_comp\n"
119 "service_feature\tservice_comp2\n"
120 "service_feature\tservice_comp3";
122 static const char file_dat[] =
123 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
124 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
125 "File\tFile\n"
126 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
127 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
128 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
129 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
130 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
131 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
132 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t6\n"
133 "service_file2\tservice_comp2\tservice2.exe\t100\t\t\t8192\t7";
135 static const char install_exec_seq_dat[] =
136 "Action\tCondition\tSequence\n"
137 "s72\tS255\tI2\n"
138 "InstallExecuteSequence\tAction\n"
139 "AllocateRegistrySpace\tNOT Installed\t1550\n"
140 "CostFinalize\t\t1000\n"
141 "CostInitialize\t\t800\n"
142 "FileCost\t\t900\n"
143 "ResolveSource\t\t950\n"
144 "MoveFiles\t\t1700\n"
145 "InstallFiles\t\t4000\n"
146 "DuplicateFiles\t\t4500\n"
147 "WriteEnvironmentStrings\t\t4550\n"
148 "CreateShortcuts\t\t4600\n"
149 "InstallServices\t\t5000\n"
150 "InstallFinalize\t\t6600\n"
151 "InstallInitialize\t\t1500\n"
152 "InstallValidate\t\t1400\n"
153 "LaunchConditions\t\t100\n"
154 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
156 static const char media_dat[] =
157 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
158 "i2\ti4\tL64\tS255\tS32\tS72\n"
159 "Media\tDiskId\n"
160 "1\t3\t\t\tDISK1\t\n"
161 "2\t7\t\tmsitest.cab\tDISK2\t\n";
163 static const char property_dat[] =
164 "Property\tValue\n"
165 "s72\tl0\n"
166 "Property\tProperty\n"
167 "DefaultUIFont\tDlgFont8\n"
168 "HASUIRUN\t0\n"
169 "INSTALLLEVEL\t3\n"
170 "InstallMode\tTypical\n"
171 "Manufacturer\tWine\n"
172 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
173 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
174 "ProductID\tnone\n"
175 "ProductLanguage\t1033\n"
176 "ProductName\tMSITEST\n"
177 "ProductVersion\t1.1.1\n"
178 "PROMPTROLLBACKCOST\tP\n"
179 "Setup\tSetup\n"
180 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
181 "AdminProperties\tPOSTADMIN\n"
182 "ROOTDRIVE\tC:\\\n"
183 "SERVNAME\tTestService\n"
184 "SERVNAME2\tTestService2\n"
185 "SERVDISP\tTestServiceDisp\n"
186 "SERVDISP2\tTestServiceDisp2\n"
187 "MSIFASTINSTALL\t1\n";
189 static const char environment_dat[] =
190 "Environment\tName\tValue\tComponent_\n"
191 "s72\tl255\tL255\ts72\n"
192 "Environment\tEnvironment\n"
193 "Var1\t=-MSITESTVAR1\t1\tOne\n"
194 "Var2\tMSITESTVAR2\t1\tOne\n"
195 "Var3\t=-MSITESTVAR3\t1\tOne\n"
196 "Var4\tMSITESTVAR4\t1\tOne\n"
197 "Var5\t-MSITESTVAR5\t\tOne\n"
198 "Var6\tMSITESTVAR6\t\tOne\n"
199 "Var7\t!-MSITESTVAR7\t\tOne\n"
200 "Var8\t!-*MSITESTVAR8\t\tOne\n"
201 "Var9\t=-MSITESTVAR9\t\tOne\n"
202 "Var10\t=MSITESTVAR10\t\tOne\n"
203 "Var11\t+-MSITESTVAR11\t[~];1\tOne\n"
204 "Var12\t+-MSITESTVAR11\t[~];2\tOne\n"
205 "Var13\t+-MSITESTVAR12\t[~];1\tOne\n"
206 "Var14\t=MSITESTVAR13\t[~];1\tOne\n"
207 "Var15\t=MSITESTVAR13\t[~];2\tOne\n"
208 "Var16\t=MSITESTVAR14\t;1;\tOne\n"
209 "Var17\t=MSITESTVAR15\t;;1;;\tOne\n"
210 "Var18\t=MSITESTVAR16\t 1 \tOne\n"
211 "Var19\t+-MSITESTVAR17\t1\tOne\n"
212 "Var20\t+-MSITESTVAR17\t;;2;;[~]\tOne\n"
213 "Var21\t+-MSITESTVAR18\t1\tOne\n"
214 "Var22\t+-MSITESTVAR18\t[~];;2;;\tOne\n"
215 "Var23\t+-MSITESTVAR19\t1\tOne\n"
216 "Var24\t+-MSITESTVAR19\t[~]2\tOne\n"
217 "Var25\t+-MSITESTVAR20\t1\tOne\n"
218 "Var26\t+-MSITESTVAR20\t2[~]\tOne\n";
220 static const char service_install_dat[] =
221 "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
222 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
223 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
224 "ServiceInstall\tServiceInstall\n"
225 "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService\t\t-a arg\tservice_comp\tdescription\n"
226 "TestService2\tSERVNAME2]\t[SERVDISP2]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService2\t\t-a arg\tservice_comp2\tdescription";
228 static const char service_install2_dat[] =
229 "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
230 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
231 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
232 "ServiceInstall\tServiceInstall\n"
233 "TestService\tTestService\tTestService\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\n"
234 "TestService4\tTestService4\tTestService4\t2\t3\t0\t\t\tTestService4\t\t\tservice_comp3\t\n";
236 static const char service_control_dat[] =
237 "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
238 "s72\tl255\ti2\tL255\tI2\ts72\n"
239 "ServiceControl\tServiceControl\n"
240 "ServiceControl\tTestService3\t8\t\t0\tservice_comp\n"
241 "ServiceControl2\tTestService3\t128\t\t0\tservice_comp2";
243 static const char sss_service_control_dat[] =
244 "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
245 "s72\tl255\ti2\tL255\tI2\ts72\n"
246 "ServiceControl\tServiceControl\n"
247 "ServiceControl\tSpooler\t1\t\t0\tservice_comp";
249 static const char sss_install_exec_seq_dat[] =
250 "Action\tCondition\tSequence\n"
251 "s72\tS255\tI2\n"
252 "InstallExecuteSequence\tAction\n"
253 "LaunchConditions\t\t100\n"
254 "CostInitialize\t\t800\n"
255 "FileCost\t\t900\n"
256 "ResolveSource\t\t950\n"
257 "CostFinalize\t\t1000\n"
258 "InstallValidate\t\t1400\n"
259 "InstallInitialize\t\t1500\n"
260 "DeleteServices\t\t5000\n"
261 "MoveFiles\t\t5100\n"
262 "InstallFiles\t\t5200\n"
263 "DuplicateFiles\t\t5300\n"
264 "StartServices\t\t5400\n"
265 "InstallFinalize\t\t6000\n";
267 static const char sds_install_exec_seq_dat[] =
268 "Action\tCondition\tSequence\n"
269 "s72\tS255\tI2\n"
270 "InstallExecuteSequence\tAction\n"
271 "LaunchConditions\t\t100\n"
272 "CostInitialize\t\t800\n"
273 "FileCost\t\t900\n"
274 "ResolveSource\t\t950\n"
275 "CostFinalize\t\t1000\n"
276 "InstallValidate\t\t1400\n"
277 "InstallInitialize\t\t1500\n"
278 "StopServices\t\t5000\n"
279 "DeleteServices\t\t5050\n"
280 "MoveFiles\t\t5100\n"
281 "InstallFiles\t\t5200\n"
282 "DuplicateFiles\t\t5300\n"
283 "InstallServices\t\t5400\n"
284 "StartServices\t\t5450\n"
285 "RegisterProduct\t\t5500\n"
286 "PublishFeatures\t\t5600\n"
287 "PublishProduct\t\t5700\n"
288 "InstallFinalize\t\t6000\n";
290 static const char rof_component_dat[] =
291 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
292 "s72\tS38\ts72\ti2\tS255\tS72\n"
293 "Component\tComponent\n"
294 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
296 static const char rof_feature_dat[] =
297 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
298 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
299 "Feature\tFeature\n"
300 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
301 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
303 static const char rof_feature_comp_dat[] =
304 "Feature_\tComponent_\n"
305 "s38\ts72\n"
306 "FeatureComponents\tFeature_\tComponent_\n"
307 "feature\tmaximus\n"
308 "montecristo\tmaximus";
310 static const char rof_file_dat[] =
311 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
312 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
313 "File\tFile\n"
314 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
316 static const char rof_media_dat[] =
317 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
318 "i2\ti4\tL64\tS255\tS32\tS72\n"
319 "Media\tDiskId\n"
320 "1\t1\t\t\tDISK1\t\n";
322 static const char ci2_feature_comp_dat[] =
323 "Feature_\tComponent_\n"
324 "s38\ts72\n"
325 "FeatureComponents\tFeature_\tComponent_\n"
326 "feature\taugustus";
328 static const char ci2_file_dat[] =
329 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
330 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
331 "File\tFile\n"
332 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
334 static const char pp_install_exec_seq_dat[] =
335 "Action\tCondition\tSequence\n"
336 "s72\tS255\tI2\n"
337 "InstallExecuteSequence\tAction\n"
338 "ValidateProductID\t\t700\n"
339 "CostInitialize\t\t800\n"
340 "FileCost\t\t900\n"
341 "CostFinalize\t\t1000\n"
342 "InstallValidate\t\t1400\n"
343 "InstallInitialize\t\t1500\n"
344 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
345 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
346 "RemoveFiles\t\t3500\n"
347 "InstallFiles\t\t4000\n"
348 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
349 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
350 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
351 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
352 "InstallFinalize\t\t6600";
354 static const char pp_component_dat[] =
355 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
356 "s72\tS38\ts72\ti2\tS255\tS72\n"
357 "Component\tComponent\n"
358 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\t\tmaximus\n";
360 static const char ppc_component_dat[] =
361 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
362 "s72\tS38\ts72\ti2\tS255\tS72\n"
363 "Component\tComponent\n"
364 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\t\tmaximus\n"
365 "augustus\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\taugustus\n";
367 static const char ppc_file_dat[] =
368 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
369 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
370 "File\tFile\n"
371 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1\n"
372 "augustus\taugustus\taugustus\t500\t\t\t8192\t2";
374 static const char ppc_media_dat[] =
375 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
376 "i2\ti4\tL64\tS255\tS32\tS72\n"
377 "Media\tDiskId\n"
378 "1\t2\t\t\tDISK1\t\n";
380 static const char ppc_feature_comp_dat[] =
381 "Feature_\tComponent_\n"
382 "s38\ts72\n"
383 "FeatureComponents\tFeature_\tComponent_\n"
384 "feature\tmaximus\n"
385 "feature\taugustus\n"
386 "montecristo\tmaximus";
388 static const char cwd_component_dat[] =
389 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
390 "s72\tS38\ts72\ti2\tS255\tS72\n"
391 "Component\tComponent\n"
392 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
394 static const char rem_component_dat[] =
395 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
396 "s72\tS38\ts72\ti2\tS255\tS72\n"
397 "Component\tComponent\n"
398 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t0\t\thydrogen\n"
399 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\thelium\n"
400 "lithium\t\tMSITESTDIR\t2\t\tlithium\n";
402 static const char rem_feature_comp_dat[] =
403 "Feature_\tComponent_\n"
404 "s38\ts72\n"
405 "FeatureComponents\tFeature_\tComponent_\n"
406 "feature\thydrogen\n"
407 "feature\thelium\n"
408 "feature\tlithium";
410 static const char rem_file_dat[] =
411 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
412 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
413 "File\tFile\n"
414 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
415 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
416 "lithium\tlithium\tlithium\t0\t\t\t8192\t1";
418 static const char rem_install_exec_seq_dat[] =
419 "Action\tCondition\tSequence\n"
420 "s72\tS255\tI2\n"
421 "InstallExecuteSequence\tAction\n"
422 "ValidateProductID\t\t700\n"
423 "CostInitialize\t\t800\n"
424 "FileCost\t\t900\n"
425 "CostFinalize\t\t1000\n"
426 "InstallValidate\t\t1400\n"
427 "InstallInitialize\t\t1500\n"
428 "ProcessComponents\t\t1600\n"
429 "UnpublishFeatures\t\t1800\n"
430 "RemoveFiles\t\t3500\n"
431 "InstallFiles\t\t4000\n"
432 "RegisterProduct\t\t6100\n"
433 "PublishFeatures\t\t6300\n"
434 "PublishProduct\t\t6400\n"
435 "InstallFinalize\t\t6600";
437 static const char rem_remove_files_dat[] =
438 "FileKey\tComponent_\tFileName\tDirProperty\tInstallMode\n"
439 "s72\ts72\tS255\ts72\tI2\n"
440 "RemoveFile\tFileKey\n"
441 "furlong\thydrogen\tfurlong\tMSITESTDIR\t1\n"
442 "firkin\thelium\tfirkin\tMSITESTDIR\t1\n"
443 "fortnight\tlithium\tfortnight\tMSITESTDIR\t1\n"
444 "becquerel\thydrogen\tbecquerel\tMSITESTDIR\t2\n"
445 "dioptre\thelium\tdioptre\tMSITESTDIR\t2\n"
446 "attoparsec\tlithium\tattoparsec\tMSITESTDIR\t2\n"
447 "storeys\thydrogen\tstoreys\tMSITESTDIR\t3\n"
448 "block\thelium\tblock\tMSITESTDIR\t3\n"
449 "siriometer\tlithium\tsiriometer\tMSITESTDIR\t3\n"
450 "nanoacre\thydrogen\t\tCABOUTDIR\t3\n";
452 static const char mov_move_file_dat[] =
453 "FileKey\tComponent_\tSourceName\tDestName\tSourceFolder\tDestFolder\tOptions\n"
454 "s72\ts72\tS255\tS255\tS72\ts72\ti2\n"
455 "MoveFile\tFileKey\n"
456 "abkhazia\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t0\n"
457 "bahamas\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t1\n"
458 "cambodia\taugustus\tcameroon\tcanada\tSourceDir\tMSITESTDIR\t0\n"
459 "denmark\taugustus\tdjibouti\tdominica\tSourceDir\tMSITESTDIR\t1\n"
460 "ecuador\taugustus\tegypt\telsalvador\tNotAProp\tMSITESTDIR\t1\n"
461 "fiji\taugustus\tfinland\tfrance\tSourceDir\tNotAProp\t1\n"
462 "gabon\taugustus\tgambia\tgeorgia\tSOURCEFULL\tMSITESTDIR\t1\n"
463 "haiti\taugustus\thonduras\thungary\tSourceDir\tDESTFULL\t1\n"
464 "iceland\taugustus\tindia\tindonesia\tMSITESTDIR\tMSITESTDIR\t1\n"
465 "jamaica\taugustus\tjapan\tjordan\tFILEPATHBAD\tMSITESTDIR\t1\n"
466 "kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n"
467 "laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n"
468 "namibia\taugustus\tnauru\tkiribati\tSourceDir\tMSITESTDIR\t1\n"
469 "pakistan\taugustus\tperu\tsfn|poland\tSourceDir\tMSITESTDIR\t1\n"
470 "wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
471 "single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
472 "wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
473 "singlenodest\taugustus\tb?r\t\tSourceDir\tMSITESTDIR\t1\n";
475 static const char df_directory_dat[] =
476 "Directory\tDirectory_Parent\tDefaultDir\n"
477 "s72\tS72\tl255\n"
478 "Directory\tDirectory\n"
479 "THIS\tMSITESTDIR\tthis\n"
480 "DOESNOT\tTHIS\tdoesnot\n"
481 "NONEXISTENT\tDOESNOT\texist\n"
482 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
483 "ProgramFilesFolder\tTARGETDIR\t.\n"
484 "TARGETDIR\t\tSourceDir";
486 static const char df_duplicate_file_dat[] =
487 "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
488 "s72\ts72\ts72\tS255\tS72\n"
489 "DuplicateFile\tFileKey\n"
490 "maximus\tmaximus\tmaximus\taugustus\t\n"
491 "caesar\tmaximus\tmaximus\t\tNONEXISTENT\n"
492 "augustus\tnosuchcomponent\tmaximus\t\tMSITESTDIR\n";
494 static const char wrv_component_dat[] =
495 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
496 "s72\tS38\ts72\ti2\tS255\tS72\n"
497 "Component\tComponent\n"
498 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
500 static const char wrv_registry_dat[] =
501 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
502 "s72\ti2\tl255\tL255\tL0\ts72\n"
503 "Registry\tRegistry\n"
504 "regdata\t2\tSOFTWARE\\Wine\\msitest\tValue\t[~]one[~]two[~]three\taugustus\n"
505 "regdata1\t2\tSOFTWARE\\Wine\\msitest\t*\t\taugustus\n"
506 "regdata2\t2\tSOFTWARE\\Wine\\msitest\t*\t#%\taugustus\n"
507 "regdata3\t2\tSOFTWARE\\Wine\\msitest\t*\t#x\taugustus\n"
508 "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"
509 "regdata5\t2\tSOFTWARE\\Wine\\msitest\tValue1\t[~]one[~]\taugustus\n"
510 "regdata6\t2\tSOFTWARE\\Wine\\msitest\tValue2\t[~]two\taugustus\n"
511 "regdata7\t2\tSOFTWARE\\Wine\\msitest\tValue3\tone[~]\taugustus\n"
512 "regdata8\t2\tSOFTWARE\\Wine\\msitest\tValue4\tone[~]two\taugustus\n"
513 "regdata9\t2\tSOFTWARE\\Wine\\msitest\tValue5\t[~]one[~]two[~]three\taugustus\n"
514 "regdata10\t2\tSOFTWARE\\Wine\\msitest\tValue6\t[~]\taugustus\n"
515 "regdata11\t2\tSOFTWARE\\Wine\\msitest\tValue7\t[~]two\taugustus\n";
517 static const char cf_directory_dat[] =
518 "Directory\tDirectory_Parent\tDefaultDir\n"
519 "s72\tS72\tl255\n"
520 "Directory\tDirectory\n"
521 "FIRSTDIR\tMSITESTDIR\tfirst\n"
522 "SECONDDIR\tMSITESTDIR\tsecond\n"
523 "THIRDDIR\tMSITESTDIR\tthird\n"
524 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
525 "ProgramFilesFolder\tTARGETDIR\t.\n"
526 "TARGETDIR\t\tSourceDir";
528 static const char cf_component_dat[] =
529 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
530 "s72\tS38\ts72\ti2\tS255\tS72\n"
531 "Component\tComponent\n"
532 "One\t{F8CD42AC-9C38-48FE-8664-B35FD121012A}\tFIRSTDIR\t0\t\tone.txt\n"
533 "Two\t{DE2DB02E-2DDF-4E34-8CF6-DCA13E29DF52}\tSECONDDIR\t0\t\ttwo.txt\n";
535 static const char cf_feature_dat[] =
536 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
537 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
538 "Feature\tFeature\n"
539 "One\t\tOne\tThe One Feature\t1\t3\tFIRSTDIR\t0\n"
540 "Two\t\tTwo\tThe Two Feature\t1\t3\tSECONDDIR\t0\n";
542 static const char cf_feature_comp_dat[] =
543 "Feature_\tComponent_\n"
544 "s38\ts72\n"
545 "FeatureComponents\tFeature_\tComponent_\n"
546 "One\tOne\n"
547 "Two\tTwo\n";
549 static const char cf_file_dat[] =
550 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
551 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
552 "File\tFile\n"
553 "one.txt\tOne\tone.txt\t0\t\t\t0\t1\n"
554 "two.txt\tTwo\ttwo.txt\t0\t\t\t0\t2\n";
556 static const char cf_create_folders_dat[] =
557 "Directory_\tComponent_\n"
558 "s72\ts72\n"
559 "CreateFolder\tDirectory_\tComponent_\n"
560 "FIRSTDIR\tOne\n"
561 "SECONDDIR\tTwo\n"
562 "THIRDDIR\tTwo\n";
564 static const char cf_install_exec_seq_dat[] =
565 "Action\tCondition\tSequence\n"
566 "s72\tS255\tI2\n"
567 "InstallExecuteSequence\tAction\n"
568 "CostFinalize\t\t1000\n"
569 "ValidateProductID\t\t700\n"
570 "CostInitialize\t\t800\n"
571 "FileCost\t\t900\n"
572 "RemoveFiles\t\t3500\n"
573 "CreateFolders\t\t3700\n"
574 "RemoveFolders\t\t3800\n"
575 "InstallFiles\t\t4000\n"
576 "RegisterUser\t\t6000\n"
577 "RegisterProduct\t\t6100\n"
578 "PublishFeatures\t\t6300\n"
579 "PublishProduct\t\t6400\n"
580 "InstallFinalize\t\t6600\n"
581 "InstallInitialize\t\t1500\n"
582 "ProcessComponents\t\t1600\n"
583 "UnpublishFeatures\t\t1800\n"
584 "InstallValidate\t\t1400\n"
585 "LaunchConditions\t\t100\n";
587 static const char sr_selfreg_dat[] =
588 "File_\tCost\n"
589 "s72\tI2\n"
590 "SelfReg\tFile_\n"
591 "one.txt\t1\n";
593 static const char sr_install_exec_seq_dat[] =
594 "Action\tCondition\tSequence\n"
595 "s72\tS255\tI2\n"
596 "InstallExecuteSequence\tAction\n"
597 "CostFinalize\t\t1000\n"
598 "CostInitialize\t\t800\n"
599 "FileCost\t\t900\n"
600 "ResolveSource\t\t950\n"
601 "MoveFiles\t\t1700\n"
602 "SelfUnregModules\t\t3900\n"
603 "InstallFiles\t\t4000\n"
604 "DuplicateFiles\t\t4500\n"
605 "WriteEnvironmentStrings\t\t4550\n"
606 "CreateShortcuts\t\t4600\n"
607 "InstallFinalize\t\t6600\n"
608 "InstallInitialize\t\t1500\n"
609 "InstallValidate\t\t1400\n"
610 "LaunchConditions\t\t100\n";
612 static const char font_media_dat[] =
613 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
614 "i2\ti4\tL64\tS255\tS32\tS72\n"
615 "Media\tDiskId\n"
616 "1\t3\t\t\tDISK1\t\n";
618 static const char font_file_dat[] =
619 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
620 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
621 "File\tFile\n"
622 "font.ttf\tfonts\tfont.ttf\t1000\t\t\t8192\t1\n";
624 static const char font_feature_dat[] =
625 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
626 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
627 "Feature\tFeature\n"
628 "fonts\t\t\tfont feature\t1\t2\tMSITESTDIR\t0\n";
630 static const char font_component_dat[] =
631 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
632 "s72\tS38\ts72\ti2\tS255\tS72\n"
633 "Component\tComponent\n"
634 "fonts\t{F5920ED0-1183-4B8F-9330-86CE56557C05}\tMSITESTDIR\t0\t\tfont.ttf\n";
636 static const char font_feature_comp_dat[] =
637 "Feature_\tComponent_\n"
638 "s38\ts72\n"
639 "FeatureComponents\tFeature_\tComponent_\n"
640 "fonts\tfonts\n";
642 static const char font_dat[] =
643 "File_\tFontTitle\n"
644 "s72\tS128\n"
645 "Font\tFile_\n"
646 "font.ttf\tmsi test font\n";
648 static const char font_install_exec_seq_dat[] =
649 "Action\tCondition\tSequence\n"
650 "s72\tS255\tI2\n"
651 "InstallExecuteSequence\tAction\n"
652 "ValidateProductID\t\t700\n"
653 "CostInitialize\t\t800\n"
654 "FileCost\t\t900\n"
655 "CostFinalize\t\t1000\n"
656 "InstallValidate\t\t1400\n"
657 "InstallInitialize\t\t1500\n"
658 "ProcessComponents\t\t1600\n"
659 "UnpublishFeatures\t\t1800\n"
660 "RemoveFiles\t\t3500\n"
661 "InstallFiles\t\t4000\n"
662 "RegisterFonts\t\t4100\n"
663 "UnregisterFonts\t\t4200\n"
664 "RegisterUser\t\t6000\n"
665 "RegisterProduct\t\t6100\n"
666 "PublishFeatures\t\t6300\n"
667 "PublishProduct\t\t6400\n"
668 "InstallFinalize\t\t6600";
670 static const char vp_property_dat[] =
671 "Property\tValue\n"
672 "s72\tl0\n"
673 "Property\tProperty\n"
674 "HASUIRUN\t0\n"
675 "INSTALLLEVEL\t3\n"
676 "InstallMode\tTypical\n"
677 "Manufacturer\tWine\n"
678 "PIDTemplate\t###-#######\n"
679 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
680 "ProductLanguage\t1033\n"
681 "ProductName\tMSITEST\n"
682 "ProductVersion\t1.1.1\n"
683 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
684 "MSIFASTINSTALL\t1\n";
686 static const char vp_custom_action_dat[] =
687 "Action\tType\tSource\tTarget\tISComments\n"
688 "s72\ti2\tS64\tS0\tS255\n"
689 "CustomAction\tAction\n"
690 "SetProductID1\t51\tProductID\t1\t\n"
691 "SetProductID2\t51\tProductID\t2\t\n"
692 "TestProductID1\t19\t\t\tHalts installation\n"
693 "TestProductID2\t19\t\t\tHalts installation\n";
695 static const char vp_install_exec_seq_dat[] =
696 "Action\tCondition\tSequence\n"
697 "s72\tS255\tI2\n"
698 "InstallExecuteSequence\tAction\n"
699 "LaunchConditions\t\t100\n"
700 "CostInitialize\t\t800\n"
701 "FileCost\t\t900\n"
702 "CostFinalize\t\t1000\n"
703 "InstallValidate\t\t1400\n"
704 "InstallInitialize\t\t1500\n"
705 "SetProductID1\tSET_PRODUCT_ID=1\t3000\n"
706 "SetProductID2\tSET_PRODUCT_ID=2\t3100\n"
707 "ValidateProductID\t\t3200\n"
708 "InstallExecute\t\t3300\n"
709 "TestProductID1\tProductID=1\t3400\n"
710 "TestProductID2\tProductID=\"123-1234567\"\t3500\n"
711 "InstallFiles\t\t4000\n"
712 "InstallFinalize\t\t6000\n";
714 static const char odbc_file_dat[] =
715 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
716 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
717 "File\tFile\n"
718 "ODBCdriver.dll\todbc\tODBCdriver.dll\t1000\t\t\t8192\t1\n"
719 "ODBCdriver2.dll\todbc\tODBCdriver2.dll\t1000\t\t\t8192\t2\n"
720 "ODBCtranslator.dll\todbc\tODBCtranslator.dll\t1000\t\t\t8192\t3\n"
721 "ODBCtranslator2.dll\todbc\tODBCtranslator2.dll\t1000\t\t\t8192\t4\n"
722 "ODBCsetup.dll\todbc\tODBCsetup.dll\t1000\t\t\t8192\t5\n";
724 static const char odbc_feature_dat[] =
725 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
726 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
727 "Feature\tFeature\n"
728 "odbc\t\t\todbc feature\t1\t2\tMSITESTDIR\t0\n";
730 static const char odbc_feature_comp_dat[] =
731 "Feature_\tComponent_\n"
732 "s38\ts72\n"
733 "FeatureComponents\tFeature_\tComponent_\n"
734 "odbc\todbc\n";
736 static const char odbc_component_dat[] =
737 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
738 "s72\tS38\ts72\ti2\tS255\tS72\n"
739 "Component\tComponent\n"
740 "odbc\t{B6F3E4AE-35D1-4B72-9044-989F03E20A43}\tMSITESTDIR\t0\t\tODBCdriver.dll\n";
742 static const char odbc_driver_dat[] =
743 "Driver\tComponent_\tDescription\tFile_\tFile_Setup\n"
744 "s72\ts72\ts255\ts72\tS72\n"
745 "ODBCDriver\tDriver\n"
746 "ODBC test driver\todbc\tODBC test driver\tODBCdriver.dll\t\n"
747 "ODBC test driver2\todbc\tODBC test driver2\tODBCdriver2.dll\tODBCsetup.dll\n";
749 static const char odbc_translator_dat[] =
750 "Translator\tComponent_\tDescription\tFile_\tFile_Setup\n"
751 "s72\ts72\ts255\ts72\tS72\n"
752 "ODBCTranslator\tTranslator\n"
753 "ODBC test translator\todbc\tODBC test translator\tODBCtranslator.dll\t\n"
754 "ODBC test translator2\todbc\tODBC test translator2\tODBCtranslator2.dll\tODBCsetup.dll\n";
756 static const char odbc_datasource_dat[] =
757 "DataSource\tComponent_\tDescription\tDriverDescription\tRegistration\n"
758 "s72\ts72\ts255\ts255\ti2\n"
759 "ODBCDataSource\tDataSource\n"
760 "ODBC data source\todbc\tODBC data source\tODBC driver\t0\n";
762 static const char odbc_install_exec_seq_dat[] =
763 "Action\tCondition\tSequence\n"
764 "s72\tS255\tI2\n"
765 "InstallExecuteSequence\tAction\n"
766 "LaunchConditions\t\t100\n"
767 "CostInitialize\t\t800\n"
768 "FileCost\t\t900\n"
769 "CostFinalize\t\t1000\n"
770 "InstallValidate\t\t1400\n"
771 "InstallInitialize\t\t1500\n"
772 "ProcessComponents\t\t1600\n"
773 "InstallODBC\t\t3000\n"
774 "RemoveODBC\t\t3100\n"
775 "RemoveFiles\t\t3900\n"
776 "InstallFiles\t\t4000\n"
777 "RegisterProduct\t\t5000\n"
778 "PublishFeatures\t\t5100\n"
779 "PublishProduct\t\t5200\n"
780 "InstallFinalize\t\t6000\n";
782 static const char odbc_media_dat[] =
783 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
784 "i2\ti4\tL64\tS255\tS32\tS72\n"
785 "Media\tDiskId\n"
786 "1\t5\t\t\tDISK1\t\n";
788 static const char tl_file_dat[] =
789 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
790 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
791 "File\tFile\n"
792 "typelib.dll\ttypelib\ttypelib.dll\t1000\t\t\t8192\t1\n";
794 static const char tl_feature_dat[] =
795 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
796 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
797 "Feature\tFeature\n"
798 "typelib\t\t\ttypelib feature\t1\t2\tMSITESTDIR\t0\n";
800 static const char tl_feature_comp_dat[] =
801 "Feature_\tComponent_\n"
802 "s38\ts72\n"
803 "FeatureComponents\tFeature_\tComponent_\n"
804 "typelib\ttypelib\n";
806 static const char tl_component_dat[] =
807 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
808 "s72\tS38\ts72\ti2\tS255\tS72\n"
809 "Component\tComponent\n"
810 "typelib\t{BB4C26FD-89D8-4E49-AF1C-DB4DCB5BF1B0}\tMSITESTDIR\t0\t\ttypelib.dll\n";
812 static const char tl_typelib_dat[] =
813 "LibID\tLanguage\tComponent_\tVersion\tDescription\tDirectory_\tFeature_\tCost\n"
814 "s38\ti2\ts72\tI4\tL128\tS72\ts38\tI4\n"
815 "TypeLib\tLibID\tLanguage\tComponent_\n"
816 "{EAC5166A-9734-4D91-878F-1DD02304C66C}\t0\ttypelib\t1793\t\tMSITESTDIR\ttypelib\t\n";
818 static const char tl_install_exec_seq_dat[] =
819 "Action\tCondition\tSequence\n"
820 "s72\tS255\tI2\n"
821 "InstallExecuteSequence\tAction\n"
822 "LaunchConditions\t\t100\n"
823 "CostInitialize\t\t800\n"
824 "FileCost\t\t900\n"
825 "CostFinalize\t\t1000\n"
826 "InstallValidate\t\t1400\n"
827 "InstallInitialize\t\t1500\n"
828 "ProcessComponents\t\t1600\n"
829 "RemoveFiles\t\t1700\n"
830 "InstallFiles\t\t2000\n"
831 "RegisterTypeLibraries\tREGISTER_TYPELIB=1\t3000\n"
832 "UnregisterTypeLibraries\t\t3100\n"
833 "RegisterProduct\t\t5100\n"
834 "PublishFeatures\t\t5200\n"
835 "PublishProduct\t\t5300\n"
836 "InstallFinalize\t\t6000\n";
838 static const char crs_file_dat[] =
839 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
840 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
841 "File\tFile\n"
842 "target.txt\tshortcut\ttarget.txt\t1000\t\t\t8192\t1\n";
844 static const char crs_feature_dat[] =
845 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
846 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
847 "Feature\tFeature\n"
848 "shortcut\t\t\tshortcut feature\t1\t2\tMSITESTDIR\t0\n";
850 static const char crs_feature_comp_dat[] =
851 "Feature_\tComponent_\n"
852 "s38\ts72\n"
853 "FeatureComponents\tFeature_\tComponent_\n"
854 "shortcut\tshortcut\n";
856 static const char crs_component_dat[] =
857 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
858 "s72\tS38\ts72\ti2\tS255\tS72\n"
859 "Component\tComponent\n"
860 "shortcut\t{5D20E3C6-7206-498F-AC28-87AF2F9AD4CC}\tMSITESTDIR\t0\t\ttarget.txt\n";
862 static const char crs_shortcut_dat[] =
863 "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
864 "s72\ts72\tl128\ts72\ts72\tL255\tL255\tI2\tS72\tI2\tI2\tS72\n"
865 "Shortcut\tShortcut\n"
866 "shortcut\tMSITESTDIR\tshortcut\tshortcut\t[MSITESTDIR]target.txt\t\t\t\t\t\t\t\n";
868 static const char crs_install_exec_seq_dat[] =
869 "Action\tCondition\tSequence\n"
870 "s72\tS255\tI2\n"
871 "InstallExecuteSequence\tAction\n"
872 "LaunchConditions\t\t100\n"
873 "CostInitialize\t\t800\n"
874 "FileCost\t\t900\n"
875 "CostFinalize\t\t1000\n"
876 "InstallValidate\t\t1400\n"
877 "InstallInitialize\t\t1500\n"
878 "ProcessComponents\t\t1600\n"
879 "RemoveFiles\t\t1700\n"
880 "InstallFiles\t\t2000\n"
881 "RemoveShortcuts\t\t3000\n"
882 "CreateShortcuts\t\t3100\n"
883 "RegisterProduct\t\t5000\n"
884 "PublishFeatures\t\t5100\n"
885 "PublishProduct\t\t5200\n"
886 "InstallFinalize\t\t6000\n";
888 static const char pub_file_dat[] =
889 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
890 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
891 "File\tFile\n"
892 "english.txt\tpublish\tenglish.txt\t1000\t\t\t8192\t1\n";
894 static const char pub_feature_dat[] =
895 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
896 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
897 "Feature\tFeature\n"
898 "publish\t\t\tpublish feature\t1\t2\tMSITESTDIR\t0\n";
900 static const char pub_feature_comp_dat[] =
901 "Feature_\tComponent_\n"
902 "s38\ts72\n"
903 "FeatureComponents\tFeature_\tComponent_\n"
904 "publish\tpublish\n";
906 static const char pub_component_dat[] =
907 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
908 "s72\tS38\ts72\ti2\tS255\tS72\n"
909 "Component\tComponent\n"
910 "publish\t{B4EA0ACF-6238-426E-9C6D-7869F0F9C768}\tMSITESTDIR\t0\t\tenglish.txt\n";
912 static const char pub_publish_component_dat[] =
913 "ComponentId\tQualifier\tComponent_\tAppData\tFeature_\n"
914 "s38\ts255\ts72\tL255\ts38\n"
915 "PublishComponent\tComponentId\tQualifier\tComponent_\n"
916 "{92AFCBC0-9CA6-4270-8454-47C5EE2B8FAA}\tenglish.txt\tpublish\t\tpublish\n";
918 static const char pub_install_exec_seq_dat[] =
919 "Action\tCondition\tSequence\n"
920 "s72\tS255\tI2\n"
921 "InstallExecuteSequence\tAction\n"
922 "LaunchConditions\t\t100\n"
923 "CostInitialize\t\t800\n"
924 "FileCost\t\t900\n"
925 "CostFinalize\t\t1000\n"
926 "InstallValidate\t\t1400\n"
927 "InstallInitialize\t\t1500\n"
928 "ProcessComponents\t\t1600\n"
929 "RemoveFiles\t\t1700\n"
930 "InstallFiles\t\t2000\n"
931 "PublishComponents\t\t3000\n"
932 "UnpublishComponents\t\t3100\n"
933 "RegisterProduct\t\t5000\n"
934 "PublishFeatures\t\t5100\n"
935 "PublishProduct\t\t5200\n"
936 "InstallFinalize\t\t6000\n";
938 static const char rd_file_dat[] =
939 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
940 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
941 "File\tFile\n"
942 "original.txt\tduplicate\toriginal.txt\t1000\t\t\t8192\t1\n"
943 "original2.txt\tduplicate\toriginal2.txt\t1000\t\t\t8192\t2\n"
944 "original3.txt\tduplicate2\toriginal3.txt\t1000\t\t\t8192\t3\n";
946 static const char rd_feature_dat[] =
947 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
948 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
949 "Feature\tFeature\n"
950 "duplicate\t\t\tduplicate feature\t1\t2\tMSITESTDIR\t0\n";
952 static const char rd_feature_comp_dat[] =
953 "Feature_\tComponent_\n"
954 "s38\ts72\n"
955 "FeatureComponents\tFeature_\tComponent_\n"
956 "duplicate\tduplicate\n";
958 static const char rd_component_dat[] =
959 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
960 "s72\tS38\ts72\ti2\tS255\tS72\n"
961 "Component\tComponent\n"
962 "duplicate\t{EB45D06A-ADFE-44E3-8D41-B7DE150E41AD}\tMSITESTDIR\t0\t\toriginal.txt\n"
963 "duplicate2\t{B8BA60E0-B2E9-488E-9D0E-E60F25F04F97}\tMSITESTDIR\t0\tDUPLICATE2=1\toriginal3.txt\n";
965 static const char rd_duplicate_file_dat[] =
966 "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
967 "s72\ts72\ts72\tS255\tS72\n"
968 "DuplicateFile\tFileKey\n"
969 "duplicate\tduplicate\toriginal.txt\tduplicate.txt\t\n"
970 "duplicate2\tduplicate\toriginal2.txt\t\tMSITESTDIR\n"
971 "duplicate3\tduplicate2\toriginal3.txt\tduplicate2.txt\t\n";
973 static const char rd_install_exec_seq_dat[] =
974 "Action\tCondition\tSequence\n"
975 "s72\tS255\tI2\n"
976 "InstallExecuteSequence\tAction\n"
977 "LaunchConditions\t\t100\n"
978 "CostInitialize\t\t800\n"
979 "FileCost\t\t900\n"
980 "CostFinalize\t\t1000\n"
981 "InstallValidate\t\t1400\n"
982 "InstallInitialize\t\t1500\n"
983 "ProcessComponents\t\t1600\n"
984 "RemoveDuplicateFiles\t\t1900\n"
985 "InstallFiles\t\t2000\n"
986 "DuplicateFiles\t\t2100\n"
987 "RegisterProduct\t\t5000\n"
988 "PublishFeatures\t\t5100\n"
989 "PublishProduct\t\t5200\n"
990 "InstallFinalize\t\t6000\n";
992 static const char rrv_file_dat[] =
993 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
994 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
995 "File\tFile\n"
996 "registry.txt\tregistry\tregistry.txt\t1000\t\t\t8192\t1\n";
998 static const char rrv_feature_dat[] =
999 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1000 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1001 "Feature\tFeature\n"
1002 "registry\t\t\tregistry feature\t1\t2\tMSITESTDIR\t0\n";
1004 static const char rrv_feature_comp_dat[] =
1005 "Feature_\tComponent_\n"
1006 "s38\ts72\n"
1007 "FeatureComponents\tFeature_\tComponent_\n"
1008 "registry\tregistry\n";
1010 static const char rrv_component_dat[] =
1011 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1012 "s72\tS38\ts72\ti2\tS255\tS72\n"
1013 "Component\tComponent\n"
1014 "registry\t{DA97585B-962D-45EB-AD32-DA15E60CA9EE}\tMSITESTDIR\t0\t\tregistry.txt\n";
1016 static const char rrv_registry_dat[] =
1017 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
1018 "s72\ti2\tl255\tL255\tL0\ts72\n"
1019 "Registry\tRegistry\n"
1020 "reg1\t2\tSOFTWARE\\Wine\\keyA\t\tA\tregistry\n"
1021 "reg2\t2\tSOFTWARE\\Wine\\keyA\tvalueA\tA\tregistry\n"
1022 "reg3\t2\tSOFTWARE\\Wine\\key1\t-\t\tregistry\n";
1024 static const char rrv_remove_registry_dat[] =
1025 "RemoveRegistry\tRoot\tKey\tName\tComponent_\n"
1026 "s72\ti2\tl255\tL255\ts72\n"
1027 "RemoveRegistry\tRemoveRegistry\n"
1028 "reg1\t2\tSOFTWARE\\Wine\\keyB\t\tregistry\n"
1029 "reg2\t2\tSOFTWARE\\Wine\\keyB\tValueB\tregistry\n"
1030 "reg3\t2\tSOFTWARE\\Wine\\key2\t-\tregistry\n";
1032 static const char rrv_install_exec_seq_dat[] =
1033 "Action\tCondition\tSequence\n"
1034 "s72\tS255\tI2\n"
1035 "InstallExecuteSequence\tAction\n"
1036 "LaunchConditions\t\t100\n"
1037 "CostInitialize\t\t800\n"
1038 "FileCost\t\t900\n"
1039 "CostFinalize\t\t1000\n"
1040 "InstallValidate\t\t1400\n"
1041 "InstallInitialize\t\t1500\n"
1042 "ProcessComponents\t\t1600\n"
1043 "RemoveFiles\t\t1700\n"
1044 "InstallFiles\t\t2000\n"
1045 "RemoveRegistryValues\t\t3000\n"
1046 "RegisterProduct\t\t5000\n"
1047 "PublishFeatures\t\t5100\n"
1048 "PublishProduct\t\t5200\n"
1049 "InstallFinalize\t\t6000\n";
1051 static const char frp_file_dat[] =
1052 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1053 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1054 "File\tFile\n"
1055 "product.txt\tproduct\tproduct.txt\t1000\t\t\t8192\t1\n";
1057 static const char frp_feature_dat[] =
1058 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1059 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1060 "Feature\tFeature\n"
1061 "product\t\t\tproduct feature\t1\t2\tMSITESTDIR\t0\n";
1063 static const char frp_feature_comp_dat[] =
1064 "Feature_\tComponent_\n"
1065 "s38\ts72\n"
1066 "FeatureComponents\tFeature_\tComponent_\n"
1067 "product\tproduct\n";
1069 static const char frp_component_dat[] =
1070 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1071 "s72\tS38\ts72\ti2\tS255\tS72\n"
1072 "Component\tComponent\n"
1073 "product\t{44725EE0-EEA8-40BD-8162-A48224A2FEA1}\tMSITESTDIR\t0\t\tproduct.txt\n";
1075 static const char frp_custom_action_dat[] =
1076 "Action\tType\tSource\tTarget\tISComments\n"
1077 "s72\ti2\tS64\tS0\tS255\n"
1078 "CustomAction\tAction\n"
1079 "TestProp\t19\t\t\tPROP set\n";
1081 static const char frp_upgrade_dat[] =
1082 "UpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\tRemove\tActionProperty\n"
1083 "s38\tS20\tS20\tS255\ti4\tS255\ts72\n"
1084 "Upgrade\tUpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\n"
1085 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}\t1.1.1\t2.2.2\t\t768\t\tPROP\n";
1087 static const char frp_install_exec_seq_dat[] =
1088 "Action\tCondition\tSequence\n"
1089 "s72\tS255\tI2\n"
1090 "InstallExecuteSequence\tAction\n"
1091 "FindRelatedProducts\t\t50\n"
1092 "TestProp\tPROP AND NOT REMOVE\t51\n"
1093 "LaunchConditions\t\t100\n"
1094 "CostInitialize\t\t800\n"
1095 "FileCost\t\t900\n"
1096 "CostFinalize\t\t1000\n"
1097 "InstallValidate\t\t1400\n"
1098 "InstallInitialize\t\t1500\n"
1099 "ProcessComponents\t\t1600\n"
1100 "RemoveFiles\t\t1700\n"
1101 "InstallFiles\t\t2000\n"
1102 "RegisterProduct\t\t5000\n"
1103 "PublishFeatures\t\t5100\n"
1104 "PublishProduct\t\t5200\n"
1105 "InstallFinalize\t\t6000\n";
1107 static const char riv_file_dat[] =
1108 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1109 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1110 "File\tFile\n"
1111 "inifile.txt\tinifile\tinifile.txt\t1000\t\t\t8192\t1\n";
1113 static const char riv_feature_dat[] =
1114 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1115 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1116 "Feature\tFeature\n"
1117 "inifile\t\t\tinifile feature\t1\t2\tMSITESTDIR\t0\n";
1119 static const char riv_feature_comp_dat[] =
1120 "Feature_\tComponent_\n"
1121 "s38\ts72\n"
1122 "FeatureComponents\tFeature_\tComponent_\n"
1123 "inifile\tinifile\n";
1125 static const char riv_component_dat[] =
1126 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1127 "s72\tS38\ts72\ti2\tS255\tS72\n"
1128 "Component\tComponent\n"
1129 "inifile\t{A0F15705-4F57-4437-88C4-6C8B37ACC6DE}\tMSITESTDIR\t0\t\tinifile.txt\n";
1131 static const char riv_ini_file_dat[] =
1132 "IniFile\tFileName\tDirProperty\tSection\tKey\tValue\tAction\tComponent_\n"
1133 "s72\tl255\tS72\tl96\tl128\tl255\ti2\ts72\n"
1134 "IniFile\tIniFile\n"
1135 "inifile1\ttest.ini\tMSITESTDIR\tsection1\tkey1\tvalue1\t0\tinifile\n";
1137 static const char riv_remove_ini_file_dat[] =
1138 "RemoveIniFile\tFileName\tDirProperty\tSection\tKey\tValue\tAction\tComponent_\n"
1139 "s72\tl255\tS72\tl96\tl128\tL255\ti2\ts72\n"
1140 "RemoveIniFile\tRemoveIniFile\n"
1141 "inifile1\ttest.ini\tMSITESTDIR\tsectionA\tkeyA\tvalueA\t2\tinifile\n";
1143 static const char riv_install_exec_seq_dat[] =
1144 "Action\tCondition\tSequence\n"
1145 "s72\tS255\tI2\n"
1146 "InstallExecuteSequence\tAction\n"
1147 "LaunchConditions\t\t100\n"
1148 "CostInitialize\t\t800\n"
1149 "FileCost\t\t900\n"
1150 "CostFinalize\t\t1000\n"
1151 "InstallValidate\t\t1400\n"
1152 "InstallInitialize\t\t1500\n"
1153 "ProcessComponents\t\t1600\n"
1154 "RemoveFiles\t\t1700\n"
1155 "InstallFiles\t\t2000\n"
1156 "RemoveIniValues\t\t3000\n"
1157 "RegisterProduct\t\t5000\n"
1158 "PublishFeatures\t\t5100\n"
1159 "PublishProduct\t\t5200\n"
1160 "InstallFinalize\t\t6000\n";
1162 static const char res_file_dat[] =
1163 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1164 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1165 "File\tFile\n"
1166 "envvar.txt\tenvvar\tenvvar.txt\t1000\t\t\t8192\t1\n";
1168 static const char res_feature_dat[] =
1169 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1170 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1171 "Feature\tFeature\n"
1172 "envvar\t\t\tenvvar feature\t1\t2\tMSITESTDIR\t0\n";
1174 static const char res_feature_comp_dat[] =
1175 "Feature_\tComponent_\n"
1176 "s38\ts72\n"
1177 "FeatureComponents\tFeature_\tComponent_\n"
1178 "envvar\tenvvar\n";
1180 static const char res_component_dat[] =
1181 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1182 "s72\tS38\ts72\ti2\tS255\tS72\n"
1183 "Component\tComponent\n"
1184 "envvar\t{45EE9AF4-E5D1-445F-8BB7-B22D4EEBD29E}\tMSITESTDIR\t0\t\tenvvar.txt\n";
1186 static const char res_environment_dat[] =
1187 "Environment\tName\tValue\tComponent_\n"
1188 "s72\tl255\tL255\ts72\n"
1189 "Environment\tEnvironment\n"
1190 "var1\t=-MSITESTVAR1\t1\tenvvar\n"
1191 "var2\t=+-MSITESTVAR2\t1\tenvvar\n"
1192 "var3\t=MSITESTVAR3\t1\tenvvar\n"
1193 "var4\t=-MSITESTVAR4\t\tenvvar\n"
1194 "var5\t=MSITESTVAR5\t\tenvvar\n";
1196 static const char res_install_exec_seq_dat[] =
1197 "Action\tCondition\tSequence\n"
1198 "s72\tS255\tI2\n"
1199 "InstallExecuteSequence\tAction\n"
1200 "LaunchConditions\t\t100\n"
1201 "CostInitialize\t\t800\n"
1202 "FileCost\t\t900\n"
1203 "CostFinalize\t\t1000\n"
1204 "InstallValidate\t\t1400\n"
1205 "InstallInitialize\t\t1500\n"
1206 "ProcessComponents\t\t1600\n"
1207 "RemoveFiles\t\t1700\n"
1208 "InstallFiles\t\t2000\n"
1209 "RemoveEnvironmentStrings\t\t3000\n"
1210 "RegisterProduct\t\t5000\n"
1211 "PublishFeatures\t\t5100\n"
1212 "PublishProduct\t\t5200\n"
1213 "InstallFinalize\t\t6000\n";
1215 static const char rci_file_dat[] =
1216 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1217 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1218 "File\tFile\n"
1219 "class.txt\tclass\tclass.txt\t1000\t\t\t8192\t1\n";
1221 static const char rci_feature_dat[] =
1222 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1223 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1224 "Feature\tFeature\n"
1225 "class\t\t\tclass feature\t1\t2\tMSITESTDIR\t0\n";
1227 static const char rci_feature_comp_dat[] =
1228 "Feature_\tComponent_\n"
1229 "s38\ts72\n"
1230 "FeatureComponents\tFeature_\tComponent_\n"
1231 "class\tclass\n";
1233 static const char rci_component_dat[] =
1234 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1235 "s72\tS38\ts72\ti2\tS255\tS72\n"
1236 "Component\tComponent\n"
1237 "class\t{89A98345-F8A1-422E-A48B-0250B5809F2D}\tMSITESTDIR\t0\t\tclass.txt\n";
1239 static const char rci_appid_dat[] =
1240 "AppId\tRemoteServerName\tLocalService\tServiceParameters\tDllSurrogate\tActivateAtStorage\tRunAsInteractiveUser\n"
1241 "s38\tS255\tS255\tS255\tS255\tI2\tI2\n"
1242 "AppId\tAppId\n"
1243 "{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\t\t\t\t\t\t\n";
1245 static const char rci_class_dat[] =
1246 "CLSID\tContext\tComponent_\tProgId_Default\tDescription\tAppId_\tFileTypeMask\tIcon_\tIconIndex\tDefInprocHandler\tArgument\tFeature_\tAttributes\n"
1247 "s38\ts32\ts72\tS255\tL255\tS38\tS255\tS72\tI2\tS32\tS255\ts38\tI2\n"
1248 "Class\tCLSID\tContext\tComponent_\n"
1249 "{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tLocalServer\tclass\t\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tclass\t\n";
1251 static const char rci_install_exec_seq_dat[] =
1252 "Action\tCondition\tSequence\n"
1253 "s72\tS255\tI2\n"
1254 "InstallExecuteSequence\tAction\n"
1255 "LaunchConditions\t\t100\n"
1256 "CostInitialize\t\t800\n"
1257 "FileCost\t\t900\n"
1258 "CostFinalize\t\t1000\n"
1259 "InstallValidate\t\t1400\n"
1260 "InstallInitialize\t\t1500\n"
1261 "ProcessComponents\t\t1600\n"
1262 "RemoveFiles\t\t1700\n"
1263 "InstallFiles\t\t2000\n"
1264 "UnregisterClassInfo\t\t3000\n"
1265 "RegisterClassInfo\t\t4000\n"
1266 "RegisterProduct\t\t5000\n"
1267 "PublishFeatures\t\t5100\n"
1268 "PublishProduct\t\t5200\n"
1269 "InstallFinalize\t\t6000\n";
1271 static const char rei_file_dat[] =
1272 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1273 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1274 "File\tFile\n"
1275 "extension.txt\textension\textension.txt\t1000\t\t\t8192\t1\n";
1277 static const char rei_feature_dat[] =
1278 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1279 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1280 "Feature\tFeature\n"
1281 "extension\t\t\textension feature\t1\t2\tMSITESTDIR\t0\n";
1283 static const char rei_feature_comp_dat[] =
1284 "Feature_\tComponent_\n"
1285 "s38\ts72\n"
1286 "FeatureComponents\tFeature_\tComponent_\n"
1287 "extension\textension\n";
1289 static const char rei_component_dat[] =
1290 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1291 "s72\tS38\ts72\ti2\tS255\tS72\n"
1292 "Component\tComponent\n"
1293 "extension\t{9A3060D4-60BA-4A82-AB55-9FB148AD013C}\tMSITESTDIR\t0\t\textension.txt\n";
1295 static const char rei_extension_dat[] =
1296 "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n"
1297 "s255\ts72\tS255\tS64\ts38\n"
1298 "Extension\tExtension\tComponent_\n"
1299 "extension\textension\tProg.Id.1\t\textension\n";
1301 static const char rei_verb_dat[] =
1302 "Extension_\tVerb\tSequence\tCommand\tArgument\n"
1303 "s255\ts32\tI2\tL255\tL255\n"
1304 "Verb\tExtension_\tVerb\n"
1305 "extension\tOpen\t1\t&Open\t/argument\n";
1307 static const char rei_progid_dat[] =
1308 "ProgId\tProgId_Parent\tClass_\tDescription\tIcon_\tIconIndex\n"
1309 "s255\tS255\tS38\tL255\tS72\tI2\n"
1310 "ProgId\tProgId\n"
1311 "Prog.Id.1\t\t\tdescription\t\t\n";
1313 static const char rei_install_exec_seq_dat[] =
1314 "Action\tCondition\tSequence\n"
1315 "s72\tS255\tI2\n"
1316 "InstallExecuteSequence\tAction\n"
1317 "LaunchConditions\t\t100\n"
1318 "CostInitialize\t\t800\n"
1319 "FileCost\t\t900\n"
1320 "CostFinalize\t\t1000\n"
1321 "InstallValidate\t\t1400\n"
1322 "InstallInitialize\t\t1500\n"
1323 "ProcessComponents\t\t1600\n"
1324 "RemoveFiles\t\t1700\n"
1325 "InstallFiles\t\t2000\n"
1326 "UnregisterExtensionInfo\t\t3000\n"
1327 "RegisterExtensionInfo\t\t4000\n"
1328 "RegisterProduct\t\t5000\n"
1329 "PublishFeatures\t\t5100\n"
1330 "PublishProduct\t\t5200\n"
1331 "InstallFinalize\t\t6000\n";
1333 static const char rmi_file_dat[] =
1334 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1335 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1336 "File\tFile\n"
1337 "mime.txt\tmime\tmime.txt\t1000\t\t\t8192\t1\n";
1339 static const char rmi_feature_dat[] =
1340 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1341 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1342 "Feature\tFeature\n"
1343 "mime\t\t\tmime feature\t1\t2\tMSITESTDIR\t0\n";
1345 static const char rmi_feature_comp_dat[] =
1346 "Feature_\tComponent_\n"
1347 "s38\ts72\n"
1348 "FeatureComponents\tFeature_\tComponent_\n"
1349 "mime\tmime\n";
1351 static const char rmi_component_dat[] =
1352 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1353 "s72\tS38\ts72\ti2\tS255\tS72\n"
1354 "Component\tComponent\n"
1355 "mime\t{A1D630CE-13A7-4882-AFDD-148E2BBAFC6D}\tMSITESTDIR\t0\t\tmime.txt\n";
1357 static const char rmi_extension_dat[] =
1358 "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n"
1359 "s255\ts72\tS255\tS64\ts38\n"
1360 "Extension\tExtension\tComponent_\n"
1361 "mime\tmime\t\tmime/type\tmime\n";
1363 static const char rmi_verb_dat[] =
1364 "Extension_\tVerb\tSequence\tCommand\tArgument\n"
1365 "s255\ts32\tI2\tL255\tL255\n"
1366 "Verb\tExtension_\tVerb\n"
1367 "mime\tOpen\t1\t&Open\t/argument\n";
1369 static const char rmi_mime_dat[] =
1370 "ContentType\tExtension_\tCLSID\n"
1371 "s64\ts255\tS38\n"
1372 "MIME\tContentType\n"
1373 "mime/type\tmime\t\n";
1375 static const char rmi_install_exec_seq_dat[] =
1376 "Action\tCondition\tSequence\n"
1377 "s72\tS255\tI2\n"
1378 "InstallExecuteSequence\tAction\n"
1379 "LaunchConditions\t\t100\n"
1380 "CostInitialize\t\t800\n"
1381 "FileCost\t\t900\n"
1382 "CostFinalize\t\t1000\n"
1383 "InstallValidate\t\t1400\n"
1384 "InstallInitialize\t\t1500\n"
1385 "ProcessComponents\t\t1600\n"
1386 "RemoveFiles\t\t1700\n"
1387 "InstallFiles\t\t2000\n"
1388 "UnregisterExtensionInfo\t\t3000\n"
1389 "UnregisterMIMEInfo\t\t3500\n"
1390 "RegisterExtensionInfo\t\t4000\n"
1391 "RegisterMIMEInfo\t\t4500\n"
1392 "RegisterProduct\t\t5000\n"
1393 "PublishFeatures\t\t5100\n"
1394 "PublishProduct\t\t5200\n"
1395 "InstallFinalize\t\t6000\n";
1397 static const char pa_file_dat[] =
1398 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1399 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1400 "File\tFile\n"
1401 "win32.txt\twin32\twin32.txt\t1000\t\t\t8192\t1\n"
1402 "manifest.txt\twin32\tmanifest.txt\t1000\t\t\t8192\t1\n"
1403 "win32_local.txt\twin32_local\twin32_local.txt\t1000\t\t\t8192\t1\n"
1404 "manifest_local.txt\twin32_local\tmanifest_local.txt\t1000\t\t\t8192\t1\n"
1405 "dotnet.txt\tdotnet\tdotnet.txt\t1000\t\t\t8192\t1\n"
1406 "dotnet_local.txt\tdotnet_local\tdotnet_local.txt\t1000\t\t\t8192\t1\n"
1407 "application_win32.txt\twin32_local\tapplication_win32.txt\t1000\t\t\t8192\t1\n"
1408 "application_dotnet.txt\tdotnet_local\tapplication_dotnet.txt\t1000\t\t\t8192\t1\n";
1410 static const char pa_feature_dat[] =
1411 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1412 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1413 "Feature\tFeature\n"
1414 "assembly\t\t\tassembly feature\t1\t2\tMSITESTDIR\t0\n";
1416 static const char pa_feature_comp_dat[] =
1417 "Feature_\tComponent_\n"
1418 "s38\ts72\n"
1419 "FeatureComponents\tFeature_\tComponent_\n"
1420 "assembly\twin32\n"
1421 "assembly\twin32_local\n"
1422 "assembly\tdotnet\n"
1423 "assembly\tdotnet_local\n";
1425 static const char pa_component_dat[] =
1426 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1427 "s72\tS38\ts72\ti2\tS255\tS72\n"
1428 "Component\tComponent\n"
1429 "win32\t{F515549E-7E61-425D-AAC1-9BEF2E066D06}\tMSITESTDIR\t0\t\twin32.txt\n"
1430 "win32_local\t{D34D3FBA-6789-4E57-AD1A-1281297DC201}\tMSITESTDIR\t0\t\twin32_local.txt\n"
1431 "dotnet\t{8943164F-2B31-4C09-A894-493A8CBDE0A4}\tMSITESTDIR\t0\t\tdotnet.txt\n"
1432 "dotnet_local\t{4E8567E8-8EAE-4E36-90F1-B99D33C663F8}\tMSITESTDIR\t0\t\tdotnet_local.txt\n";
1434 static const char pa_msi_assembly_dat[] =
1435 "Component_\tFeature_\tFile_Manifest\tFile_Application\tAttributes\n"
1436 "s72\ts38\tS72\tS72\tI2\n"
1437 "MsiAssembly\tComponent_\n"
1438 "win32\tassembly\tmanifest.txt\t\t1\n"
1439 "win32_local\tassembly\tmanifest_local.txt\tapplication_win32.txt\t1\n"
1440 "dotnet\tassembly\t\t\t0\n"
1441 "dotnet_local\tassembly\t\tapplication_dotnet.txt\t0\n";
1443 static const char pa_msi_assembly_name_dat[] =
1444 "Component_\tName\tValue\n"
1445 "s72\ts255\ts255\n"
1446 "MsiAssemblyName\tComponent_\tName\n"
1447 "win32\tName\tWine.Win32.Assembly\n"
1448 "win32\tprocessorArchitecture\tx86\n"
1449 "win32\tpublicKeyToken\tabcdef0123456789\n"
1450 "win32\ttype\twin32\n"
1451 "win32\tversion\t1.0.0.0\n"
1452 "win32_local\tName\tWine.Win32.Local.Assembly\n"
1453 "win32_local\tprocessorArchitecture\tx86\n"
1454 "win32_local\tpublicKeyToken\tabcdef0123456789\n"
1455 "win32_local\ttype\twin32\n"
1456 "win32_local\tversion\t1.0.0.0\n"
1457 "dotnet\tName\tWine.Dotnet.Assembly\n"
1458 "dotnet\tprocessorArchitecture\tMSIL\n"
1459 "dotnet\tpublicKeyToken\tabcdef0123456789\n"
1460 "dotnet\tculture\tneutral\n"
1461 "dotnet\tversion\t1.0.0.0\n"
1462 "dotnet_local\tName\tWine.Dotnet.Local.Assembly\n"
1463 "dotnet_local\tprocessorArchitecture\tMSIL\n"
1464 "dotnet_local\tpublicKeyToken\tabcdef0123456789\n"
1465 "dotnet_local\tculture\tneutral\n"
1466 "dotnet_local\tversion\t1.0.0.0\n";
1468 static const char pa_install_exec_seq_dat[] =
1469 "Action\tCondition\tSequence\n"
1470 "s72\tS255\tI2\n"
1471 "InstallExecuteSequence\tAction\n"
1472 "LaunchConditions\t\t100\n"
1473 "CostInitialize\t\t800\n"
1474 "FileCost\t\t900\n"
1475 "CostFinalize\t\t1000\n"
1476 "InstallValidate\t\t1400\n"
1477 "InstallInitialize\t\t1500\n"
1478 "ProcessComponents\t\t1600\n"
1479 "MsiPublishAssemblies\t\t3000\n"
1480 "MsiUnpublishAssemblies\t\t4000\n"
1481 "RegisterProduct\t\t5000\n"
1482 "PublishFeatures\t\t5100\n"
1483 "PublishProduct\t\t5200\n"
1484 "InstallFinalize\t\t6000\n";
1486 static const char rep_file_dat[] =
1487 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1488 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1489 "File\tFile\n"
1490 "rep.txt\trep\trep.txt\t1000\t\t\t8192\t1\n";
1492 static const char rep_feature_dat[] =
1493 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1494 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1495 "Feature\tFeature\n"
1496 "rep\t\t\trep feature\t1\t2\tMSITESTDIR\t0\n";
1498 static const char rep_feature_comp_dat[] =
1499 "Feature_\tComponent_\n"
1500 "s38\ts72\n"
1501 "FeatureComponents\tFeature_\tComponent_\n"
1502 "rep\trep\n";
1504 static const char rep_component_dat[] =
1505 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1506 "s72\tS38\ts72\ti2\tS255\tS72\n"
1507 "Component\tComponent\n"
1508 "rep\t{A24FAF2A-3B2E-41EF-AA78-331542E1A29D}\tMSITESTDIR\t0\t\trep.txt\n";
1510 static const char rep_upgrade_dat[] =
1511 "UpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\tRemove\tActionProperty\n"
1512 "s38\tS20\tS20\tS255\ti4\tS255\ts72\n"
1513 "Upgrade\tUpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\n"
1514 "{2967C1CC-34D4-42EE-8D96-CD6836F192BF}\t\t\t\t256\t\tPRODUCT\n";
1516 static const char rep_property_dat[] =
1517 "Property\tValue\n"
1518 "s72\tl0\n"
1519 "Property\tProperty\n"
1520 "HASUIRUN\t0\n"
1521 "INSTALLLEVEL\t3\n"
1522 "InstallMode\tTypical\n"
1523 "Manufacturer\tWine\n"
1524 "PIDTemplate\t###-#######\n"
1525 "ProductCode\t{1699F0BB-0B61-4A89-AFE4-CFD60DFD76F3}\n"
1526 "ProductLanguage\t1033\n"
1527 "ProductName\tMSITEST\n"
1528 "ProductVersion\t1.1.1\n"
1529 "UpgradeCode\t{2967C1CC-34D4-42EE-8D96-CD6836F192BF}\n"
1530 "PRODUCT\t2F41860D-7B4C-4DA7-BED9-B64F26594C56\n"
1531 "MSIFASTINSTALL\t1\n";
1533 static const char rep_install_exec_seq_dat[] =
1534 "Action\tCondition\tSequence\n"
1535 "s72\tS255\tI2\n"
1536 "InstallExecuteSequence\tAction\n"
1537 "FindRelatedProducts\t\t100\n"
1538 "CostInitialize\t\t800\n"
1539 "FileCost\t\t900\n"
1540 "CostFinalize\t\t1000\n"
1541 "InstallValidate\t\t1400\n"
1542 "RemoveExistingProducts\t\t1499\n"
1543 "InstallInitialize\t\t1500\n"
1544 "ProcessComponents\t\t1600\n"
1545 "RemoveFiles\t\t1700\n"
1546 "InstallFiles\t\t2000\n"
1547 "UnregisterExtensionInfo\t\t3000\n"
1548 "UnregisterMIMEInfo\t\t3500\n"
1549 "RegisterExtensionInfo\t\t4000\n"
1550 "RegisterMIMEInfo\t\t4500\n"
1551 "RegisterProduct\t\t5000\n"
1552 "PublishFeatures\t\t5100\n"
1553 "PublishProduct\t\t5200\n"
1554 "InstallFinalize\t\t6000\n";
1556 typedef struct _msi_table
1558 const char *filename;
1559 const char *data;
1560 unsigned int size;
1561 } msi_table;
1563 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
1565 static const msi_table env_tables[] =
1567 ADD_TABLE(component),
1568 ADD_TABLE(directory),
1569 ADD_TABLE(feature),
1570 ADD_TABLE(feature_comp),
1571 ADD_TABLE(file),
1572 ADD_TABLE(install_exec_seq),
1573 ADD_TABLE(media),
1574 ADD_TABLE(property),
1575 ADD_TABLE(environment)
1578 static const msi_table pp_tables[] =
1580 ADD_TABLE(pp_component),
1581 ADD_TABLE(directory),
1582 ADD_TABLE(rof_feature),
1583 ADD_TABLE(rof_feature_comp),
1584 ADD_TABLE(rof_file),
1585 ADD_TABLE(pp_install_exec_seq),
1586 ADD_TABLE(rof_media),
1587 ADD_TABLE(property),
1590 static const msi_table ppc_tables[] =
1592 ADD_TABLE(ppc_component),
1593 ADD_TABLE(directory),
1594 ADD_TABLE(rof_feature),
1595 ADD_TABLE(ppc_feature_comp),
1596 ADD_TABLE(ppc_file),
1597 ADD_TABLE(pp_install_exec_seq),
1598 ADD_TABLE(ppc_media),
1599 ADD_TABLE(property),
1602 static const msi_table rem_tables[] =
1604 ADD_TABLE(rem_component),
1605 ADD_TABLE(directory),
1606 ADD_TABLE(rof_feature),
1607 ADD_TABLE(rem_feature_comp),
1608 ADD_TABLE(rem_file),
1609 ADD_TABLE(rem_install_exec_seq),
1610 ADD_TABLE(rof_media),
1611 ADD_TABLE(property),
1612 ADD_TABLE(rem_remove_files),
1615 static const msi_table mov_tables[] =
1617 ADD_TABLE(cwd_component),
1618 ADD_TABLE(directory),
1619 ADD_TABLE(rof_feature),
1620 ADD_TABLE(ci2_feature_comp),
1621 ADD_TABLE(ci2_file),
1622 ADD_TABLE(install_exec_seq),
1623 ADD_TABLE(rof_media),
1624 ADD_TABLE(property),
1625 ADD_TABLE(mov_move_file),
1628 static const msi_table df_tables[] =
1630 ADD_TABLE(rof_component),
1631 ADD_TABLE(df_directory),
1632 ADD_TABLE(rof_feature),
1633 ADD_TABLE(rof_feature_comp),
1634 ADD_TABLE(rof_file),
1635 ADD_TABLE(install_exec_seq),
1636 ADD_TABLE(rof_media),
1637 ADD_TABLE(property),
1638 ADD_TABLE(df_duplicate_file),
1641 static const msi_table wrv_tables[] =
1643 ADD_TABLE(wrv_component),
1644 ADD_TABLE(directory),
1645 ADD_TABLE(rof_feature),
1646 ADD_TABLE(ci2_feature_comp),
1647 ADD_TABLE(ci2_file),
1648 ADD_TABLE(install_exec_seq),
1649 ADD_TABLE(rof_media),
1650 ADD_TABLE(property),
1651 ADD_TABLE(wrv_registry),
1654 static const msi_table cf_tables[] =
1656 ADD_TABLE(cf_component),
1657 ADD_TABLE(cf_directory),
1658 ADD_TABLE(cf_feature),
1659 ADD_TABLE(cf_feature_comp),
1660 ADD_TABLE(cf_file),
1661 ADD_TABLE(cf_create_folders),
1662 ADD_TABLE(cf_install_exec_seq),
1663 ADD_TABLE(media),
1664 ADD_TABLE(property)
1667 static const msi_table sss_tables[] =
1669 ADD_TABLE(component),
1670 ADD_TABLE(directory),
1671 ADD_TABLE(feature),
1672 ADD_TABLE(feature_comp),
1673 ADD_TABLE(file),
1674 ADD_TABLE(sss_install_exec_seq),
1675 ADD_TABLE(sss_service_control),
1676 ADD_TABLE(media),
1677 ADD_TABLE(property)
1680 static const msi_table sds_tables[] =
1682 ADD_TABLE(component),
1683 ADD_TABLE(directory),
1684 ADD_TABLE(feature),
1685 ADD_TABLE(feature_comp),
1686 ADD_TABLE(file),
1687 ADD_TABLE(sds_install_exec_seq),
1688 ADD_TABLE(service_control),
1689 ADD_TABLE(service_install),
1690 ADD_TABLE(media),
1691 ADD_TABLE(property)
1694 static const msi_table sis_tables[] =
1696 ADD_TABLE(component),
1697 ADD_TABLE(directory),
1698 ADD_TABLE(feature),
1699 ADD_TABLE(feature_comp),
1700 ADD_TABLE(file),
1701 ADD_TABLE(sds_install_exec_seq),
1702 ADD_TABLE(service_install2),
1703 ADD_TABLE(media),
1704 ADD_TABLE(property)
1707 static const msi_table sr_tables[] =
1709 ADD_TABLE(component),
1710 ADD_TABLE(directory),
1711 ADD_TABLE(feature),
1712 ADD_TABLE(feature_comp),
1713 ADD_TABLE(file),
1714 ADD_TABLE(sr_selfreg),
1715 ADD_TABLE(sr_install_exec_seq),
1716 ADD_TABLE(media),
1717 ADD_TABLE(property)
1720 static const msi_table font_tables[] =
1722 ADD_TABLE(font_component),
1723 ADD_TABLE(directory),
1724 ADD_TABLE(font_feature),
1725 ADD_TABLE(font_feature_comp),
1726 ADD_TABLE(font_file),
1727 ADD_TABLE(font),
1728 ADD_TABLE(font_install_exec_seq),
1729 ADD_TABLE(font_media),
1730 ADD_TABLE(property)
1733 static const msi_table vp_tables[] =
1735 ADD_TABLE(component),
1736 ADD_TABLE(directory),
1737 ADD_TABLE(feature),
1738 ADD_TABLE(feature_comp),
1739 ADD_TABLE(file),
1740 ADD_TABLE(vp_custom_action),
1741 ADD_TABLE(vp_install_exec_seq),
1742 ADD_TABLE(media),
1743 ADD_TABLE(vp_property)
1746 static const msi_table odbc_tables[] =
1748 ADD_TABLE(odbc_component),
1749 ADD_TABLE(directory),
1750 ADD_TABLE(odbc_feature),
1751 ADD_TABLE(odbc_feature_comp),
1752 ADD_TABLE(odbc_file),
1753 ADD_TABLE(odbc_driver),
1754 ADD_TABLE(odbc_translator),
1755 ADD_TABLE(odbc_datasource),
1756 ADD_TABLE(odbc_install_exec_seq),
1757 ADD_TABLE(odbc_media),
1758 ADD_TABLE(property)
1761 static const msi_table tl_tables[] =
1763 ADD_TABLE(tl_component),
1764 ADD_TABLE(directory),
1765 ADD_TABLE(tl_feature),
1766 ADD_TABLE(tl_feature_comp),
1767 ADD_TABLE(tl_file),
1768 ADD_TABLE(tl_typelib),
1769 ADD_TABLE(tl_install_exec_seq),
1770 ADD_TABLE(media),
1771 ADD_TABLE(property)
1774 static const msi_table crs_tables[] =
1776 ADD_TABLE(crs_component),
1777 ADD_TABLE(directory),
1778 ADD_TABLE(crs_feature),
1779 ADD_TABLE(crs_feature_comp),
1780 ADD_TABLE(crs_file),
1781 ADD_TABLE(crs_shortcut),
1782 ADD_TABLE(crs_install_exec_seq),
1783 ADD_TABLE(media),
1784 ADD_TABLE(property)
1787 static const msi_table pub_tables[] =
1789 ADD_TABLE(directory),
1790 ADD_TABLE(pub_component),
1791 ADD_TABLE(pub_feature),
1792 ADD_TABLE(pub_feature_comp),
1793 ADD_TABLE(pub_file),
1794 ADD_TABLE(pub_publish_component),
1795 ADD_TABLE(pub_install_exec_seq),
1796 ADD_TABLE(media),
1797 ADD_TABLE(property)
1800 static const msi_table rd_tables[] =
1802 ADD_TABLE(directory),
1803 ADD_TABLE(rd_component),
1804 ADD_TABLE(rd_feature),
1805 ADD_TABLE(rd_feature_comp),
1806 ADD_TABLE(rd_file),
1807 ADD_TABLE(rd_duplicate_file),
1808 ADD_TABLE(rd_install_exec_seq),
1809 ADD_TABLE(media),
1810 ADD_TABLE(property)
1813 static const msi_table rrv_tables[] =
1815 ADD_TABLE(directory),
1816 ADD_TABLE(rrv_component),
1817 ADD_TABLE(rrv_feature),
1818 ADD_TABLE(rrv_feature_comp),
1819 ADD_TABLE(rrv_file),
1820 ADD_TABLE(rrv_registry),
1821 ADD_TABLE(rrv_remove_registry),
1822 ADD_TABLE(rrv_install_exec_seq),
1823 ADD_TABLE(media),
1824 ADD_TABLE(property)
1827 static const msi_table frp_tables[] =
1829 ADD_TABLE(directory),
1830 ADD_TABLE(frp_component),
1831 ADD_TABLE(frp_feature),
1832 ADD_TABLE(frp_feature_comp),
1833 ADD_TABLE(frp_file),
1834 ADD_TABLE(frp_upgrade),
1835 ADD_TABLE(frp_custom_action),
1836 ADD_TABLE(frp_install_exec_seq),
1837 ADD_TABLE(media),
1838 ADD_TABLE(property)
1841 static const msi_table riv_tables[] =
1843 ADD_TABLE(directory),
1844 ADD_TABLE(riv_component),
1845 ADD_TABLE(riv_feature),
1846 ADD_TABLE(riv_feature_comp),
1847 ADD_TABLE(riv_file),
1848 ADD_TABLE(riv_ini_file),
1849 ADD_TABLE(riv_remove_ini_file),
1850 ADD_TABLE(riv_install_exec_seq),
1851 ADD_TABLE(media),
1852 ADD_TABLE(property)
1855 static const msi_table res_tables[] =
1857 ADD_TABLE(directory),
1858 ADD_TABLE(res_component),
1859 ADD_TABLE(res_feature),
1860 ADD_TABLE(res_feature_comp),
1861 ADD_TABLE(res_file),
1862 ADD_TABLE(res_environment),
1863 ADD_TABLE(res_install_exec_seq),
1864 ADD_TABLE(media),
1865 ADD_TABLE(property)
1868 static const msi_table rci_tables[] =
1870 ADD_TABLE(directory),
1871 ADD_TABLE(rci_component),
1872 ADD_TABLE(rci_feature),
1873 ADD_TABLE(rci_feature_comp),
1874 ADD_TABLE(rci_file),
1875 ADD_TABLE(rci_appid),
1876 ADD_TABLE(rci_class),
1877 ADD_TABLE(rci_install_exec_seq),
1878 ADD_TABLE(media),
1879 ADD_TABLE(property)
1882 static const msi_table rei_tables[] =
1884 ADD_TABLE(directory),
1885 ADD_TABLE(rei_component),
1886 ADD_TABLE(rei_feature),
1887 ADD_TABLE(rei_feature_comp),
1888 ADD_TABLE(rei_file),
1889 ADD_TABLE(rei_extension),
1890 ADD_TABLE(rei_verb),
1891 ADD_TABLE(rei_progid),
1892 ADD_TABLE(rei_install_exec_seq),
1893 ADD_TABLE(media),
1894 ADD_TABLE(property)
1897 static const msi_table rmi_tables[] =
1899 ADD_TABLE(directory),
1900 ADD_TABLE(rmi_component),
1901 ADD_TABLE(rmi_feature),
1902 ADD_TABLE(rmi_feature_comp),
1903 ADD_TABLE(rmi_file),
1904 ADD_TABLE(rmi_extension),
1905 ADD_TABLE(rmi_verb),
1906 ADD_TABLE(rmi_mime),
1907 ADD_TABLE(rmi_install_exec_seq),
1908 ADD_TABLE(media),
1909 ADD_TABLE(property)
1912 static const msi_table pa_tables[] =
1914 ADD_TABLE(directory),
1915 ADD_TABLE(pa_component),
1916 ADD_TABLE(pa_feature),
1917 ADD_TABLE(pa_feature_comp),
1918 ADD_TABLE(pa_file),
1919 ADD_TABLE(pa_msi_assembly),
1920 ADD_TABLE(pa_msi_assembly_name),
1921 ADD_TABLE(pa_install_exec_seq),
1922 ADD_TABLE(media),
1923 ADD_TABLE(property)
1926 static const msi_table rep_tables[] =
1928 ADD_TABLE(directory),
1929 ADD_TABLE(rep_component),
1930 ADD_TABLE(rep_feature),
1931 ADD_TABLE(rep_feature_comp),
1932 ADD_TABLE(rep_file),
1933 ADD_TABLE(rep_upgrade),
1934 ADD_TABLE(rep_property),
1935 ADD_TABLE(rep_install_exec_seq),
1936 ADD_TABLE(media)
1939 /* based on RegDeleteTreeW from dlls/advapi32/registry.c */
1940 static LSTATUS action_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey, REGSAM access)
1942 LONG ret;
1943 DWORD dwMaxSubkeyLen, dwMaxValueLen;
1944 DWORD dwMaxLen, dwSize;
1945 char szNameBuf[MAX_PATH], *lpszName = szNameBuf;
1946 HKEY hSubKey = hKey;
1948 if(lpszSubKey)
1950 ret = RegOpenKeyExA(hKey, lpszSubKey, 0, access, &hSubKey);
1951 if (ret) return ret;
1954 ret = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, NULL,
1955 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
1956 if (ret) goto cleanup;
1958 dwMaxSubkeyLen++;
1959 dwMaxValueLen++;
1960 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
1961 if (dwMaxLen > sizeof(szNameBuf))
1963 /* Name too big: alloc a buffer for it */
1964 if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen)))
1966 ret = ERROR_NOT_ENOUGH_MEMORY;
1967 goto cleanup;
1971 /* Recursively delete all the subkeys */
1972 while (TRUE)
1974 dwSize = dwMaxLen;
1975 if (RegEnumKeyExA(hSubKey, 0, lpszName, &dwSize, NULL,
1976 NULL, NULL, NULL)) break;
1978 ret = action_RegDeleteTreeA(hSubKey, lpszName, access);
1979 if (ret) goto cleanup;
1982 if (lpszSubKey)
1984 if (pRegDeleteKeyExA)
1985 ret = pRegDeleteKeyExA(hKey, lpszSubKey, access, 0);
1986 else
1987 ret = RegDeleteKeyA(hKey, lpszSubKey);
1989 else
1990 while (TRUE)
1992 dwSize = dwMaxLen;
1993 if (RegEnumValueA(hKey, 0, lpszName, &dwSize,
1994 NULL, NULL, NULL, NULL)) break;
1996 ret = RegDeleteValueA(hKey, lpszName);
1997 if (ret) goto cleanup;
2000 cleanup:
2001 if (lpszName != szNameBuf)
2002 HeapFree(GetProcessHeap(), 0, lpszName);
2003 if(lpszSubKey)
2004 RegCloseKey(hSubKey);
2005 return ret;
2008 /* cabinet definitions */
2010 /* make the max size large so there is only one cab file */
2011 #define MEDIA_SIZE 0x7FFFFFFF
2012 #define FOLDER_THRESHOLD 900000
2014 /* the FCI callbacks */
2016 static void * CDECL mem_alloc(ULONG cb)
2018 return HeapAlloc(GetProcessHeap(), 0, cb);
2021 static void CDECL mem_free(void *memory)
2023 HeapFree(GetProcessHeap(), 0, memory);
2026 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
2028 sprintf(pccab->szCab, pv, pccab->iCab);
2029 return TRUE;
2032 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
2034 return 0;
2037 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
2038 BOOL fContinuation, void *pv)
2040 return 0;
2043 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
2045 HANDLE handle;
2046 DWORD dwAccess = 0;
2047 DWORD dwShareMode = 0;
2048 DWORD dwCreateDisposition = OPEN_EXISTING;
2050 dwAccess = GENERIC_READ | GENERIC_WRITE;
2051 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
2053 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
2054 dwCreateDisposition = OPEN_EXISTING;
2055 else
2056 dwCreateDisposition = CREATE_NEW;
2058 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
2059 dwCreateDisposition, 0, NULL);
2061 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
2063 return (INT_PTR)handle;
2066 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2068 HANDLE handle = (HANDLE)hf;
2069 DWORD dwRead;
2070 BOOL res;
2072 res = ReadFile(handle, memory, cb, &dwRead, NULL);
2073 ok(res, "Failed to ReadFile\n");
2075 return dwRead;
2078 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2080 HANDLE handle = (HANDLE)hf;
2081 DWORD dwWritten;
2082 BOOL res;
2084 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2085 ok(res, "Failed to WriteFile\n");
2087 return dwWritten;
2090 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
2092 HANDLE handle = (HANDLE)hf;
2093 ok(CloseHandle(handle), "Failed to CloseHandle\n");
2095 return 0;
2098 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
2100 HANDLE handle = (HANDLE)hf;
2101 DWORD ret;
2103 ret = SetFilePointer(handle, dist, NULL, seektype);
2104 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2106 return ret;
2109 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
2111 BOOL ret = DeleteFileA(pszFile);
2112 ok(ret, "Failed to DeleteFile %s\n", pszFile);
2114 return 0;
2117 static void init_functionpointers(void)
2119 HMODULE hmsi = GetModuleHandleA("msi.dll");
2120 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2121 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2123 #define GET_PROC(mod, func) \
2124 p ## func = (void*)GetProcAddress(mod, #func); \
2125 if(!p ## func) \
2126 trace("GetProcAddress(%s) failed\n", #func);
2128 GET_PROC(hmsi, MsiQueryComponentStateA);
2129 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
2130 GET_PROC(hmsi, MsiSourceListGetInfoA);
2131 GET_PROC(hmsi, MsiGetComponentPathExA);
2132 GET_PROC(hmsi, MsiQueryFeatureStateExA);
2134 GET_PROC(hadvapi32, ConvertSidToStringSidA);
2135 GET_PROC(hadvapi32, OpenProcessToken);
2136 GET_PROC(hadvapi32, RegDeleteKeyExA)
2137 GET_PROC(hkernel32, IsWow64Process)
2139 hsrclient = LoadLibraryA("srclient.dll");
2140 GET_PROC(hsrclient, SRRemoveRestorePoint);
2141 GET_PROC(hsrclient, SRSetRestorePointA);
2143 #undef GET_PROC
2146 static BOOL is_process_limited(void)
2148 HANDLE token;
2150 if (!pOpenProcessToken) return FALSE;
2152 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2154 BOOL ret;
2155 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
2156 DWORD size;
2158 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2159 CloseHandle(token);
2160 return (ret && type == TokenElevationTypeLimited);
2162 return FALSE;
2165 static char *get_user_sid(void)
2167 HANDLE token;
2168 DWORD size = 0;
2169 TOKEN_USER *user;
2170 char *usersid = NULL;
2172 if (!pConvertSidToStringSidA)
2174 win_skip("ConvertSidToStringSidA is not available\n");
2175 return NULL;
2177 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
2178 GetTokenInformation(token, TokenUser, NULL, size, &size);
2180 user = HeapAlloc(GetProcessHeap(), 0, size);
2181 GetTokenInformation(token, TokenUser, user, size, &size);
2182 pConvertSidToStringSidA(user->User.Sid, &usersid);
2183 HeapFree(GetProcessHeap(), 0, user);
2185 CloseHandle(token);
2186 return usersid;
2189 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2191 LPSTR tempname;
2193 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2194 GetTempFileNameA(".", "xx", 0, tempname);
2196 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2198 lstrcpyA(pszTempName, tempname);
2199 HeapFree(GetProcessHeap(), 0, tempname);
2200 return TRUE;
2203 HeapFree(GetProcessHeap(), 0, tempname);
2205 return FALSE;
2208 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2209 USHORT *pattribs, int *err, void *pv)
2211 BY_HANDLE_FILE_INFORMATION finfo;
2212 FILETIME filetime;
2213 HANDLE handle;
2214 DWORD attrs;
2215 BOOL res;
2217 handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2218 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2220 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2222 res = GetFileInformationByHandle(handle, &finfo);
2223 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2225 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2226 FileTimeToDosDateTime(&filetime, pdate, ptime);
2228 attrs = GetFileAttributesA(pszName);
2229 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2231 return (INT_PTR)handle;
2234 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2236 char path[MAX_PATH];
2237 char filename[MAX_PATH];
2239 lstrcpyA(path, CURR_DIR);
2240 lstrcatA(path, "\\");
2241 lstrcatA(path, file);
2243 lstrcpyA(filename, file);
2245 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2246 progress, get_open_info, compress);
2249 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2251 ZeroMemory(pCabParams, sizeof(CCAB));
2253 pCabParams->cb = max_size;
2254 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2255 pCabParams->setID = 0xbeef;
2256 pCabParams->iCab = 1;
2257 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2258 lstrcatA(pCabParams->szCabPath, "\\");
2259 lstrcpyA(pCabParams->szCab, name);
2262 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2264 CCAB cabParams;
2265 LPCSTR ptr;
2266 HFCI hfci;
2267 ERF erf;
2268 BOOL res;
2270 set_cab_parameters(&cabParams, name, max_size);
2272 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2273 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2274 get_temp_file, &cabParams, NULL);
2276 ok(hfci != NULL, "Failed to create an FCI context\n");
2278 ptr = files;
2279 while (*ptr)
2281 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2282 ok(res, "Failed to add file: %s\n", ptr);
2283 ptr += lstrlenA(ptr) + 1;
2286 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2287 ok(res, "Failed to flush the cabinet\n");
2289 res = FCIDestroy(hfci);
2290 ok(res, "Failed to destroy the cabinet\n");
2293 static BOOL get_user_dirs(void)
2295 HKEY hkey;
2296 DWORD type, size;
2298 if (RegOpenKeyA(HKEY_CURRENT_USER,
2299 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2300 return FALSE;
2302 size = MAX_PATH;
2303 if (RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size))
2305 RegCloseKey(hkey);
2306 return FALSE;
2309 RegCloseKey(hkey);
2310 return TRUE;
2313 static BOOL get_system_dirs(void)
2315 HKEY hkey;
2316 DWORD type, size;
2318 if (RegOpenKeyA(HKEY_LOCAL_MACHINE,
2319 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2320 return FALSE;
2322 size = MAX_PATH;
2323 if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2324 RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size))
2326 RegCloseKey(hkey);
2327 return FALSE;
2330 size = MAX_PATH;
2331 if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2332 RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size))
2334 RegCloseKey(hkey);
2335 return FALSE;
2338 RegCloseKey(hkey);
2340 if (!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH))
2341 return FALSE;
2343 return TRUE;
2346 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2348 HANDLE file;
2349 DWORD written;
2351 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2352 if (file == INVALID_HANDLE_VALUE)
2353 return;
2355 WriteFile(file, data, strlen(data), &written, NULL);
2357 if (size)
2359 SetFilePointer(file, size, NULL, FILE_BEGIN);
2360 SetEndOfFile(file);
2363 CloseHandle(file);
2366 #define create_file(name, size) create_file_data(name, name, size)
2368 static void create_test_files(void)
2370 CreateDirectoryA("msitest", NULL);
2371 create_file("msitest\\one.txt", 100);
2372 CreateDirectoryA("msitest\\first", NULL);
2373 create_file("msitest\\first\\two.txt", 100);
2374 CreateDirectoryA("msitest\\second", NULL);
2375 create_file("msitest\\second\\three.txt", 100);
2377 create_file("four.txt", 100);
2378 create_file("five.txt", 100);
2379 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2381 create_file("msitest\\filename", 100);
2382 create_file("msitest\\service.exe", 100);
2383 create_file("msitest\\service2.exe", 100);
2385 DeleteFileA("four.txt");
2386 DeleteFileA("five.txt");
2389 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2391 CHAR path[MAX_PATH];
2393 lstrcpyA(path, PROG_FILES_DIR);
2394 lstrcatA(path, "\\");
2395 lstrcatA(path, rel_path);
2397 if (is_file)
2398 return DeleteFileA(path);
2399 else
2400 return RemoveDirectoryA(path);
2403 static void delete_test_files(void)
2405 DeleteFileA("msitest.msi");
2406 DeleteFileA("msitest.cab");
2407 DeleteFileA("msitest\\second\\three.txt");
2408 DeleteFileA("msitest\\first\\two.txt");
2409 DeleteFileA("msitest\\one.txt");
2410 DeleteFileA("msitest\\service.exe");
2411 DeleteFileA("msitest\\service2.exe");
2412 DeleteFileA("msitest\\filename");
2413 RemoveDirectoryA("msitest\\second");
2414 RemoveDirectoryA("msitest\\first");
2415 RemoveDirectoryA("msitest");
2418 static void write_file(const CHAR *filename, const char *data, int data_size)
2420 DWORD size;
2421 HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2422 WriteFile(hf, data, data_size, &size, NULL);
2423 CloseHandle(hf);
2426 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, const char *template)
2428 MSIHANDLE summary;
2429 UINT r;
2431 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2432 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2434 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2435 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2437 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
2438 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2439 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2441 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL);
2442 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2444 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2445 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2447 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2448 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2450 /* write the summary changes back to the stream */
2451 r = MsiSummaryInfoPersist(summary);
2452 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2454 MsiCloseHandle(summary);
2457 #define create_database(name, tables, num_tables) \
2458 create_database_wordcount(name, tables, num_tables, 100, 0, ";1033");
2460 #define create_database_template(name, tables, num_tables, version, template) \
2461 create_database_wordcount(name, tables, num_tables, version, 0, template);
2463 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2464 int num_tables, INT version, INT wordcount,
2465 const char *template)
2467 MSIHANDLE db;
2468 UINT r;
2469 WCHAR *nameW;
2470 int j, len;
2472 len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2473 if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
2474 MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2476 r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
2477 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2479 /* import the tables into the database */
2480 for (j = 0; j < num_tables; j++)
2482 const msi_table *table = &tables[j];
2484 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2486 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2487 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2489 DeleteFileA(table->filename);
2492 write_msi_summary_info(db, version, wordcount, template);
2494 r = MsiDatabaseCommit(db);
2495 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2497 MsiCloseHandle(db);
2498 HeapFree( GetProcessHeap(), 0, nameW );
2501 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2503 RESTOREPOINTINFOA spec;
2505 spec.dwEventType = event_type;
2506 spec.dwRestorePtType = APPLICATION_INSTALL;
2507 spec.llSequenceNumber = status->llSequenceNumber;
2508 lstrcpyA(spec.szDescription, "msitest restore point");
2510 return pSRSetRestorePointA(&spec, status);
2513 static void remove_restore_point(DWORD seq_number)
2515 DWORD res;
2517 res = pSRRemoveRestorePoint(seq_number);
2518 if (res != ERROR_SUCCESS)
2519 trace("Failed to remove the restore point : %08x\n", res);
2522 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
2524 if (pRegDeleteKeyExA)
2525 return pRegDeleteKeyExA( key, subkey, access, 0 );
2526 return RegDeleteKeyA( key, subkey );
2529 static BOOL file_exists(LPCSTR file)
2531 return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES;
2534 static BOOL pf_exists(LPCSTR file)
2536 CHAR path[MAX_PATH];
2538 lstrcpyA(path, PROG_FILES_DIR);
2539 lstrcatA(path, "\\");
2540 lstrcatA(path, file);
2542 return file_exists(path);
2545 static void delete_pfmsitest_files(void)
2547 SHFILEOPSTRUCTA shfl;
2548 CHAR path[MAX_PATH+11];
2550 lstrcpyA(path, PROG_FILES_DIR);
2551 lstrcatA(path, "\\msitest\\*");
2552 path[strlen(path) + 1] = '\0';
2554 shfl.hwnd = NULL;
2555 shfl.wFunc = FO_DELETE;
2556 shfl.pFrom = path;
2557 shfl.pTo = NULL;
2558 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT | FOF_NOERRORUI;
2560 SHFileOperationA(&shfl);
2562 lstrcpyA(path, PROG_FILES_DIR);
2563 lstrcatA(path, "\\msitest");
2564 RemoveDirectoryA(path);
2567 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
2569 char val[MAX_PATH];
2570 DWORD size, type;
2571 LONG res;
2573 size = MAX_PATH;
2574 val[0] = '\0';
2575 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
2577 if (res != ERROR_SUCCESS ||
2578 (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
2580 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2581 return;
2584 if (!expected)
2585 ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val);
2586 else
2588 if (bcase)
2589 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
2590 else
2591 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
2595 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
2597 DWORD val, size, type;
2598 LONG res;
2600 size = sizeof(DWORD);
2601 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2603 if (res != ERROR_SUCCESS || type != REG_DWORD)
2605 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2606 return;
2609 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
2612 static void check_reg_dword4(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3,
2613 DWORD expected4, DWORD line)
2615 DWORD val, size, type;
2616 LONG res;
2618 size = sizeof(DWORD);
2619 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2621 if (res != ERROR_SUCCESS || type != REG_DWORD)
2623 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2624 return;
2627 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4,
2628 "Expected %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, val);
2631 static void check_reg_dword5(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3,
2632 DWORD expected4, DWORD expected5, DWORD line)
2634 DWORD val, size, type;
2635 LONG res;
2637 size = sizeof(DWORD);
2638 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2640 if (res != ERROR_SUCCESS || type != REG_DWORD)
2642 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2643 return;
2646 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4 ||
2647 val == expected5,
2648 "Expected %d, %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, expected5, val);
2651 #define CHECK_REG_STR(prodkey, name, expected) \
2652 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
2654 #define CHECK_DEL_REG_STR(prodkey, name, expected) \
2655 do { \
2656 check_reg_str(prodkey, name, expected, TRUE, __LINE__); \
2657 RegDeleteValueA(prodkey, name); \
2658 } while(0)
2660 #define CHECK_REG_ISTR(prodkey, name, expected) \
2661 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
2663 #define CHECK_DEL_REG_ISTR(prodkey, name, expected) \
2664 do { \
2665 check_reg_str(prodkey, name, expected, FALSE, __LINE__); \
2666 RegDeleteValueA(prodkey, name); \
2667 } while(0)
2669 #define CHECK_REG_DWORD(prodkey, name, expected) \
2670 check_reg_dword(prodkey, name, expected, __LINE__);
2672 #define CHECK_DEL_REG_DWORD(prodkey, name, expected) \
2673 do { \
2674 check_reg_dword(prodkey, name, expected, __LINE__); \
2675 RegDeleteValueA(prodkey, name); \
2676 } while(0)
2678 #define CHECK_REG_DWORD2(prodkey, name, expected1, expected2) \
2679 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__);
2681 #define CHECK_DEL_REG_DWORD2(prodkey, name, expected1, expected2) \
2682 do { \
2683 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__); \
2684 RegDeleteValueA(prodkey, name); \
2685 } while(0)
2687 #define CHECK_REG_DWORD4(prodkey, name, expected1, expected2, expected3, expected4) \
2688 check_reg_dword4(prodkey, name, expected1, expected2, expected3, expected4, __LINE__);
2690 #define CHECK_DEL_REG_DWORD5(prodkey, name, expected1, expected2, expected3, expected4 ,expected5) \
2691 do { \
2692 check_reg_dword5(prodkey, name, expected1, expected2, expected3, expected4, expected5, __LINE__); \
2693 RegDeleteValueA(prodkey, name); \
2694 } while(0)
2696 static void get_date_str(LPSTR date)
2698 SYSTEMTIME systime;
2700 static const char date_fmt[] = "%d%02d%02d";
2701 GetLocalTime(&systime);
2702 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
2705 static void test_register_product(void)
2707 UINT r;
2708 LONG res;
2709 HKEY hkey, props, usage;
2710 LPSTR usersid;
2711 char date[MAX_PATH], temp[MAX_PATH], keypath[MAX_PATH], path[MAX_PATH];
2712 DWORD size, type;
2713 REGSAM access = KEY_ALL_ACCESS;
2715 static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2716 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2717 static const CHAR uninstall_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion"
2718 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2719 static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2720 "\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2721 static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2722 "\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2723 static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2724 "\\51AAE0C44620A5E4788506E91F249BD2";
2726 if (is_process_limited())
2728 skip("process is limited\n");
2729 return;
2732 if (!(usersid = get_user_sid()))
2733 return;
2735 get_date_str(date);
2736 GetTempPathA(MAX_PATH, temp);
2738 CreateDirectoryA("msitest", NULL);
2739 create_file("msitest\\maximus", 500);
2741 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2743 if (is_wow64)
2744 access |= KEY_WOW64_64KEY;
2746 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2748 /* RegisterProduct */
2749 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
2750 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2752 skip("Not enough rights to perform tests\n");
2753 goto error;
2755 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2756 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2757 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2759 res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
2760 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2762 if (is_64bit)
2764 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey);
2765 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2767 else
2769 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_ALL_ACCESS, &hkey);
2770 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2773 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2774 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2775 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2776 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2777 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2778 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2779 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2780 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2781 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2782 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2783 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2784 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2785 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2786 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2787 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2788 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2789 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2790 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2791 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2792 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2793 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2794 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2795 todo_wine
2797 CHECK_DEL_REG_DWORD5(hkey, "EstimatedSize", 12, -12, 4, 10, 24);
2800 delete_key(hkey, "", access);
2801 RegCloseKey(hkey);
2803 sprintf(keypath, userdata, usersid);
2804 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
2805 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2807 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
2808 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2810 size = sizeof(path);
2811 RegQueryValueExA(props, "LocalPackage", NULL, &type, (LPBYTE)path, &size);
2812 DeleteFileA(path);
2813 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2815 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2816 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2817 CHECK_DEL_REG_STR(props, "InstallDate", date);
2818 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2819 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2820 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2821 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2822 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2823 CHECK_DEL_REG_STR(props, "Comments", NULL);
2824 CHECK_DEL_REG_STR(props, "Contact", NULL);
2825 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2826 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2827 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2828 CHECK_DEL_REG_STR(props, "Readme", NULL);
2829 CHECK_DEL_REG_STR(props, "Size", NULL);
2830 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2831 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2832 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2833 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2834 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2835 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2836 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2837 todo_wine
2839 CHECK_DEL_REG_DWORD5(props, "EstimatedSize", 12, -12, 4, 10, 24);
2842 delete_key(props, "", access);
2843 RegCloseKey(props);
2845 res = RegOpenKeyExA(hkey, "Usage", 0, access, &usage);
2846 todo_wine
2848 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2851 delete_key(usage, "", access);
2852 RegCloseKey(usage);
2853 delete_key(hkey, "", access);
2854 RegCloseKey(hkey);
2856 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, access, &hkey);
2857 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2859 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2861 delete_key(hkey, "", access);
2862 RegCloseKey(hkey);
2864 /* RegisterProduct, machine */
2865 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 ALLUSERS=1");
2866 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2867 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2868 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2870 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, userugkey, 0, access, &hkey);
2871 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2873 if (is_64bit)
2875 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey);
2876 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2878 else
2880 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_ALL_ACCESS, &hkey);
2881 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2884 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2885 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2886 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2887 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2888 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2889 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2890 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2891 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2892 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2893 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2894 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2895 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2896 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2897 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2898 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2899 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2900 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2901 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2902 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2903 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2904 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2905 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2906 todo_wine
2908 CHECK_DEL_REG_DWORD5(hkey, "EstimatedSize", 12, -12, 4, 10, 24);
2911 delete_key(hkey, "", access);
2912 RegCloseKey(hkey);
2914 sprintf(keypath, userdata, "S-1-5-18");
2915 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
2916 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2918 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
2919 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2921 size = sizeof(path);
2922 RegQueryValueExA(props, "LocalPackage", NULL, &type, (LPBYTE)path, &size);
2923 DeleteFileA(path);
2924 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2926 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2927 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2928 CHECK_DEL_REG_STR(props, "InstallDate", date);
2929 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2930 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2931 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2932 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2933 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2934 CHECK_DEL_REG_STR(props, "Comments", NULL);
2935 CHECK_DEL_REG_STR(props, "Contact", NULL);
2936 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2937 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2938 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2939 CHECK_DEL_REG_STR(props, "Readme", NULL);
2940 CHECK_DEL_REG_STR(props, "Size", NULL);
2941 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2942 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2943 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2944 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2945 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2946 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2947 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2948 todo_wine
2950 CHECK_DEL_REG_DWORD5(props, "EstimatedSize", 12, -12, 4, 10, 24);
2953 delete_key(props, "", access);
2954 RegCloseKey(props);
2956 res = RegOpenKeyExA(hkey, "Usage", 0, access, &usage);
2957 todo_wine
2959 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2962 delete_key(usage, "", access);
2963 RegCloseKey(usage);
2964 delete_key(hkey, "", access);
2965 RegCloseKey(hkey);
2967 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, access, &hkey);
2968 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2970 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2972 delete_key(hkey, "", access);
2973 RegCloseKey(hkey);
2975 error:
2976 DeleteFileA(msifile);
2977 DeleteFileA("msitest\\maximus");
2978 RemoveDirectoryA("msitest");
2979 HeapFree(GetProcessHeap(), 0, usersid);
2982 static void test_publish_product(void)
2984 static const char prodpath[] =
2985 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
2986 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2987 static const char cuprodpath[] =
2988 "Software\\Microsoft\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2989 static const char cuupgrades[] =
2990 "Software\\Microsoft\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2991 static const char badprod[] =
2992 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products"
2993 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2994 static const char machprod[] =
2995 "Software\\Classes\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2996 static const char machup[] =
2997 "Software\\Classes\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2998 UINT r;
2999 LONG res;
3000 LPSTR usersid;
3001 HKEY sourcelist, net, props;
3002 HKEY hkey, patches, media;
3003 CHAR keypath[MAX_PATH];
3004 CHAR temp[MAX_PATH];
3005 CHAR path[MAX_PATH];
3006 BOOL old_installer = FALSE;
3007 REGSAM access = KEY_ALL_ACCESS;
3009 if (is_process_limited())
3011 skip("process is limited\n");
3012 return;
3015 if (!(usersid = get_user_sid()))
3016 return;
3018 GetTempPathA(MAX_PATH, temp);
3020 CreateDirectoryA("msitest", NULL);
3021 create_file("msitest\\maximus", 500);
3023 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3025 if (is_wow64)
3026 access |= KEY_WOW64_64KEY;
3028 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3030 /* PublishProduct, current user */
3031 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
3032 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3034 skip("Not enough rights to perform tests\n");
3035 goto error;
3037 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3038 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3039 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3041 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, badprod, 0, access, &hkey);
3042 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3044 sprintf(keypath, prodpath, usersid);
3045 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3046 if (res == ERROR_FILE_NOT_FOUND)
3048 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
3049 if (res == ERROR_SUCCESS)
3051 win_skip("Windows Installer < 3.0 detected\n");
3052 RegCloseKey(hkey);
3053 old_installer = TRUE;
3054 goto currentuser;
3056 else
3058 win_skip("Install failed, no need to continue\n");
3059 return;
3062 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3064 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
3065 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3067 res = RegOpenKeyExA(hkey, "Patches", 0, access, &patches);
3068 todo_wine
3070 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3071 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3074 delete_key(patches, "", access);
3075 RegCloseKey(patches);
3076 delete_key(hkey, "", access);
3077 RegCloseKey(hkey);
3079 currentuser:
3080 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
3081 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3083 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3084 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052C94DA02821EECD05F2F");
3085 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3086 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3087 if (!old_installer)
3088 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3089 CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
3090 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3091 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3092 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3094 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
3095 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3097 lstrcpyA(path, "n;1;");
3098 lstrcatA(path, temp);
3099 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3100 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3102 res = RegOpenKeyA(sourcelist, "Net", &net);
3103 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3105 CHECK_DEL_REG_STR(net, "1", temp);
3107 RegDeleteKeyA(net, "");
3108 RegCloseKey(net);
3110 res = RegOpenKeyA(sourcelist, "Media", &media);
3111 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3113 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3115 RegDeleteKeyA(media, "");
3116 RegCloseKey(media);
3117 RegDeleteKeyA(sourcelist, "");
3118 RegCloseKey(sourcelist);
3119 RegDeleteKeyA(hkey, "");
3120 RegCloseKey(hkey);
3122 res = RegOpenKeyA(HKEY_CURRENT_USER, cuupgrades, &hkey);
3123 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3125 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3127 RegDeleteKeyA(hkey, "");
3128 RegCloseKey(hkey);
3130 /* PublishProduct, machine */
3131 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
3132 if (old_installer)
3133 goto machprod;
3134 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3135 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3136 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3138 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, badprod, 0, access, &hkey);
3139 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3141 sprintf(keypath, prodpath, "S-1-5-18");
3142 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3143 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3145 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
3146 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3148 res = RegOpenKeyExA(hkey, "Patches", 0, access, &patches);
3149 todo_wine
3151 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3152 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3155 delete_key(patches, "", access);
3156 RegCloseKey(patches);
3157 delete_key(hkey, "", access);
3158 RegCloseKey(hkey);
3160 machprod:
3161 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, machprod, 0, access, &hkey);
3162 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3164 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3165 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052C94DA02821EECD05F2F");
3166 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3167 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3168 if (!old_installer)
3169 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3170 todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
3171 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3172 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3173 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3175 res = RegOpenKeyExA(hkey, "SourceList", 0, access, &sourcelist);
3176 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3178 lstrcpyA(path, "n;1;");
3179 lstrcatA(path, temp);
3180 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3181 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3183 res = RegOpenKeyExA(sourcelist, "Net", 0, access, &net);
3184 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3186 CHECK_DEL_REG_STR(net, "1", temp);
3188 res = delete_key(net, "", access);
3189 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3190 RegCloseKey(net);
3192 res = RegOpenKeyExA(sourcelist, "Media", 0, access, &media);
3193 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3195 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3197 res = delete_key(media, "", access);
3198 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3199 RegCloseKey(media);
3200 res = delete_key(sourcelist, "", access);
3201 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3202 RegCloseKey(sourcelist);
3203 res = delete_key(hkey, "", access);
3204 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3205 RegCloseKey(hkey);
3207 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, machup, 0, access, &hkey);
3208 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3210 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3212 res = delete_key(hkey, "", access);
3213 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3214 RegCloseKey(hkey);
3216 error:
3217 DeleteFileA(msifile);
3218 DeleteFileA("msitest\\maximus");
3219 RemoveDirectoryA("msitest");
3220 HeapFree(GetProcessHeap(), 0, usersid);
3223 static void test_publish_features(void)
3225 static const char cupath[] =
3226 "Software\\Microsoft\\Installer\\Features\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3227 static const char udfeatpath[] =
3228 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
3229 "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
3230 static const char udpridpath[] =
3231 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
3232 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3233 static const char featkey[] =
3234 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Features";
3235 static const char classfeat[] =
3236 "Software\\Classes\\Installer\\Features\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3237 UINT r;
3238 LONG res;
3239 HKEY hkey;
3240 LPSTR usersid;
3241 CHAR keypath[MAX_PATH];
3242 REGSAM access = KEY_ALL_ACCESS;
3244 if (is_process_limited())
3246 skip("process is limited\n");
3247 return;
3250 if (!(usersid = get_user_sid()))
3251 return;
3253 CreateDirectoryA("msitest", NULL);
3254 create_file("msitest\\maximus", 500);
3256 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3258 if (is_wow64)
3259 access |= KEY_WOW64_64KEY;
3261 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3263 /* PublishFeatures, current user */
3264 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
3265 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3267 skip("Not enough rights to perform tests\n");
3268 goto error;
3270 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3271 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3272 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3274 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, featkey, 0, access, &hkey);
3275 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3277 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, classfeat, 0, access, &hkey);
3278 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3280 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
3281 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3283 CHECK_REG_STR(hkey, "feature", "");
3284 CHECK_REG_STR(hkey, "montecristo", "");
3286 RegDeleteValueA(hkey, "feature");
3287 RegDeleteValueA(hkey, "montecristo");
3288 delete_key(hkey, "", access);
3289 RegCloseKey(hkey);
3291 sprintf(keypath, udfeatpath, usersid);
3292 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3293 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3295 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
3296 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
3298 RegDeleteValueA(hkey, "feature");
3299 RegDeleteValueA(hkey, "montecristo");
3300 delete_key(hkey, "", access);
3301 RegCloseKey(hkey);
3302 sprintf(keypath, udpridpath, usersid);
3303 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3305 /* PublishFeatures, machine */
3306 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
3307 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3308 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3309 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3311 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, featkey, 0, access, &hkey);
3312 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3314 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
3315 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3316 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, classfeat, 0, access, &hkey);
3317 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3319 CHECK_REG_STR(hkey, "feature", "");
3320 CHECK_REG_STR(hkey, "montecristo", "");
3322 RegDeleteValueA(hkey, "feature");
3323 RegDeleteValueA(hkey, "montecristo");
3324 delete_key(hkey, "", access);
3325 RegCloseKey(hkey);
3327 sprintf(keypath, udfeatpath, "S-1-5-18");
3328 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3329 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3331 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
3332 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
3334 RegDeleteValueA(hkey, "feature");
3335 RegDeleteValueA(hkey, "montecristo");
3336 delete_key(hkey, "", access);
3337 RegCloseKey(hkey);
3338 sprintf(keypath, udpridpath, "S-1-5-18");
3339 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3341 error:
3342 DeleteFileA(msifile);
3343 DeleteFileA("msitest\\maximus");
3344 RemoveDirectoryA("msitest");
3345 HeapFree(GetProcessHeap(), 0, usersid);
3348 static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
3350 DWORD len = 0;
3351 LPSTR val;
3352 LONG r;
3354 r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
3355 if (r != ERROR_SUCCESS)
3356 return NULL;
3358 len += sizeof (WCHAR);
3359 val = HeapAlloc(GetProcessHeap(), 0, len);
3360 if (!val) return NULL;
3361 val[0] = 0;
3362 RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
3363 return val;
3366 static void get_owner_company(LPSTR *owner, LPSTR *company)
3368 LONG res;
3369 HKEY hkey;
3370 REGSAM access = KEY_ALL_ACCESS;
3372 *owner = *company = NULL;
3374 if (is_wow64)
3375 access |= KEY_WOW64_64KEY;
3377 res = RegOpenKeyA(HKEY_CURRENT_USER,
3378 "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
3379 if (res == ERROR_SUCCESS)
3381 *owner = reg_get_val_str(hkey, "DefName");
3382 *company = reg_get_val_str(hkey, "DefCompany");
3383 RegCloseKey(hkey);
3386 if (!*owner || !*company)
3388 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
3389 "Software\\Microsoft\\Windows\\CurrentVersion", 0, access, &hkey);
3390 if (res == ERROR_SUCCESS)
3392 *owner = reg_get_val_str(hkey, "RegisteredOwner");
3393 *company = reg_get_val_str(hkey, "RegisteredOrganization");
3394 RegCloseKey(hkey);
3398 if (!*owner || !*company)
3400 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
3401 "Software\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey);
3402 if (res == ERROR_SUCCESS)
3404 *owner = reg_get_val_str(hkey, "RegisteredOwner");
3405 *company = reg_get_val_str(hkey, "RegisteredOrganization");
3406 RegCloseKey(hkey);
3411 static void test_register_user(void)
3413 UINT r;
3414 LONG res;
3415 HKEY props;
3416 LPSTR usersid;
3417 LPSTR owner, company;
3418 CHAR keypath[MAX_PATH];
3419 REGSAM access = KEY_ALL_ACCESS;
3421 static const CHAR keypropsfmt[] =
3422 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3423 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
3424 static const CHAR keypridfmt[] =
3425 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3426 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3428 if (is_process_limited())
3430 skip("process is limited\n");
3431 return;
3434 if (!(usersid = get_user_sid()))
3435 return;
3437 get_owner_company(&owner, &company);
3439 CreateDirectoryA("msitest", NULL);
3440 create_file("msitest\\maximus", 500);
3442 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3444 if (is_wow64)
3445 access |= KEY_WOW64_64KEY;
3447 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3449 /* RegisterUser, per-user */
3450 r = MsiInstallProductA(msifile, "REGISTER_USER=1");
3451 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3453 skip("Not enough rights to perform tests\n");
3454 goto error;
3456 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3457 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3458 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3460 sprintf(keypath, keypropsfmt, usersid);
3461 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
3462 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3464 CHECK_REG_STR(props, "ProductID", "none");
3465 CHECK_REG_STR(props, "RegCompany", company);
3466 CHECK_REG_STR(props, "RegOwner", owner);
3468 RegDeleteValueA(props, "ProductID");
3469 RegDeleteValueA(props, "RegCompany");
3470 RegDeleteValueA(props, "RegOwner");
3471 delete_key(props, "", access);
3472 RegCloseKey(props);
3473 sprintf(keypath, keypridfmt, usersid);
3474 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3476 /* RegisterUser, machine */
3477 r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
3478 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3479 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3480 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3482 sprintf(keypath, keypropsfmt, "S-1-5-18");
3483 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
3484 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3486 CHECK_REG_STR(props, "ProductID", "none");
3487 CHECK_REG_STR(props, "RegCompany", company);
3488 CHECK_REG_STR(props, "RegOwner", owner);
3490 RegDeleteValueA(props, "ProductID");
3491 RegDeleteValueA(props, "RegCompany");
3492 RegDeleteValueA(props, "RegOwner");
3493 delete_key(props, "", access);
3494 RegCloseKey(props);
3495 sprintf(keypath, keypridfmt, "S-1-5-18");
3496 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3498 error:
3499 HeapFree(GetProcessHeap(), 0, company);
3500 HeapFree(GetProcessHeap(), 0, owner);
3502 DeleteFileA(msifile);
3503 DeleteFileA("msitest\\maximus");
3504 RemoveDirectoryA("msitest");
3505 LocalFree(usersid);
3508 static void test_process_components(void)
3510 static const char keyfmt[] =
3511 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Components\\%s";
3512 static const char compkey[] =
3513 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
3514 UINT r;
3515 LONG res;
3516 DWORD size;
3517 HKEY comp, hkey;
3518 LPSTR usersid;
3519 CHAR val[MAX_PATH];
3520 CHAR keypath[MAX_PATH];
3521 CHAR program_files_maximus[MAX_PATH];
3522 REGSAM access = KEY_ALL_ACCESS;
3524 if (is_process_limited())
3526 skip("process is limited\n");
3527 return;
3530 if (!(usersid = get_user_sid()))
3531 return;
3533 CreateDirectoryA("msitest", NULL);
3534 create_file("msitest\\maximus", 500);
3536 create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table));
3538 if (is_wow64)
3539 access |= KEY_WOW64_64KEY;
3541 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3543 /* ProcessComponents, per-user */
3544 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3545 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3547 skip("Not enough rights to perform tests\n");
3548 goto error;
3550 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3551 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3552 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3554 sprintf(keypath, keyfmt, usersid, "CBABC2FDCCB35E749A8944D8C1C098B5");
3555 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3556 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3558 size = MAX_PATH;
3559 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3560 NULL, NULL, (LPBYTE)val, &size);
3561 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3563 lstrcpyA(program_files_maximus,PROG_FILES_DIR);
3564 lstrcatA(program_files_maximus,"\\msitest\\maximus");
3566 ok(!lstrcmpiA(val, program_files_maximus),
3567 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3569 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3570 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3572 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3573 delete_key(comp, "", access);
3574 RegCloseKey(comp);
3576 sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
3577 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3578 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3580 size = MAX_PATH;
3581 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3582 NULL, NULL, (LPBYTE)val, &size);
3583 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3584 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3585 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3587 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3588 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3590 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3591 delete_key(comp, "", access);
3592 RegCloseKey(comp);
3594 /* ProcessComponents, machine */
3595 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
3596 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3597 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3598 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3600 sprintf(keypath, keyfmt, "S-1-5-18", "CBABC2FDCCB35E749A8944D8C1C098B5");
3601 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3602 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3604 size = MAX_PATH;
3605 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3606 NULL, NULL, (LPBYTE)val, &size);
3607 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3608 ok(!lstrcmpiA(val, program_files_maximus),
3609 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3611 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3612 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3614 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3615 delete_key(comp, "", access);
3616 RegCloseKey(comp);
3618 sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
3619 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3620 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3622 size = MAX_PATH;
3623 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3624 NULL, NULL, (LPBYTE)val, &size);
3625 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3626 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3627 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3629 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3630 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3632 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3633 delete_key(comp, "", access);
3634 RegCloseKey(comp);
3636 error:
3637 DeleteFileA(msifile);
3638 DeleteFileA("msitest\\maximus");
3639 RemoveDirectoryA("msitest");
3640 LocalFree(usersid);
3643 static void test_publish(void)
3645 static const char subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3646 static const char subkey_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3647 UINT r;
3648 LONG res;
3649 HKEY uninstall, prodkey, uninstall_32node = NULL;
3650 INSTALLSTATE state;
3651 char date[MAX_PATH], temp[MAX_PATH], prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3652 REGSAM access = KEY_ALL_ACCESS;
3653 DWORD error;
3655 if (!pMsiQueryFeatureStateExA)
3657 win_skip("MsiQueryFeatureStateExA is not available\n");
3658 return;
3660 if (is_process_limited())
3662 skip("process is limited\n");
3663 return;
3666 get_date_str(date);
3667 GetTempPathA(MAX_PATH, temp);
3669 if (is_wow64)
3670 access |= KEY_WOW64_64KEY;
3672 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey, 0, KEY_ALL_ACCESS, &uninstall);
3673 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3675 if (is_64bit)
3677 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey_32node, 0, KEY_ALL_ACCESS, &uninstall_32node);
3678 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3681 CreateDirectoryA("msitest", NULL);
3682 create_file("msitest\\maximus", 500);
3684 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3686 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3688 state = MsiQueryProductStateA(prodcode);
3689 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3691 state = MsiQueryFeatureStateA(prodcode, "feature");
3692 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3694 state = 0xdead;
3695 SetLastError(0xdeadbeef);
3696 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state);
3697 error = GetLastError();
3698 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3699 ok(state == 0xdead, "got %d\n", state);
3700 ok(error == 0xdeadbeef, "got %u\n", error);
3702 state = 0xdead;
3703 SetLastError(0xdeadbeef);
3704 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state);
3705 error = GetLastError();
3706 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3707 ok(state == 0xdead, "got %d\n", state);
3708 ok(error == ERROR_SUCCESS, "got %u\n", error);
3710 state = 0xdead;
3711 SetLastError(0xdeadbeef);
3712 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state);
3713 error = GetLastError();
3714 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3715 ok(state == 0xdead, "got %d\n", state);
3716 ok(error == ERROR_SUCCESS, "got %u\n", error);
3718 state = MsiQueryFeatureStateA(prodcode, "feature");
3719 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3721 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3722 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3724 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3725 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3726 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3727 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3729 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3730 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3732 /* nothing published */
3733 r = MsiInstallProductA(msifile, NULL);
3734 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3736 skip("Not enough rights to perform tests\n");
3737 goto error;
3739 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3740 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3741 ok(pf_exists("msitest"), "File not installed\n");
3743 state = MsiQueryProductStateA(prodcode);
3744 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3746 state = MsiQueryFeatureStateA(prodcode, "feature");
3747 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3749 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3750 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3752 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3753 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3754 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3755 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3757 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3758 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3760 /* PublishProduct and RegisterProduct */
3761 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
3762 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3763 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3764 ok(pf_exists("msitest"), "File not installed\n");
3766 state = MsiQueryProductStateA(prodcode);
3767 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3769 state = MsiQueryFeatureStateA(prodcode, "feature");
3770 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3772 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3773 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3775 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3776 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3777 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
3778 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3780 if (is_64bit)
3782 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3783 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3785 else
3787 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3788 if (is_wow64 && res == ERROR_FILE_NOT_FOUND) /* XP - Vista, Wow64 */
3789 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3790 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3793 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3794 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3795 CHECK_REG_STR(prodkey, "InstallDate", date);
3796 CHECK_REG_STR(prodkey, "InstallSource", temp);
3797 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3798 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3799 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3800 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3801 CHECK_REG_STR(prodkey, "Comments", NULL);
3802 CHECK_REG_STR(prodkey, "Contact", NULL);
3803 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3804 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3805 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3806 CHECK_REG_STR(prodkey, "Readme", NULL);
3807 CHECK_REG_STR(prodkey, "Size", NULL);
3808 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3809 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3810 CHECK_REG_DWORD(prodkey, "Language", 1033);
3811 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3812 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3813 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3814 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3815 todo_wine
3817 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
3820 RegCloseKey(prodkey);
3822 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3823 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3824 ok(pf_exists("msitest\\maximus"), "File deleted\n");
3825 ok(pf_exists("msitest"), "File deleted\n");
3827 state = MsiQueryProductStateA(prodcode);
3828 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3830 state = MsiQueryFeatureStateA(prodcode, "feature");
3831 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3833 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3834 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3836 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3837 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3838 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3839 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3841 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3842 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3844 /* complete install */
3845 r = MsiInstallProductA(msifile, "FULL=1");
3846 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3847 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3848 ok(pf_exists("msitest"), "File not installed\n");
3850 state = MsiQueryProductStateA(prodcode);
3851 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3853 state = MsiQueryFeatureStateA(prodcode, "feature");
3854 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3856 state = 0xdead;
3857 SetLastError(0xdeadbeef);
3858 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state);
3859 error = GetLastError();
3860 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3861 ok(state == 0xdead, "got %d\n", state);
3862 ok(error == 0xdeadbeef, "got %u\n", error);
3864 state = 0xdead;
3865 SetLastError(0xdeadbeef);
3866 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state);
3867 error = GetLastError();
3868 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3869 ok(state == 0xdead, "got %d\n", state);
3870 ok(error == ERROR_SUCCESS, "got %u\n", error);
3872 state = 0xdead;
3873 SetLastError(0xdeadbeef);
3874 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state);
3875 error = GetLastError();
3876 ok(r == ERROR_SUCCESS, "got %u\n", r);
3877 ok(state == INSTALLSTATE_LOCAL, "got %d\n", state);
3878 ok(error == ERROR_SUCCESS, "got %u\n", error);
3880 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3881 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3883 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3884 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3885 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3886 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3888 if (is_64bit)
3890 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3891 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3893 else
3895 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3896 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3899 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3900 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3901 CHECK_REG_STR(prodkey, "InstallDate", date);
3902 CHECK_REG_STR(prodkey, "InstallSource", temp);
3903 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3904 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3905 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3906 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3907 CHECK_REG_STR(prodkey, "Comments", NULL);
3908 CHECK_REG_STR(prodkey, "Contact", NULL);
3909 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3910 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3911 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3912 CHECK_REG_STR(prodkey, "Readme", NULL);
3913 CHECK_REG_STR(prodkey, "Size", NULL);
3914 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3915 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3916 CHECK_REG_DWORD(prodkey, "Language", 1033);
3917 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3918 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3919 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3920 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3921 todo_wine
3923 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
3926 RegCloseKey(prodkey);
3928 /* no UnpublishFeatures */
3929 r = MsiInstallProductA(msifile, "REMOVE=ALL");
3930 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3931 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
3932 ok(!pf_exists("msitest"), "Directory not deleted\n");
3934 state = MsiQueryProductStateA(prodcode);
3935 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3937 state = MsiQueryFeatureStateA(prodcode, "feature");
3938 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3940 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3941 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3943 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3944 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3945 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3946 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3948 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3949 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3951 /* complete install */
3952 r = MsiInstallProductA(msifile, "FULL=1");
3953 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3954 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3955 ok(pf_exists("msitest"), "File not installed\n");
3957 state = MsiQueryProductStateA(prodcode);
3958 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3960 state = MsiQueryFeatureStateA(prodcode, "feature");
3961 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3963 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3964 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3966 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3967 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3968 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3969 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3971 if (is_64bit)
3973 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3974 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3976 else
3978 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3979 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3982 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3983 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3984 CHECK_REG_STR(prodkey, "InstallDate", date);
3985 CHECK_REG_STR(prodkey, "InstallSource", temp);
3986 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3987 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3988 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3989 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3990 CHECK_REG_STR(prodkey, "Comments", NULL);
3991 CHECK_REG_STR(prodkey, "Contact", NULL);
3992 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3993 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3994 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3995 CHECK_REG_STR(prodkey, "Readme", NULL);
3996 CHECK_REG_STR(prodkey, "Size", NULL);
3997 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3998 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3999 CHECK_REG_DWORD(prodkey, "Language", 1033);
4000 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4001 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4002 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4003 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4004 todo_wine
4006 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4009 RegCloseKey(prodkey);
4011 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
4012 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
4013 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4014 ok(pf_exists("msitest\\maximus"), "File deleted\n");
4015 ok(pf_exists("msitest"), "Directory deleted\n");
4017 state = MsiQueryProductStateA(prodcode);
4018 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4020 state = MsiQueryFeatureStateA(prodcode, "feature");
4021 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4023 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4024 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4026 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4027 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4028 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4029 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4031 if (is_64bit)
4033 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4034 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4036 else
4038 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4039 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4042 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4043 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4044 CHECK_REG_STR(prodkey, "InstallDate", date);
4045 CHECK_REG_STR(prodkey, "InstallSource", temp);
4046 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4047 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4048 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4049 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4050 CHECK_REG_STR(prodkey, "Comments", NULL);
4051 CHECK_REG_STR(prodkey, "Contact", NULL);
4052 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4053 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4054 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4055 CHECK_REG_STR(prodkey, "Readme", NULL);
4056 CHECK_REG_STR(prodkey, "Size", NULL);
4057 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4058 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4059 CHECK_REG_DWORD(prodkey, "Language", 1033);
4060 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4061 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4062 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4063 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4064 todo_wine
4066 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4069 RegCloseKey(prodkey);
4071 /* complete install */
4072 r = MsiInstallProductA(msifile, "FULL=1");
4073 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4074 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4075 ok(pf_exists("msitest"), "File not installed\n");
4077 state = MsiQueryProductStateA(prodcode);
4078 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4080 state = MsiQueryFeatureStateA(prodcode, "feature");
4081 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4083 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4084 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4086 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4087 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4088 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4089 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4091 if (is_64bit)
4093 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4094 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4096 else
4098 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4099 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4102 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4103 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4104 CHECK_REG_STR(prodkey, "InstallDate", date);
4105 CHECK_REG_STR(prodkey, "InstallSource", temp);
4106 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4107 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4108 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4109 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4110 CHECK_REG_STR(prodkey, "Comments", NULL);
4111 CHECK_REG_STR(prodkey, "Contact", NULL);
4112 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4113 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4114 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4115 CHECK_REG_STR(prodkey, "Readme", NULL);
4116 CHECK_REG_STR(prodkey, "Size", NULL);
4117 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4118 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4119 CHECK_REG_DWORD(prodkey, "Language", 1033);
4120 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4121 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4122 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4123 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4124 todo_wine
4126 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -20, 10, 24);
4129 RegCloseKey(prodkey);
4131 /* UnpublishFeatures, both features removed */
4132 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
4133 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4134 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4135 ok(!pf_exists("msitest"), "Directory not deleted\n");
4137 state = MsiQueryProductStateA(prodcode);
4138 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4140 state = MsiQueryFeatureStateA(prodcode, "feature");
4141 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4143 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4144 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4146 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4147 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4148 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4149 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4151 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
4152 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4154 /* complete install */
4155 r = MsiInstallProductA(msifile, "FULL=1");
4156 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4157 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4158 ok(pf_exists("msitest"), "File not installed\n");
4160 state = MsiQueryProductStateA(prodcode);
4161 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4163 state = MsiQueryFeatureStateA(prodcode, "feature");
4164 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4166 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4167 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4169 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4170 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4171 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4172 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4174 if (is_64bit)
4176 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4177 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4179 else
4181 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4182 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4185 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4186 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4187 CHECK_REG_STR(prodkey, "InstallDate", date);
4188 CHECK_REG_STR(prodkey, "InstallSource", temp);
4189 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4190 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4191 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4192 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4193 CHECK_REG_STR(prodkey, "Comments", NULL);
4194 CHECK_REG_STR(prodkey, "Contact", NULL);
4195 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4196 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4197 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4198 CHECK_REG_STR(prodkey, "Readme", NULL);
4199 CHECK_REG_STR(prodkey, "Size", NULL);
4200 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4201 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4202 CHECK_REG_DWORD(prodkey, "Language", 1033);
4203 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4204 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4205 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4206 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4207 todo_wine
4209 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4212 RegCloseKey(prodkey);
4214 /* complete uninstall */
4215 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4216 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4217 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4218 ok(!pf_exists("msitest"), "Directory not deleted\n");
4220 state = MsiQueryProductStateA(prodcode);
4221 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4223 state = MsiQueryFeatureStateA(prodcode, "feature");
4224 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4226 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4227 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4229 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4230 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4231 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4232 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4234 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
4235 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4237 /* make sure 'Program Files\msitest' is removed */
4238 delete_pfmsitest_files();
4240 error:
4241 RegCloseKey(uninstall);
4242 RegCloseKey(uninstall_32node);
4243 DeleteFileA(msifile);
4244 DeleteFileA("msitest\\maximus");
4245 RemoveDirectoryA("msitest");
4248 static void test_publish_sourcelist(void)
4250 UINT r;
4251 DWORD size;
4252 CHAR value[MAX_PATH];
4253 CHAR path[MAX_PATH];
4254 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
4256 if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
4258 win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
4259 return;
4261 if (is_process_limited())
4263 skip("process is limited\n");
4264 return;
4267 CreateDirectoryA("msitest", NULL);
4268 create_file("msitest\\maximus", 500);
4270 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4272 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4274 r = MsiInstallProductA(msifile, NULL);
4275 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4277 skip("Not enough rights to perform tests\n");
4278 goto error;
4280 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4281 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4282 ok(pf_exists("msitest"), "File not installed\n");
4284 /* nothing published */
4285 size = MAX_PATH;
4286 lstrcpyA(value, "aaa");
4287 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4288 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4289 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4290 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4291 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4293 size = MAX_PATH;
4294 lstrcpyA(value, "aaa");
4295 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4296 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4297 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4298 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4299 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4301 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
4302 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4303 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4304 ok(pf_exists("msitest"), "File not installed\n");
4306 /* after RegisterProduct */
4307 size = MAX_PATH;
4308 lstrcpyA(value, "aaa");
4309 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4310 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4311 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4312 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4313 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4315 size = MAX_PATH;
4316 lstrcpyA(value, "aaa");
4317 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4318 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4319 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4320 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4321 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4323 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
4324 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4325 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4326 ok(pf_exists("msitest"), "File not installed\n");
4328 /* after ProcessComponents */
4329 size = MAX_PATH;
4330 lstrcpyA(value, "aaa");
4331 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4332 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4333 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4334 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4335 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4337 size = MAX_PATH;
4338 lstrcpyA(value, "aaa");
4339 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4340 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4341 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4342 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4343 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4345 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
4346 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4347 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4348 ok(pf_exists("msitest"), "File not installed\n");
4350 /* after PublishFeatures */
4351 size = MAX_PATH;
4352 lstrcpyA(value, "aaa");
4353 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4354 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4355 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4356 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4357 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4359 size = MAX_PATH;
4360 lstrcpyA(value, "aaa");
4361 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4362 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4363 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4364 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4365 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4367 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
4368 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4369 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4370 ok(pf_exists("msitest"), "File not installed\n");
4372 /* after PublishProduct */
4373 size = MAX_PATH;
4374 lstrcpyA(value, "aaa");
4375 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4376 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4377 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4378 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
4379 ok(size == 11, "Expected 11, got %d\n", size);
4381 size = MAX_PATH;
4382 lstrcpyA(value, "aaa");
4383 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4384 MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, value, &size);
4385 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4386 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
4387 ok(size == 0, "Expected 0, got %d\n", size);
4389 size = MAX_PATH;
4390 lstrcpyA(value, "aaa");
4391 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4392 MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPTA, value, &size);
4393 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4394 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
4395 ok(size == 0, "Expected 0, got %d\n", size);
4397 lstrcpyA(path, CURR_DIR);
4398 lstrcatA(path, "\\");
4400 size = MAX_PATH;
4401 lstrcpyA(value, "aaa");
4402 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4403 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size);
4404 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4405 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
4406 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
4408 size = MAX_PATH;
4409 lstrcpyA(value, "aaa");
4410 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4411 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size);
4412 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4413 ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
4414 ok(size == 1, "Expected 1, got %d\n", size);
4416 size = MAX_PATH;
4417 lstrcpyA(value, "aaa");
4418 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4419 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4420 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4421 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
4422 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
4424 size = MAX_PATH;
4425 lstrcpyA(value, "aaa");
4426 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4427 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
4428 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4429 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
4430 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
4432 size = MAX_PATH;
4433 lstrcpyA(value, "aaa");
4434 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4435 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
4436 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4437 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
4438 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
4440 /* complete uninstall */
4441 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4442 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4443 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4444 ok(!pf_exists("msitest"), "Directory not deleted\n");
4446 /* make sure 'Program Files\msitest' is removed */
4447 delete_pfmsitest_files();
4449 error:
4450 DeleteFileA(msifile);
4451 DeleteFileA("msitest\\maximus");
4452 RemoveDirectoryA("msitest");
4455 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
4457 CHAR path[MAX_PATH];
4459 lstrcpyA(path, PROG_FILES_DIR);
4460 lstrcatA(path, "\\");
4461 lstrcatA(path, file);
4463 if (is_file)
4464 create_file_data(path, data, 500);
4465 else
4466 CreateDirectoryA(path, NULL);
4469 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
4471 static void test_remove_files(void)
4473 UINT r;
4475 if (is_process_limited())
4477 skip("process is limited\n");
4478 return;
4481 CreateDirectoryA("msitest", NULL);
4482 create_file("msitest\\hydrogen", 500);
4483 create_file("msitest\\helium", 500);
4484 create_file("msitest\\lithium", 500);
4486 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
4488 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4490 r = MsiInstallProductA(msifile, NULL);
4491 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4493 skip("Not enough rights to perform tests\n");
4494 goto error;
4496 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4497 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4498 ok(!pf_exists("msitest\\helium"), "File installed\n");
4499 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4500 ok(pf_exists("msitest"), "File not installed\n");
4502 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4503 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4504 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4505 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
4506 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4507 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4509 create_pf("msitest", FALSE);
4510 create_pf("msitest\\hydrogen", TRUE);
4511 create_pf("msitest\\helium", TRUE);
4512 create_pf("msitest\\lithium", TRUE);
4514 r = MsiInstallProductA(msifile, NULL);
4515 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4516 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4517 ok(pf_exists("msitest\\helium"), "File not installed\n");
4518 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4519 ok(pf_exists("msitest"), "File not installed\n");
4521 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4522 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4523 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4524 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
4525 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4526 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4528 create_pf("msitest", FALSE);
4529 create_pf("msitest\\furlong", TRUE);
4530 create_pf("msitest\\firkin", TRUE);
4531 create_pf("msitest\\fortnight", TRUE);
4532 create_pf("msitest\\becquerel", TRUE);
4533 create_pf("msitest\\dioptre", TRUE);
4534 create_pf("msitest\\attoparsec", TRUE);
4535 create_pf("msitest\\storeys", TRUE);
4536 create_pf("msitest\\block", TRUE);
4537 create_pf("msitest\\siriometer", TRUE);
4538 create_pf("msitest\\cabout", FALSE);
4539 create_pf("msitest\\cabout\\blocker", TRUE);
4541 r = MsiInstallProductA(msifile, NULL);
4542 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4543 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4544 ok(!pf_exists("msitest\\helium"), "File installed\n");
4545 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4546 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
4547 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
4548 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
4549 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
4550 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
4551 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
4552 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
4553 ok(!pf_exists("msitest\\block"), "File not deleted\n");
4554 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
4555 ok(pf_exists("msitest\\cabout"), "Directory removed\n");
4556 ok(pf_exists("msitest"), "File not installed\n");
4558 create_pf("msitest\\furlong", TRUE);
4559 create_pf("msitest\\firkin", TRUE);
4560 create_pf("msitest\\fortnight", TRUE);
4561 create_pf("msitest\\storeys", TRUE);
4562 create_pf("msitest\\block", TRUE);
4563 create_pf("msitest\\siriometer", TRUE);
4565 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4566 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4567 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
4568 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
4569 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4570 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
4571 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
4572 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
4573 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
4574 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
4575 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
4576 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
4577 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
4578 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
4579 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4580 ok(pf_exists("msitest"), "Directory deleted\n");
4582 r = MsiInstallProductA(msifile, NULL);
4583 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4584 ok(delete_pf("msitest\\hydrogen", TRUE), "File not installed\n");
4585 ok(!delete_pf("msitest\\helium", TRUE), "File installed\n");
4586 ok(delete_pf("msitest\\lithium", TRUE), "File not installed\n");
4587 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4588 ok(pf_exists("msitest"), "Directory deleted\n");
4590 delete_pf("msitest\\cabout\\blocker", TRUE);
4592 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4593 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4594 ok(!delete_pf("msitest\\cabout", FALSE), "Directory not deleted\n");
4595 delete_pf("msitest", FALSE);
4597 error:
4598 DeleteFileA(msifile);
4599 DeleteFileA("msitest\\hydrogen");
4600 DeleteFileA("msitest\\helium");
4601 DeleteFileA("msitest\\lithium");
4602 RemoveDirectoryA("msitest");
4605 static void test_move_files(void)
4607 UINT r;
4608 char props[MAX_PATH];
4610 if (is_process_limited())
4612 skip("process is limited\n");
4613 return;
4616 CreateDirectoryA("msitest", NULL);
4617 create_file("msitest\\augustus", 100);
4618 create_file("cameroon", 100);
4619 create_file("djibouti", 100);
4620 create_file("egypt", 100);
4621 create_file("finland", 100);
4622 create_file("gambai", 100);
4623 create_file("honduras", 100);
4624 create_file("msitest\\india", 100);
4625 create_file("japan", 100);
4626 create_file("kenya", 100);
4627 CreateDirectoryA("latvia", NULL);
4628 create_file("nauru", 100);
4629 create_file("peru", 100);
4630 create_file("apple", 100);
4631 create_file("application", 100);
4632 create_file("ape", 100);
4633 create_file("foo", 100);
4634 create_file("fao", 100);
4635 create_file("fbod", 100);
4636 create_file("budding", 100);
4637 create_file("buddy", 100);
4638 create_file("bud", 100);
4639 create_file("bar", 100);
4640 create_file("bur", 100);
4641 create_file("bird", 100);
4643 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
4645 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4647 /* if the source or dest property is not a full path,
4648 * windows tries to access it as a network resource
4651 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
4652 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
4653 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
4655 r = MsiInstallProductA(msifile, props);
4656 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4658 skip("Not enough rights to perform tests\n");
4659 goto error;
4661 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4662 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4663 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
4664 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
4665 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
4666 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
4667 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
4668 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
4669 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
4670 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
4671 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
4672 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
4673 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
4674 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
4675 ok(delete_pf("msitest\\poland", TRUE), "File not moved\n");
4676 /* either apple or application will be moved depending on directory order */
4677 if (!delete_pf("msitest\\apple", TRUE))
4678 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
4679 else
4680 ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
4681 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
4682 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
4683 /* either fao or foo will be moved depending on directory order */
4684 if (delete_pf("msitest\\foo", TRUE))
4685 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
4686 else
4687 ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
4688 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
4689 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
4690 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
4691 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
4692 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
4693 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
4694 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
4695 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
4696 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4697 ok(DeleteFileA("cameroon"), "File moved\n");
4698 ok(!DeleteFileA("djibouti"), "File not moved\n");
4699 ok(DeleteFileA("egypt"), "File moved\n");
4700 ok(DeleteFileA("finland"), "File moved\n");
4701 ok(DeleteFileA("gambai"), "File moved\n");
4702 ok(!DeleteFileA("honduras"), "File not moved\n");
4703 ok(DeleteFileA("msitest\\india"), "File moved\n");
4704 ok(DeleteFileA("japan"), "File moved\n");
4705 ok(!DeleteFileA("kenya"), "File not moved\n");
4706 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
4707 ok(!DeleteFileA("nauru"), "File not moved\n");
4708 ok(!DeleteFileA("peru"), "File not moved\n");
4709 ok(!DeleteFileA("apple"), "File not moved\n");
4710 ok(!DeleteFileA("application"), "File not moved\n");
4711 ok(DeleteFileA("ape"), "File moved\n");
4712 ok(!DeleteFileA("foo"), "File not moved\n");
4713 ok(!DeleteFileA("fao"), "File not moved\n");
4714 ok(DeleteFileA("fbod"), "File moved\n");
4715 ok(!DeleteFileA("budding"), "File not moved\n");
4716 ok(!DeleteFileA("buddy"), "File not moved\n");
4717 ok(DeleteFileA("bud"), "File moved\n");
4718 ok(!DeleteFileA("bar"), "File not moved\n");
4719 ok(!DeleteFileA("bur"), "File not moved\n");
4720 ok(DeleteFileA("bird"), "File moved\n");
4722 error:
4723 DeleteFileA("cameroon");
4724 DeleteFileA("djibouti");
4725 DeleteFileA("egypt");
4726 DeleteFileA("finland");
4727 DeleteFileA("gambai");
4728 DeleteFileA("honduras");
4729 DeleteFileA("japan");
4730 DeleteFileA("kenya");
4731 DeleteFileA("nauru");
4732 DeleteFileA("peru");
4733 DeleteFileA("apple");
4734 DeleteFileA("application");
4735 DeleteFileA("ape");
4736 DeleteFileA("foo");
4737 DeleteFileA("fao");
4738 DeleteFileA("fbod");
4739 DeleteFileA("budding");
4740 DeleteFileA("buddy");
4741 DeleteFileA("bud");
4742 DeleteFileA("bar");
4743 DeleteFileA("bur");
4744 DeleteFileA("bird");
4745 DeleteFileA("msitest\\india");
4746 DeleteFileA("msitest\\augustus");
4747 RemoveDirectoryA("latvia");
4748 RemoveDirectoryA("msitest");
4749 DeleteFileA(msifile);
4752 static void test_duplicate_files(void)
4754 UINT r;
4756 if (is_process_limited())
4758 skip("process is limited\n");
4759 return;
4762 CreateDirectoryA("msitest", NULL);
4763 create_file("msitest\\maximus", 500);
4764 create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
4766 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4768 /* fails if the destination folder is not a valid property */
4770 r = MsiInstallProductA(msifile, NULL);
4771 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4773 skip("Not enough rights to perform tests\n");
4774 goto error;
4776 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4777 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4778 ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
4779 ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
4780 ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "Directory not created\n");
4781 ok(delete_pf("msitest\\this\\doesnot", FALSE), "Directory not created\n");
4782 ok(delete_pf("msitest\\this", FALSE), "Directory not created\n");
4783 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4785 error:
4786 DeleteFileA("msitest\\maximus");
4787 RemoveDirectoryA("msitest");
4788 DeleteFileA(msifile);
4791 static void test_write_registry_values(void)
4793 UINT r;
4794 LONG res;
4795 HKEY hkey;
4796 DWORD type, size;
4797 CHAR path[MAX_PATH];
4799 if (is_process_limited())
4801 skip("process is limited\n");
4802 return;
4805 CreateDirectoryA("msitest", NULL);
4806 create_file("msitest\\augustus", 500);
4808 create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
4810 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4812 if (is_64bit)
4813 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Wine\\msitest", 0, NULL, 0,
4814 KEY_ALL_ACCESS, NULL, &hkey, NULL);
4815 else
4816 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", 0, NULL, 0, KEY_ALL_ACCESS,
4817 NULL, &hkey, NULL);
4818 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4820 res = RegSetValueExA(hkey, "Value1", 0, REG_MULTI_SZ, (const BYTE *)"two\0", 5);
4821 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4822 res = RegSetValueExA(hkey, "Value2", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4823 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4824 res = RegSetValueExA(hkey, "Value3", 0, REG_MULTI_SZ, (const BYTE *)"two\0", 5);
4825 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4826 res = RegSetValueExA(hkey, "Value4", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4827 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4828 res = RegSetValueExA(hkey, "Value5", 0, REG_MULTI_SZ, (const BYTE *)"one\0two\0", 9);
4829 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4830 res = RegSetValueExA(hkey, "Value6", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4831 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4832 res = RegSetValueExA(hkey, "Value7", 0, REG_SZ, (const BYTE *)"one", 4);
4833 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4834 RegCloseKey(hkey);
4836 r = MsiInstallProductA(msifile, NULL);
4837 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4839 skip("Not enough rights to perform tests\n");
4840 goto error;
4842 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4843 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4844 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4846 if (is_64bit)
4847 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Wine\\msitest", 0, KEY_ALL_ACCESS, &hkey);
4848 else
4849 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", 0, KEY_ALL_ACCESS, &hkey);
4850 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4852 size = MAX_PATH;
4853 type = 0xdeadbeef;
4854 memset(path, 'a', MAX_PATH);
4855 res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size);
4856 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4857 ok(!memcmp(path, "one\0two\0three\0\0", size), "Wrong multi-sz data\n");
4858 ok(size == 15, "Expected 15, got %d\n", size);
4859 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4861 res = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL);
4862 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4864 res = action_RegDeleteTreeA(hkey, "VisualStudio", KEY_ALL_ACCESS);
4865 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4867 size = MAX_PATH;
4868 type = 0xdeadbeef;
4869 memset(path, 'a', MAX_PATH);
4870 res = RegQueryValueExA(hkey, "Value1", NULL, &type, (LPBYTE)path, &size);
4871 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4872 ok(!memcmp(path, "one\0", size), "Wrong multi-sz data\n");
4873 ok(size == 5, "Expected 5, got %d\n", size);
4874 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4876 size = MAX_PATH;
4877 type = 0xdeadbeef;
4878 memset(path, 'a', MAX_PATH);
4879 res = RegQueryValueExA(hkey, "Value2", NULL, &type, (LPBYTE)path, &size);
4880 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4881 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
4882 ok(size == 9, "Expected 9, got %d\n", size);
4883 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4885 size = MAX_PATH;
4886 type = 0xdeadbeef;
4887 memset(path, 'a', MAX_PATH);
4888 res = RegQueryValueExA(hkey, "Value3", NULL, &type, (LPBYTE)path, &size);
4889 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4890 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
4891 ok(size == 9, "Expected 9, got %d\n", size);
4892 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4894 size = MAX_PATH;
4895 type = 0xdeadbeef;
4896 memset(path, 'a', MAX_PATH);
4897 res = RegQueryValueExA(hkey, "Value4", NULL, &type, (LPBYTE)path, &size);
4898 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4899 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
4900 ok(size == 9, "Expected 9, got %d\n", size);
4901 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4903 size = MAX_PATH;
4904 type = 0xdeadbeef;
4905 memset(path, 'a', MAX_PATH);
4906 res = RegQueryValueExA(hkey, "Value5", NULL, &type, (LPBYTE)path, &size);
4907 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4908 ok(!memcmp(path, "one\0two\0three\0", size), "Wrong multi-sz data\n");
4909 ok(size == 15, "Expected 15, got %d\n", size);
4910 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4912 size = MAX_PATH;
4913 type = 0xdeadbeef;
4914 memset(path, 'a', MAX_PATH);
4915 res = RegQueryValueExA(hkey, "Value6", NULL, &type, (LPBYTE)path, &size);
4916 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4917 ok(!memcmp(path, "", size), "Wrong multi-sz data\n");
4918 ok(size == 1, "Expected 1, got %d\n", size);
4919 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4921 size = MAX_PATH;
4922 type = 0xdeadbeef;
4923 memset(path, 'a', MAX_PATH);
4924 res = RegQueryValueExA(hkey, "Value7", NULL, &type, (LPBYTE)path, &size);
4925 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4926 ok(!memcmp(path, "two\0", size), "Wrong multi-sz data\n");
4927 ok(size == 5, "Expected 5, got %d\n", size);
4928 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4930 RegDeleteValueA(hkey, "Value");
4931 RegDeleteValueA(hkey, "Value1");
4932 RegDeleteValueA(hkey, "Value2");
4933 RegDeleteValueA(hkey, "Value3");
4934 RegDeleteValueA(hkey, "Value4");
4935 RegDeleteValueA(hkey, "Value5");
4936 RegDeleteValueA(hkey, "Value6");
4937 RegDeleteValueA(hkey, "Value7");
4938 RegCloseKey(hkey);
4939 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
4941 error:
4942 DeleteFileA(msifile);
4943 DeleteFileA("msitest\\augustus");
4944 RemoveDirectoryA("msitest");
4947 static void test_envvar(void)
4949 static const char *results[] =
4951 "1;2", /* MSITESTVAR11 */
4952 "1", /* MSITESTVAR12 */
4953 "1;2", /* MSITESTVAR13 */
4954 ";1;", /* MSITESTVAR14 */
4955 ";;1;;", /* MSITESTVAR15 */
4956 " 1 ", /* MSITESTVAR16 */
4957 ";;2;;1", /* MSITESTVAR17 */
4958 "1;;2;;", /* MSITESTVAR18 */
4959 "1", /* MSITESTVAR19 */
4960 "1", /* MSITESTVAR20 */
4961 NULL
4963 UINT r;
4964 HKEY env;
4965 LONG res;
4966 DWORD type, size;
4967 char buffer[16];
4968 UINT i;
4970 if (is_process_limited())
4972 skip("process is limited\n");
4973 return;
4976 create_test_files();
4977 create_database(msifile, env_tables, sizeof(env_tables) / sizeof(msi_table));
4979 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Environment", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &env, NULL);
4980 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4982 res = RegSetValueExA(env, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"0", 2);
4983 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4985 res = RegSetValueExA(env, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"0", 2);
4986 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4988 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4990 r = MsiInstallProductA(msifile, NULL);
4991 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4993 skip("Not enough rights to perform tests\n");
4994 goto error;
4996 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4998 type = REG_NONE;
4999 size = sizeof(buffer);
5000 buffer[0] = 0;
5001 res = RegQueryValueExA(env, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
5002 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5003 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
5004 ok(!lstrcmpA(buffer, "1"), "Expected \"1\", got %s\n", buffer);
5006 res = RegDeleteValueA(env, "MSITESTVAR1");
5007 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5009 type = REG_NONE;
5010 size = sizeof(buffer);
5011 buffer[0] = 0;
5012 res = RegQueryValueExA(env, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
5013 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5014 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
5015 ok(!lstrcmpA(buffer, "1"), "Expected \"1\", got %s\n", buffer);
5017 res = RegDeleteValueA(env, "MSITESTVAR2");
5018 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5020 res = RegDeleteValueA(env, "MSITESTVAR3");
5021 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5023 res = RegDeleteValueA(env, "MSITESTVAR4");
5024 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5026 res = RegDeleteValueA(env, "MSITESTVAR5");
5027 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5029 res = RegDeleteValueA(env, "MSITESTVAR6");
5030 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5032 res = RegDeleteValueA(env, "MSITESTVAR7");
5033 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5035 res = RegDeleteValueA(env, "MSITESTVAR8");
5036 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5038 res = RegDeleteValueA(env, "MSITESTVAR9");
5039 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5041 res = RegDeleteValueA(env, "MSITESTVAR10");
5042 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5044 i = 11;
5045 while (results[i - 11])
5047 char name[20];
5048 sprintf(name, "MSITESTVAR%d", i);
5050 type = REG_NONE;
5051 size = sizeof(buffer);
5052 buffer[0] = 0;
5053 res = RegQueryValueExA(env, name, NULL, &type, (LPBYTE)buffer, &size);
5054 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
5055 ok(type == REG_SZ, "%d: Expected REG_SZ, got %u\n", i, type);
5056 ok(!lstrcmpA(buffer, results[i - 11]), "%d: Expected %s, got %s\n", i, results[i - 11], buffer);
5058 res = RegDeleteValueA(env, name);
5059 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
5060 i++;
5063 delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
5064 delete_pf("msitest\\cabout\\new", FALSE);
5065 delete_pf("msitest\\cabout\\four.txt", TRUE);
5066 delete_pf("msitest\\cabout", FALSE);
5067 delete_pf("msitest\\changed\\three.txt", TRUE);
5068 delete_pf("msitest\\changed", FALSE);
5069 delete_pf("msitest\\first\\two.txt", TRUE);
5070 delete_pf("msitest\\first", FALSE);
5071 delete_pf("msitest\\filename", TRUE);
5072 delete_pf("msitest\\one.txt", TRUE);
5073 delete_pf("msitest\\service.exe", TRUE);
5074 delete_pf("msitest\\service2.exe", TRUE);
5075 delete_pf("msitest", FALSE);
5077 error:
5078 RegDeleteValueA(env, "MSITESTVAR1");
5079 RegDeleteValueA(env, "MSITESTVAR2");
5080 RegCloseKey(env);
5082 delete_test_files();
5083 DeleteFileA(msifile);
5086 static void test_create_remove_folder(void)
5088 UINT r;
5090 if (is_process_limited())
5092 skip("process is limited\n");
5093 return;
5096 CreateDirectoryA("msitest", NULL);
5097 CreateDirectoryA("msitest\\first", NULL);
5098 CreateDirectoryA("msitest\\second", NULL);
5099 create_file("msitest\\first\\one.txt", 1000);
5100 create_file("msitest\\second\\two.txt", 1000);
5101 create_database(msifile, cf_tables, sizeof(cf_tables) / sizeof(msi_table));
5103 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5105 r = MsiInstallProductA(msifile, NULL);
5106 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5108 skip("Not enough rights to perform tests\n");
5109 goto error;
5111 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5113 ok(pf_exists("msitest\\first\\one.txt"), "file not installed\n");
5114 ok(pf_exists("msitest\\first"), "directory not created\n");
5115 ok(pf_exists("msitest\\second\\two.txt"), "file not installed\n");
5116 ok(pf_exists("msitest\\second"), "directory not created\n");
5117 ok(pf_exists("msitest\\third"), "directory not created\n");
5118 ok(pf_exists("msitest"), "directory not created\n");
5120 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5121 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5123 ok(!pf_exists("msitest\\first\\one.txt"), "file not removed\n");
5124 ok(!pf_exists("msitest\\first"), "directory not removed\n");
5125 ok(!pf_exists("msitest\\second\\two.txt"), "file not removed\n");
5126 ok(!pf_exists("msitest\\second"), "directory not removed\n");
5127 ok(!pf_exists("msitest\\third"), "directory not removed\n");
5128 todo_wine ok(!pf_exists("msitest"), "directory not removed\n");
5130 error:
5131 DeleteFileA("msitest\\first\\one.txt");
5132 DeleteFileA("msitest\\second\\two.txt");
5133 RemoveDirectoryA("msitest\\first");
5134 RemoveDirectoryA("msitest\\second");
5135 RemoveDirectoryA("msitest");
5136 DeleteFileA(msifile);
5139 static void test_start_services(void)
5141 UINT r;
5142 SC_HANDLE scm, service;
5143 BOOL ret;
5144 DWORD error = ERROR_SUCCESS;
5146 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5147 if (!scm && GetLastError() == ERROR_ACCESS_DENIED)
5149 skip("Not enough rights to perform tests\n");
5150 return;
5152 ok(scm != NULL, "Failed to open the SC Manager\n");
5153 if (!scm) return;
5155 service = OpenServiceA(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
5156 if (!service && GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST)
5158 win_skip("The 'Spooler' service does not exist\n");
5159 CloseServiceHandle(scm);
5160 return;
5162 ok(service != NULL, "Failed to open Spooler, error %d\n", GetLastError());
5163 if (!service) {
5164 CloseServiceHandle(scm);
5165 return;
5168 ret = StartServiceA(service, 0, NULL);
5169 if (!ret && (error = GetLastError()) != ERROR_SERVICE_ALREADY_RUNNING)
5171 skip("Spooler service not available, skipping test\n");
5172 CloseServiceHandle(service);
5173 CloseServiceHandle(scm);
5174 return;
5177 CloseServiceHandle(service);
5178 CloseServiceHandle(scm);
5180 create_test_files();
5181 create_database(msifile, sss_tables, sizeof(sss_tables) / sizeof(msi_table));
5183 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5185 r = MsiInstallProductA(msifile, NULL);
5186 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5188 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5189 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5190 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5191 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5192 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5193 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5194 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5195 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5196 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5197 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5198 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5199 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5200 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5202 delete_test_files();
5203 DeleteFileA(msifile);
5205 if (error == ERROR_SUCCESS)
5207 SERVICE_STATUS status;
5209 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5210 service = OpenServiceA(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
5212 ret = ControlService(service, SERVICE_CONTROL_STOP, &status);
5213 ok(ret, "ControlService failed %u\n", GetLastError());
5215 CloseServiceHandle(service);
5216 CloseServiceHandle(scm);
5220 static void test_delete_services(void)
5222 UINT r;
5223 SC_HANDLE manager, service;
5224 DWORD error;
5226 if (is_process_limited())
5228 skip("process is limited\n");
5229 return;
5232 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5233 ok(manager != NULL, "can't open service manager %u\n", GetLastError());
5234 if (!manager) return;
5236 service = CreateServiceA(manager, "TestService3", "TestService3",
5237 SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_DEMAND_START,
5238 SERVICE_ERROR_NORMAL, "C:\\doesnt_exist.exe", NULL, NULL, NULL, NULL, NULL);
5239 ok(service != NULL, "can't create service %u\n", GetLastError());
5240 CloseServiceHandle(service);
5241 CloseServiceHandle(manager);
5242 if (!service) goto error;
5244 create_test_files();
5245 create_database(msifile, sds_tables, sizeof(sds_tables) / sizeof(msi_table));
5247 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5249 r = MsiInstallProductA(msifile, NULL);
5250 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5252 skip("Not enough rights to perform tests\n");
5253 goto error;
5255 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5257 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5258 ok(manager != NULL, "can't open service manager\n");
5259 if (!manager) goto error;
5261 service = OpenServiceA(manager, "TestService3", GENERIC_ALL);
5262 error = GetLastError();
5263 ok(service == NULL, "TestService3 not deleted\n");
5264 ok(error == ERROR_SERVICE_DOES_NOT_EXIST, "wrong error %u\n", error);
5265 CloseServiceHandle(manager);
5267 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5268 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5270 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5271 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5272 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5273 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5274 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5275 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5276 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5277 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5278 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5279 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5280 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5281 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5282 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5284 error:
5285 delete_test_files();
5286 DeleteFileA(msifile);
5289 static void test_install_services(void)
5291 UINT r;
5292 SC_HANDLE manager, service;
5293 BOOL ret;
5295 if (is_process_limited())
5297 skip("process is limited\n");
5298 return;
5301 create_test_files();
5302 create_database(msifile, sis_tables, sizeof(sis_tables) / sizeof(msi_table));
5304 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5306 r = MsiInstallProductA(msifile, NULL);
5307 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5309 skip("Not enough rights to perform tests\n");
5310 goto error;
5312 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5314 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5315 ok(manager != NULL, "can't open service manager\n");
5316 if (!manager) goto error;
5318 service = OpenServiceA(manager, "TestService", GENERIC_ALL);
5319 ok(service != NULL, "TestService not installed\n");
5320 CloseServiceHandle(service);
5322 service = OpenServiceA(manager, "TestService4", GENERIC_ALL);
5323 ok(service == NULL, "TestService4 installed\n");
5324 CloseServiceHandle(manager);
5326 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5327 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5329 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5330 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5331 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5332 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5333 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5334 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5335 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5336 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5337 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5338 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5339 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5340 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5341 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5343 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5344 ok(manager != NULL, "can't open service manager\n");
5345 if (!manager) goto error;
5347 service = OpenServiceA(manager, "TestService", GENERIC_ALL);
5348 ok(service != NULL, "TestService doesn't exist\n");
5350 ret = DeleteService( service );
5351 ok( ret, "failed to delete service %u\n", GetLastError() );
5353 CloseServiceHandle(service);
5354 CloseServiceHandle(manager);
5356 error:
5357 delete_test_files();
5358 DeleteFileA(msifile);
5361 static void test_self_registration(void)
5363 UINT r;
5365 if (is_process_limited())
5367 skip("process is limited\n");
5368 return;
5371 create_test_files();
5372 create_database(msifile, sr_tables, sizeof(sr_tables) / sizeof(msi_table));
5374 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5376 r = MsiInstallProductA(msifile, NULL);
5377 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5379 skip("Not enough rights to perform tests\n");
5380 goto error;
5382 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5384 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5385 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5386 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5387 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5388 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5389 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5390 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5391 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5392 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5393 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5394 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5395 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5396 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5398 error:
5399 delete_test_files();
5400 DeleteFileA(msifile);
5403 static void test_register_font(void)
5405 static const char regfont1[] = "Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
5406 static const char regfont2[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Fonts";
5407 LONG ret;
5408 HKEY key;
5409 UINT r;
5410 REGSAM access = KEY_ALL_ACCESS;
5412 if (is_process_limited())
5414 skip("process is limited\n");
5415 return;
5418 create_test_files();
5419 create_file("msitest\\font.ttf", 1000);
5420 create_database(msifile, font_tables, sizeof(font_tables) / sizeof(msi_table));
5422 if (is_wow64)
5423 access |= KEY_WOW64_64KEY;
5425 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5427 r = MsiInstallProductA(msifile, NULL);
5428 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5430 skip("Not enough rights to perform tests\n");
5431 goto error;
5433 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5435 ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, regfont1, 0, access, &key);
5436 if (ret)
5437 RegOpenKeyExA(HKEY_LOCAL_MACHINE, regfont2, 0, access, &key);
5439 ret = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
5440 ok(ret != ERROR_FILE_NOT_FOUND, "unexpected result %d\n", ret);
5442 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5443 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5445 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5447 ret = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
5448 ok(ret == ERROR_FILE_NOT_FOUND, "unexpected result %d\n", ret);
5450 RegDeleteValueA(key, "msi test font");
5451 RegCloseKey(key);
5453 error:
5454 DeleteFileA("msitest\\font.ttf");
5455 delete_test_files();
5456 DeleteFileA(msifile);
5459 static void test_validate_product_id(void)
5461 UINT r;
5463 if (is_process_limited())
5465 skip("process is limited\n");
5466 return;
5469 create_test_files();
5470 create_database(msifile, vp_tables, sizeof(vp_tables) / sizeof(msi_table));
5472 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5474 r = MsiInstallProductA(msifile, NULL);
5475 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5477 skip("Not enough rights to perform tests\n");
5478 goto error;
5480 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5482 r = MsiInstallProductA(msifile, "SET_PRODUCT_ID=1");
5483 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5485 r = MsiInstallProductA(msifile, "SET_PRODUCT_ID=2");
5486 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5488 r = MsiInstallProductA(msifile, "PIDKEY=123-1234567");
5489 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5491 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5492 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5493 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5494 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5495 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5496 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5497 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5498 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5499 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5500 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5501 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5502 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5503 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5505 error:
5506 delete_test_files();
5507 DeleteFileA(msifile);
5510 static void test_install_remove_odbc(void)
5512 UINT r;
5514 if (is_process_limited())
5516 skip("process is limited\n");
5517 return;
5520 create_test_files();
5521 create_file("msitest\\ODBCdriver.dll", 1000);
5522 create_file("msitest\\ODBCdriver2.dll", 1000);
5523 create_file("msitest\\ODBCtranslator.dll", 1000);
5524 create_file("msitest\\ODBCtranslator2.dll", 1000);
5525 create_file("msitest\\ODBCsetup.dll", 1000);
5526 create_database(msifile, odbc_tables, sizeof(odbc_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 ok(pf_exists("msitest\\ODBCdriver.dll"), "file not created\n");
5539 ok(pf_exists("msitest\\ODBCdriver2.dll"), "file not created\n");
5540 ok(pf_exists("msitest\\ODBCtranslator.dll"), "file not created\n");
5541 ok(pf_exists("msitest\\ODBCtranslator2.dll"), "file not created\n");
5542 ok(pf_exists("msitest\\ODBCsetup.dll"), "file not created\n");
5544 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5545 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5547 ok(!delete_pf("msitest\\ODBCdriver.dll", TRUE), "file not removed\n");
5548 ok(!delete_pf("msitest\\ODBCdriver2.dll", TRUE), "file not removed\n");
5549 ok(!delete_pf("msitest\\ODBCtranslator.dll", TRUE), "file not removed\n");
5550 ok(!delete_pf("msitest\\ODBCtranslator2.dll", TRUE), "file not removed\n");
5551 ok(!delete_pf("msitest\\ODBCsetup.dll", TRUE), "file not removed\n");
5552 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5554 error:
5555 DeleteFileA("msitest\\ODBCdriver.dll");
5556 DeleteFileA("msitest\\ODBCdriver2.dll");
5557 DeleteFileA("msitest\\ODBCtranslator.dll");
5558 DeleteFileA("msitest\\ODBCtranslator2.dll");
5559 DeleteFileA("msitest\\ODBCsetup.dll");
5560 delete_test_files();
5561 DeleteFileA(msifile);
5564 static void test_register_typelib(void)
5566 UINT r;
5568 if (is_process_limited())
5570 skip("process is limited\n");
5571 return;
5574 create_test_files();
5575 create_file("msitest\\typelib.dll", 1000);
5576 create_database(msifile, tl_tables, sizeof(tl_tables) / sizeof(msi_table));
5578 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5580 r = MsiInstallProductA(msifile, "REGISTER_TYPELIB=1");
5581 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5583 skip("Not enough rights to perform tests\n");
5584 goto error;
5586 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5588 r = MsiInstallProductA(msifile, NULL);
5589 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5591 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5592 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5594 ok(!delete_pf("msitest\\typelib.dll", TRUE), "file not removed\n");
5595 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5597 error:
5598 DeleteFileA("msitest\\typelib.dll");
5599 delete_test_files();
5600 DeleteFileA(msifile);
5603 static void test_create_remove_shortcut(void)
5605 UINT r;
5607 if (is_process_limited())
5609 skip("process is limited\n");
5610 return;
5613 create_test_files();
5614 create_file("msitest\\target.txt", 1000);
5615 create_database(msifile, crs_tables, sizeof(crs_tables) / sizeof(msi_table));
5617 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5619 r = MsiInstallProductA(msifile, NULL);
5620 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5622 skip("Not enough rights to perform tests\n");
5623 goto error;
5625 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5627 ok(pf_exists("msitest\\target.txt"), "file not created\n");
5628 ok(pf_exists("msitest\\shortcut.lnk"), "file not created\n");
5630 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5631 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5633 ok(!delete_pf("msitest\\shortcut.lnk", TRUE), "file not removed\n");
5634 ok(!delete_pf("msitest\\target.txt", TRUE), "file not removed\n");
5635 todo_wine ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5637 error:
5638 DeleteFileA("msitest\\target.txt");
5639 delete_test_files();
5640 DeleteFileA(msifile);
5643 static void test_publish_components(void)
5645 static const char keypath[] =
5646 "Software\\Microsoft\\Installer\\Components\\0CBCFA296AC907244845745CEEB2F8AA";
5648 UINT r;
5649 LONG res;
5650 HKEY key;
5652 if (is_process_limited())
5654 skip("process is limited\n");
5655 return;
5658 create_test_files();
5659 create_file("msitest\\english.txt", 1000);
5660 create_database(msifile, pub_tables, sizeof(pub_tables) / sizeof(msi_table));
5662 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5664 r = MsiInstallProductA(msifile, NULL);
5665 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5667 skip("Not enough rights to perform tests\n");
5668 goto error;
5670 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5672 res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
5673 ok(res == ERROR_SUCCESS, "components key not created %d\n", res);
5675 res = RegQueryValueExA(key, "english.txt", NULL, NULL, NULL, NULL);
5676 ok(res == ERROR_SUCCESS, "value not found %d\n", res);
5677 RegCloseKey(key);
5679 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5680 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5682 res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
5683 ok(res == ERROR_FILE_NOT_FOUND, "unexpected result %d\n", res);
5685 ok(!delete_pf("msitest\\english.txt", TRUE), "file not removed\n");
5686 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5688 error:
5689 DeleteFileA("msitest\\english.txt");
5690 delete_test_files();
5691 DeleteFileA(msifile);
5694 static void test_remove_duplicate_files(void)
5696 UINT r;
5698 if (is_process_limited())
5700 skip("process is limited\n");
5701 return;
5704 create_test_files();
5705 create_file("msitest\\original.txt", 1000);
5706 create_file("msitest\\original2.txt", 1000);
5707 create_file("msitest\\original3.txt", 1000);
5708 create_database(msifile, rd_tables, sizeof(rd_tables) / sizeof(msi_table));
5710 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5712 r = MsiInstallProductA(msifile, NULL);
5713 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5715 skip("Not enough rights to perform tests\n");
5716 goto error;
5718 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5720 ok(pf_exists("msitest\\original.txt"), "file not created\n");
5721 ok(pf_exists("msitest\\original2.txt"), "file not created\n");
5722 ok(!pf_exists("msitest\\original3.txt"), "file created\n");
5723 ok(pf_exists("msitest\\duplicate.txt"), "file not created\n");
5724 ok(!pf_exists("msitest\\duplicate2.txt"), "file created\n");
5726 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5727 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5729 ok(delete_pf("msitest\\original.txt", TRUE), "file removed\n");
5730 ok(!delete_pf("msitest\\original2.txt", TRUE), "file not removed\n");
5731 ok(!delete_pf("msitest\\original3.txt", TRUE), "file not removed\n");
5732 ok(!delete_pf("msitest\\duplicate.txt", TRUE), "file not removed\n");
5733 ok(!delete_pf("msitest\\duplicate2.txt", TRUE), "file not removed\n");
5734 ok(delete_pf("msitest", FALSE), "directory removed\n");
5736 error:
5737 DeleteFileA("msitest\\original.txt");
5738 DeleteFileA("msitest\\original2.txt");
5739 DeleteFileA("msitest\\original3.txt");
5740 delete_test_files();
5741 DeleteFileA(msifile);
5744 static void test_remove_registry_values(void)
5746 UINT r;
5747 LONG res;
5748 HKEY key;
5749 REGSAM access = KEY_ALL_ACCESS;
5751 if (is_process_limited())
5753 skip("process is limited\n");
5754 return;
5757 create_test_files();
5758 create_file("msitest\\registry.txt", 1000);
5759 create_database(msifile, rrv_tables, sizeof(rrv_tables) / sizeof(msi_table));
5761 if (is_wow64)
5762 access |= KEY_WOW64_64KEY;
5764 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5766 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, NULL, 0, access, NULL, &key, NULL);
5767 RegSetValueExA(key, "value1", 0, REG_SZ, (const BYTE *)"1", 2);
5768 RegCloseKey(key);
5770 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, NULL, 0, access, NULL, &key, NULL);
5771 RegSetValueExA(key, "value2", 0, REG_SZ, (const BYTE *)"2", 2);
5772 RegCloseKey(key);
5774 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", 0, NULL, 0, access, NULL, &key, NULL);
5775 RegSetValueExA(key, "", 0, REG_SZ, (const BYTE *)"default", 8);
5776 RegSetValueExA(key, "valueA", 0, REG_SZ, (const BYTE *)"A", 2);
5777 RegSetValueExA(key, "valueB", 0, REG_SZ, (const BYTE *)"B", 2);
5778 RegCloseKey(key);
5780 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", 0, NULL, 0, access, NULL, &key, NULL);
5781 RegSetValueExA(key, "", 0, REG_SZ, (const BYTE *)"default", 8);
5782 RegSetValueExA(key, "valueB", 0, REG_SZ, (const BYTE *)"B", 2);
5783 RegCloseKey(key);
5785 r = MsiInstallProductA(msifile, NULL);
5786 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5788 skip("Not enough rights to perform tests\n");
5789 goto error;
5791 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5793 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, access, &key);
5794 ok(res == ERROR_SUCCESS, "key removed\n");
5795 RegCloseKey(key);
5797 if (is_64bit)
5799 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\key2", 0, KEY_ALL_ACCESS, &key);
5800 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5802 else
5804 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, KEY_ALL_ACCESS, &key);
5805 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5808 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, NULL, 0, access, NULL, &key, NULL);
5809 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5810 RegCloseKey(key);
5812 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5813 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5815 if (is_64bit)
5817 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\key1", 0, KEY_ALL_ACCESS, &key);
5818 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5820 else
5822 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, KEY_ALL_ACCESS, &key);
5823 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5826 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, access, &key);
5827 ok(res == ERROR_SUCCESS, "key removed\n");
5828 RegCloseKey(key);
5830 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", 0, access, &key);
5831 ok(res == ERROR_SUCCESS, "key removed\n");
5832 RegCloseKey(key);
5834 if (is_64bit)
5836 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\keyB", 0, KEY_ALL_ACCESS, &key);
5837 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5839 else
5841 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", 0, KEY_ALL_ACCESS, &key);
5842 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5845 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", access);
5846 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", access);
5847 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine", access);
5849 ok(!delete_pf("msitest\\registry.txt", TRUE), "file not removed\n");
5850 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5852 error:
5853 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", access);
5854 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", access);
5855 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", access);
5856 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", access);
5858 DeleteFileA("msitest\\registry.txt");
5859 delete_test_files();
5860 DeleteFileA(msifile);
5863 static void test_find_related_products(void)
5865 UINT r;
5867 if (is_process_limited())
5869 skip("process is limited\n");
5870 return;
5873 create_test_files();
5874 create_file("msitest\\product.txt", 1000);
5875 create_database(msifile, frp_tables, sizeof(frp_tables) / sizeof(msi_table));
5877 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5879 r = MsiInstallProductA(msifile, NULL);
5880 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5882 skip("Not enough rights to perform tests\n");
5883 goto error;
5885 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5887 /* install again, so it finds the upgrade code */
5888 r = MsiInstallProductA(msifile, NULL);
5889 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5891 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5892 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5894 ok(!delete_pf("msitest\\product.txt", TRUE), "file not removed\n");
5895 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5897 error:
5898 DeleteFileA("msitest\\product.txt");
5899 delete_test_files();
5900 DeleteFileA(msifile);
5903 static void test_remove_ini_values(void)
5905 UINT r;
5906 DWORD len;
5907 char inifile[MAX_PATH], buf[0x10];
5908 HANDLE file;
5909 BOOL ret;
5911 if (is_process_limited())
5913 skip("process is limited\n");
5914 return;
5917 create_test_files();
5918 create_file("msitest\\inifile.txt", 1000);
5919 create_database(msifile, riv_tables, sizeof(riv_tables) / sizeof(msi_table));
5921 lstrcpyA(inifile, PROG_FILES_DIR);
5922 lstrcatA(inifile, "\\msitest");
5923 ret = CreateDirectoryA(inifile, NULL);
5924 if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
5926 skip("Not enough rights to perform tests\n");
5927 goto error;
5929 lstrcatA(inifile, "\\test.ini");
5930 file = CreateFileA(inifile, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS, 0, NULL);
5931 CloseHandle(file);
5933 ret = WritePrivateProfileStringA("section1", "key1", "value1", inifile);
5934 ok(ret, "failed to write profile string %u\n", GetLastError());
5936 ret = WritePrivateProfileStringA("sectionA", "keyA", "valueA", inifile);
5937 ok(ret, "failed to write profile string %u\n", GetLastError());
5939 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5941 r = MsiInstallProductA(msifile, NULL);
5942 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5944 len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), inifile);
5945 ok(len == 6, "got %u expected 6\n", len);
5947 len = GetPrivateProfileStringA("sectionA", "keyA", NULL, buf, sizeof(buf), inifile);
5948 ok(!len, "got %u expected 0\n", len);
5950 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5951 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5953 len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), inifile);
5954 ok(!len, "got %u expected 0\n", len);
5956 len = GetPrivateProfileStringA("sectionA", "keyA", NULL, buf, sizeof(buf), inifile);
5957 ok(!len, "got %u expected 0\n", len);
5959 todo_wine ok(!delete_pf("msitest\\test.ini", TRUE), "file removed\n");
5960 ok(!delete_pf("msitest\\inifile.txt", TRUE), "file not removed\n");
5961 ok(delete_pf("msitest", FALSE), "directory removed\n");
5963 error:
5964 DeleteFileA("msitest\\inifile.txt");
5965 delete_test_files();
5966 DeleteFileA(msifile);
5969 static void test_remove_env_strings(void)
5971 UINT r;
5972 LONG res;
5973 HKEY key;
5974 DWORD type, size;
5975 char buffer[0x10];
5977 if (is_process_limited())
5979 skip("process is limited\n");
5980 return;
5983 create_test_files();
5984 create_file("msitest\\envvar.txt", 1000);
5985 create_database(msifile, res_tables, sizeof(res_tables) / sizeof(msi_table));
5987 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5989 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
5990 ok(!res, "failed to open environment key %d\n", res);
5992 RegSetValueExA(key, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"1", 2);
5993 RegSetValueExA(key, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"1", 2);
5994 RegSetValueExA(key, "MSITESTVAR3", 0, REG_SZ, (const BYTE *)"1", 2);
5995 RegSetValueExA(key, "MSITESTVAR4", 0, REG_SZ, (const BYTE *)"1", 2);
5996 RegSetValueExA(key, "MSITESTVAR5", 0, REG_SZ, (const BYTE *)"1", 2);
5998 RegCloseKey(key);
6000 r = MsiInstallProductA(msifile, NULL);
6001 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6003 skip("Not enough rights to perform tests\n");
6004 goto error;
6006 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6008 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
6009 ok(!res, "failed to open environment key %d\n", res);
6011 type = REG_NONE;
6012 buffer[0] = 0;
6013 size = sizeof(buffer);
6014 res = RegQueryValueExA(key, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
6015 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6016 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6017 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6019 type = REG_NONE;
6020 buffer[0] = 0;
6021 size = sizeof(buffer);
6022 res = RegQueryValueExA(key, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
6023 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6024 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6025 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6027 type = REG_NONE;
6028 buffer[0] = 0;
6029 size = sizeof(buffer);
6030 res = RegQueryValueExA(key, "MSITESTVAR3", NULL, &type, (LPBYTE)buffer, &size);
6031 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6032 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6033 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6035 type = REG_NONE;
6036 buffer[0] = 0;
6037 size = sizeof(buffer);
6038 res = RegQueryValueExA(key, "MSITESTVAR4", NULL, &type, (LPBYTE)buffer, &size);
6039 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6040 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6041 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6043 type = REG_NONE;
6044 buffer[0] = 0;
6045 size = sizeof(buffer);
6046 res = RegQueryValueExA(key, "MSITESTVAR5", NULL, &type, (LPBYTE)buffer, &size);
6047 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6048 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6049 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6051 RegCloseKey(key);
6053 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6054 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6056 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
6057 ok(!res, "failed to open environment key %d\n", res);
6059 res = RegQueryValueExA(key, "MSITESTVAR1", NULL, NULL, NULL, NULL);
6060 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6062 res = RegQueryValueExA(key, "MSITESTVAR2", NULL, NULL, NULL, NULL);
6063 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6065 type = REG_NONE;
6066 buffer[0] = 0;
6067 size = sizeof(buffer);
6068 res = RegQueryValueExA(key, "MSITESTVAR3", NULL, &type, (LPBYTE)buffer, &size);
6069 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6070 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6071 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6072 RegDeleteValueA(key, "MSITESTVAR3");
6074 res = RegQueryValueExA(key, "MSITESTVAR4", NULL, NULL, NULL, NULL);
6075 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6077 type = REG_NONE;
6078 buffer[0] = 0;
6079 size = sizeof(buffer);
6080 res = RegQueryValueExA(key, "MSITESTVAR5", NULL, &type, (LPBYTE)buffer, &size);
6081 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6082 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6083 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6084 RegDeleteValueA(key, "MSITESTVAR5");
6086 ok(!delete_pf("msitest\\envvar.txt", TRUE), "file not removed\n");
6087 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6089 error:
6090 RegDeleteValueA(key, "MSITESTVAR1");
6091 RegDeleteValueA(key, "MSITESTVAR2");
6092 RegDeleteValueA(key, "MSITESTVAR3");
6093 RegDeleteValueA(key, "MSITESTVAR4");
6094 RegDeleteValueA(key, "MSITESTVAR5");
6095 RegCloseKey(key);
6097 DeleteFileA("msitest\\envvar.txt");
6098 delete_test_files();
6099 DeleteFileA(msifile);
6102 static void test_register_class_info(void)
6104 UINT r;
6105 LONG res;
6106 HKEY hkey;
6108 if (is_process_limited())
6110 skip("process is limited\n");
6111 return;
6114 create_test_files();
6115 create_file("msitest\\class.txt", 1000);
6116 create_database(msifile, rci_tables, sizeof(rci_tables) / sizeof(msi_table));
6118 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6120 r = MsiInstallProductA(msifile, NULL);
6121 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6123 skip("Not enough rights to perform tests\n");
6124 goto error;
6126 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6128 if (is_64bit)
6129 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6130 else
6131 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6132 ok(res == ERROR_SUCCESS, "key not created\n");
6133 RegCloseKey(hkey);
6135 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6136 ok(res == ERROR_SUCCESS, "key not created\n");
6137 RegCloseKey(hkey);
6139 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &hkey);
6140 ok(res == ERROR_SUCCESS, "key not created\n");
6141 RegCloseKey(hkey);
6143 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6144 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6146 if (is_64bit)
6147 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6148 else
6149 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6150 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6152 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6153 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6155 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &hkey);
6156 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6158 ok(!delete_pf("msitest\\class.txt", TRUE), "file not removed\n");
6159 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6161 error:
6162 DeleteFileA("msitest\\class.txt");
6163 delete_test_files();
6164 DeleteFileA(msifile);
6167 static void test_register_extension_info(void)
6169 UINT r;
6170 LONG res;
6171 HKEY hkey;
6173 if (is_process_limited())
6175 skip("process is limited\n");
6176 return;
6179 create_test_files();
6180 create_file("msitest\\extension.txt", 1000);
6181 create_database(msifile, rei_tables, sizeof(rei_tables) / sizeof(msi_table));
6183 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6185 r = MsiInstallProductA(msifile, NULL);
6186 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6188 skip("Not enough rights to perform tests\n");
6189 goto error;
6191 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6193 res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &hkey);
6194 ok(res == ERROR_SUCCESS, "key not created\n");
6195 RegCloseKey(hkey);
6197 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1\\shell\\Open\\command", &hkey);
6198 ok(res == ERROR_SUCCESS, "key not created\n");
6199 RegCloseKey(hkey);
6201 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6202 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6204 res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &hkey);
6205 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6207 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1", &hkey);
6208 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6210 ok(!delete_pf("msitest\\extension.txt", TRUE), "file not removed\n");
6211 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6213 error:
6214 DeleteFileA("msitest\\extension.txt");
6215 delete_test_files();
6216 DeleteFileA(msifile);
6219 static void test_register_mime_info(void)
6221 UINT r;
6222 LONG res;
6223 HKEY hkey;
6225 if (is_process_limited())
6227 skip("process is limited\n");
6228 return;
6231 create_test_files();
6232 create_file("msitest\\mime.txt", 1000);
6233 create_database(msifile, rmi_tables, sizeof(rmi_tables) / sizeof(msi_table));
6235 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6237 r = MsiInstallProductA(msifile, NULL);
6238 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6240 skip("Not enough rights to perform tests\n");
6241 goto error;
6243 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6245 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &hkey);
6246 ok(res == ERROR_SUCCESS, "key not created\n");
6247 RegCloseKey(hkey);
6249 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6250 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6252 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &hkey);
6253 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6255 ok(!delete_pf("msitest\\mime.txt", TRUE), "file not removed\n");
6256 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6258 error:
6259 DeleteFileA("msitest\\mime.txt");
6260 delete_test_files();
6261 DeleteFileA(msifile);
6264 static void test_publish_assemblies(void)
6266 static const char manifest[] =
6267 "<assemblyIdentity type=\"win32\" name=\"Wine.Win32.Assembly\" "
6268 "version=\"1.0.0.0\" publicKeyToken=\"abcdef0123456789\" "
6269 "processorArchitecture=\"x86\"/>";
6270 static const char manifest_local[] =
6271 "<assemblyIdentity type=\"win32\" name=\"Wine.Win32.Local.Assembly\" "
6272 "version=\"1.0.0.0\" publicKeyToken=\"abcdef0123456789\" "
6273 "processorArchitecture=\"x86\"/>";
6274 static const char classes_path_dotnet[] =
6275 "Installer\\Assemblies\\Global";
6276 static const char classes_path_dotnet_local[] =
6277 "Installer\\Assemblies\\C:|Program Files|msitest|application_dotnet.txt";
6278 static const char classes_path_dotnet_local_wow64[] =
6279 "Installer\\Assemblies\\C:|Program Files (x86)|msitest|application_dotnet.txt";
6280 static const char classes_path_win32[] =
6281 "Installer\\Win32Assemblies\\Global";
6282 static const char classes_path_win32_local[] =
6283 "Installer\\Win32Assemblies\\C:|Program Files|msitest|application_win32.txt";
6284 static const char classes_path_win32_local_wow64[] =
6285 "Installer\\Win32Assemblies\\C:|Program Files (x86)|msitest|application_win32.txt";
6286 static const char path_dotnet[] =
6287 "Software\\Microsoft\\Installer\\Assemblies\\Global";
6288 static const char path_dotnet_local[] =
6289 "Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files|msitest|application_dotnet.txt";
6290 static const char path_dotnet_local_wow64[] =
6291 "Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files (x86)|msitest|application_dotnet.txt";
6292 static const char path_win32[] =
6293 "Software\\Microsoft\\Installer\\Win32Assemblies\\Global";
6294 static const char path_win32_local[] =
6295 "Software\\Microsoft\\Installer\\Win32Assemblies\\C:|Program Files|msitest|application_win32.txt";
6296 static const char path_win32_local_wow64[] =
6297 "Software\\Microsoft\\Installer\\Win32Assemblies\\C:|Program Files (x86)|msitest|application_win32.txt";
6298 static const char name_dotnet[] =
6299 "Wine.Dotnet.Assembly,processorArchitecture=\"MSIL\",publicKeyToken=\"abcdef0123456789\","
6300 "version=\"1.0.0.0\",culture=\"neutral\"";
6301 static const char name_dotnet_local[] =
6302 "Wine.Dotnet.Local.Assembly,processorArchitecture=\"MSIL\",publicKeyToken=\"abcdef0123456789\","
6303 "version=\"1.0.0.0\",culture=\"neutral\"";
6304 static const char name_win32[] =
6305 "Wine.Win32.Assembly,processorArchitecture=\"x86\",publicKeyToken=\"abcdef0123456789\","
6306 "type=\"win32\",version=\"1.0.0.0\"";
6307 static const char name_win32_local[] =
6308 "Wine.Win32.Local.Assembly,processorArchitecture=\"x86\",publicKeyToken=\"abcdef0123456789\","
6309 "type=\"win32\",version=\"1.0.0.0\"";
6310 UINT r;
6311 LONG res;
6312 HKEY hkey;
6313 const char *path;
6314 int access;
6316 if (is_process_limited())
6318 skip("process is limited\n");
6319 return;
6322 create_test_files();
6323 create_file("msitest\\win32.txt", 1000);
6324 create_file("msitest\\win32_local.txt", 1000);
6325 create_file("msitest\\dotnet.txt", 1000);
6326 create_file("msitest\\dotnet_local.txt", 1000);
6327 create_file_data("msitest\\manifest.txt", manifest, 0);
6328 create_file_data("msitest\\manifest_local.txt", manifest_local, 0);
6329 create_file("msitest\\application_win32.txt", 1000);
6330 create_file("msitest\\application_dotnet.txt", 1000);
6331 create_database(msifile, pa_tables, sizeof(pa_tables) / sizeof(msi_table));
6333 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6335 r = MsiInstallProductA(msifile, NULL);
6336 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6338 skip("Not enough rights to perform tests\n");
6339 goto done;
6341 if (r == ERROR_INSTALL_FAILURE)
6343 skip("No support for installing side-by-side assemblies\n");
6344 goto done;
6346 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6348 res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &hkey);
6349 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6350 CHECK_REG_STR(hkey, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
6351 RegCloseKey(hkey);
6353 path = (is_wow64 || is_64bit) ? path_dotnet_local_wow64 : path_dotnet_local;
6354 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6355 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6356 CHECK_REG_STR(hkey, name_dotnet_local, "rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox");
6357 RegCloseKey(hkey);
6359 res = RegOpenKeyA(HKEY_CURRENT_USER, path_win32, &hkey);
6360 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6361 "Expected ERROR_SUCCESS, got %d\n", res);
6362 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32, "rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%");
6363 RegCloseKey(hkey);
6365 path = (is_wow64 || is_64bit) ? path_win32_local_wow64 : path_win32_local;
6366 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6367 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6368 "Expected ERROR_SUCCESS, got %d\n", res);
6369 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32_local, "rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
6370 RegCloseKey(hkey);
6372 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6373 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6375 res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &hkey);
6376 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6377 if (res == ERROR_SUCCESS)
6379 res = RegDeleteValueA(hkey, name_dotnet);
6380 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6381 RegCloseKey(hkey);
6384 path = (is_wow64 || is_64bit) ? path_dotnet_local_wow64 : path_dotnet_local;
6385 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6386 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6388 res = RegOpenKeyA(HKEY_CURRENT_USER, path_win32, &hkey);
6389 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6390 if (res == ERROR_SUCCESS)
6392 res = RegDeleteValueA(hkey, name_win32);
6393 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6394 RegCloseKey(hkey);
6397 path = (is_wow64 || is_64bit) ? path_win32_local_wow64 : path_win32_local;
6398 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6399 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6401 r = MsiInstallProductA(msifile, "ALLUSERS=1");
6402 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6404 access = KEY_QUERY_VALUE;
6405 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_dotnet, 0, access, &hkey);
6406 if (res == ERROR_FILE_NOT_FOUND && is_wow64) /* Vista WOW64 */
6408 trace("Using 64-bit registry view for HKCR\\Installer\n");
6409 access = KEY_QUERY_VALUE | KEY_WOW64_64KEY;
6410 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_dotnet, 0, access, &hkey);
6412 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6413 CHECK_REG_STR(hkey, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
6414 RegCloseKey(hkey);
6416 path = (is_wow64 || is_64bit) ? classes_path_dotnet_local_wow64 : classes_path_dotnet_local;
6417 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
6418 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6419 CHECK_REG_STR(hkey, name_dotnet_local, "rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox");
6420 RegCloseKey(hkey);
6422 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_win32, 0, access, &hkey);
6423 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6424 "Expected ERROR_SUCCESS, got %d\n", res);
6425 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32, "rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%");
6426 RegCloseKey(hkey);
6428 path = (is_wow64 || is_64bit) ? classes_path_win32_local_wow64 : classes_path_win32_local;
6429 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
6430 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6431 "Expected ERROR_SUCCESS, got %d\n", res);
6432 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32_local, "rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
6433 RegCloseKey(hkey);
6435 r = MsiInstallProductA(msifile, "REMOVE=ALL ALLUSERS=1");
6436 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6438 res = RegOpenKeyA(HKEY_CLASSES_ROOT, classes_path_dotnet, &hkey);
6439 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6440 if (res == ERROR_SUCCESS)
6442 res = RegDeleteValueA(hkey, name_dotnet);
6443 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6444 RegCloseKey(hkey);
6447 path = (is_wow64 || is_64bit) ? classes_path_dotnet_local_wow64 : classes_path_dotnet_local;
6448 res = RegOpenKeyA(HKEY_CLASSES_ROOT, path, &hkey);
6449 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6451 res = RegOpenKeyA(HKEY_CLASSES_ROOT, classes_path_win32, &hkey);
6452 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6453 if (res == ERROR_SUCCESS)
6455 res = RegDeleteValueA(hkey, name_win32);
6456 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6457 RegCloseKey(hkey);
6460 path = (is_wow64 || is_64bit) ? classes_path_win32_local_wow64 : classes_path_win32_local;
6461 res = RegOpenKeyA(HKEY_CLASSES_ROOT, path, &hkey);
6462 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6464 done:
6465 DeleteFileA("msitest\\win32.txt");
6466 DeleteFileA("msitest\\win32_local.txt");
6467 DeleteFileA("msitest\\dotnet.txt");
6468 DeleteFileA("msitest\\dotnet_local.txt");
6469 DeleteFileA("msitest\\manifest.txt");
6470 DeleteFileA("msitest\\manifest_local.txt");
6471 DeleteFileA("msitest\\application_win32.txt");
6472 DeleteFileA("msitest\\application_dotnet.txt");
6473 delete_test_files();
6474 DeleteFileA(msifile);
6477 static void test_remove_existing_products(void)
6479 UINT r;
6481 if (is_process_limited())
6483 skip("process is limited\n");
6484 return;
6487 create_test_files();
6488 create_file("msitest\\rep.txt", 1000);
6489 create_database(msifile, rep_tables, sizeof(rep_tables) / sizeof(msi_table));
6491 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6493 r = MsiInstallProductA(msifile, NULL);
6494 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6496 skip("Not enough rights to perform tests\n");
6497 goto error;
6499 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6501 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6502 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6504 ok(!delete_pf("msitest\\rep.txt", TRUE), "file not removed\n");
6505 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6507 error:
6508 DeleteFileA("msitest\\rep.txt");
6509 delete_test_files();
6510 DeleteFileA(msifile);
6513 START_TEST(action)
6515 DWORD len;
6516 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6517 STATEMGRSTATUS status;
6518 BOOL ret = FALSE;
6520 init_functionpointers();
6522 if (pIsWow64Process)
6523 pIsWow64Process(GetCurrentProcess(), &is_wow64);
6525 GetCurrentDirectoryA(MAX_PATH, prev_path);
6526 GetTempPathA(MAX_PATH, temp_path);
6527 SetCurrentDirectoryA(temp_path);
6529 lstrcpyA(CURR_DIR, temp_path);
6530 len = lstrlenA(CURR_DIR);
6532 if(len && (CURR_DIR[len - 1] == '\\'))
6533 CURR_DIR[len - 1] = 0;
6535 ok(get_system_dirs(), "failed to retrieve system dirs\n");
6536 ok(get_user_dirs(), "failed to retrieve user dirs\n");
6538 /* Create a restore point ourselves so we circumvent the multitude of restore points
6539 * that would have been created by all the installation and removal tests.
6541 * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
6542 * creation of restore points.
6544 if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
6546 memset(&status, 0, sizeof(status));
6547 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
6550 /* Create only one log file and don't append. We have to pass something
6551 * for the log mode for this to work. The logfile needs to have an absolute
6552 * path otherwise we still end up with some extra logfiles as some tests
6553 * change the current directory.
6555 lstrcpyA(log_file, temp_path);
6556 lstrcatA(log_file, "\\msitest.log");
6557 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
6559 test_register_product();
6560 test_publish_product();
6561 test_publish_features();
6562 test_register_user();
6563 test_process_components();
6564 test_publish();
6565 test_publish_sourcelist();
6566 test_remove_files();
6567 test_move_files();
6568 test_duplicate_files();
6569 test_write_registry_values();
6570 test_envvar();
6571 test_create_remove_folder();
6572 test_start_services();
6573 test_delete_services();
6574 test_install_services();
6575 test_self_registration();
6576 test_register_font();
6577 test_validate_product_id();
6578 test_install_remove_odbc();
6579 test_register_typelib();
6580 test_create_remove_shortcut();
6581 test_publish_components();
6582 test_remove_duplicate_files();
6583 test_remove_registry_values();
6584 test_find_related_products();
6585 test_remove_ini_values();
6586 test_remove_env_strings();
6587 test_register_class_info();
6588 test_register_extension_info();
6589 test_register_mime_info();
6590 test_publish_assemblies();
6591 test_remove_existing_products();
6593 DeleteFileA(log_file);
6595 if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
6597 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
6598 if (ret)
6599 remove_restore_point(status.llSequenceNumber);
6601 FreeLibrary(hsrclient);
6603 SetCurrentDirectoryA(prev_path);