* The Shell.. for a long time we dreamed of having a compatible, properly working...
[reactos.git] / rostests / winetests / msi / action.c
1 /*
2 * Copyright (C) 2006 James Hawkins
3 * Copyright 2010 Hans Leidekker for CodeWeavers
4 *
5 * Tests concentrating on standard actions
6 *
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.
11 *
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.
16 *
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
20 */
21
22 #define _WIN32_MSI 300
23 #include <stdio.h>
24
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
32 #include "wine/test.h"
33
34 static UINT (WINAPI *pMsiQueryComponentStateA)
35 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *);
36 static UINT (WINAPI *pMsiSourceListEnumSourcesA)
37 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD);
38 static UINT (WINAPI *pMsiSourceListGetInfoA)
39 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, LPCSTR, LPSTR, LPDWORD);
40 static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)
41 (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
42 static UINT (WINAPI *pMsiQueryFeatureStateExA)
43 (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *);
44
45 static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL);
46 static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR *);
47 static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE);
48 static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
49 static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
50
51 static HMODULE hsrclient;
52 static BOOL (WINAPI *pSRRemoveRestorePoint)(DWORD);
53 static BOOL (WINAPI *pSRSetRestorePointA)(RESTOREPOINTINFOA *, STATEMGRSTATUS *);
54
55 static BOOL is_wow64;
56 static const BOOL is_64bit = sizeof(void *) > sizeof(int);
57
58 static const char *msifile = "msitest.msi";
59 static CHAR CURR_DIR[MAX_PATH];
60 static CHAR PROG_FILES_DIR[MAX_PATH];
61 static CHAR COMMON_FILES_DIR[MAX_PATH];
62 static CHAR APP_DATA_DIR[MAX_PATH];
63 static CHAR WINDOWS_DIR[MAX_PATH];
64
65 /* msi database data */
66
67 static const char component_dat[] =
68 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
69 "s72\tS38\ts72\ti2\tS255\tS72\n"
70 "Component\tComponent\n"
71 "Five\t{8CC92E9D-14B2-4CA4-B2AA-B11D02078087}\tNEWDIR\t2\t\tfive.txt\n"
72 "Four\t{FD37B4EA-7209-45C0-8917-535F35A2F080}\tCABOUTDIR\t2\t\tfour.txt\n"
73 "One\t{783B242E-E185-4A56-AF86-C09815EC053C}\tMSITESTDIR\t2\tNOT REINSTALL\tone.txt\n"
74 "Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
75 "Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
76 "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
77 "component\t\tMSITESTDIR\t0\t1\tfile\n"
78 "service_comp\t{935A0A91-22A3-4F87-BCA8-928FFDFE2353}\tMSITESTDIR\t0\t\tservice_file\n"
79 "service_comp2\t{3F7B04A4-9521-4649-BDC9-0C8722740A49}\tMSITESTDIR\t0\t\tservice_file2\n"
80 "service_comp3\t{DBCD1502-20E3-423F-B53E-F37E263CDC7E}\tMSITESTDIR\t0\t\t\n";
81
82 static const char directory_dat[] =
83 "Directory\tDirectory_Parent\tDefaultDir\n"
84 "s72\tS72\tl255\n"
85 "Directory\tDirectory\n"
86 "CABOUTDIR\tMSITESTDIR\tcabout\n"
87 "CHANGEDDIR\tMSITESTDIR\tchanged:second\n"
88 "FIRSTDIR\tMSITESTDIR\tfirst\n"
89 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
90 "NEWDIR\tCABOUTDIR\tnew\n"
91 "ProgramFilesFolder\tTARGETDIR\t.\n"
92 "TARGETDIR\t\tSourceDir";
93
94 static const char feature_dat[] =
95 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
96 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
97 "Feature\tFeature\n"
98 "Five\t\tFive\tThe Five Feature\t5\t3\tNEWDIR\t0\n"
99 "Four\t\tFour\tThe Four Feature\t4\t3\tCABOUTDIR\t0\n"
100 "One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
101 "Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
102 "Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
103 "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
104 "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
105
106 static const char feature_comp_dat[] =
107 "Feature_\tComponent_\n"
108 "s38\ts72\n"
109 "FeatureComponents\tFeature_\tComponent_\n"
110 "Five\tFive\n"
111 "Four\tFour\n"
112 "One\tOne\n"
113 "Three\tThree\n"
114 "Two\tTwo\n"
115 "feature\tcomponent\n"
116 "service_feature\tservice_comp\n"
117 "service_feature\tservice_comp2\n"
118 "service_feature\tservice_comp3";
119
120 static const char file_dat[] =
121 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
122 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
123 "File\tFile\n"
124 "five.txt\tFive\tfive.txt\t1000\t\t\t16384\t5\n"
125 "four.txt\tFour\tfour.txt\t1000\t\t\t16384\t4\n"
126 "one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
127 "three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
128 "two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
129 "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
130 "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t6\n"
131 "service_file2\tservice_comp2\tservice2.exe\t100\t\t\t8192\t7";
132
133 static const char install_exec_seq_dat[] =
134 "Action\tCondition\tSequence\n"
135 "s72\tS255\tI2\n"
136 "InstallExecuteSequence\tAction\n"
137 "AllocateRegistrySpace\tNOT Installed\t1550\n"
138 "CostFinalize\t\t1000\n"
139 "CostInitialize\t\t800\n"
140 "FileCost\t\t900\n"
141 "ResolveSource\t\t950\n"
142 "MoveFiles\t\t1700\n"
143 "InstallFiles\t\t4000\n"
144 "DuplicateFiles\t\t4500\n"
145 "WriteEnvironmentStrings\t\t4550\n"
146 "CreateShortcuts\t\t4600\n"
147 "InstallServices\t\t5000\n"
148 "InstallFinalize\t\t6600\n"
149 "InstallInitialize\t\t1500\n"
150 "InstallValidate\t\t1400\n"
151 "LaunchConditions\t\t100\n"
152 "WriteRegistryValues\tSourceDir And SOURCEDIR\t5000";
153
154 static const char media_dat[] =
155 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
156 "i2\ti4\tL64\tS255\tS32\tS72\n"
157 "Media\tDiskId\n"
158 "1\t3\t\t\tDISK1\t\n"
159 "2\t7\t\tmsitest.cab\tDISK2\t\n";
160
161 static const char property_dat[] =
162 "Property\tValue\n"
163 "s72\tl0\n"
164 "Property\tProperty\n"
165 "DefaultUIFont\tDlgFont8\n"
166 "HASUIRUN\t0\n"
167 "INSTALLLEVEL\t3\n"
168 "InstallMode\tTypical\n"
169 "Manufacturer\tWine\n"
170 "PIDTemplate\t12345<###-%%%%%%%>@@@@@\n"
171 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
172 "ProductID\tnone\n"
173 "ProductLanguage\t1033\n"
174 "ProductName\tMSITEST\n"
175 "ProductVersion\t1.1.1\n"
176 "PROMPTROLLBACKCOST\tP\n"
177 "Setup\tSetup\n"
178 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
179 "AdminProperties\tPOSTADMIN\n"
180 "ROOTDRIVE\tC:\\\n"
181 "SERVNAME\tTestService\n"
182 "SERVNAME2\tTestService2\n"
183 "SERVDISP\tTestServiceDisp\n"
184 "SERVDISP2\tTestServiceDisp2\n"
185 "MSIFASTINSTALL\t1\n";
186
187 static const char environment_dat[] =
188 "Environment\tName\tValue\tComponent_\n"
189 "s72\tl255\tL255\ts72\n"
190 "Environment\tEnvironment\n"
191 "Var1\t=-MSITESTVAR1\t1\tOne\n"
192 "Var2\tMSITESTVAR2\t1\tOne\n"
193 "Var3\t=-MSITESTVAR3\t1\tOne\n"
194 "Var4\tMSITESTVAR4\t1\tOne\n"
195 "Var5\t-MSITESTVAR5\t\tOne\n"
196 "Var6\tMSITESTVAR6\t\tOne\n"
197 "Var7\t!-MSITESTVAR7\t\tOne\n"
198 "Var8\t!-*MSITESTVAR8\t\tOne\n"
199 "Var9\t=-MSITESTVAR9\t\tOne\n"
200 "Var10\t=MSITESTVAR10\t\tOne\n"
201 "Var11\t+-MSITESTVAR11\t[~];1\tOne\n"
202 "Var12\t+-MSITESTVAR11\t[~];2\tOne\n"
203 "Var13\t+-MSITESTVAR12\t[~];1\tOne\n"
204 "Var14\t=MSITESTVAR13\t[~];1\tOne\n"
205 "Var15\t=MSITESTVAR13\t[~];2\tOne\n"
206 "Var16\t=MSITESTVAR14\t;1;\tOne\n"
207 "Var17\t=MSITESTVAR15\t;;1;;\tOne\n"
208 "Var18\t=MSITESTVAR16\t 1 \tOne\n"
209 "Var19\t+-MSITESTVAR17\t1\tOne\n"
210 "Var20\t+-MSITESTVAR17\t;;2;;[~]\tOne\n"
211 "Var21\t+-MSITESTVAR18\t1\tOne\n"
212 "Var22\t+-MSITESTVAR18\t[~];;2;;\tOne\n"
213 "Var23\t+-MSITESTVAR19\t1\tOne\n"
214 "Var24\t+-MSITESTVAR19\t[~]2\tOne\n"
215 "Var25\t+-MSITESTVAR20\t1\tOne\n"
216 "Var26\t+-MSITESTVAR20\t2[~]\tOne\n";
217
218 static const char service_install_dat[] =
219 "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
220 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
221 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
222 "ServiceInstall\tServiceInstall\n"
223 "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService\t\t-a arg\tservice_comp\tdescription\n"
224 "TestService2\tSERVNAME2]\t[SERVDISP2]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService2\t\t-a arg\tservice_comp2\tdescription";
225
226 static const char service_install2_dat[] =
227 "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
228 "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
229 "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
230 "ServiceInstall\tServiceInstall\n"
231 "TestService\tTestService\tTestService\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\n"
232 "TestService4\tTestService4\tTestService4\t2\t3\t0\t\t\tTestService4\t\t\tservice_comp3\t\n";
233
234 static const char service_control_dat[] =
235 "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
236 "s72\tl255\ti2\tL255\tI2\ts72\n"
237 "ServiceControl\tServiceControl\n"
238 "ServiceControl\tTestService3\t8\t\t0\tservice_comp\n"
239 "ServiceControl2\tTestService3\t128\t\t0\tservice_comp2";
240
241 static const char sss_service_control_dat[] =
242 "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
243 "s72\tl255\ti2\tL255\tI2\ts72\n"
244 "ServiceControl\tServiceControl\n"
245 "ServiceControl\tSpooler\t1\t\t0\tservice_comp";
246
247 static const char sss_install_exec_seq_dat[] =
248 "Action\tCondition\tSequence\n"
249 "s72\tS255\tI2\n"
250 "InstallExecuteSequence\tAction\n"
251 "LaunchConditions\t\t100\n"
252 "CostInitialize\t\t800\n"
253 "FileCost\t\t900\n"
254 "ResolveSource\t\t950\n"
255 "CostFinalize\t\t1000\n"
256 "InstallValidate\t\t1400\n"
257 "InstallInitialize\t\t1500\n"
258 "DeleteServices\t\t5000\n"
259 "MoveFiles\t\t5100\n"
260 "InstallFiles\t\t5200\n"
261 "DuplicateFiles\t\t5300\n"
262 "StartServices\t\t5400\n"
263 "InstallFinalize\t\t6000\n";
264
265 static const char sds_install_exec_seq_dat[] =
266 "Action\tCondition\tSequence\n"
267 "s72\tS255\tI2\n"
268 "InstallExecuteSequence\tAction\n"
269 "LaunchConditions\t\t100\n"
270 "CostInitialize\t\t800\n"
271 "FileCost\t\t900\n"
272 "ResolveSource\t\t950\n"
273 "CostFinalize\t\t1000\n"
274 "InstallValidate\t\t1400\n"
275 "InstallInitialize\t\t1500\n"
276 "StopServices\t\t5000\n"
277 "DeleteServices\t\t5050\n"
278 "MoveFiles\t\t5100\n"
279 "InstallFiles\t\t5200\n"
280 "DuplicateFiles\t\t5300\n"
281 "InstallServices\t\t5400\n"
282 "StartServices\t\t5450\n"
283 "RegisterProduct\t\t5500\n"
284 "PublishFeatures\t\t5600\n"
285 "PublishProduct\t\t5700\n"
286 "InstallFinalize\t\t6000\n";
287
288 static const char rof_component_dat[] =
289 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
290 "s72\tS38\ts72\ti2\tS255\tS72\n"
291 "Component\tComponent\n"
292 "maximus\t\tMSITESTDIR\t0\t1\tmaximus\n";
293
294 static const char rof_feature_dat[] =
295 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
296 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
297 "Feature\tFeature\n"
298 "feature\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0\n"
299 "montecristo\t\tFeature\tFeature\t2\t1\tTARGETDIR\t0";
300
301 static const char rof_feature_comp_dat[] =
302 "Feature_\tComponent_\n"
303 "s38\ts72\n"
304 "FeatureComponents\tFeature_\tComponent_\n"
305 "feature\tmaximus\n"
306 "montecristo\tmaximus";
307
308 static const char rof_file_dat[] =
309 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
310 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
311 "File\tFile\n"
312 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1";
313
314 static const char rof_media_dat[] =
315 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
316 "i2\ti4\tL64\tS255\tS32\tS72\n"
317 "Media\tDiskId\n"
318 "1\t1\t\t\tDISK1\t\n";
319
320 static const char ci2_feature_comp_dat[] =
321 "Feature_\tComponent_\n"
322 "s38\ts72\n"
323 "FeatureComponents\tFeature_\tComponent_\n"
324 "feature\taugustus";
325
326 static const char ci2_file_dat[] =
327 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
328 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
329 "File\tFile\n"
330 "augustus\taugustus\taugustus\t500\t\t\t8192\t1";
331
332 static const char pp_install_exec_seq_dat[] =
333 "Action\tCondition\tSequence\n"
334 "s72\tS255\tI2\n"
335 "InstallExecuteSequence\tAction\n"
336 "ValidateProductID\t\t700\n"
337 "CostInitialize\t\t800\n"
338 "FileCost\t\t900\n"
339 "CostFinalize\t\t1000\n"
340 "InstallValidate\t\t1400\n"
341 "InstallInitialize\t\t1500\n"
342 "ProcessComponents\tPROCESS_COMPONENTS=1 Or FULL=1\t1600\n"
343 "UnpublishFeatures\tUNPUBLISH_FEATURES=1 Or FULL=1\t1800\n"
344 "RemoveFiles\t\t3500\n"
345 "InstallFiles\t\t4000\n"
346 "RegisterUser\tREGISTER_USER=1 Or FULL=1\t6000\n"
347 "RegisterProduct\tREGISTER_PRODUCT=1 Or FULL=1\t6100\n"
348 "PublishFeatures\tPUBLISH_FEATURES=1 Or FULL=1\t6300\n"
349 "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n"
350 "InstallFinalize\t\t6600";
351
352 static const char pp_component_dat[] =
353 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
354 "s72\tS38\ts72\ti2\tS255\tS72\n"
355 "Component\tComponent\n"
356 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\t\tmaximus\n";
357
358 static const char ppc_component_dat[] =
359 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
360 "s72\tS38\ts72\ti2\tS255\tS72\n"
361 "Component\tComponent\n"
362 "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\t\tmaximus\n"
363 "augustus\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\taugustus\n";
364
365 static const char ppc_file_dat[] =
366 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
367 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
368 "File\tFile\n"
369 "maximus\tmaximus\tmaximus\t500\t\t\t8192\t1\n"
370 "augustus\taugustus\taugustus\t500\t\t\t8192\t2";
371
372 static const char ppc_media_dat[] =
373 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
374 "i2\ti4\tL64\tS255\tS32\tS72\n"
375 "Media\tDiskId\n"
376 "1\t2\t\t\tDISK1\t\n";
377
378 static const char ppc_feature_comp_dat[] =
379 "Feature_\tComponent_\n"
380 "s38\ts72\n"
381 "FeatureComponents\tFeature_\tComponent_\n"
382 "feature\tmaximus\n"
383 "feature\taugustus\n"
384 "montecristo\tmaximus";
385
386 static const char cwd_component_dat[] =
387 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
388 "s72\tS38\ts72\ti2\tS255\tS72\n"
389 "Component\tComponent\n"
390 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
391
392 static const char rem_component_dat[] =
393 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
394 "s72\tS38\ts72\ti2\tS255\tS72\n"
395 "Component\tComponent\n"
396 "hydrogen\t{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}\tMSITESTDIR\t0\t\thydrogen\n"
397 "helium\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\thelium\n"
398 "lithium\t\tMSITESTDIR\t2\t\tlithium\n";
399
400 static const char rem_feature_comp_dat[] =
401 "Feature_\tComponent_\n"
402 "s38\ts72\n"
403 "FeatureComponents\tFeature_\tComponent_\n"
404 "feature\thydrogen\n"
405 "feature\thelium\n"
406 "feature\tlithium";
407
408 static const char rem_file_dat[] =
409 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
410 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
411 "File\tFile\n"
412 "hydrogen\thydrogen\thydrogen\t0\t\t\t8192\t1\n"
413 "helium\thelium\thelium\t0\t\t\t8192\t1\n"
414 "lithium\tlithium\tlithium\t0\t\t\t8192\t1";
415
416 static const char rem_install_exec_seq_dat[] =
417 "Action\tCondition\tSequence\n"
418 "s72\tS255\tI2\n"
419 "InstallExecuteSequence\tAction\n"
420 "ValidateProductID\t\t700\n"
421 "CostInitialize\t\t800\n"
422 "FileCost\t\t900\n"
423 "CostFinalize\t\t1000\n"
424 "InstallValidate\t\t1400\n"
425 "InstallInitialize\t\t1500\n"
426 "ProcessComponents\t\t1600\n"
427 "UnpublishFeatures\t\t1800\n"
428 "RemoveFiles\t\t3500\n"
429 "InstallFiles\t\t4000\n"
430 "RegisterProduct\t\t6100\n"
431 "PublishFeatures\t\t6300\n"
432 "PublishProduct\t\t6400\n"
433 "InstallFinalize\t\t6600";
434
435 static const char rem_remove_files_dat[] =
436 "FileKey\tComponent_\tFileName\tDirProperty\tInstallMode\n"
437 "s72\ts72\tS255\ts72\tI2\n"
438 "RemoveFile\tFileKey\n"
439 "furlong\thydrogen\tfurlong\tMSITESTDIR\t1\n"
440 "firkin\thelium\tfirkin\tMSITESTDIR\t1\n"
441 "fortnight\tlithium\tfortnight\tMSITESTDIR\t1\n"
442 "becquerel\thydrogen\tbecquerel\tMSITESTDIR\t2\n"
443 "dioptre\thelium\tdioptre\tMSITESTDIR\t2\n"
444 "attoparsec\tlithium\tattoparsec\tMSITESTDIR\t2\n"
445 "storeys\thydrogen\tstoreys\tMSITESTDIR\t3\n"
446 "block\thelium\tblock\tMSITESTDIR\t3\n"
447 "siriometer\tlithium\tsiriometer\tMSITESTDIR\t3\n"
448 "nanoacre\thydrogen\t\tCABOUTDIR\t3\n";
449
450 static const char mov_move_file_dat[] =
451 "FileKey\tComponent_\tSourceName\tDestName\tSourceFolder\tDestFolder\tOptions\n"
452 "s72\ts72\tS255\tS255\tS72\ts72\ti2\n"
453 "MoveFile\tFileKey\n"
454 "abkhazia\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t0\n"
455 "bahamas\taugustus\tnonexistent\tdest\tSourceDir\tMSITESTDIR\t1\n"
456 "cambodia\taugustus\tcameroon\tcanada\tSourceDir\tMSITESTDIR\t0\n"
457 "denmark\taugustus\tdjibouti\tdominica\tSourceDir\tMSITESTDIR\t1\n"
458 "ecuador\taugustus\tegypt\telsalvador\tNotAProp\tMSITESTDIR\t1\n"
459 "fiji\taugustus\tfinland\tfrance\tSourceDir\tNotAProp\t1\n"
460 "gabon\taugustus\tgambia\tgeorgia\tSOURCEFULL\tMSITESTDIR\t1\n"
461 "haiti\taugustus\thonduras\thungary\tSourceDir\tDESTFULL\t1\n"
462 "iceland\taugustus\tindia\tindonesia\tMSITESTDIR\tMSITESTDIR\t1\n"
463 "jamaica\taugustus\tjapan\tjordan\tFILEPATHBAD\tMSITESTDIR\t1\n"
464 "kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n"
465 "laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n"
466 "namibia\taugustus\tnauru\tkiribati\tSourceDir\tMSITESTDIR\t1\n"
467 "pakistan\taugustus\tperu\tsfn|poland\tSourceDir\tMSITESTDIR\t1\n"
468 "wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
469 "single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
470 "wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
471 "singlenodest\taugustus\tb?r\t\tSourceDir\tMSITESTDIR\t1\n";
472
473 static const char df_directory_dat[] =
474 "Directory\tDirectory_Parent\tDefaultDir\n"
475 "s72\tS72\tl255\n"
476 "Directory\tDirectory\n"
477 "THIS\tMSITESTDIR\tthis\n"
478 "DOESNOT\tTHIS\tdoesnot\n"
479 "NONEXISTENT\tDOESNOT\texist\n"
480 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
481 "ProgramFilesFolder\tTARGETDIR\t.\n"
482 "TARGETDIR\t\tSourceDir";
483
484 static const char df_duplicate_file_dat[] =
485 "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
486 "s72\ts72\ts72\tS255\tS72\n"
487 "DuplicateFile\tFileKey\n"
488 "maximus\tmaximus\tmaximus\taugustus\t\n"
489 "caesar\tmaximus\tmaximus\t\tNONEXISTENT\n"
490 "augustus\tnosuchcomponent\tmaximus\t\tMSITESTDIR\n";
491
492 static const char wrv_component_dat[] =
493 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
494 "s72\tS38\ts72\ti2\tS255\tS72\n"
495 "Component\tComponent\n"
496 "augustus\t\tMSITESTDIR\t0\t\taugustus\n";
497
498 static const char wrv_registry_dat[] =
499 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
500 "s72\ti2\tl255\tL255\tL0\ts72\n"
501 "Registry\tRegistry\n"
502 "regdata\t2\tSOFTWARE\\Wine\\msitest\tValue\t[~]one[~]two[~]three\taugustus\n"
503 "regdata1\t2\tSOFTWARE\\Wine\\msitest\t*\t\taugustus\n"
504 "regdata2\t2\tSOFTWARE\\Wine\\msitest\t*\t#%\taugustus\n"
505 "regdata3\t2\tSOFTWARE\\Wine\\msitest\t*\t#x\taugustus\n"
506 "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"
507 "regdata5\t2\tSOFTWARE\\Wine\\msitest\tValue1\t[~]one[~]\taugustus\n"
508 "regdata6\t2\tSOFTWARE\\Wine\\msitest\tValue2\t[~]two\taugustus\n"
509 "regdata7\t2\tSOFTWARE\\Wine\\msitest\tValue3\tone[~]\taugustus\n"
510 "regdata8\t2\tSOFTWARE\\Wine\\msitest\tValue4\tone[~]two\taugustus\n"
511 "regdata9\t2\tSOFTWARE\\Wine\\msitest\tValue5\t[~]one[~]two[~]three\taugustus\n"
512 "regdata10\t2\tSOFTWARE\\Wine\\msitest\tValue6\t[~]\taugustus\n"
513 "regdata11\t2\tSOFTWARE\\Wine\\msitest\tValue7\t[~]two\taugustus\n";
514
515 static const char cf_directory_dat[] =
516 "Directory\tDirectory_Parent\tDefaultDir\n"
517 "s72\tS72\tl255\n"
518 "Directory\tDirectory\n"
519 "FIRSTDIR\tMSITESTDIR\tfirst\n"
520 "SECONDDIR\tMSITESTDIR\tsecond\n"
521 "THIRDDIR\tMSITESTDIR\tthird\n"
522 "MSITESTDIR\tProgramFilesFolder\tmsitest\n"
523 "ProgramFilesFolder\tTARGETDIR\t.\n"
524 "TARGETDIR\t\tSourceDir";
525
526 static const char cf_component_dat[] =
527 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
528 "s72\tS38\ts72\ti2\tS255\tS72\n"
529 "Component\tComponent\n"
530 "One\t{F8CD42AC-9C38-48FE-8664-B35FD121012A}\tFIRSTDIR\t0\t\tone.txt\n"
531 "Two\t{DE2DB02E-2DDF-4E34-8CF6-DCA13E29DF52}\tSECONDDIR\t0\t\ttwo.txt\n";
532
533 static const char cf_feature_dat[] =
534 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
535 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
536 "Feature\tFeature\n"
537 "One\t\tOne\tThe One Feature\t1\t3\tFIRSTDIR\t0\n"
538 "Two\t\tTwo\tThe Two Feature\t1\t3\tSECONDDIR\t0\n";
539
540 static const char cf_feature_comp_dat[] =
541 "Feature_\tComponent_\n"
542 "s38\ts72\n"
543 "FeatureComponents\tFeature_\tComponent_\n"
544 "One\tOne\n"
545 "Two\tTwo\n";
546
547 static const char cf_file_dat[] =
548 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
549 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
550 "File\tFile\n"
551 "one.txt\tOne\tone.txt\t0\t\t\t0\t1\n"
552 "two.txt\tTwo\ttwo.txt\t0\t\t\t0\t2\n";
553
554 static const char cf_create_folders_dat[] =
555 "Directory_\tComponent_\n"
556 "s72\ts72\n"
557 "CreateFolder\tDirectory_\tComponent_\n"
558 "FIRSTDIR\tOne\n"
559 "SECONDDIR\tTwo\n"
560 "THIRDDIR\tTwo\n";
561
562 static const char cf_install_exec_seq_dat[] =
563 "Action\tCondition\tSequence\n"
564 "s72\tS255\tI2\n"
565 "InstallExecuteSequence\tAction\n"
566 "CostFinalize\t\t1000\n"
567 "ValidateProductID\t\t700\n"
568 "CostInitialize\t\t800\n"
569 "FileCost\t\t900\n"
570 "RemoveFiles\t\t3500\n"
571 "CreateFolders\t\t3700\n"
572 "RemoveFolders\t\t3800\n"
573 "InstallFiles\t\t4000\n"
574 "RegisterUser\t\t6000\n"
575 "RegisterProduct\t\t6100\n"
576 "PublishFeatures\t\t6300\n"
577 "PublishProduct\t\t6400\n"
578 "InstallFinalize\t\t6600\n"
579 "InstallInitialize\t\t1500\n"
580 "ProcessComponents\t\t1600\n"
581 "UnpublishFeatures\t\t1800\n"
582 "InstallValidate\t\t1400\n"
583 "LaunchConditions\t\t100\n";
584
585 static const char sr_selfreg_dat[] =
586 "File_\tCost\n"
587 "s72\tI2\n"
588 "SelfReg\tFile_\n"
589 "one.txt\t1\n";
590
591 static const char sr_install_exec_seq_dat[] =
592 "Action\tCondition\tSequence\n"
593 "s72\tS255\tI2\n"
594 "InstallExecuteSequence\tAction\n"
595 "CostFinalize\t\t1000\n"
596 "CostInitialize\t\t800\n"
597 "FileCost\t\t900\n"
598 "ResolveSource\t\t950\n"
599 "MoveFiles\t\t1700\n"
600 "SelfUnregModules\t\t3900\n"
601 "InstallFiles\t\t4000\n"
602 "DuplicateFiles\t\t4500\n"
603 "WriteEnvironmentStrings\t\t4550\n"
604 "CreateShortcuts\t\t4600\n"
605 "InstallFinalize\t\t6600\n"
606 "InstallInitialize\t\t1500\n"
607 "InstallValidate\t\t1400\n"
608 "LaunchConditions\t\t100\n";
609
610 static const char font_media_dat[] =
611 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
612 "i2\ti4\tL64\tS255\tS32\tS72\n"
613 "Media\tDiskId\n"
614 "1\t3\t\t\tDISK1\t\n";
615
616 static const char font_file_dat[] =
617 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
618 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
619 "File\tFile\n"
620 "font.ttf\tfonts\tfont.ttf\t1000\t\t\t8192\t1\n";
621
622 static const char font_feature_dat[] =
623 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
624 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
625 "Feature\tFeature\n"
626 "fonts\t\t\tfont feature\t1\t2\tMSITESTDIR\t0\n";
627
628 static const char font_component_dat[] =
629 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
630 "s72\tS38\ts72\ti2\tS255\tS72\n"
631 "Component\tComponent\n"
632 "fonts\t{F5920ED0-1183-4B8F-9330-86CE56557C05}\tMSITESTDIR\t0\t\tfont.ttf\n";
633
634 static const char font_feature_comp_dat[] =
635 "Feature_\tComponent_\n"
636 "s38\ts72\n"
637 "FeatureComponents\tFeature_\tComponent_\n"
638 "fonts\tfonts\n";
639
640 static const char font_dat[] =
641 "File_\tFontTitle\n"
642 "s72\tS128\n"
643 "Font\tFile_\n"
644 "font.ttf\tmsi test font\n";
645
646 static const char font_install_exec_seq_dat[] =
647 "Action\tCondition\tSequence\n"
648 "s72\tS255\tI2\n"
649 "InstallExecuteSequence\tAction\n"
650 "ValidateProductID\t\t700\n"
651 "CostInitialize\t\t800\n"
652 "FileCost\t\t900\n"
653 "CostFinalize\t\t1000\n"
654 "InstallValidate\t\t1400\n"
655 "InstallInitialize\t\t1500\n"
656 "ProcessComponents\t\t1600\n"
657 "UnpublishFeatures\t\t1800\n"
658 "RemoveFiles\t\t3500\n"
659 "InstallFiles\t\t4000\n"
660 "RegisterFonts\t\t4100\n"
661 "UnregisterFonts\t\t4200\n"
662 "RegisterUser\t\t6000\n"
663 "RegisterProduct\t\t6100\n"
664 "PublishFeatures\t\t6300\n"
665 "PublishProduct\t\t6400\n"
666 "InstallFinalize\t\t6600";
667
668 static const char vp_property_dat[] =
669 "Property\tValue\n"
670 "s72\tl0\n"
671 "Property\tProperty\n"
672 "HASUIRUN\t0\n"
673 "INSTALLLEVEL\t3\n"
674 "InstallMode\tTypical\n"
675 "Manufacturer\tWine\n"
676 "PIDTemplate\t###-#######\n"
677 "ProductCode\t{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}\n"
678 "ProductLanguage\t1033\n"
679 "ProductName\tMSITEST\n"
680 "ProductVersion\t1.1.1\n"
681 "UpgradeCode\t{4C0EAA15-0264-4E5A-8758-609EF142B92D}\n"
682 "MSIFASTINSTALL\t1\n";
683
684 static const char vp_custom_action_dat[] =
685 "Action\tType\tSource\tTarget\tISComments\n"
686 "s72\ti2\tS64\tS0\tS255\n"
687 "CustomAction\tAction\n"
688 "SetProductID1\t51\tProductID\t1\t\n"
689 "SetProductID2\t51\tProductID\t2\t\n"
690 "TestProductID1\t19\t\t\tHalts installation\n"
691 "TestProductID2\t19\t\t\tHalts installation\n";
692
693 static const char vp_install_exec_seq_dat[] =
694 "Action\tCondition\tSequence\n"
695 "s72\tS255\tI2\n"
696 "InstallExecuteSequence\tAction\n"
697 "LaunchConditions\t\t100\n"
698 "CostInitialize\t\t800\n"
699 "FileCost\t\t900\n"
700 "CostFinalize\t\t1000\n"
701 "InstallValidate\t\t1400\n"
702 "InstallInitialize\t\t1500\n"
703 "SetProductID1\tSET_PRODUCT_ID=1\t3000\n"
704 "SetProductID2\tSET_PRODUCT_ID=2\t3100\n"
705 "ValidateProductID\t\t3200\n"
706 "InstallExecute\t\t3300\n"
707 "TestProductID1\tProductID=1\t3400\n"
708 "TestProductID2\tProductID=\"123-1234567\"\t3500\n"
709 "InstallFiles\t\t4000\n"
710 "InstallFinalize\t\t6000\n";
711
712 static const char odbc_file_dat[] =
713 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
714 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
715 "File\tFile\n"
716 "ODBCdriver.dll\todbc\tODBCdriver.dll\t1000\t\t\t8192\t1\n"
717 "ODBCdriver2.dll\todbc\tODBCdriver2.dll\t1000\t\t\t8192\t2\n"
718 "ODBCtranslator.dll\todbc\tODBCtranslator.dll\t1000\t\t\t8192\t3\n"
719 "ODBCtranslator2.dll\todbc\tODBCtranslator2.dll\t1000\t\t\t8192\t4\n"
720 "ODBCsetup.dll\todbc\tODBCsetup.dll\t1000\t\t\t8192\t5\n";
721
722 static const char odbc_feature_dat[] =
723 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
724 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
725 "Feature\tFeature\n"
726 "odbc\t\t\todbc feature\t1\t2\tMSITESTDIR\t0\n";
727
728 static const char odbc_feature_comp_dat[] =
729 "Feature_\tComponent_\n"
730 "s38\ts72\n"
731 "FeatureComponents\tFeature_\tComponent_\n"
732 "odbc\todbc\n";
733
734 static const char odbc_component_dat[] =
735 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
736 "s72\tS38\ts72\ti2\tS255\tS72\n"
737 "Component\tComponent\n"
738 "odbc\t{B6F3E4AE-35D1-4B72-9044-989F03E20A43}\tMSITESTDIR\t0\t\tODBCdriver.dll\n";
739
740 static const char odbc_driver_dat[] =
741 "Driver\tComponent_\tDescription\tFile_\tFile_Setup\n"
742 "s72\ts72\ts255\ts72\tS72\n"
743 "ODBCDriver\tDriver\n"
744 "ODBC test driver\todbc\tODBC test driver\tODBCdriver.dll\t\n"
745 "ODBC test driver2\todbc\tODBC test driver2\tODBCdriver2.dll\tODBCsetup.dll\n";
746
747 static const char odbc_translator_dat[] =
748 "Translator\tComponent_\tDescription\tFile_\tFile_Setup\n"
749 "s72\ts72\ts255\ts72\tS72\n"
750 "ODBCTranslator\tTranslator\n"
751 "ODBC test translator\todbc\tODBC test translator\tODBCtranslator.dll\t\n"
752 "ODBC test translator2\todbc\tODBC test translator2\tODBCtranslator2.dll\tODBCsetup.dll\n";
753
754 static const char odbc_datasource_dat[] =
755 "DataSource\tComponent_\tDescription\tDriverDescription\tRegistration\n"
756 "s72\ts72\ts255\ts255\ti2\n"
757 "ODBCDataSource\tDataSource\n"
758 "ODBC data source\todbc\tODBC data source\tODBC driver\t0\n";
759
760 static const char odbc_install_exec_seq_dat[] =
761 "Action\tCondition\tSequence\n"
762 "s72\tS255\tI2\n"
763 "InstallExecuteSequence\tAction\n"
764 "LaunchConditions\t\t100\n"
765 "CostInitialize\t\t800\n"
766 "FileCost\t\t900\n"
767 "CostFinalize\t\t1000\n"
768 "InstallValidate\t\t1400\n"
769 "InstallInitialize\t\t1500\n"
770 "ProcessComponents\t\t1600\n"
771 "InstallODBC\t\t3000\n"
772 "RemoveODBC\t\t3100\n"
773 "RemoveFiles\t\t3900\n"
774 "InstallFiles\t\t4000\n"
775 "RegisterProduct\t\t5000\n"
776 "PublishFeatures\t\t5100\n"
777 "PublishProduct\t\t5200\n"
778 "InstallFinalize\t\t6000\n";
779
780 static const char odbc_media_dat[] =
781 "DiskId\tLastSequence\tDiskPrompt\tCabinet\tVolumeLabel\tSource\n"
782 "i2\ti4\tL64\tS255\tS32\tS72\n"
783 "Media\tDiskId\n"
784 "1\t5\t\t\tDISK1\t\n";
785
786 static const char tl_file_dat[] =
787 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
788 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
789 "File\tFile\n"
790 "typelib.dll\ttypelib\ttypelib.dll\t1000\t\t\t8192\t1\n";
791
792 static const char tl_feature_dat[] =
793 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
794 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
795 "Feature\tFeature\n"
796 "typelib\t\t\ttypelib feature\t1\t2\tMSITESTDIR\t0\n";
797
798 static const char tl_feature_comp_dat[] =
799 "Feature_\tComponent_\n"
800 "s38\ts72\n"
801 "FeatureComponents\tFeature_\tComponent_\n"
802 "typelib\ttypelib\n";
803
804 static const char tl_component_dat[] =
805 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
806 "s72\tS38\ts72\ti2\tS255\tS72\n"
807 "Component\tComponent\n"
808 "typelib\t{BB4C26FD-89D8-4E49-AF1C-DB4DCB5BF1B0}\tMSITESTDIR\t0\t\ttypelib.dll\n";
809
810 static const char tl_typelib_dat[] =
811 "LibID\tLanguage\tComponent_\tVersion\tDescription\tDirectory_\tFeature_\tCost\n"
812 "s38\ti2\ts72\tI4\tL128\tS72\ts38\tI4\n"
813 "TypeLib\tLibID\tLanguage\tComponent_\n"
814 "{EAC5166A-9734-4D91-878F-1DD02304C66C}\t0\ttypelib\t1793\t\tMSITESTDIR\ttypelib\t\n";
815
816 static const char tl_install_exec_seq_dat[] =
817 "Action\tCondition\tSequence\n"
818 "s72\tS255\tI2\n"
819 "InstallExecuteSequence\tAction\n"
820 "LaunchConditions\t\t100\n"
821 "CostInitialize\t\t800\n"
822 "FileCost\t\t900\n"
823 "CostFinalize\t\t1000\n"
824 "InstallValidate\t\t1400\n"
825 "InstallInitialize\t\t1500\n"
826 "ProcessComponents\t\t1600\n"
827 "RemoveFiles\t\t1700\n"
828 "InstallFiles\t\t2000\n"
829 "RegisterTypeLibraries\tREGISTER_TYPELIB=1\t3000\n"
830 "UnregisterTypeLibraries\t\t3100\n"
831 "RegisterProduct\t\t5100\n"
832 "PublishFeatures\t\t5200\n"
833 "PublishProduct\t\t5300\n"
834 "InstallFinalize\t\t6000\n";
835
836 static const char crs_file_dat[] =
837 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
838 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
839 "File\tFile\n"
840 "target.txt\tshortcut\ttarget.txt\t1000\t\t\t8192\t1\n";
841
842 static const char crs_feature_dat[] =
843 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
844 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
845 "Feature\tFeature\n"
846 "shortcut\t\t\tshortcut feature\t1\t2\tMSITESTDIR\t0\n";
847
848 static const char crs_feature_comp_dat[] =
849 "Feature_\tComponent_\n"
850 "s38\ts72\n"
851 "FeatureComponents\tFeature_\tComponent_\n"
852 "shortcut\tshortcut\n";
853
854 static const char crs_component_dat[] =
855 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
856 "s72\tS38\ts72\ti2\tS255\tS72\n"
857 "Component\tComponent\n"
858 "shortcut\t{5D20E3C6-7206-498F-AC28-87AF2F9AD4CC}\tMSITESTDIR\t0\t\ttarget.txt\n";
859
860 static const char crs_shortcut_dat[] =
861 "Shortcut\tDirectory_\tName\tComponent_\tTarget\tArguments\tDescription\tHotkey\tIcon_\tIconIndex\tShowCmd\tWkDir\n"
862 "s72\ts72\tl128\ts72\ts72\tL255\tL255\tI2\tS72\tI2\tI2\tS72\n"
863 "Shortcut\tShortcut\n"
864 "shortcut\tMSITESTDIR\tshortcut\tshortcut\t[MSITESTDIR]target.txt\t\t\t\t\t\t\t\n";
865
866 static const char crs_install_exec_seq_dat[] =
867 "Action\tCondition\tSequence\n"
868 "s72\tS255\tI2\n"
869 "InstallExecuteSequence\tAction\n"
870 "LaunchConditions\t\t100\n"
871 "CostInitialize\t\t800\n"
872 "FileCost\t\t900\n"
873 "CostFinalize\t\t1000\n"
874 "InstallValidate\t\t1400\n"
875 "InstallInitialize\t\t1500\n"
876 "ProcessComponents\t\t1600\n"
877 "RemoveFiles\t\t1700\n"
878 "InstallFiles\t\t2000\n"
879 "RemoveShortcuts\t\t3000\n"
880 "CreateShortcuts\t\t3100\n"
881 "RegisterProduct\t\t5000\n"
882 "PublishFeatures\t\t5100\n"
883 "PublishProduct\t\t5200\n"
884 "InstallFinalize\t\t6000\n";
885
886 static const char pub_file_dat[] =
887 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
888 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
889 "File\tFile\n"
890 "english.txt\tpublish\tenglish.txt\t1000\t\t\t8192\t1\n";
891
892 static const char pub_feature_dat[] =
893 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
894 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
895 "Feature\tFeature\n"
896 "publish\t\t\tpublish feature\t1\t2\tMSITESTDIR\t0\n";
897
898 static const char pub_feature_comp_dat[] =
899 "Feature_\tComponent_\n"
900 "s38\ts72\n"
901 "FeatureComponents\tFeature_\tComponent_\n"
902 "publish\tpublish\n";
903
904 static const char pub_component_dat[] =
905 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
906 "s72\tS38\ts72\ti2\tS255\tS72\n"
907 "Component\tComponent\n"
908 "publish\t{B4EA0ACF-6238-426E-9C6D-7869F0F9C768}\tMSITESTDIR\t0\t\tenglish.txt\n";
909
910 static const char pub_publish_component_dat[] =
911 "ComponentId\tQualifier\tComponent_\tAppData\tFeature_\n"
912 "s38\ts255\ts72\tL255\ts38\n"
913 "PublishComponent\tComponentId\tQualifier\tComponent_\n"
914 "{92AFCBC0-9CA6-4270-8454-47C5EE2B8FAA}\tenglish.txt\tpublish\t\tpublish\n";
915
916 static const char pub_install_exec_seq_dat[] =
917 "Action\tCondition\tSequence\n"
918 "s72\tS255\tI2\n"
919 "InstallExecuteSequence\tAction\n"
920 "LaunchConditions\t\t100\n"
921 "CostInitialize\t\t800\n"
922 "FileCost\t\t900\n"
923 "CostFinalize\t\t1000\n"
924 "InstallValidate\t\t1400\n"
925 "InstallInitialize\t\t1500\n"
926 "ProcessComponents\t\t1600\n"
927 "RemoveFiles\t\t1700\n"
928 "InstallFiles\t\t2000\n"
929 "PublishComponents\t\t3000\n"
930 "UnpublishComponents\t\t3100\n"
931 "RegisterProduct\t\t5000\n"
932 "PublishFeatures\t\t5100\n"
933 "PublishProduct\t\t5200\n"
934 "InstallFinalize\t\t6000\n";
935
936 static const char rd_file_dat[] =
937 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
938 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
939 "File\tFile\n"
940 "original.txt\tduplicate\toriginal.txt\t1000\t\t\t8192\t1\n"
941 "original2.txt\tduplicate\toriginal2.txt\t1000\t\t\t8192\t2\n"
942 "original3.txt\tduplicate2\toriginal3.txt\t1000\t\t\t8192\t3\n";
943
944 static const char rd_feature_dat[] =
945 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
946 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
947 "Feature\tFeature\n"
948 "duplicate\t\t\tduplicate feature\t1\t2\tMSITESTDIR\t0\n";
949
950 static const char rd_feature_comp_dat[] =
951 "Feature_\tComponent_\n"
952 "s38\ts72\n"
953 "FeatureComponents\tFeature_\tComponent_\n"
954 "duplicate\tduplicate\n";
955
956 static const char rd_component_dat[] =
957 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
958 "s72\tS38\ts72\ti2\tS255\tS72\n"
959 "Component\tComponent\n"
960 "duplicate\t{EB45D06A-ADFE-44E3-8D41-B7DE150E41AD}\tMSITESTDIR\t0\t\toriginal.txt\n"
961 "duplicate2\t{B8BA60E0-B2E9-488E-9D0E-E60F25F04F97}\tMSITESTDIR\t0\tDUPLICATE2=1\toriginal3.txt\n";
962
963 static const char rd_duplicate_file_dat[] =
964 "FileKey\tComponent_\tFile_\tDestName\tDestFolder\n"
965 "s72\ts72\ts72\tS255\tS72\n"
966 "DuplicateFile\tFileKey\n"
967 "duplicate\tduplicate\toriginal.txt\tduplicate.txt\t\n"
968 "duplicate2\tduplicate\toriginal2.txt\t\tMSITESTDIR\n"
969 "duplicate3\tduplicate2\toriginal3.txt\tduplicate2.txt\t\n";
970
971 static const char rd_install_exec_seq_dat[] =
972 "Action\tCondition\tSequence\n"
973 "s72\tS255\tI2\n"
974 "InstallExecuteSequence\tAction\n"
975 "LaunchConditions\t\t100\n"
976 "CostInitialize\t\t800\n"
977 "FileCost\t\t900\n"
978 "CostFinalize\t\t1000\n"
979 "InstallValidate\t\t1400\n"
980 "InstallInitialize\t\t1500\n"
981 "ProcessComponents\t\t1600\n"
982 "RemoveDuplicateFiles\t\t1900\n"
983 "InstallFiles\t\t2000\n"
984 "DuplicateFiles\t\t2100\n"
985 "RegisterProduct\t\t5000\n"
986 "PublishFeatures\t\t5100\n"
987 "PublishProduct\t\t5200\n"
988 "InstallFinalize\t\t6000\n";
989
990 static const char rrv_file_dat[] =
991 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
992 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
993 "File\tFile\n"
994 "registry.txt\tregistry\tregistry.txt\t1000\t\t\t8192\t1\n";
995
996 static const char rrv_feature_dat[] =
997 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
998 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
999 "Feature\tFeature\n"
1000 "registry\t\t\tregistry feature\t1\t2\tMSITESTDIR\t0\n";
1001
1002 static const char rrv_feature_comp_dat[] =
1003 "Feature_\tComponent_\n"
1004 "s38\ts72\n"
1005 "FeatureComponents\tFeature_\tComponent_\n"
1006 "registry\tregistry\n";
1007
1008 static const char rrv_component_dat[] =
1009 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1010 "s72\tS38\ts72\ti2\tS255\tS72\n"
1011 "Component\tComponent\n"
1012 "registry\t{DA97585B-962D-45EB-AD32-DA15E60CA9EE}\tMSITESTDIR\t0\t\tregistry.txt\n";
1013
1014 static const char rrv_registry_dat[] =
1015 "Registry\tRoot\tKey\tName\tValue\tComponent_\n"
1016 "s72\ti2\tl255\tL255\tL0\ts72\n"
1017 "Registry\tRegistry\n"
1018 "reg1\t2\tSOFTWARE\\Wine\\keyA\t\tA\tregistry\n"
1019 "reg2\t2\tSOFTWARE\\Wine\\keyA\tvalueA\tA\tregistry\n"
1020 "reg3\t2\tSOFTWARE\\Wine\\key1\t-\t\tregistry\n";
1021
1022 static const char rrv_remove_registry_dat[] =
1023 "RemoveRegistry\tRoot\tKey\tName\tComponent_\n"
1024 "s72\ti2\tl255\tL255\ts72\n"
1025 "RemoveRegistry\tRemoveRegistry\n"
1026 "reg1\t2\tSOFTWARE\\Wine\\keyB\t\tregistry\n"
1027 "reg2\t2\tSOFTWARE\\Wine\\keyB\tValueB\tregistry\n"
1028 "reg3\t2\tSOFTWARE\\Wine\\key2\t-\tregistry\n";
1029
1030 static const char rrv_install_exec_seq_dat[] =
1031 "Action\tCondition\tSequence\n"
1032 "s72\tS255\tI2\n"
1033 "InstallExecuteSequence\tAction\n"
1034 "LaunchConditions\t\t100\n"
1035 "CostInitialize\t\t800\n"
1036 "FileCost\t\t900\n"
1037 "CostFinalize\t\t1000\n"
1038 "InstallValidate\t\t1400\n"
1039 "InstallInitialize\t\t1500\n"
1040 "ProcessComponents\t\t1600\n"
1041 "RemoveFiles\t\t1700\n"
1042 "InstallFiles\t\t2000\n"
1043 "RemoveRegistryValues\t\t3000\n"
1044 "RegisterProduct\t\t5000\n"
1045 "PublishFeatures\t\t5100\n"
1046 "PublishProduct\t\t5200\n"
1047 "InstallFinalize\t\t6000\n";
1048
1049 static const char frp_file_dat[] =
1050 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1051 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1052 "File\tFile\n"
1053 "product.txt\tproduct\tproduct.txt\t1000\t\t\t8192\t1\n";
1054
1055 static const char frp_feature_dat[] =
1056 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1057 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1058 "Feature\tFeature\n"
1059 "product\t\t\tproduct feature\t1\t2\tMSITESTDIR\t0\n";
1060
1061 static const char frp_feature_comp_dat[] =
1062 "Feature_\tComponent_\n"
1063 "s38\ts72\n"
1064 "FeatureComponents\tFeature_\tComponent_\n"
1065 "product\tproduct\n";
1066
1067 static const char frp_component_dat[] =
1068 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1069 "s72\tS38\ts72\ti2\tS255\tS72\n"
1070 "Component\tComponent\n"
1071 "product\t{44725EE0-EEA8-40BD-8162-A48224A2FEA1}\tMSITESTDIR\t0\t\tproduct.txt\n";
1072
1073 static const char frp_custom_action_dat[] =
1074 "Action\tType\tSource\tTarget\tISComments\n"
1075 "s72\ti2\tS64\tS0\tS255\n"
1076 "CustomAction\tAction\n"
1077 "TestProp\t19\t\t\tPROP set\n";
1078
1079 static const char frp_upgrade_dat[] =
1080 "UpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\tRemove\tActionProperty\n"
1081 "s38\tS20\tS20\tS255\ti4\tS255\ts72\n"
1082 "Upgrade\tUpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\n"
1083 "{4C0EAA15-0264-4E5A-8758-609EF142B92D}\t1.1.1\t2.2.2\t\t768\t\tPROP\n";
1084
1085 static const char frp_install_exec_seq_dat[] =
1086 "Action\tCondition\tSequence\n"
1087 "s72\tS255\tI2\n"
1088 "InstallExecuteSequence\tAction\n"
1089 "FindRelatedProducts\t\t50\n"
1090 "TestProp\tPROP AND NOT REMOVE\t51\n"
1091 "LaunchConditions\t\t100\n"
1092 "CostInitialize\t\t800\n"
1093 "FileCost\t\t900\n"
1094 "CostFinalize\t\t1000\n"
1095 "InstallValidate\t\t1400\n"
1096 "InstallInitialize\t\t1500\n"
1097 "ProcessComponents\t\t1600\n"
1098 "RemoveFiles\t\t1700\n"
1099 "InstallFiles\t\t2000\n"
1100 "RegisterProduct\t\t5000\n"
1101 "PublishFeatures\t\t5100\n"
1102 "PublishProduct\t\t5200\n"
1103 "InstallFinalize\t\t6000\n";
1104
1105 static const char riv_file_dat[] =
1106 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1107 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1108 "File\tFile\n"
1109 "inifile.txt\tinifile\tinifile.txt\t1000\t\t\t8192\t1\n";
1110
1111 static const char riv_feature_dat[] =
1112 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1113 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1114 "Feature\tFeature\n"
1115 "inifile\t\t\tinifile feature\t1\t2\tMSITESTDIR\t0\n";
1116
1117 static const char riv_feature_comp_dat[] =
1118 "Feature_\tComponent_\n"
1119 "s38\ts72\n"
1120 "FeatureComponents\tFeature_\tComponent_\n"
1121 "inifile\tinifile\n";
1122
1123 static const char riv_component_dat[] =
1124 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1125 "s72\tS38\ts72\ti2\tS255\tS72\n"
1126 "Component\tComponent\n"
1127 "inifile\t{A0F15705-4F57-4437-88C4-6C8B37ACC6DE}\tMSITESTDIR\t0\t\tinifile.txt\n";
1128
1129 static const char riv_ini_file_dat[] =
1130 "IniFile\tFileName\tDirProperty\tSection\tKey\tValue\tAction\tComponent_\n"
1131 "s72\tl255\tS72\tl96\tl128\tl255\ti2\ts72\n"
1132 "IniFile\tIniFile\n"
1133 "inifile1\ttest.ini\tMSITESTDIR\tsection1\tkey1\tvalue1\t0\tinifile\n";
1134
1135 static const char riv_remove_ini_file_dat[] =
1136 "RemoveIniFile\tFileName\tDirProperty\tSection\tKey\tValue\tAction\tComponent_\n"
1137 "s72\tl255\tS72\tl96\tl128\tL255\ti2\ts72\n"
1138 "RemoveIniFile\tRemoveIniFile\n"
1139 "inifile1\ttest.ini\tMSITESTDIR\tsectionA\tkeyA\tvalueA\t2\tinifile\n";
1140
1141 static const char riv_install_exec_seq_dat[] =
1142 "Action\tCondition\tSequence\n"
1143 "s72\tS255\tI2\n"
1144 "InstallExecuteSequence\tAction\n"
1145 "LaunchConditions\t\t100\n"
1146 "CostInitialize\t\t800\n"
1147 "FileCost\t\t900\n"
1148 "CostFinalize\t\t1000\n"
1149 "InstallValidate\t\t1400\n"
1150 "InstallInitialize\t\t1500\n"
1151 "ProcessComponents\t\t1600\n"
1152 "RemoveFiles\t\t1700\n"
1153 "InstallFiles\t\t2000\n"
1154 "RemoveIniValues\t\t3000\n"
1155 "RegisterProduct\t\t5000\n"
1156 "PublishFeatures\t\t5100\n"
1157 "PublishProduct\t\t5200\n"
1158 "InstallFinalize\t\t6000\n";
1159
1160 static const char res_file_dat[] =
1161 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1162 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1163 "File\tFile\n"
1164 "envvar.txt\tenvvar\tenvvar.txt\t1000\t\t\t8192\t1\n";
1165
1166 static const char res_feature_dat[] =
1167 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1168 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1169 "Feature\tFeature\n"
1170 "envvar\t\t\tenvvar feature\t1\t2\tMSITESTDIR\t0\n";
1171
1172 static const char res_feature_comp_dat[] =
1173 "Feature_\tComponent_\n"
1174 "s38\ts72\n"
1175 "FeatureComponents\tFeature_\tComponent_\n"
1176 "envvar\tenvvar\n";
1177
1178 static const char res_component_dat[] =
1179 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1180 "s72\tS38\ts72\ti2\tS255\tS72\n"
1181 "Component\tComponent\n"
1182 "envvar\t{45EE9AF4-E5D1-445F-8BB7-B22D4EEBD29E}\tMSITESTDIR\t0\t\tenvvar.txt\n";
1183
1184 static const char res_environment_dat[] =
1185 "Environment\tName\tValue\tComponent_\n"
1186 "s72\tl255\tL255\ts72\n"
1187 "Environment\tEnvironment\n"
1188 "var1\t=-MSITESTVAR1\t1\tenvvar\n"
1189 "var2\t=+-MSITESTVAR2\t1\tenvvar\n"
1190 "var3\t=MSITESTVAR3\t1\tenvvar\n"
1191 "var4\t=-MSITESTVAR4\t\tenvvar\n"
1192 "var5\t=MSITESTVAR5\t\tenvvar\n";
1193
1194 static const char res_install_exec_seq_dat[] =
1195 "Action\tCondition\tSequence\n"
1196 "s72\tS255\tI2\n"
1197 "InstallExecuteSequence\tAction\n"
1198 "LaunchConditions\t\t100\n"
1199 "CostInitialize\t\t800\n"
1200 "FileCost\t\t900\n"
1201 "CostFinalize\t\t1000\n"
1202 "InstallValidate\t\t1400\n"
1203 "InstallInitialize\t\t1500\n"
1204 "ProcessComponents\t\t1600\n"
1205 "RemoveFiles\t\t1700\n"
1206 "InstallFiles\t\t2000\n"
1207 "RemoveEnvironmentStrings\t\t3000\n"
1208 "RegisterProduct\t\t5000\n"
1209 "PublishFeatures\t\t5100\n"
1210 "PublishProduct\t\t5200\n"
1211 "InstallFinalize\t\t6000\n";
1212
1213 static const char rci_file_dat[] =
1214 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1215 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1216 "File\tFile\n"
1217 "class.txt\tclass\tclass.txt\t1000\t\t\t8192\t1\n";
1218
1219 static const char rci_feature_dat[] =
1220 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1221 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1222 "Feature\tFeature\n"
1223 "class\t\t\tclass feature\t1\t2\tMSITESTDIR\t0\n";
1224
1225 static const char rci_feature_comp_dat[] =
1226 "Feature_\tComponent_\n"
1227 "s38\ts72\n"
1228 "FeatureComponents\tFeature_\tComponent_\n"
1229 "class\tclass\n";
1230
1231 static const char rci_component_dat[] =
1232 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1233 "s72\tS38\ts72\ti2\tS255\tS72\n"
1234 "Component\tComponent\n"
1235 "class\t{89A98345-F8A1-422E-A48B-0250B5809F2D}\tMSITESTDIR\t0\t\tclass.txt\n";
1236
1237 static const char rci_appid_dat[] =
1238 "AppId\tRemoteServerName\tLocalService\tServiceParameters\tDllSurrogate\tActivateAtStorage\tRunAsInteractiveUser\n"
1239 "s38\tS255\tS255\tS255\tS255\tI2\tI2\n"
1240 "AppId\tAppId\n"
1241 "{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\t\t\t\t\t\t\n";
1242
1243 static const char rci_class_dat[] =
1244 "CLSID\tContext\tComponent_\tProgId_Default\tDescription\tAppId_\tFileTypeMask\tIcon_\tIconIndex\tDefInprocHandler\tArgument\tFeature_\tAttributes\n"
1245 "s38\ts32\ts72\tS255\tL255\tS38\tS255\tS72\tI2\tS32\tS255\ts38\tI2\n"
1246 "Class\tCLSID\tContext\tComponent_\n"
1247 "{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tLocalServer\tclass\t\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tclass\t\n";
1248
1249 static const char rci_install_exec_seq_dat[] =
1250 "Action\tCondition\tSequence\n"
1251 "s72\tS255\tI2\n"
1252 "InstallExecuteSequence\tAction\n"
1253 "LaunchConditions\t\t100\n"
1254 "CostInitialize\t\t800\n"
1255 "FileCost\t\t900\n"
1256 "CostFinalize\t\t1000\n"
1257 "InstallValidate\t\t1400\n"
1258 "InstallInitialize\t\t1500\n"
1259 "ProcessComponents\t\t1600\n"
1260 "RemoveFiles\t\t1700\n"
1261 "InstallFiles\t\t2000\n"
1262 "UnregisterClassInfo\t\t3000\n"
1263 "RegisterClassInfo\t\t4000\n"
1264 "RegisterProduct\t\t5000\n"
1265 "PublishFeatures\t\t5100\n"
1266 "PublishProduct\t\t5200\n"
1267 "InstallFinalize\t\t6000\n";
1268
1269 static const char rei_file_dat[] =
1270 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1271 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1272 "File\tFile\n"
1273 "extension.txt\textension\textension.txt\t1000\t\t\t8192\t1\n";
1274
1275 static const char rei_feature_dat[] =
1276 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1277 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1278 "Feature\tFeature\n"
1279 "extension\t\t\textension feature\t1\t2\tMSITESTDIR\t0\n";
1280
1281 static const char rei_feature_comp_dat[] =
1282 "Feature_\tComponent_\n"
1283 "s38\ts72\n"
1284 "FeatureComponents\tFeature_\tComponent_\n"
1285 "extension\textension\n";
1286
1287 static const char rei_component_dat[] =
1288 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1289 "s72\tS38\ts72\ti2\tS255\tS72\n"
1290 "Component\tComponent\n"
1291 "extension\t{9A3060D4-60BA-4A82-AB55-9FB148AD013C}\tMSITESTDIR\t0\t\textension.txt\n";
1292
1293 static const char rei_extension_dat[] =
1294 "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n"
1295 "s255\ts72\tS255\tS64\ts38\n"
1296 "Extension\tExtension\tComponent_\n"
1297 "extension\textension\tProg.Id.1\t\textension\n";
1298
1299 static const char rei_verb_dat[] =
1300 "Extension_\tVerb\tSequence\tCommand\tArgument\n"
1301 "s255\ts32\tI2\tL255\tL255\n"
1302 "Verb\tExtension_\tVerb\n"
1303 "extension\tOpen\t1\t&Open\t/argument\n";
1304
1305 static const char rei_progid_dat[] =
1306 "ProgId\tProgId_Parent\tClass_\tDescription\tIcon_\tIconIndex\n"
1307 "s255\tS255\tS38\tL255\tS72\tI2\n"
1308 "ProgId\tProgId\n"
1309 "Prog.Id.1\t\t\tdescription\t\t\n";
1310
1311 static const char rei_install_exec_seq_dat[] =
1312 "Action\tCondition\tSequence\n"
1313 "s72\tS255\tI2\n"
1314 "InstallExecuteSequence\tAction\n"
1315 "LaunchConditions\t\t100\n"
1316 "CostInitialize\t\t800\n"
1317 "FileCost\t\t900\n"
1318 "CostFinalize\t\t1000\n"
1319 "InstallValidate\t\t1400\n"
1320 "InstallInitialize\t\t1500\n"
1321 "ProcessComponents\t\t1600\n"
1322 "RemoveFiles\t\t1700\n"
1323 "InstallFiles\t\t2000\n"
1324 "UnregisterExtensionInfo\t\t3000\n"
1325 "RegisterExtensionInfo\t\t4000\n"
1326 "RegisterProduct\t\t5000\n"
1327 "PublishFeatures\t\t5100\n"
1328 "PublishProduct\t\t5200\n"
1329 "InstallFinalize\t\t6000\n";
1330
1331 static const char rpi_file_dat[] =
1332 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1333 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1334 "File\tFile\n"
1335 "progid.txt\tprogid\tprogid.txt\t1000\t\t\t8192\t1\n";
1336
1337 static const char rpi_feature_dat[] =
1338 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1339 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1340 "Feature\tFeature\n"
1341 "progid\t\t\tprogid feature\t1\t2\tMSITESTDIR\t0\n";
1342
1343 static const char rpi_feature_comp_dat[] =
1344 "Feature_\tComponent_\n"
1345 "s38\ts72\n"
1346 "FeatureComponents\tFeature_\tComponent_\n"
1347 "progid\tprogid\n";
1348
1349 static const char rpi_component_dat[] =
1350 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1351 "s72\tS38\ts72\ti2\tS255\tS72\n"
1352 "Component\tComponent\n"
1353 "progid\t{89A98345-F8A1-422E-A48B-0250B5809F2D}\tMSITESTDIR\t0\t\tprogid.txt\n";
1354
1355 static const char rpi_appid_dat[] =
1356 "AppId\tRemoteServerName\tLocalService\tServiceParameters\tDllSurrogate\tActivateAtStorage\tRunAsInteractiveUser\n"
1357 "s38\tS255\tS255\tS255\tS255\tI2\tI2\n"
1358 "AppId\tAppId\n"
1359 "{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\t\t\t\t\t\t\n";
1360
1361 static const char rpi_class_dat[] =
1362 "CLSID\tContext\tComponent_\tProgId_Default\tDescription\tAppId_\tFileTypeMask\tIcon_\tIconIndex\tDefInprocHandler\tArgument\tFeature_\tAttributes\n"
1363 "s38\ts32\ts72\tS255\tL255\tS38\tS255\tS72\tI2\tS32\tS255\ts38\tI2\n"
1364 "Class\tCLSID\tContext\tComponent_\n"
1365 "{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tLocalServer\tprogid\tWinetest.Class.1\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tprogid\t\n"
1366 "{904E6BC9-F57F-4412-B460-D40DE2F256E2}\tLocalServer\tprogid\tWinetest.VerClass\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tprogid\t\n"
1367 "{57C413FB-CA02-498A-81F6-7E769BDB7C97}\tLocalServer\tprogid\t\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tprogid\t\n";
1368
1369 static const char rpi_extension_dat[] =
1370 "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n"
1371 "s255\ts72\tS255\tS64\ts38\n"
1372 "Extension\tExtension\tComponent_\n"
1373 "winetest\tprogid\tWinetest.Extension\t\tprogid\n";
1374
1375 static const char rpi_verb_dat[] =
1376 "Extension_\tVerb\tSequence\tCommand\tArgument\n"
1377 "s255\ts32\tI2\tL255\tL255\n"
1378 "Verb\tExtension_\tVerb\n"
1379 "winetest\tOpen\t1\t&Open\t/argument\n";
1380
1381 static const char rpi_progid_dat[] =
1382 "ProgId\tProgId_Parent\tClass_\tDescription\tIcon_\tIconIndex\n"
1383 "s255\tS255\tS38\tL255\tS72\tI2\n"
1384 "ProgId\tProgId\n"
1385 "Winetest.Class.1\t\t{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tdescription\t\t\n"
1386 "Winetest.Class\tWinetest.Class.1\t\tdescription\t\t\n"
1387 "Winetest.Class.2\t\t{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tdescription\t\t\n"
1388 "Winetest.VerClass.1\t\t{904E6BC9-F57F-4412-B460-D40DE2F256E2}\tdescription\t\t\n"
1389 "Winetest.VerClass\tWinetest.VerClass.1\t\tdescription\t\t\n"
1390 "Winetest.NoProgIdClass.1\t\t{57C413FB-CA02-498A-81F6-7E769BDB7C97}\tdescription\t\t\n"
1391 "Winetest.NoProgIdClass\tWinetest.NoProgIdClass.1\t\tdescription\t\t\n"
1392 "Winetest.Orphaned\t\t\tdescription\t\t\n"
1393 "Winetest.Orphaned2\t\t\tdescription\t\t\n"
1394 "Winetest.Extension\t\t\tdescription\t\t\n";
1395
1396 static const char rpi_install_exec_seq_dat[] =
1397 "Action\tCondition\tSequence\n"
1398 "s72\tS255\tI2\n"
1399 "InstallExecuteSequence\tAction\n"
1400 "LaunchConditions\t\t100\n"
1401 "CostInitialize\t\t800\n"
1402 "FileCost\t\t900\n"
1403 "CostFinalize\t\t1000\n"
1404 "InstallValidate\t\t1400\n"
1405 "InstallInitialize\t\t1500\n"
1406 "ProcessComponents\t\t1600\n"
1407 "RemoveFiles\t\t1700\n"
1408 "UnregisterClassInfo\t\t3000\n"
1409 "UnregisterExtensionInfo\t\t3200\n"
1410 "UnregisterProgIdInfo\t\t3400\n"
1411 "InstallFiles\t\t3600\n"
1412 "RegisterClassInfo\t\t4000\n"
1413 "RegisterExtensionInfo\t\t4200\n"
1414 "RegisterProgIdInfo\t\t4400\n"
1415 "RegisterProduct\t\t5000\n"
1416 "PublishFeatures\t\t5100\n"
1417 "PublishProduct\t\t5200\n"
1418 "InstallFinalize\t\t6000\n";
1419
1420 static const char rmi_file_dat[] =
1421 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1422 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1423 "File\tFile\n"
1424 "mime.txt\tmime\tmime.txt\t1000\t\t\t8192\t1\n";
1425
1426 static const char rmi_feature_dat[] =
1427 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1428 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1429 "Feature\tFeature\n"
1430 "mime\t\t\tmime feature\t1\t2\tMSITESTDIR\t0\n";
1431
1432 static const char rmi_feature_comp_dat[] =
1433 "Feature_\tComponent_\n"
1434 "s38\ts72\n"
1435 "FeatureComponents\tFeature_\tComponent_\n"
1436 "mime\tmime\n";
1437
1438 static const char rmi_component_dat[] =
1439 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1440 "s72\tS38\ts72\ti2\tS255\tS72\n"
1441 "Component\tComponent\n"
1442 "mime\t{A1D630CE-13A7-4882-AFDD-148E2BBAFC6D}\tMSITESTDIR\t0\t\tmime.txt\n";
1443
1444 static const char rmi_extension_dat[] =
1445 "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n"
1446 "s255\ts72\tS255\tS64\ts38\n"
1447 "Extension\tExtension\tComponent_\n"
1448 "mime\tmime\t\tmime/type\tmime\n";
1449
1450 static const char rmi_verb_dat[] =
1451 "Extension_\tVerb\tSequence\tCommand\tArgument\n"
1452 "s255\ts32\tI2\tL255\tL255\n"
1453 "Verb\tExtension_\tVerb\n"
1454 "mime\tOpen\t1\t&Open\t/argument\n";
1455
1456 static const char rmi_mime_dat[] =
1457 "ContentType\tExtension_\tCLSID\n"
1458 "s64\ts255\tS38\n"
1459 "MIME\tContentType\n"
1460 "mime/type\tmime\t\n";
1461
1462 static const char rmi_install_exec_seq_dat[] =
1463 "Action\tCondition\tSequence\n"
1464 "s72\tS255\tI2\n"
1465 "InstallExecuteSequence\tAction\n"
1466 "LaunchConditions\t\t100\n"
1467 "CostInitialize\t\t800\n"
1468 "FileCost\t\t900\n"
1469 "CostFinalize\t\t1000\n"
1470 "InstallValidate\t\t1400\n"
1471 "InstallInitialize\t\t1500\n"
1472 "ProcessComponents\t\t1600\n"
1473 "RemoveFiles\t\t1700\n"
1474 "InstallFiles\t\t2000\n"
1475 "UnregisterExtensionInfo\t\t3000\n"
1476 "UnregisterMIMEInfo\t\t3500\n"
1477 "RegisterExtensionInfo\t\t4000\n"
1478 "RegisterMIMEInfo\t\t4500\n"
1479 "RegisterProduct\t\t5000\n"
1480 "PublishFeatures\t\t5100\n"
1481 "PublishProduct\t\t5200\n"
1482 "InstallFinalize\t\t6000\n";
1483
1484 static const char pa_file_dat[] =
1485 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1486 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1487 "File\tFile\n"
1488 "win32.txt\twin32\twin32.txt\t1000\t\t\t8192\t1\n"
1489 "manifest.txt\twin32\tmanifest.txt\t1000\t\t\t8192\t1\n"
1490 "win32_local.txt\twin32_local\twin32_local.txt\t1000\t\t\t8192\t1\n"
1491 "manifest_local.txt\twin32_local\tmanifest_local.txt\t1000\t\t\t8192\t1\n"
1492 "dotnet.txt\tdotnet\tdotnet.txt\t1000\t\t\t8192\t1\n"
1493 "dotnet_local.txt\tdotnet_local\tdotnet_local.txt\t1000\t\t\t8192\t1\n"
1494 "application_win32.txt\twin32_local\tapplication_win32.txt\t1000\t\t\t8192\t1\n"
1495 "application_dotnet.txt\tdotnet_local\tapplication_dotnet.txt\t1000\t\t\t8192\t1\n";
1496
1497 static const char pa_feature_dat[] =
1498 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1499 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1500 "Feature\tFeature\n"
1501 "assembly\t\t\tassembly feature\t1\t2\tMSITESTDIR\t0\n";
1502
1503 static const char pa_feature_comp_dat[] =
1504 "Feature_\tComponent_\n"
1505 "s38\ts72\n"
1506 "FeatureComponents\tFeature_\tComponent_\n"
1507 "assembly\twin32\n"
1508 "assembly\twin32_local\n"
1509 "assembly\tdotnet\n"
1510 "assembly\tdotnet_local\n";
1511
1512 static const char pa_component_dat[] =
1513 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1514 "s72\tS38\ts72\ti2\tS255\tS72\n"
1515 "Component\tComponent\n"
1516 "win32\t{F515549E-7E61-425D-AAC1-9BEF2E066D06}\tMSITESTDIR\t0\t\twin32.txt\n"
1517 "win32_local\t{D34D3FBA-6789-4E57-AD1A-1281297DC201}\tMSITESTDIR\t0\t\twin32_local.txt\n"
1518 "dotnet\t{8943164F-2B31-4C09-A894-493A8CBDE0A4}\tMSITESTDIR\t0\t\tdotnet.txt\n"
1519 "dotnet_local\t{4E8567E8-8EAE-4E36-90F1-B99D33C663F8}\tMSITESTDIR\t0\t\tdotnet_local.txt\n";
1520
1521 static const char pa_msi_assembly_dat[] =
1522 "Component_\tFeature_\tFile_Manifest\tFile_Application\tAttributes\n"
1523 "s72\ts38\tS72\tS72\tI2\n"
1524 "MsiAssembly\tComponent_\n"
1525 "win32\tassembly\tmanifest.txt\t\t1\n"
1526 "win32_local\tassembly\tmanifest_local.txt\tapplication_win32.txt\t1\n"
1527 "dotnet\tassembly\t\t\t0\n"
1528 "dotnet_local\tassembly\t\tapplication_dotnet.txt\t0\n";
1529
1530 static const char pa_msi_assembly_name_dat[] =
1531 "Component_\tName\tValue\n"
1532 "s72\ts255\ts255\n"
1533 "MsiAssemblyName\tComponent_\tName\n"
1534 "win32\tName\tWine.Win32.Assembly\n"
1535 "win32\tprocessorArchitecture\tx86\n"
1536 "win32\tpublicKeyToken\tabcdef0123456789\n"
1537 "win32\ttype\twin32\n"
1538 "win32\tversion\t1.0.0.0\n"
1539 "win32_local\tName\tWine.Win32.Local.Assembly\n"
1540 "win32_local\tprocessorArchitecture\tx86\n"
1541 "win32_local\tpublicKeyToken\tabcdef0123456789\n"
1542 "win32_local\ttype\twin32\n"
1543 "win32_local\tversion\t1.0.0.0\n"
1544 "dotnet\tName\tWine.Dotnet.Assembly\n"
1545 "dotnet\tprocessorArchitecture\tMSIL\n"
1546 "dotnet\tpublicKeyToken\tabcdef0123456789\n"
1547 "dotnet\tculture\tneutral\n"
1548 "dotnet\tversion\t1.0.0.0\n"
1549 "dotnet_local\tName\tWine.Dotnet.Local.Assembly\n"
1550 "dotnet_local\tprocessorArchitecture\tMSIL\n"
1551 "dotnet_local\tpublicKeyToken\tabcdef0123456789\n"
1552 "dotnet_local\tculture\tneutral\n"
1553 "dotnet_local\tversion\t1.0.0.0\n";
1554
1555 static const char pa_install_exec_seq_dat[] =
1556 "Action\tCondition\tSequence\n"
1557 "s72\tS255\tI2\n"
1558 "InstallExecuteSequence\tAction\n"
1559 "LaunchConditions\t\t100\n"
1560 "CostInitialize\t\t800\n"
1561 "FileCost\t\t900\n"
1562 "CostFinalize\t\t1000\n"
1563 "InstallValidate\t\t1400\n"
1564 "InstallInitialize\t\t1500\n"
1565 "ProcessComponents\t\t1600\n"
1566 "MsiPublishAssemblies\t\t3000\n"
1567 "MsiUnpublishAssemblies\t\t4000\n"
1568 "RegisterProduct\t\t5000\n"
1569 "PublishFeatures\t\t5100\n"
1570 "PublishProduct\t\t5200\n"
1571 "InstallFinalize\t\t6000\n";
1572
1573 static const char rep_file_dat[] =
1574 "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
1575 "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
1576 "File\tFile\n"
1577 "rep.txt\trep\trep.txt\t1000\t\t\t8192\t1\n";
1578
1579 static const char rep_feature_dat[] =
1580 "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n"
1581 "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n"
1582 "Feature\tFeature\n"
1583 "rep\t\t\trep feature\t1\t2\tMSITESTDIR\t0\n";
1584
1585 static const char rep_feature_comp_dat[] =
1586 "Feature_\tComponent_\n"
1587 "s38\ts72\n"
1588 "FeatureComponents\tFeature_\tComponent_\n"
1589 "rep\trep\n";
1590
1591 static const char rep_component_dat[] =
1592 "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n"
1593 "s72\tS38\ts72\ti2\tS255\tS72\n"
1594 "Component\tComponent\n"
1595 "rep\t{A24FAF2A-3B2E-41EF-AA78-331542E1A29D}\tMSITESTDIR\t0\t\trep.txt\n";
1596
1597 static const char rep_upgrade_dat[] =
1598 "UpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\tRemove\tActionProperty\n"
1599 "s38\tS20\tS20\tS255\ti4\tS255\ts72\n"
1600 "Upgrade\tUpgradeCode\tVersionMin\tVersionMax\tLanguage\tAttributes\n"
1601 "{2967C1CC-34D4-42EE-8D96-CD6836F192BF}\t\t\t\t256\t\tPRODUCT\n";
1602
1603 static const char rep_property_dat[] =
1604 "Property\tValue\n"
1605 "s72\tl0\n"
1606 "Property\tProperty\n"
1607 "HASUIRUN\t0\n"
1608 "INSTALLLEVEL\t3\n"
1609 "InstallMode\tTypical\n"
1610 "Manufacturer\tWine\n"
1611 "PIDTemplate\t###-#######\n"
1612 "ProductCode\t{1699F0BB-0B61-4A89-AFE4-CFD60DFD76F3}\n"
1613 "ProductLanguage\t1033\n"
1614 "ProductName\tMSITEST\n"
1615 "ProductVersion\t1.1.1\n"
1616 "UpgradeCode\t{2967C1CC-34D4-42EE-8D96-CD6836F192BF}\n"
1617 "PRODUCT\t2F41860D-7B4C-4DA7-BED9-B64F26594C56\n"
1618 "MSIFASTINSTALL\t1\n";
1619
1620 static const char rep_install_exec_seq_dat[] =
1621 "Action\tCondition\tSequence\n"
1622 "s72\tS255\tI2\n"
1623 "InstallExecuteSequence\tAction\n"
1624 "FindRelatedProducts\t\t100\n"
1625 "CostInitialize\t\t800\n"
1626 "FileCost\t\t900\n"
1627 "CostFinalize\t\t1000\n"
1628 "InstallValidate\t\t1400\n"
1629 "RemoveExistingProducts\t\t1499\n"
1630 "InstallInitialize\t\t1500\n"
1631 "ProcessComponents\t\t1600\n"
1632 "RemoveFiles\t\t1700\n"
1633 "InstallFiles\t\t2000\n"
1634 "UnregisterExtensionInfo\t\t3000\n"
1635 "UnregisterMIMEInfo\t\t3500\n"
1636 "RegisterExtensionInfo\t\t4000\n"
1637 "RegisterMIMEInfo\t\t4500\n"
1638 "RegisterProduct\t\t5000\n"
1639 "PublishFeatures\t\t5100\n"
1640 "PublishProduct\t\t5200\n"
1641 "InstallFinalize\t\t6000\n";
1642
1643 typedef struct _msi_table
1644 {
1645 const char *filename;
1646 const char *data;
1647 unsigned int size;
1648 } msi_table;
1649
1650 #define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
1651
1652 static const msi_table env_tables[] =
1653 {
1654 ADD_TABLE(component),
1655 ADD_TABLE(directory),
1656 ADD_TABLE(feature),
1657 ADD_TABLE(feature_comp),
1658 ADD_TABLE(file),
1659 ADD_TABLE(install_exec_seq),
1660 ADD_TABLE(media),
1661 ADD_TABLE(property),
1662 ADD_TABLE(environment)
1663 };
1664
1665 static const msi_table pp_tables[] =
1666 {
1667 ADD_TABLE(pp_component),
1668 ADD_TABLE(directory),
1669 ADD_TABLE(rof_feature),
1670 ADD_TABLE(rof_feature_comp),
1671 ADD_TABLE(rof_file),
1672 ADD_TABLE(pp_install_exec_seq),
1673 ADD_TABLE(rof_media),
1674 ADD_TABLE(property),
1675 };
1676
1677 static const msi_table ppc_tables[] =
1678 {
1679 ADD_TABLE(ppc_component),
1680 ADD_TABLE(directory),
1681 ADD_TABLE(rof_feature),
1682 ADD_TABLE(ppc_feature_comp),
1683 ADD_TABLE(ppc_file),
1684 ADD_TABLE(pp_install_exec_seq),
1685 ADD_TABLE(ppc_media),
1686 ADD_TABLE(property),
1687 };
1688
1689 static const msi_table rem_tables[] =
1690 {
1691 ADD_TABLE(rem_component),
1692 ADD_TABLE(directory),
1693 ADD_TABLE(rof_feature),
1694 ADD_TABLE(rem_feature_comp),
1695 ADD_TABLE(rem_file),
1696 ADD_TABLE(rem_install_exec_seq),
1697 ADD_TABLE(rof_media),
1698 ADD_TABLE(property),
1699 ADD_TABLE(rem_remove_files),
1700 };
1701
1702 static const msi_table mov_tables[] =
1703 {
1704 ADD_TABLE(cwd_component),
1705 ADD_TABLE(directory),
1706 ADD_TABLE(rof_feature),
1707 ADD_TABLE(ci2_feature_comp),
1708 ADD_TABLE(ci2_file),
1709 ADD_TABLE(install_exec_seq),
1710 ADD_TABLE(rof_media),
1711 ADD_TABLE(property),
1712 ADD_TABLE(mov_move_file),
1713 };
1714
1715 static const msi_table df_tables[] =
1716 {
1717 ADD_TABLE(rof_component),
1718 ADD_TABLE(df_directory),
1719 ADD_TABLE(rof_feature),
1720 ADD_TABLE(rof_feature_comp),
1721 ADD_TABLE(rof_file),
1722 ADD_TABLE(install_exec_seq),
1723 ADD_TABLE(rof_media),
1724 ADD_TABLE(property),
1725 ADD_TABLE(df_duplicate_file),
1726 };
1727
1728 static const msi_table wrv_tables[] =
1729 {
1730 ADD_TABLE(wrv_component),
1731 ADD_TABLE(directory),
1732 ADD_TABLE(rof_feature),
1733 ADD_TABLE(ci2_feature_comp),
1734 ADD_TABLE(ci2_file),
1735 ADD_TABLE(install_exec_seq),
1736 ADD_TABLE(rof_media),
1737 ADD_TABLE(property),
1738 ADD_TABLE(wrv_registry),
1739 };
1740
1741 static const msi_table cf_tables[] =
1742 {
1743 ADD_TABLE(cf_component),
1744 ADD_TABLE(cf_directory),
1745 ADD_TABLE(cf_feature),
1746 ADD_TABLE(cf_feature_comp),
1747 ADD_TABLE(cf_file),
1748 ADD_TABLE(cf_create_folders),
1749 ADD_TABLE(cf_install_exec_seq),
1750 ADD_TABLE(media),
1751 ADD_TABLE(property)
1752 };
1753
1754 static const msi_table sss_tables[] =
1755 {
1756 ADD_TABLE(component),
1757 ADD_TABLE(directory),
1758 ADD_TABLE(feature),
1759 ADD_TABLE(feature_comp),
1760 ADD_TABLE(file),
1761 ADD_TABLE(sss_install_exec_seq),
1762 ADD_TABLE(sss_service_control),
1763 ADD_TABLE(media),
1764 ADD_TABLE(property)
1765 };
1766
1767 static const msi_table sds_tables[] =
1768 {
1769 ADD_TABLE(component),
1770 ADD_TABLE(directory),
1771 ADD_TABLE(feature),
1772 ADD_TABLE(feature_comp),
1773 ADD_TABLE(file),
1774 ADD_TABLE(sds_install_exec_seq),
1775 ADD_TABLE(service_control),
1776 ADD_TABLE(service_install),
1777 ADD_TABLE(media),
1778 ADD_TABLE(property)
1779 };
1780
1781 static const msi_table sis_tables[] =
1782 {
1783 ADD_TABLE(component),
1784 ADD_TABLE(directory),
1785 ADD_TABLE(feature),
1786 ADD_TABLE(feature_comp),
1787 ADD_TABLE(file),
1788 ADD_TABLE(sds_install_exec_seq),
1789 ADD_TABLE(service_install2),
1790 ADD_TABLE(media),
1791 ADD_TABLE(property)
1792 };
1793
1794 static const msi_table sr_tables[] =
1795 {
1796 ADD_TABLE(component),
1797 ADD_TABLE(directory),
1798 ADD_TABLE(feature),
1799 ADD_TABLE(feature_comp),
1800 ADD_TABLE(file),
1801 ADD_TABLE(sr_selfreg),
1802 ADD_TABLE(sr_install_exec_seq),
1803 ADD_TABLE(media),
1804 ADD_TABLE(property)
1805 };
1806
1807 static const msi_table font_tables[] =
1808 {
1809 ADD_TABLE(font_component),
1810 ADD_TABLE(directory),
1811 ADD_TABLE(font_feature),
1812 ADD_TABLE(font_feature_comp),
1813 ADD_TABLE(font_file),
1814 ADD_TABLE(font),
1815 ADD_TABLE(font_install_exec_seq),
1816 ADD_TABLE(font_media),
1817 ADD_TABLE(property)
1818 };
1819
1820 static const msi_table vp_tables[] =
1821 {
1822 ADD_TABLE(component),
1823 ADD_TABLE(directory),
1824 ADD_TABLE(feature),
1825 ADD_TABLE(feature_comp),
1826 ADD_TABLE(file),
1827 ADD_TABLE(vp_custom_action),
1828 ADD_TABLE(vp_install_exec_seq),
1829 ADD_TABLE(media),
1830 ADD_TABLE(vp_property)
1831 };
1832
1833 static const msi_table odbc_tables[] =
1834 {
1835 ADD_TABLE(odbc_component),
1836 ADD_TABLE(directory),
1837 ADD_TABLE(odbc_feature),
1838 ADD_TABLE(odbc_feature_comp),
1839 ADD_TABLE(odbc_file),
1840 ADD_TABLE(odbc_driver),
1841 ADD_TABLE(odbc_translator),
1842 ADD_TABLE(odbc_datasource),
1843 ADD_TABLE(odbc_install_exec_seq),
1844 ADD_TABLE(odbc_media),
1845 ADD_TABLE(property)
1846 };
1847
1848 static const msi_table tl_tables[] =
1849 {
1850 ADD_TABLE(tl_component),
1851 ADD_TABLE(directory),
1852 ADD_TABLE(tl_feature),
1853 ADD_TABLE(tl_feature_comp),
1854 ADD_TABLE(tl_file),
1855 ADD_TABLE(tl_typelib),
1856 ADD_TABLE(tl_install_exec_seq),
1857 ADD_TABLE(media),
1858 ADD_TABLE(property)
1859 };
1860
1861 static const msi_table crs_tables[] =
1862 {
1863 ADD_TABLE(crs_component),
1864 ADD_TABLE(directory),
1865 ADD_TABLE(crs_feature),
1866 ADD_TABLE(crs_feature_comp),
1867 ADD_TABLE(crs_file),
1868 ADD_TABLE(crs_shortcut),
1869 ADD_TABLE(crs_install_exec_seq),
1870 ADD_TABLE(media),
1871 ADD_TABLE(property)
1872 };
1873
1874 static const msi_table pub_tables[] =
1875 {
1876 ADD_TABLE(directory),
1877 ADD_TABLE(pub_component),
1878 ADD_TABLE(pub_feature),
1879 ADD_TABLE(pub_feature_comp),
1880 ADD_TABLE(pub_file),
1881 ADD_TABLE(pub_publish_component),
1882 ADD_TABLE(pub_install_exec_seq),
1883 ADD_TABLE(media),
1884 ADD_TABLE(property)
1885 };
1886
1887 static const msi_table rd_tables[] =
1888 {
1889 ADD_TABLE(directory),
1890 ADD_TABLE(rd_component),
1891 ADD_TABLE(rd_feature),
1892 ADD_TABLE(rd_feature_comp),
1893 ADD_TABLE(rd_file),
1894 ADD_TABLE(rd_duplicate_file),
1895 ADD_TABLE(rd_install_exec_seq),
1896 ADD_TABLE(media),
1897 ADD_TABLE(property)
1898 };
1899
1900 static const msi_table rrv_tables[] =
1901 {
1902 ADD_TABLE(directory),
1903 ADD_TABLE(rrv_component),
1904 ADD_TABLE(rrv_feature),
1905 ADD_TABLE(rrv_feature_comp),
1906 ADD_TABLE(rrv_file),
1907 ADD_TABLE(rrv_registry),
1908 ADD_TABLE(rrv_remove_registry),
1909 ADD_TABLE(rrv_install_exec_seq),
1910 ADD_TABLE(media),
1911 ADD_TABLE(property)
1912 };
1913
1914 static const msi_table frp_tables[] =
1915 {
1916 ADD_TABLE(directory),
1917 ADD_TABLE(frp_component),
1918 ADD_TABLE(frp_feature),
1919 ADD_TABLE(frp_feature_comp),
1920 ADD_TABLE(frp_file),
1921 ADD_TABLE(frp_upgrade),
1922 ADD_TABLE(frp_custom_action),
1923 ADD_TABLE(frp_install_exec_seq),
1924 ADD_TABLE(media),
1925 ADD_TABLE(property)
1926 };
1927
1928 static const msi_table riv_tables[] =
1929 {
1930 ADD_TABLE(directory),
1931 ADD_TABLE(riv_component),
1932 ADD_TABLE(riv_feature),
1933 ADD_TABLE(riv_feature_comp),
1934 ADD_TABLE(riv_file),
1935 ADD_TABLE(riv_ini_file),
1936 ADD_TABLE(riv_remove_ini_file),
1937 ADD_TABLE(riv_install_exec_seq),
1938 ADD_TABLE(media),
1939 ADD_TABLE(property)
1940 };
1941
1942 static const msi_table res_tables[] =
1943 {
1944 ADD_TABLE(directory),
1945 ADD_TABLE(res_component),
1946 ADD_TABLE(res_feature),
1947 ADD_TABLE(res_feature_comp),
1948 ADD_TABLE(res_file),
1949 ADD_TABLE(res_environment),
1950 ADD_TABLE(res_install_exec_seq),
1951 ADD_TABLE(media),
1952 ADD_TABLE(property)
1953 };
1954
1955 static const msi_table rci_tables[] =
1956 {
1957 ADD_TABLE(directory),
1958 ADD_TABLE(rci_component),
1959 ADD_TABLE(rci_feature),
1960 ADD_TABLE(rci_feature_comp),
1961 ADD_TABLE(rci_file),
1962 ADD_TABLE(rci_appid),
1963 ADD_TABLE(rci_class),
1964 ADD_TABLE(rci_install_exec_seq),
1965 ADD_TABLE(media),
1966 ADD_TABLE(property)
1967 };
1968
1969 static const msi_table rei_tables[] =
1970 {
1971 ADD_TABLE(directory),
1972 ADD_TABLE(rei_component),
1973 ADD_TABLE(rei_feature),
1974 ADD_TABLE(rei_feature_comp),
1975 ADD_TABLE(rei_file),
1976 ADD_TABLE(rei_extension),
1977 ADD_TABLE(rei_verb),
1978 ADD_TABLE(rei_progid),
1979 ADD_TABLE(rei_install_exec_seq),
1980 ADD_TABLE(media),
1981 ADD_TABLE(property)
1982 };
1983
1984 static const msi_table rpi_tables[] =
1985 {
1986 ADD_TABLE(directory),
1987 ADD_TABLE(rpi_component),
1988 ADD_TABLE(rpi_feature),
1989 ADD_TABLE(rpi_feature_comp),
1990 ADD_TABLE(rpi_file),
1991 ADD_TABLE(rpi_appid),
1992 ADD_TABLE(rpi_class),
1993 ADD_TABLE(rpi_extension),
1994 ADD_TABLE(rpi_verb),
1995 ADD_TABLE(rpi_progid),
1996 ADD_TABLE(rpi_install_exec_seq),
1997 ADD_TABLE(media),
1998 ADD_TABLE(property)
1999 };
2000
2001 static const msi_table rmi_tables[] =
2002 {
2003 ADD_TABLE(directory),
2004 ADD_TABLE(rmi_component),
2005 ADD_TABLE(rmi_feature),
2006 ADD_TABLE(rmi_feature_comp),
2007 ADD_TABLE(rmi_file),
2008 ADD_TABLE(rmi_extension),
2009 ADD_TABLE(rmi_verb),
2010 ADD_TABLE(rmi_mime),
2011 ADD_TABLE(rmi_install_exec_seq),
2012 ADD_TABLE(media),
2013 ADD_TABLE(property)
2014 };
2015
2016 static const msi_table pa_tables[] =
2017 {
2018 ADD_TABLE(directory),
2019 ADD_TABLE(pa_component),
2020 ADD_TABLE(pa_feature),
2021 ADD_TABLE(pa_feature_comp),
2022 ADD_TABLE(pa_file),
2023 ADD_TABLE(pa_msi_assembly),
2024 ADD_TABLE(pa_msi_assembly_name),
2025 ADD_TABLE(pa_install_exec_seq),
2026 ADD_TABLE(media),
2027 ADD_TABLE(property)
2028 };
2029
2030 static const msi_table rep_tables[] =
2031 {
2032 ADD_TABLE(directory),
2033 ADD_TABLE(rep_component),
2034 ADD_TABLE(rep_feature),
2035 ADD_TABLE(rep_feature_comp),
2036 ADD_TABLE(rep_file),
2037 ADD_TABLE(rep_upgrade),
2038 ADD_TABLE(rep_property),
2039 ADD_TABLE(rep_install_exec_seq),
2040 ADD_TABLE(media)
2041 };
2042
2043 /* based on RegDeleteTreeW from dlls/advapi32/registry.c */
2044 static LSTATUS action_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey, REGSAM access)
2045 {
2046 LONG ret;
2047 DWORD dwMaxSubkeyLen, dwMaxValueLen;
2048 DWORD dwMaxLen, dwSize;
2049 char szNameBuf[MAX_PATH], *lpszName = szNameBuf;
2050 HKEY hSubKey = hKey;
2051
2052 if(lpszSubKey)
2053 {
2054 ret = RegOpenKeyExA(hKey, lpszSubKey, 0, access, &hSubKey);
2055 if (ret) return ret;
2056 }
2057
2058 ret = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, NULL,
2059 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
2060 if (ret) goto cleanup;
2061
2062 dwMaxSubkeyLen++;
2063 dwMaxValueLen++;
2064 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
2065 if (dwMaxLen > sizeof(szNameBuf))
2066 {
2067 /* Name too big: alloc a buffer for it */
2068 if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen)))
2069 {
2070 ret = ERROR_NOT_ENOUGH_MEMORY;
2071 goto cleanup;
2072 }
2073 }
2074
2075 /* Recursively delete all the subkeys */
2076 while (TRUE)
2077 {
2078 dwSize = dwMaxLen;
2079 if (RegEnumKeyExA(hSubKey, 0, lpszName, &dwSize, NULL,
2080 NULL, NULL, NULL)) break;
2081
2082 ret = action_RegDeleteTreeA(hSubKey, lpszName, access);
2083 if (ret) goto cleanup;
2084 }
2085
2086 if (lpszSubKey)
2087 {
2088 if (pRegDeleteKeyExA)
2089 ret = pRegDeleteKeyExA(hKey, lpszSubKey, access, 0);
2090 else
2091 ret = RegDeleteKeyA(hKey, lpszSubKey);
2092 }
2093 else
2094 while (TRUE)
2095 {
2096 dwSize = dwMaxLen;
2097 if (RegEnumValueA(hKey, 0, lpszName, &dwSize,
2098 NULL, NULL, NULL, NULL)) break;
2099
2100 ret = RegDeleteValueA(hKey, lpszName);
2101 if (ret) goto cleanup;
2102 }
2103
2104 cleanup:
2105 if (lpszName != szNameBuf)
2106 HeapFree(GetProcessHeap(), 0, lpszName);
2107 if(lpszSubKey)
2108 RegCloseKey(hSubKey);
2109 return ret;
2110 }
2111
2112 /* cabinet definitions */
2113
2114 /* make the max size large so there is only one cab file */
2115 #define MEDIA_SIZE 0x7FFFFFFF
2116 #define FOLDER_THRESHOLD 900000
2117
2118 /* the FCI callbacks */
2119
2120 static void * CDECL mem_alloc(ULONG cb)
2121 {
2122 return HeapAlloc(GetProcessHeap(), 0, cb);
2123 }
2124
2125 static void CDECL mem_free(void *memory)
2126 {
2127 HeapFree(GetProcessHeap(), 0, memory);
2128 }
2129
2130 static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
2131 {
2132 sprintf(pccab->szCab, pv, pccab->iCab);
2133 return TRUE;
2134 }
2135
2136 static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
2137 {
2138 return 0;
2139 }
2140
2141 static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile,
2142 BOOL fContinuation, void *pv)
2143 {
2144 return 0;
2145 }
2146
2147 static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
2148 {
2149 HANDLE handle;
2150 DWORD dwAccess = 0;
2151 DWORD dwShareMode = 0;
2152 DWORD dwCreateDisposition = OPEN_EXISTING;
2153
2154 dwAccess = GENERIC_READ | GENERIC_WRITE;
2155 dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
2156
2157 if (GetFileAttributesA(pszFile) != INVALID_FILE_ATTRIBUTES)
2158 dwCreateDisposition = OPEN_EXISTING;
2159 else
2160 dwCreateDisposition = CREATE_NEW;
2161
2162 handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
2163 dwCreateDisposition, 0, NULL);
2164
2165 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
2166
2167 return (INT_PTR)handle;
2168 }
2169
2170 static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2171 {
2172 HANDLE handle = (HANDLE)hf;
2173 DWORD dwRead;
2174 BOOL res;
2175
2176 res = ReadFile(handle, memory, cb, &dwRead, NULL);
2177 ok(res, "Failed to ReadFile\n");
2178
2179 return dwRead;
2180 }
2181
2182 static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
2183 {
2184 HANDLE handle = (HANDLE)hf;
2185 DWORD dwWritten;
2186 BOOL res;
2187
2188 res = WriteFile(handle, memory, cb, &dwWritten, NULL);
2189 ok(res, "Failed to WriteFile\n");
2190
2191 return dwWritten;
2192 }
2193
2194 static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
2195 {
2196 HANDLE handle = (HANDLE)hf;
2197 ok(CloseHandle(handle), "Failed to CloseHandle\n");
2198
2199 return 0;
2200 }
2201
2202 static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
2203 {
2204 HANDLE handle = (HANDLE)hf;
2205 DWORD ret;
2206
2207 ret = SetFilePointer(handle, dist, NULL, seektype);
2208 ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
2209
2210 return ret;
2211 }
2212
2213 static int CDECL fci_delete(char *pszFile, int *err, void *pv)
2214 {
2215 BOOL ret = DeleteFileA(pszFile);
2216 ok(ret, "Failed to DeleteFile %s\n", pszFile);
2217
2218 return 0;
2219 }
2220
2221 static void init_functionpointers(void)
2222 {
2223 HMODULE hmsi = GetModuleHandleA("msi.dll");
2224 HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll");
2225 HMODULE hkernel32 = GetModuleHandleA("kernel32.dll");
2226
2227 #define GET_PROC(mod, func) \
2228 p ## func = (void*)GetProcAddress(mod, #func); \
2229 if(!p ## func) \
2230 trace("GetProcAddress(%s) failed\n", #func);
2231
2232 GET_PROC(hmsi, MsiQueryComponentStateA);
2233 GET_PROC(hmsi, MsiSourceListEnumSourcesA);
2234 GET_PROC(hmsi, MsiSourceListGetInfoA);
2235 GET_PROC(hmsi, MsiGetComponentPathExA);
2236 GET_PROC(hmsi, MsiQueryFeatureStateExA);
2237
2238 GET_PROC(hadvapi32, CheckTokenMembership);
2239 GET_PROC(hadvapi32, ConvertSidToStringSidA);
2240 GET_PROC(hadvapi32, OpenProcessToken);
2241 GET_PROC(hadvapi32, RegDeleteKeyExA)
2242 GET_PROC(hkernel32, IsWow64Process)
2243
2244 hsrclient = LoadLibraryA("srclient.dll");
2245 GET_PROC(hsrclient, SRRemoveRestorePoint);
2246 GET_PROC(hsrclient, SRSetRestorePointA);
2247
2248 #undef GET_PROC
2249 }
2250
2251 static BOOL is_process_limited(void)
2252 {
2253 SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY};
2254 PSID Group = NULL;
2255 BOOL IsInGroup;
2256 HANDLE token;
2257
2258 if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE;
2259
2260 if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
2261 DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &Group) ||
2262 !pCheckTokenMembership(NULL, Group, &IsInGroup))
2263 {
2264 trace("Could not check if the current user is an administrator\n");
2265 FreeSid(Group);
2266 return FALSE;
2267 }
2268 FreeSid(Group);
2269
2270 if (!IsInGroup)
2271 {
2272 /* Only administrators have enough privileges for these tests */
2273 return TRUE;
2274 }
2275
2276 if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token))
2277 {
2278 BOOL ret;
2279 TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault;
2280 DWORD size;
2281
2282 ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size);
2283 CloseHandle(token);
2284 return (ret && type == TokenElevationTypeLimited);
2285 }
2286 return FALSE;
2287 }
2288
2289 static char *get_user_sid(void)
2290 {
2291 HANDLE token;
2292 DWORD size = 0;
2293 TOKEN_USER *user;
2294 char *usersid = NULL;
2295
2296 if (!pConvertSidToStringSidA)
2297 {
2298 win_skip("ConvertSidToStringSidA is not available\n");
2299 return NULL;
2300 }
2301 OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
2302 GetTokenInformation(token, TokenUser, NULL, size, &size);
2303
2304 user = HeapAlloc(GetProcessHeap(), 0, size);
2305 GetTokenInformation(token, TokenUser, user, size, &size);
2306 pConvertSidToStringSidA(user->User.Sid, &usersid);
2307 HeapFree(GetProcessHeap(), 0, user);
2308
2309 CloseHandle(token);
2310 return usersid;
2311 }
2312
2313 static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
2314 {
2315 LPSTR tempname;
2316
2317 tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
2318 GetTempFileNameA(".", "xx", 0, tempname);
2319
2320 if (tempname && (strlen(tempname) < (unsigned)cbTempName))
2321 {
2322 lstrcpyA(pszTempName, tempname);
2323 HeapFree(GetProcessHeap(), 0, tempname);
2324 return TRUE;
2325 }
2326
2327 HeapFree(GetProcessHeap(), 0, tempname);
2328
2329 return FALSE;
2330 }
2331
2332 static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime,
2333 USHORT *pattribs, int *err, void *pv)
2334 {
2335 BY_HANDLE_FILE_INFORMATION finfo;
2336 FILETIME filetime;
2337 HANDLE handle;
2338 DWORD attrs;
2339 BOOL res;
2340
2341 handle = CreateFileA(pszName, GENERIC_READ, FILE_SHARE_READ, NULL,
2342 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
2343
2344 ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
2345
2346 res = GetFileInformationByHandle(handle, &finfo);
2347 ok(res, "Expected GetFileInformationByHandle to succeed\n");
2348
2349 FileTimeToLocalFileTime(&finfo.ftLastWriteTime, &filetime);
2350 FileTimeToDosDateTime(&filetime, pdate, ptime);
2351
2352 attrs = GetFileAttributesA(pszName);
2353 ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
2354
2355 return (INT_PTR)handle;
2356 }
2357
2358 static BOOL add_file(HFCI hfci, const char *file, TCOMP compress)
2359 {
2360 char path[MAX_PATH];
2361 char filename[MAX_PATH];
2362
2363 lstrcpyA(path, CURR_DIR);
2364 lstrcatA(path, "\\");
2365 lstrcatA(path, file);
2366
2367 lstrcpyA(filename, file);
2368
2369 return FCIAddFile(hfci, path, filename, FALSE, get_next_cabinet,
2370 progress, get_open_info, compress);
2371 }
2372
2373 static void set_cab_parameters(PCCAB pCabParams, const CHAR *name, DWORD max_size)
2374 {
2375 ZeroMemory(pCabParams, sizeof(CCAB));
2376
2377 pCabParams->cb = max_size;
2378 pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
2379 pCabParams->setID = 0xbeef;
2380 pCabParams->iCab = 1;
2381 lstrcpyA(pCabParams->szCabPath, CURR_DIR);
2382 lstrcatA(pCabParams->szCabPath, "\\");
2383 lstrcpyA(pCabParams->szCab, name);
2384 }
2385
2386 static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
2387 {
2388 CCAB cabParams;
2389 LPCSTR ptr;
2390 HFCI hfci;
2391 ERF erf;
2392 BOOL res;
2393
2394 set_cab_parameters(&cabParams, name, max_size);
2395
2396 hfci = FCICreate(&erf, file_placed, mem_alloc, mem_free, fci_open,
2397 fci_read, fci_write, fci_close, fci_seek, fci_delete,
2398 get_temp_file, &cabParams, NULL);
2399
2400 ok(hfci != NULL, "Failed to create an FCI context\n");
2401
2402 ptr = files;
2403 while (*ptr)
2404 {
2405 res = add_file(hfci, ptr, tcompTYPE_MSZIP);
2406 ok(res, "Failed to add file: %s\n", ptr);
2407 ptr += lstrlenA(ptr) + 1;
2408 }
2409
2410 res = FCIFlushCabinet(hfci, FALSE, get_next_cabinet, progress);
2411 ok(res, "Failed to flush the cabinet\n");
2412
2413 res = FCIDestroy(hfci);
2414 ok(res, "Failed to destroy the cabinet\n");
2415 }
2416
2417 static BOOL get_user_dirs(void)
2418 {
2419 HKEY hkey;
2420 DWORD type, size;
2421
2422 if (RegOpenKeyA(HKEY_CURRENT_USER,
2423 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", &hkey))
2424 return FALSE;
2425
2426 size = MAX_PATH;
2427 if (RegQueryValueExA(hkey, "AppData", 0, &type, (LPBYTE)APP_DATA_DIR, &size))
2428 {
2429 RegCloseKey(hkey);
2430 return FALSE;
2431 }
2432
2433 RegCloseKey(hkey);
2434 return TRUE;
2435 }
2436
2437 static BOOL get_system_dirs(void)
2438 {
2439 HKEY hkey;
2440 DWORD type, size;
2441
2442 if (RegOpenKeyA(HKEY_LOCAL_MACHINE,
2443 "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
2444 return FALSE;
2445
2446 size = MAX_PATH;
2447 if (RegQueryValueExA(hkey, "ProgramFilesDir (x86)", 0, &type, (LPBYTE)PROG_FILES_DIR, &size) &&
2448 RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)PROG_FILES_DIR, &size))
2449 {
2450 RegCloseKey(hkey);
2451 return FALSE;
2452 }
2453
2454 size = MAX_PATH;
2455 if (RegQueryValueExA(hkey, "CommonFilesDir (x86)", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size) &&
2456 RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)COMMON_FILES_DIR, &size))
2457 {
2458 RegCloseKey(hkey);
2459 return FALSE;
2460 }
2461
2462 RegCloseKey(hkey);
2463
2464 if (!GetWindowsDirectoryA(WINDOWS_DIR, MAX_PATH))
2465 return FALSE;
2466
2467 return TRUE;
2468 }
2469
2470 static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
2471 {
2472 HANDLE file;
2473 DWORD written;
2474
2475 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
2476 if (file == INVALID_HANDLE_VALUE)
2477 return;
2478
2479 WriteFile(file, data, strlen(data), &written, NULL);
2480
2481 if (size)
2482 {
2483 SetFilePointer(file, size, NULL, FILE_BEGIN);
2484 SetEndOfFile(file);
2485 }
2486
2487 CloseHandle(file);
2488 }
2489
2490 #define create_file(name, size) create_file_data(name, name, size)
2491
2492 static void create_test_files(void)
2493 {
2494 CreateDirectoryA("msitest", NULL);
2495 create_file("msitest\\one.txt", 100);
2496 CreateDirectoryA("msitest\\first", NULL);
2497 create_file("msitest\\first\\two.txt", 100);
2498 CreateDirectoryA("msitest\\second", NULL);
2499 create_file("msitest\\second\\three.txt", 100);
2500
2501 create_file("four.txt", 100);
2502 create_file("five.txt", 100);
2503 create_cab_file("msitest.cab", MEDIA_SIZE, "four.txt\0five.txt\0");
2504
2505 create_file("msitest\\filename", 100);
2506 create_file("msitest\\service.exe", 100);
2507 create_file("msitest\\service2.exe", 100);
2508
2509 DeleteFileA("four.txt");
2510 DeleteFileA("five.txt");
2511 }
2512
2513 static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
2514 {
2515 CHAR path[MAX_PATH];
2516
2517 lstrcpyA(path, PROG_FILES_DIR);
2518 lstrcatA(path, "\\");
2519 lstrcatA(path, rel_path);
2520
2521 if (is_file)
2522 return DeleteFileA(path);
2523 else
2524 return RemoveDirectoryA(path);
2525 }
2526
2527 static void delete_test_files(void)
2528 {
2529 DeleteFileA("msitest.msi");
2530 DeleteFileA("msitest.cab");
2531 DeleteFileA("msitest\\second\\three.txt");
2532 DeleteFileA("msitest\\first\\two.txt");
2533 DeleteFileA("msitest\\one.txt");
2534 DeleteFileA("msitest\\service.exe");
2535 DeleteFileA("msitest\\service2.exe");
2536 DeleteFileA("msitest\\filename");
2537 RemoveDirectoryA("msitest\\second");
2538 RemoveDirectoryA("msitest\\first");
2539 RemoveDirectoryA("msitest");
2540 }
2541
2542 static void write_file(const CHAR *filename, const char *data, int data_size)
2543 {
2544 DWORD size;
2545 HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
2546 WriteFile(hf, data, data_size, &size, NULL);
2547 CloseHandle(hf);
2548 }
2549
2550 static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, const char *template)
2551 {
2552 MSIHANDLE summary;
2553 UINT r;
2554
2555 r = MsiGetSummaryInformationA(db, NULL, 5, &summary);
2556 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2557
2558 r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template);
2559 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2560
2561 r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
2562 "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}");
2563 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2564
2565 r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL);
2566 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2567
2568 r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, wordcount, NULL, NULL);
2569 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2570
2571 r = MsiSummaryInfoSetPropertyA(summary, PID_TITLE, VT_LPSTR, 0, NULL, "MSITEST");
2572 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2573
2574 /* write the summary changes back to the stream */
2575 r = MsiSummaryInfoPersist(summary);
2576 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2577
2578 MsiCloseHandle(summary);
2579 }
2580
2581 #define create_database(name, tables, num_tables) \
2582 create_database_wordcount(name, tables, num_tables, 100, 0, ";1033");
2583
2584 #define create_database_template(name, tables, num_tables, version, template) \
2585 create_database_wordcount(name, tables, num_tables, version, 0, template);
2586
2587 static void create_database_wordcount(const CHAR *name, const msi_table *tables,
2588 int num_tables, INT version, INT wordcount,
2589 const char *template)
2590 {
2591 MSIHANDLE db;
2592 UINT r;
2593 WCHAR *nameW;
2594 int j, len;
2595
2596 len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
2597 if (!(nameW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return;
2598 MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, len );
2599
2600 r = MsiOpenDatabaseW(nameW, MSIDBOPEN_CREATE, &db);
2601 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2602
2603 /* import the tables into the database */
2604 for (j = 0; j < num_tables; j++)
2605 {
2606 const msi_table *table = &tables[j];
2607
2608 write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
2609
2610 r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
2611 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2612
2613 DeleteFileA(table->filename);
2614 }
2615
2616 write_msi_summary_info(db, version, wordcount, template);
2617
2618 r = MsiDatabaseCommit(db);
2619 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
2620
2621 MsiCloseHandle(db);
2622 HeapFree( GetProcessHeap(), 0, nameW );
2623 }
2624
2625 static BOOL notify_system_change(DWORD event_type, STATEMGRSTATUS *status)
2626 {
2627 RESTOREPOINTINFOA spec;
2628
2629 spec.dwEventType = event_type;
2630 spec.dwRestorePtType = APPLICATION_INSTALL;
2631 spec.llSequenceNumber = status->llSequenceNumber;
2632 lstrcpyA(spec.szDescription, "msitest restore point");
2633
2634 return pSRSetRestorePointA(&spec, status);
2635 }
2636
2637 static void remove_restore_point(DWORD seq_number)
2638 {
2639 DWORD res;
2640
2641 res = pSRRemoveRestorePoint(seq_number);
2642 if (res != ERROR_SUCCESS)
2643 trace("Failed to remove the restore point : %08x\n", res);
2644 }
2645
2646 static LONG delete_key( HKEY key, LPCSTR subkey, REGSAM access )
2647 {
2648 if (pRegDeleteKeyExA)
2649 return pRegDeleteKeyExA( key, subkey, access, 0 );
2650 return RegDeleteKeyA( key, subkey );
2651 }
2652
2653 static BOOL file_exists(LPCSTR file)
2654 {
2655 return GetFileAttributesA(file) != INVALID_FILE_ATTRIBUTES;
2656 }
2657
2658 static BOOL pf_exists(LPCSTR file)
2659 {
2660 CHAR path[MAX_PATH];
2661
2662 lstrcpyA(path, PROG_FILES_DIR);
2663 lstrcatA(path, "\\");
2664 lstrcatA(path, file);
2665
2666 return file_exists(path);
2667 }
2668
2669 static void delete_pfmsitest_files(void)
2670 {
2671 SHFILEOPSTRUCTA shfl;
2672 CHAR path[MAX_PATH+11];
2673
2674 lstrcpyA(path, PROG_FILES_DIR);
2675 lstrcatA(path, "\\msitest\\*");
2676 path[strlen(path) + 1] = '\0';
2677
2678 shfl.hwnd = NULL;
2679 shfl.wFunc = FO_DELETE;
2680 shfl.pFrom = path;
2681 shfl.pTo = NULL;
2682 shfl.fFlags = FOF_FILESONLY | FOF_NOCONFIRMATION | FOF_NORECURSION | FOF_SILENT | FOF_NOERRORUI;
2683
2684 SHFileOperationA(&shfl);
2685
2686 lstrcpyA(path, PROG_FILES_DIR);
2687 lstrcatA(path, "\\msitest");
2688 RemoveDirectoryA(path);
2689 }
2690
2691 static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase, DWORD line)
2692 {
2693 char val[MAX_PATH];
2694 DWORD size, type;
2695 LONG res;
2696
2697 size = MAX_PATH;
2698 val[0] = '\0';
2699 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)val, &size);
2700
2701 if (res != ERROR_SUCCESS ||
2702 (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_MULTI_SZ))
2703 {
2704 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2705 return;
2706 }
2707
2708 if (!expected)
2709 ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val);
2710 else
2711 {
2712 if (bcase)
2713 ok_(__FILE__, line)(!lstrcmpA(val, expected), "Expected %s, got %s\n", expected, val);
2714 else
2715 ok_(__FILE__, line)(!lstrcmpiA(val, expected), "Expected %s, got %s\n", expected, val);
2716 }
2717 }
2718
2719 static void check_reg_dword(HKEY prodkey, LPCSTR name, DWORD expected, DWORD line)
2720 {
2721 DWORD val, size, type;
2722 LONG res;
2723
2724 size = sizeof(DWORD);
2725 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2726
2727 if (res != ERROR_SUCCESS || type != REG_DWORD)
2728 {
2729 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2730 return;
2731 }
2732
2733 ok_(__FILE__, line)(val == expected, "Expected %d, got %d\n", expected, val);
2734 }
2735
2736 static void check_reg_dword4(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3,
2737 DWORD expected4, DWORD line)
2738 {
2739 DWORD val, size, type;
2740 LONG res;
2741
2742 size = sizeof(DWORD);
2743 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2744
2745 if (res != ERROR_SUCCESS || type != REG_DWORD)
2746 {
2747 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2748 return;
2749 }
2750
2751 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4,
2752 "Expected %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, val);
2753 }
2754
2755 static void check_reg_dword5(HKEY prodkey, LPCSTR name, DWORD expected1, DWORD expected2, DWORD expected3,
2756 DWORD expected4, DWORD expected5, DWORD line)
2757 {
2758 DWORD val, size, type;
2759 LONG res;
2760
2761 size = sizeof(DWORD);
2762 res = RegQueryValueExA(prodkey, name, NULL, &type, (LPBYTE)&val, &size);
2763
2764 if (res != ERROR_SUCCESS || type != REG_DWORD)
2765 {
2766 ok_(__FILE__, line)(FALSE, "Key doesn't exist or wrong type\n");
2767 return;
2768 }
2769
2770 ok_(__FILE__, line)(val == expected1 || val == expected2 || val == expected3 || val == expected4 ||
2771 val == expected5,
2772 "Expected %d, %d, %d, %d or %d, got %d\n", expected1, expected2, expected3, expected4, expected5, val);
2773 }
2774
2775 #define CHECK_REG_STR(prodkey, name, expected) \
2776 check_reg_str(prodkey, name, expected, TRUE, __LINE__);
2777
2778 #define CHECK_DEL_REG_STR(prodkey, name, expected) \
2779 do { \
2780 check_reg_str(prodkey, name, expected, TRUE, __LINE__); \
2781 RegDeleteValueA(prodkey, name); \
2782 } while(0)
2783
2784 #define CHECK_REG_ISTR(prodkey, name, expected) \
2785 check_reg_str(prodkey, name, expected, FALSE, __LINE__);
2786
2787 #define CHECK_DEL_REG_ISTR(prodkey, name, expected) \
2788 do { \
2789 check_reg_str(prodkey, name, expected, FALSE, __LINE__); \
2790 RegDeleteValueA(prodkey, name); \
2791 } while(0)
2792
2793 #define CHECK_REG_DWORD(prodkey, name, expected) \
2794 check_reg_dword(prodkey, name, expected, __LINE__);
2795
2796 #define CHECK_DEL_REG_DWORD(prodkey, name, expected) \
2797 do { \
2798 check_reg_dword(prodkey, name, expected, __LINE__); \
2799 RegDeleteValueA(prodkey, name); \
2800 } while(0)
2801
2802 #define CHECK_REG_DWORD2(prodkey, name, expected1, expected2) \
2803 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__);
2804
2805 #define CHECK_DEL_REG_DWORD2(prodkey, name, expected1, expected2) \
2806 do { \
2807 check_reg_dword2(prodkey, name, expected1, expected2, __LINE__); \
2808 RegDeleteValueA(prodkey, name); \
2809 } while(0)
2810
2811 #define CHECK_REG_DWORD4(prodkey, name, expected1, expected2, expected3, expected4) \
2812 check_reg_dword4(prodkey, name, expected1, expected2, expected3, expected4, __LINE__);
2813
2814 #define CHECK_DEL_REG_DWORD5(prodkey, name, expected1, expected2, expected3, expected4 ,expected5) \
2815 do { \
2816 check_reg_dword5(prodkey, name, expected1, expected2, expected3, expected4, expected5, __LINE__); \
2817 RegDeleteValueA(prodkey, name); \
2818 } while(0)
2819
2820 static void get_date_str(LPSTR date)
2821 {
2822 SYSTEMTIME systime;
2823
2824 static const char date_fmt[] = "%d%02d%02d";
2825 GetLocalTime(&systime);
2826 sprintf(date, date_fmt, systime.wYear, systime.wMonth, systime.wDay);
2827 }
2828
2829 static void test_register_product(void)
2830 {
2831 UINT r;
2832 LONG res;
2833 HKEY hkey, props, usage;
2834 LPSTR usersid;
2835 char date[MAX_PATH], temp[MAX_PATH], keypath[MAX_PATH], path[MAX_PATH];
2836 DWORD size, type;
2837 REGSAM access = KEY_ALL_ACCESS;
2838
2839 static const CHAR uninstall[] = "Software\\Microsoft\\Windows\\CurrentVersion"
2840 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2841 static const CHAR uninstall_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion"
2842 "\\Uninstall\\{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
2843 static const CHAR userdata[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2844 "\\UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
2845 static const CHAR ugkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"
2846 "\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
2847 static const CHAR userugkey[] = "Software\\Microsoft\\Installer\\UpgradeCodes"
2848 "\\51AAE0C44620A5E4788506E91F249BD2";
2849
2850 if (is_process_limited())
2851 {
2852 skip("process is limited\n");
2853 return;
2854 }
2855
2856 if (!(usersid = get_user_sid()))
2857 return;
2858
2859 get_date_str(date);
2860 GetTempPathA(MAX_PATH, temp);
2861
2862 CreateDirectoryA("msitest", NULL);
2863 create_file("msitest\\maximus", 500);
2864
2865 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
2866
2867 if (is_wow64)
2868 access |= KEY_WOW64_64KEY;
2869
2870 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
2871
2872 /* RegisterProduct */
2873 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
2874 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
2875 {
2876 skip("Not enough rights to perform tests\n");
2877 goto error;
2878 }
2879 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2880 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2881 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2882
2883 res = RegOpenKeyA(HKEY_CURRENT_USER, userugkey, &hkey);
2884 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2885
2886 if (is_64bit)
2887 {
2888 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey);
2889 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2890 }
2891 else
2892 {
2893 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_ALL_ACCESS, &hkey);
2894 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2895 }
2896
2897 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
2898 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
2899 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
2900 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
2901 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2902 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
2903 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2904 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
2905 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
2906 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
2907 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
2908 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
2909 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
2910 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
2911 CHECK_DEL_REG_STR(hkey, "Size", NULL);
2912 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
2913 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
2914 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
2915 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
2916 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
2917 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
2918 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
2919 todo_wine
2920 {
2921 CHECK_DEL_REG_DWORD5(hkey, "EstimatedSize", 12, -12, 4, 10, 24);
2922 }
2923
2924 delete_key(hkey, "", access);
2925 RegCloseKey(hkey);
2926
2927 sprintf(keypath, userdata, usersid);
2928 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
2929 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2930
2931 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
2932 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2933
2934 size = sizeof(path);
2935 RegQueryValueExA(props, "LocalPackage", NULL, &type, (LPBYTE)path, &size);
2936 DeleteFileA(path);
2937 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
2938
2939 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
2940 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
2941 CHECK_DEL_REG_STR(props, "InstallDate", date);
2942 CHECK_DEL_REG_STR(props, "InstallSource", temp);
2943 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2944 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
2945 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
2946 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
2947 CHECK_DEL_REG_STR(props, "Comments", NULL);
2948 CHECK_DEL_REG_STR(props, "Contact", NULL);
2949 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
2950 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
2951 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
2952 CHECK_DEL_REG_STR(props, "Readme", NULL);
2953 CHECK_DEL_REG_STR(props, "Size", NULL);
2954 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
2955 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
2956 CHECK_DEL_REG_DWORD(props, "Language", 1033);
2957 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
2958 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
2959 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
2960 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
2961 todo_wine
2962 {
2963 CHECK_DEL_REG_DWORD5(props, "EstimatedSize", 12, -12, 4, 10, 24);
2964 }
2965
2966 delete_key(props, "", access);
2967 RegCloseKey(props);
2968
2969 res = RegOpenKeyExA(hkey, "Usage", 0, access, &usage);
2970 todo_wine
2971 {
2972 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2973 }
2974
2975 delete_key(usage, "", access);
2976 RegCloseKey(usage);
2977 delete_key(hkey, "", access);
2978 RegCloseKey(hkey);
2979
2980 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, access, &hkey);
2981 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
2982
2983 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
2984
2985 delete_key(hkey, "", access);
2986 RegCloseKey(hkey);
2987
2988 /* RegisterProduct, machine */
2989 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 ALLUSERS=1");
2990 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2991 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
2992 ok(delete_pf("msitest", FALSE), "Directory not created\n");
2993
2994 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, userugkey, 0, access, &hkey);
2995 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
2996
2997 if (is_64bit)
2998 {
2999 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall_32node, 0, KEY_ALL_ACCESS, &hkey);
3000 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3001 }
3002 else
3003 {
3004 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, uninstall, 0, KEY_ALL_ACCESS, &hkey);
3005 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3006 }
3007
3008 CHECK_DEL_REG_STR(hkey, "DisplayName", "MSITEST");
3009 CHECK_DEL_REG_STR(hkey, "DisplayVersion", "1.1.1");
3010 CHECK_DEL_REG_STR(hkey, "InstallDate", date);
3011 CHECK_DEL_REG_STR(hkey, "InstallSource", temp);
3012 CHECK_DEL_REG_ISTR(hkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3013 CHECK_DEL_REG_STR(hkey, "Publisher", "Wine");
3014 CHECK_DEL_REG_STR(hkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3015 CHECK_DEL_REG_STR(hkey, "AuthorizedCDFPrefix", NULL);
3016 CHECK_DEL_REG_STR(hkey, "Comments", NULL);
3017 CHECK_DEL_REG_STR(hkey, "Contact", NULL);
3018 CHECK_DEL_REG_STR(hkey, "HelpLink", NULL);
3019 CHECK_DEL_REG_STR(hkey, "HelpTelephone", NULL);
3020 CHECK_DEL_REG_STR(hkey, "InstallLocation", NULL);
3021 CHECK_DEL_REG_STR(hkey, "Readme", NULL);
3022 CHECK_DEL_REG_STR(hkey, "Size", NULL);
3023 CHECK_DEL_REG_STR(hkey, "URLInfoAbout", NULL);
3024 CHECK_DEL_REG_STR(hkey, "URLUpdateInfo", NULL);
3025 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3026 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3027 CHECK_DEL_REG_DWORD(hkey, "VersionMajor", 1);
3028 CHECK_DEL_REG_DWORD(hkey, "VersionMinor", 1);
3029 CHECK_DEL_REG_DWORD(hkey, "WindowsInstaller", 1);
3030 todo_wine
3031 {
3032 CHECK_DEL_REG_DWORD5(hkey, "EstimatedSize", 12, -12, 4, 10, 24);
3033 }
3034
3035 delete_key(hkey, "", access);
3036 RegCloseKey(hkey);
3037
3038 sprintf(keypath, userdata, "S-1-5-18");
3039 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3040 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3041
3042 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
3043 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3044
3045 size = sizeof(path);
3046 RegQueryValueExA(props, "LocalPackage", NULL, &type, (LPBYTE)path, &size);
3047 DeleteFileA(path);
3048 RegDeleteValueA(props, "LocalPackage"); /* LocalPackage is nondeterministic */
3049
3050 CHECK_DEL_REG_STR(props, "DisplayName", "MSITEST");
3051 CHECK_DEL_REG_STR(props, "DisplayVersion", "1.1.1");
3052 CHECK_DEL_REG_STR(props, "InstallDate", date);
3053 CHECK_DEL_REG_STR(props, "InstallSource", temp);
3054 CHECK_DEL_REG_ISTR(props, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3055 CHECK_DEL_REG_STR(props, "Publisher", "Wine");
3056 CHECK_DEL_REG_STR(props, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3057 CHECK_DEL_REG_STR(props, "AuthorizedCDFPrefix", NULL);
3058 CHECK_DEL_REG_STR(props, "Comments", NULL);
3059 CHECK_DEL_REG_STR(props, "Contact", NULL);
3060 CHECK_DEL_REG_STR(props, "HelpLink", NULL);
3061 CHECK_DEL_REG_STR(props, "HelpTelephone", NULL);
3062 CHECK_DEL_REG_STR(props, "InstallLocation", NULL);
3063 CHECK_DEL_REG_STR(props, "Readme", NULL);
3064 CHECK_DEL_REG_STR(props, "Size", NULL);
3065 CHECK_DEL_REG_STR(props, "URLInfoAbout", NULL);
3066 CHECK_DEL_REG_STR(props, "URLUpdateInfo", NULL);
3067 CHECK_DEL_REG_DWORD(props, "Language", 1033);
3068 CHECK_DEL_REG_DWORD(props, "Version", 0x1010001);
3069 CHECK_DEL_REG_DWORD(props, "VersionMajor", 1);
3070 CHECK_DEL_REG_DWORD(props, "VersionMinor", 1);
3071 CHECK_DEL_REG_DWORD(props, "WindowsInstaller", 1);
3072 todo_wine
3073 {
3074 CHECK_DEL_REG_DWORD5(props, "EstimatedSize", 12, -12, 4, 10, 24);
3075 }
3076
3077 delete_key(props, "", access);
3078 RegCloseKey(props);
3079
3080 res = RegOpenKeyExA(hkey, "Usage", 0, access, &usage);
3081 todo_wine
3082 {
3083 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3084 }
3085
3086 delete_key(usage, "", access);
3087 RegCloseKey(usage);
3088 delete_key(hkey, "", access);
3089 RegCloseKey(hkey);
3090
3091 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ugkey, 0, access, &hkey);
3092 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3093
3094 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3095
3096 delete_key(hkey, "", access);
3097 RegCloseKey(hkey);
3098
3099 error:
3100 DeleteFileA(msifile);
3101 DeleteFileA("msitest\\maximus");
3102 RemoveDirectoryA("msitest");
3103 HeapFree(GetProcessHeap(), 0, usersid);
3104 }
3105
3106 static void test_publish_product(void)
3107 {
3108 static const char prodpath[] =
3109 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
3110 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3111 static const char cuprodpath[] =
3112 "Software\\Microsoft\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3113 static const char cuupgrades[] =
3114 "Software\\Microsoft\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
3115 static const char badprod[] =
3116 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Products"
3117 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3118 static const char machprod[] =
3119 "Software\\Classes\\Installer\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3120 static const char machup[] =
3121 "Software\\Classes\\Installer\\UpgradeCodes\\51AAE0C44620A5E4788506E91F249BD2";
3122 UINT r;
3123 LONG res;
3124 LPSTR usersid;
3125 HKEY sourcelist, net, props;
3126 HKEY hkey, patches, media;
3127 CHAR keypath[MAX_PATH];
3128 CHAR temp[MAX_PATH];
3129 CHAR path[MAX_PATH];
3130 BOOL old_installer = FALSE;
3131 REGSAM access = KEY_ALL_ACCESS;
3132
3133 if (is_process_limited())
3134 {
3135 skip("process is limited\n");
3136 return;
3137 }
3138
3139 if (!(usersid = get_user_sid()))
3140 return;
3141
3142 GetTempPathA(MAX_PATH, temp);
3143
3144 CreateDirectoryA("msitest", NULL);
3145 create_file("msitest\\maximus", 500);
3146
3147 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3148
3149 if (is_wow64)
3150 access |= KEY_WOW64_64KEY;
3151
3152 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3153
3154 /* PublishProduct, current user */
3155 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
3156 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3157 {
3158 skip("Not enough rights to perform tests\n");
3159 goto error;
3160 }
3161 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3162 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3163 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3164
3165 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, badprod, 0, access, &hkey);
3166 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3167
3168 sprintf(keypath, prodpath, usersid);
3169 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3170 if (res == ERROR_FILE_NOT_FOUND)
3171 {
3172 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
3173 if (res == ERROR_SUCCESS)
3174 {
3175 win_skip("Windows Installer < 3.0 detected\n");
3176 RegCloseKey(hkey);
3177 old_installer = TRUE;
3178 goto currentuser;
3179 }
3180 else
3181 {
3182 win_skip("Install failed, no need to continue\n");
3183 return;
3184 }
3185 }
3186 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3187
3188 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
3189 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3190
3191 res = RegOpenKeyExA(hkey, "Patches", 0, access, &patches);
3192 todo_wine
3193 {
3194 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3195 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3196 }
3197
3198 delete_key(patches, "", access);
3199 RegCloseKey(patches);
3200 delete_key(hkey, "", access);
3201 RegCloseKey(hkey);
3202
3203 currentuser:
3204 res = RegOpenKeyA(HKEY_CURRENT_USER, cuprodpath, &hkey);
3205 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3206
3207 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3208 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052C94DA02821EECD05F2F");
3209 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3210 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3211 if (!old_installer)
3212 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3213 CHECK_DEL_REG_DWORD(hkey, "Assignment", 0);
3214 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3215 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3216 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3217
3218 res = RegOpenKeyA(hkey, "SourceList", &sourcelist);
3219 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3220
3221 lstrcpyA(path, "n;1;");
3222 lstrcatA(path, temp);
3223 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3224 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3225
3226 res = RegOpenKeyA(sourcelist, "Net", &net);
3227 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3228
3229 CHECK_DEL_REG_STR(net, "1", temp);
3230
3231 RegDeleteKeyA(net, "");
3232 RegCloseKey(net);
3233
3234 res = RegOpenKeyA(sourcelist, "Media", &media);
3235 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3236
3237 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3238
3239 RegDeleteKeyA(media, "");
3240 RegCloseKey(media);
3241 RegDeleteKeyA(sourcelist, "");
3242 RegCloseKey(sourcelist);
3243 RegDeleteKeyA(hkey, "");
3244 RegCloseKey(hkey);
3245
3246 res = RegOpenKeyA(HKEY_CURRENT_USER, cuupgrades, &hkey);
3247 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3248
3249 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3250
3251 RegDeleteKeyA(hkey, "");
3252 RegCloseKey(hkey);
3253
3254 /* PublishProduct, machine */
3255 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1 ALLUSERS=1");
3256 if (old_installer)
3257 goto machprod;
3258 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3259 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3260 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3261
3262 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, badprod, 0, access, &hkey);
3263 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3264
3265 sprintf(keypath, prodpath, "S-1-5-18");
3266 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3267 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3268
3269 res = RegOpenKeyExA(hkey, "InstallProperties", 0, access, &props);
3270 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3271
3272 res = RegOpenKeyExA(hkey, "Patches", 0, access, &patches);
3273 todo_wine
3274 {
3275 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3276 CHECK_DEL_REG_STR(patches, "AllPatches", NULL);
3277 }
3278
3279 delete_key(patches, "", access);
3280 RegCloseKey(patches);
3281 delete_key(hkey, "", access);
3282 RegCloseKey(hkey);
3283
3284 machprod:
3285 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, machprod, 0, access, &hkey);
3286 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3287
3288 CHECK_DEL_REG_STR(hkey, "ProductName", "MSITEST");
3289 CHECK_DEL_REG_STR(hkey, "PackageCode", "AC75740029052C94DA02821EECD05F2F");
3290 CHECK_DEL_REG_DWORD(hkey, "Language", 1033);
3291 CHECK_DEL_REG_DWORD(hkey, "Version", 0x1010001);
3292 if (!old_installer)
3293 CHECK_DEL_REG_DWORD(hkey, "AuthorizedLUAApp", 0);
3294 todo_wine CHECK_DEL_REG_DWORD(hkey, "Assignment", 1);
3295 CHECK_DEL_REG_DWORD(hkey, "AdvertiseFlags", 0x184);
3296 CHECK_DEL_REG_DWORD(hkey, "InstanceType", 0);
3297 CHECK_DEL_REG_STR(hkey, "Clients", ":");
3298
3299 res = RegOpenKeyExA(hkey, "SourceList", 0, access, &sourcelist);
3300 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3301
3302 lstrcpyA(path, "n;1;");
3303 lstrcatA(path, temp);
3304 CHECK_DEL_REG_STR(sourcelist, "LastUsedSource", path);
3305 CHECK_DEL_REG_STR(sourcelist, "PackageName", "msitest.msi");
3306
3307 res = RegOpenKeyExA(sourcelist, "Net", 0, access, &net);
3308 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3309
3310 CHECK_DEL_REG_STR(net, "1", temp);
3311
3312 res = delete_key(net, "", access);
3313 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3314 RegCloseKey(net);
3315
3316 res = RegOpenKeyExA(sourcelist, "Media", 0, access, &media);
3317 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3318
3319 CHECK_DEL_REG_STR(media, "1", "DISK1;");
3320
3321 res = delete_key(media, "", access);
3322 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3323 RegCloseKey(media);
3324 res = delete_key(sourcelist, "", access);
3325 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3326 RegCloseKey(sourcelist);
3327 res = delete_key(hkey, "", access);
3328 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3329 RegCloseKey(hkey);
3330
3331 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, machup, 0, access, &hkey);
3332 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3333
3334 CHECK_DEL_REG_STR(hkey, "84A88FD7F6998CE40A22FB59F6B9C2BB", NULL);
3335
3336 res = delete_key(hkey, "", access);
3337 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3338 RegCloseKey(hkey);
3339
3340 error:
3341 DeleteFileA(msifile);
3342 DeleteFileA("msitest\\maximus");
3343 RemoveDirectoryA("msitest");
3344 HeapFree(GetProcessHeap(), 0, usersid);
3345 }
3346
3347 static void test_publish_features(void)
3348 {
3349 static const char cupath[] =
3350 "Software\\Microsoft\\Installer\\Features\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3351 static const char udfeatpath[] =
3352 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
3353 "\\84A88FD7F6998CE40A22FB59F6B9C2BB\\Features";
3354 static const char udpridpath[] =
3355 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Products"
3356 "\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3357 static const char featkey[] =
3358 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Features";
3359 static const char classfeat[] =
3360 "Software\\Classes\\Installer\\Features\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3361 UINT r;
3362 LONG res;
3363 HKEY hkey;
3364 LPSTR usersid;
3365 CHAR keypath[MAX_PATH];
3366 REGSAM access = KEY_ALL_ACCESS;
3367
3368 if (is_process_limited())
3369 {
3370 skip("process is limited\n");
3371 return;
3372 }
3373
3374 if (!(usersid = get_user_sid()))
3375 return;
3376
3377 CreateDirectoryA("msitest", NULL);
3378 create_file("msitest\\maximus", 500);
3379
3380 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3381
3382 if (is_wow64)
3383 access |= KEY_WOW64_64KEY;
3384
3385 MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
3386
3387 /* PublishFeatures, current user */
3388 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
3389 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3390 {
3391 skip("Not enough rights to perform tests\n");
3392 goto error;
3393 }
3394 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3395 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3396 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3397
3398 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, featkey, 0, access, &hkey);
3399 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3400
3401 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, classfeat, 0, access, &hkey);
3402 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3403
3404 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
3405 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3406
3407 CHECK_REG_STR(hkey, "feature", "");
3408 CHECK_REG_STR(hkey, "montecristo", "");
3409
3410 RegDeleteValueA(hkey, "feature");
3411 RegDeleteValueA(hkey, "montecristo");
3412 delete_key(hkey, "", access);
3413 RegCloseKey(hkey);
3414
3415 sprintf(keypath, udfeatpath, usersid);
3416 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3417 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3418
3419 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
3420 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
3421
3422 RegDeleteValueA(hkey, "feature");
3423 RegDeleteValueA(hkey, "montecristo");
3424 delete_key(hkey, "", access);
3425 RegCloseKey(hkey);
3426 sprintf(keypath, udpridpath, usersid);
3427 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3428
3429 /* PublishFeatures, machine */
3430 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1 ALLUSERS=1");
3431 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3432 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3433 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3434
3435 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, featkey, 0, access, &hkey);
3436 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3437
3438 res = RegOpenKeyA(HKEY_CURRENT_USER, cupath, &hkey);
3439 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3440 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, classfeat, 0, access, &hkey);
3441 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3442
3443 CHECK_REG_STR(hkey, "feature", "");
3444 CHECK_REG_STR(hkey, "montecristo", "");
3445
3446 RegDeleteValueA(hkey, "feature");
3447 RegDeleteValueA(hkey, "montecristo");
3448 delete_key(hkey, "", access);
3449 RegCloseKey(hkey);
3450
3451 sprintf(keypath, udfeatpath, "S-1-5-18");
3452 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &hkey);
3453 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3454
3455 CHECK_REG_STR(hkey, "feature", "VGtfp^p+,?82@JU1j_KE");
3456 CHECK_REG_STR(hkey, "montecristo", "VGtfp^p+,?82@JU1j_KE");
3457
3458 RegDeleteValueA(hkey, "feature");
3459 RegDeleteValueA(hkey, "montecristo");
3460 delete_key(hkey, "", access);
3461 RegCloseKey(hkey);
3462 sprintf(keypath, udpridpath, "S-1-5-18");
3463 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3464
3465 error:
3466 DeleteFileA(msifile);
3467 DeleteFileA("msitest\\maximus");
3468 RemoveDirectoryA("msitest");
3469 HeapFree(GetProcessHeap(), 0, usersid);
3470 }
3471
3472 static LPSTR reg_get_val_str(HKEY hkey, LPCSTR name)
3473 {
3474 DWORD len = 0;
3475 LPSTR val;
3476 LONG r;
3477
3478 r = RegQueryValueExA(hkey, name, NULL, NULL, NULL, &len);
3479 if (r != ERROR_SUCCESS)
3480 return NULL;
3481
3482 len += sizeof (WCHAR);
3483 val = HeapAlloc(GetProcessHeap(), 0, len);
3484 if (!val) return NULL;
3485 val[0] = 0;
3486 RegQueryValueExA(hkey, name, NULL, NULL, (LPBYTE)val, &len);
3487 return val;
3488 }
3489
3490 static void get_owner_company(LPSTR *owner, LPSTR *company)
3491 {
3492 LONG res;
3493 HKEY hkey;
3494 REGSAM access = KEY_ALL_ACCESS;
3495
3496 *owner = *company = NULL;
3497
3498 if (is_wow64)
3499 access |= KEY_WOW64_64KEY;
3500
3501 res = RegOpenKeyA(HKEY_CURRENT_USER,
3502 "Software\\Microsoft\\MS Setup (ACME)\\User Info", &hkey);
3503 if (res == ERROR_SUCCESS)
3504 {
3505 *owner = reg_get_val_str(hkey, "DefName");
3506 *company = reg_get_val_str(hkey, "DefCompany");
3507 RegCloseKey(hkey);
3508 }
3509
3510 if (!*owner || !*company)
3511 {
3512 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
3513 "Software\\Microsoft\\Windows\\CurrentVersion", 0, access, &hkey);
3514 if (res == ERROR_SUCCESS)
3515 {
3516 *owner = reg_get_val_str(hkey, "RegisteredOwner");
3517 *company = reg_get_val_str(hkey, "RegisteredOrganization");
3518 RegCloseKey(hkey);
3519 }
3520 }
3521
3522 if (!*owner || !*company)
3523 {
3524 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
3525 "Software\\Microsoft\\Windows NT\\CurrentVersion", 0, access, &hkey);
3526 if (res == ERROR_SUCCESS)
3527 {
3528 *owner = reg_get_val_str(hkey, "RegisteredOwner");
3529 *company = reg_get_val_str(hkey, "RegisteredOrganization");
3530 RegCloseKey(hkey);
3531 }
3532 }
3533 }
3534
3535 static void test_register_user(void)
3536 {
3537 UINT r;
3538 LONG res;
3539 HKEY props;
3540 LPSTR usersid;
3541 LPSTR owner, company;
3542 CHAR keypath[MAX_PATH];
3543 REGSAM access = KEY_ALL_ACCESS;
3544
3545 static const CHAR keypropsfmt[] =
3546 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3547 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB\\InstallProperties";
3548 static const CHAR keypridfmt[] =
3549 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\"
3550 "UserData\\%s\\Products\\84A88FD7F6998CE40A22FB59F6B9C2BB";
3551
3552 if (is_process_limited())
3553 {
3554 skip("process is limited\n");
3555 return;
3556 }
3557
3558 if (!(usersid = get_user_sid()))
3559 return;
3560
3561 get_owner_company(&owner, &company);
3562
3563 CreateDirectoryA("msitest", NULL);
3564 create_file("msitest\\maximus", 500);
3565
3566 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3567
3568 if (is_wow64)
3569 access |= KEY_WOW64_64KEY;
3570
3571 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3572
3573 /* RegisterUser, per-user */
3574 r = MsiInstallProductA(msifile, "REGISTER_USER=1");
3575 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3576 {
3577 skip("Not enough rights to perform tests\n");
3578 goto error;
3579 }
3580 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3581 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3582 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3583
3584 sprintf(keypath, keypropsfmt, usersid);
3585 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
3586 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3587
3588 CHECK_REG_STR(props, "ProductID", "none");
3589 CHECK_REG_STR(props, "RegCompany", company);
3590 CHECK_REG_STR(props, "RegOwner", owner);
3591
3592 RegDeleteValueA(props, "ProductID");
3593 RegDeleteValueA(props, "RegCompany");
3594 RegDeleteValueA(props, "RegOwner");
3595 delete_key(props, "", access);
3596 RegCloseKey(props);
3597 sprintf(keypath, keypridfmt, usersid);
3598 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3599
3600 /* RegisterUser, machine */
3601 r = MsiInstallProductA(msifile, "REGISTER_USER=1 ALLUSERS=1");
3602 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3603 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3604 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3605
3606 sprintf(keypath, keypropsfmt, "S-1-5-18");
3607 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &props);
3608 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3609
3610 CHECK_REG_STR(props, "ProductID", "none");
3611 CHECK_REG_STR(props, "RegCompany", company);
3612 CHECK_REG_STR(props, "RegOwner", owner);
3613
3614 RegDeleteValueA(props, "ProductID");
3615 RegDeleteValueA(props, "RegCompany");
3616 RegDeleteValueA(props, "RegOwner");
3617 delete_key(props, "", access);
3618 RegCloseKey(props);
3619 sprintf(keypath, keypridfmt, "S-1-5-18");
3620 delete_key(HKEY_LOCAL_MACHINE, keypath, access);
3621
3622 error:
3623 HeapFree(GetProcessHeap(), 0, company);
3624 HeapFree(GetProcessHeap(), 0, owner);
3625
3626 DeleteFileA(msifile);
3627 DeleteFileA("msitest\\maximus");
3628 RemoveDirectoryA("msitest");
3629 LocalFree(usersid);
3630 }
3631
3632 static void test_process_components(void)
3633 {
3634 static const char keyfmt[] =
3635 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\%s\\Components\\%s";
3636 static const char compkey[] =
3637 "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Components";
3638 UINT r;
3639 LONG res;
3640 DWORD size;
3641 HKEY comp, hkey;
3642 LPSTR usersid;
3643 CHAR val[MAX_PATH];
3644 CHAR keypath[MAX_PATH];
3645 CHAR program_files_maximus[MAX_PATH];
3646 REGSAM access = KEY_ALL_ACCESS;
3647
3648 if (is_process_limited())
3649 {
3650 skip("process is limited\n");
3651 return;
3652 }
3653
3654 if (!(usersid = get_user_sid()))
3655 return;
3656
3657 CreateDirectoryA("msitest", NULL);
3658 create_file("msitest\\maximus", 500);
3659
3660 create_database(msifile, ppc_tables, sizeof(ppc_tables) / sizeof(msi_table));
3661
3662 if (is_wow64)
3663 access |= KEY_WOW64_64KEY;
3664
3665 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3666
3667 /* ProcessComponents, per-user */
3668 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
3669 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3670 {
3671 skip("Not enough rights to perform tests\n");
3672 goto error;
3673 }
3674 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3675 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3676 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3677
3678 sprintf(keypath, keyfmt, usersid, "CBABC2FDCCB35E749A8944D8C1C098B5");
3679 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3680 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3681
3682 size = MAX_PATH;
3683 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3684 NULL, NULL, (LPBYTE)val, &size);
3685 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3686
3687 lstrcpyA(program_files_maximus,PROG_FILES_DIR);
3688 lstrcatA(program_files_maximus,"\\msitest\\maximus");
3689
3690 ok(!lstrcmpiA(val, program_files_maximus),
3691 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3692
3693 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3694 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3695
3696 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3697 delete_key(comp, "", access);
3698 RegCloseKey(comp);
3699
3700 sprintf(keypath, keyfmt, usersid, "241C3DA58FECD0945B9687D408766058");
3701 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3702 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3703
3704 size = MAX_PATH;
3705 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3706 NULL, NULL, (LPBYTE)val, &size);
3707 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3708 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3709 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3710
3711 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3712 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3713
3714 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3715 delete_key(comp, "", access);
3716 RegCloseKey(comp);
3717
3718 /* ProcessComponents, machine */
3719 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1 ALLUSERS=1");
3720 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3721 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
3722 ok(delete_pf("msitest", FALSE), "Directory not created\n");
3723
3724 sprintf(keypath, keyfmt, "S-1-5-18", "CBABC2FDCCB35E749A8944D8C1C098B5");
3725 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3726 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3727
3728 size = MAX_PATH;
3729 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3730 NULL, NULL, (LPBYTE)val, &size);
3731 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3732 ok(!lstrcmpiA(val, program_files_maximus),
3733 "Expected \"%s\", got \"%s\"\n", program_files_maximus, val);
3734
3735 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3736 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3737
3738 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3739 delete_key(comp, "", access);
3740 RegCloseKey(comp);
3741
3742 sprintf(keypath, keyfmt, "S-1-5-18", "241C3DA58FECD0945B9687D408766058");
3743 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, access, &comp);
3744 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3745
3746 size = MAX_PATH;
3747 res = RegQueryValueExA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB",
3748 NULL, NULL, (LPBYTE)val, &size);
3749 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3750 ok(!lstrcmpA(val, "01\\msitest\\augustus"),
3751 "Expected \"01\\msitest\\augustus\", got \"%s\"\n", val);
3752
3753 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, compkey, 0, access, &hkey);
3754 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3755
3756 RegDeleteValueA(comp, "84A88FD7F6998CE40A22FB59F6B9C2BB");
3757 delete_key(comp, "", access);
3758 RegCloseKey(comp);
3759
3760 error:
3761 DeleteFileA(msifile);
3762 DeleteFileA("msitest\\maximus");
3763 RemoveDirectoryA("msitest");
3764 LocalFree(usersid);
3765 }
3766
3767 static void test_publish(void)
3768 {
3769 static const char subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3770 static const char subkey_32node[] = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
3771 UINT r;
3772 LONG res;
3773 HKEY uninstall, prodkey, uninstall_32node = NULL;
3774 INSTALLSTATE state;
3775 char date[MAX_PATH], temp[MAX_PATH], prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
3776 REGSAM access = KEY_ALL_ACCESS;
3777 DWORD error;
3778
3779 if (!pMsiQueryFeatureStateExA)
3780 {
3781 win_skip("MsiQueryFeatureStateExA is not available\n");
3782 return;
3783 }
3784 if (is_process_limited())
3785 {
3786 skip("process is limited\n");
3787 return;
3788 }
3789
3790 get_date_str(date);
3791 GetTempPathA(MAX_PATH, temp);
3792
3793 if (is_wow64)
3794 access |= KEY_WOW64_64KEY;
3795
3796 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey, 0, KEY_ALL_ACCESS, &uninstall);
3797 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3798
3799 if (is_64bit)
3800 {
3801 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, subkey_32node, 0, KEY_ALL_ACCESS, &uninstall_32node);
3802 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3803 }
3804
3805 CreateDirectoryA("msitest", NULL);
3806 create_file("msitest\\maximus", 500);
3807
3808 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
3809
3810 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
3811
3812 state = MsiQueryProductStateA(prodcode);
3813 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3814
3815 state = MsiQueryFeatureStateA(prodcode, "feature");
3816 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3817
3818 state = 0xdead;
3819 SetLastError(0xdeadbeef);
3820 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state);
3821 error = GetLastError();
3822 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3823 ok(state == 0xdead, "got %d\n", state);
3824 ok(error == 0xdeadbeef, "got %u\n", error);
3825
3826 state = 0xdead;
3827 SetLastError(0xdeadbeef);
3828 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state);
3829 error = GetLastError();
3830 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3831 ok(state == 0xdead, "got %d\n", state);
3832 ok(error == ERROR_SUCCESS, "got %u\n", error);
3833
3834 state = 0xdead;
3835 SetLastError(0xdeadbeef);
3836 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state);
3837 error = GetLastError();
3838 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3839 ok(state == 0xdead, "got %d\n", state);
3840 ok(error == ERROR_SUCCESS, "got %u\n", error);
3841
3842 state = MsiQueryFeatureStateA(prodcode, "feature");
3843 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3844
3845 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3846 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3847
3848 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3849 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3850 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3851 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3852
3853 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3854 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3855
3856 /* nothing published */
3857 r = MsiInstallProductA(msifile, NULL);
3858 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
3859 {
3860 skip("Not enough rights to perform tests\n");
3861 goto error;
3862 }
3863 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
3864 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3865 ok(pf_exists("msitest"), "File not installed\n");
3866
3867 state = MsiQueryProductStateA(prodcode);
3868 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3869
3870 state = MsiQueryFeatureStateA(prodcode, "feature");
3871 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3872
3873 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3874 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3875
3876 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3877 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3878 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3879 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3880
3881 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3882 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3883
3884 /* PublishProduct and RegisterProduct */
3885 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1 PUBLISH_PRODUCT=1");
3886 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3887 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3888 ok(pf_exists("msitest"), "File not installed\n");
3889
3890 state = MsiQueryProductStateA(prodcode);
3891 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3892
3893 state = MsiQueryFeatureStateA(prodcode, "feature");
3894 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3895
3896 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3897 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3898
3899 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3900 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3901 ok(r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r);
3902 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3903
3904 if (is_64bit)
3905 {
3906 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3907 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3908 }
3909 else
3910 {
3911 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3912 if (is_wow64 && res == ERROR_FILE_NOT_FOUND) /* XP - Vista, Wow64 */
3913 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
3914 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
3915 }
3916
3917 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
3918 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
3919 CHECK_REG_STR(prodkey, "InstallDate", date);
3920 CHECK_REG_STR(prodkey, "InstallSource", temp);
3921 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3922 CHECK_REG_STR(prodkey, "Publisher", "Wine");
3923 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
3924 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
3925 CHECK_REG_STR(prodkey, "Comments", NULL);
3926 CHECK_REG_STR(prodkey, "Contact", NULL);
3927 CHECK_REG_STR(prodkey, "HelpLink", NULL);
3928 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
3929 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
3930 CHECK_REG_STR(prodkey, "Readme", NULL);
3931 CHECK_REG_STR(prodkey, "Size", NULL);
3932 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
3933 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
3934 CHECK_REG_DWORD(prodkey, "Language", 1033);
3935 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
3936 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
3937 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
3938 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
3939 todo_wine
3940 {
3941 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
3942 }
3943
3944 RegCloseKey(prodkey);
3945
3946 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
3947 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3948 ok(pf_exists("msitest\\maximus"), "File deleted\n");
3949 ok(pf_exists("msitest"), "File deleted\n");
3950
3951 state = MsiQueryProductStateA(prodcode);
3952 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3953
3954 state = MsiQueryFeatureStateA(prodcode, "feature");
3955 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3956
3957 state = MsiQueryFeatureStateA(prodcode, "montecristo");
3958 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3959
3960 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
3961 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
3962 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
3963 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
3964
3965 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
3966 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
3967
3968 /* complete install */
3969 r = MsiInstallProductA(msifile, "FULL=1");
3970 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
3971 ok(pf_exists("msitest\\maximus"), "File not installed\n");
3972 ok(pf_exists("msitest"), "File not installed\n");
3973
3974 state = MsiQueryProductStateA(prodcode);
3975 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
3976
3977 state = MsiQueryFeatureStateA(prodcode, "feature");
3978 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
3979
3980 state = 0xdead;
3981 SetLastError(0xdeadbeef);
3982 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, "feature", &state);
3983 error = GetLastError();
3984 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3985 ok(state == 0xdead, "got %d\n", state);
3986 ok(error == 0xdeadbeef, "got %u\n", error);
3987
3988 state = 0xdead;
3989 SetLastError(0xdeadbeef);
3990 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, "feature", &state);
3991 error = GetLastError();
3992 ok(r == ERROR_UNKNOWN_PRODUCT, "got %u\n", r);
3993 ok(state == 0xdead, "got %d\n", state);
3994 ok(error == ERROR_SUCCESS, "got %u\n", error);
3995
3996 state = 0xdead;
3997 SetLastError(0xdeadbeef);
3998 r = pMsiQueryFeatureStateExA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED, "feature", &state);
3999 error = GetLastError();
4000 ok(r == ERROR_SUCCESS, "got %u\n", r);
4001 ok(state == INSTALLSTATE_LOCAL, "got %d\n", state);
4002 ok(error == ERROR_SUCCESS, "got %u\n", error);
4003
4004 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4005 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4006
4007 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4008 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4009 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4010 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4011
4012 if (is_64bit)
4013 {
4014 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4015 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4016 }
4017 else
4018 {
4019 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4020 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4021 }
4022
4023 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4024 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4025 CHECK_REG_STR(prodkey, "InstallDate", date);
4026 CHECK_REG_STR(prodkey, "InstallSource", temp);
4027 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4028 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4029 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4030 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4031 CHECK_REG_STR(prodkey, "Comments", NULL);
4032 CHECK_REG_STR(prodkey, "Contact", NULL);
4033 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4034 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4035 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4036 CHECK_REG_STR(prodkey, "Readme", NULL);
4037 CHECK_REG_STR(prodkey, "Size", NULL);
4038 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4039 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4040 CHECK_REG_DWORD(prodkey, "Language", 1033);
4041 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4042 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4043 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4044 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4045 todo_wine
4046 {
4047 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4048 }
4049
4050 RegCloseKey(prodkey);
4051
4052 /* no UnpublishFeatures */
4053 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4054 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4055 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4056 ok(!pf_exists("msitest"), "Directory not deleted\n");
4057
4058 state = MsiQueryProductStateA(prodcode);
4059 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4060
4061 state = MsiQueryFeatureStateA(prodcode, "feature");
4062 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4063
4064 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4065 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4066
4067 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4068 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4069 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4070 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4071
4072 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
4073 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4074
4075 /* complete install */
4076 r = MsiInstallProductA(msifile, "FULL=1");
4077 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4078 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4079 ok(pf_exists("msitest"), "File not installed\n");
4080
4081 state = MsiQueryProductStateA(prodcode);
4082 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4083
4084 state = MsiQueryFeatureStateA(prodcode, "feature");
4085 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4086
4087 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4088 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4089
4090 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4091 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4092 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4093 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4094
4095 if (is_64bit)
4096 {
4097 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4098 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4099 }
4100 else
4101 {
4102 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4103 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4104 }
4105
4106 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4107 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4108 CHECK_REG_STR(prodkey, "InstallDate", date);
4109 CHECK_REG_STR(prodkey, "InstallSource", temp);
4110 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4111 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4112 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4113 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4114 CHECK_REG_STR(prodkey, "Comments", NULL);
4115 CHECK_REG_STR(prodkey, "Contact", NULL);
4116 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4117 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4118 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4119 CHECK_REG_STR(prodkey, "Readme", NULL);
4120 CHECK_REG_STR(prodkey, "Size", NULL);
4121 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4122 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4123 CHECK_REG_DWORD(prodkey, "Language", 1033);
4124 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4125 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4126 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4127 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4128 todo_wine
4129 {
4130 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4131 }
4132
4133 RegCloseKey(prodkey);
4134
4135 /* UnpublishFeatures, only feature removed. Only works when entire product is removed */
4136 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature");
4137 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4138 ok(pf_exists("msitest\\maximus"), "File deleted\n");
4139 ok(pf_exists("msitest"), "Directory deleted\n");
4140
4141 state = MsiQueryProductStateA(prodcode);
4142 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4143
4144 state = MsiQueryFeatureStateA(prodcode, "feature");
4145 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4146
4147 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4148 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4149
4150 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4151 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4152 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4153 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4154
4155 if (is_64bit)
4156 {
4157 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4158 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4159 }
4160 else
4161 {
4162 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4163 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4164 }
4165
4166 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4167 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4168 CHECK_REG_STR(prodkey, "InstallDate", date);
4169 CHECK_REG_STR(prodkey, "InstallSource", temp);
4170 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4171 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4172 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4173 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4174 CHECK_REG_STR(prodkey, "Comments", NULL);
4175 CHECK_REG_STR(prodkey, "Contact", NULL);
4176 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4177 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4178 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4179 CHECK_REG_STR(prodkey, "Readme", NULL);
4180 CHECK_REG_STR(prodkey, "Size", NULL);
4181 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4182 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4183 CHECK_REG_DWORD(prodkey, "Language", 1033);
4184 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4185 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4186 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4187 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4188 todo_wine
4189 {
4190 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4191 }
4192
4193 RegCloseKey(prodkey);
4194
4195 /* complete install */
4196 r = MsiInstallProductA(msifile, "FULL=1");
4197 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4198 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4199 ok(pf_exists("msitest"), "File not installed\n");
4200
4201 state = MsiQueryProductStateA(prodcode);
4202 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4203
4204 state = MsiQueryFeatureStateA(prodcode, "feature");
4205 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4206
4207 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4208 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4209
4210 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4211 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4212 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4213 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4214
4215 if (is_64bit)
4216 {
4217 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4218 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4219 }
4220 else
4221 {
4222 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4223 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4224 }
4225
4226 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4227 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4228 CHECK_REG_STR(prodkey, "InstallDate", date);
4229 CHECK_REG_STR(prodkey, "InstallSource", temp);
4230 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4231 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4232 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4233 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4234 CHECK_REG_STR(prodkey, "Comments", NULL);
4235 CHECK_REG_STR(prodkey, "Contact", NULL);
4236 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4237 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4238 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4239 CHECK_REG_STR(prodkey, "Readme", NULL);
4240 CHECK_REG_STR(prodkey, "Size", NULL);
4241 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4242 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4243 CHECK_REG_DWORD(prodkey, "Language", 1033);
4244 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4245 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4246 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4247 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4248 todo_wine
4249 {
4250 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -20, 10, 24);
4251 }
4252
4253 RegCloseKey(prodkey);
4254
4255 /* UnpublishFeatures, both features removed */
4256 r = MsiInstallProductA(msifile, "UNPUBLISH_FEATURES=1 REMOVE=feature,montecristo");
4257 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4258 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4259 ok(!pf_exists("msitest"), "Directory not deleted\n");
4260
4261 state = MsiQueryProductStateA(prodcode);
4262 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4263
4264 state = MsiQueryFeatureStateA(prodcode, "feature");
4265 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4266
4267 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4268 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4269
4270 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4271 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4272 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4273 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4274
4275 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
4276 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4277
4278 /* complete install */
4279 r = MsiInstallProductA(msifile, "FULL=1");
4280 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4281 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4282 ok(pf_exists("msitest"), "File not installed\n");
4283
4284 state = MsiQueryProductStateA(prodcode);
4285 ok(state == INSTALLSTATE_DEFAULT, "Expected INSTALLSTATE_DEFAULT, got %d\n", state);
4286
4287 state = MsiQueryFeatureStateA(prodcode, "feature");
4288 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4289
4290 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4291 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4292
4293 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4294 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4295 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4296 ok(state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
4297
4298 if (is_64bit)
4299 {
4300 res = RegOpenKeyExA(uninstall_32node, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4301 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4302 }
4303 else
4304 {
4305 res = RegOpenKeyExA(uninstall, prodcode, 0, KEY_ALL_ACCESS, &prodkey);
4306 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4307 }
4308
4309 CHECK_REG_STR(prodkey, "DisplayName", "MSITEST");
4310 CHECK_REG_STR(prodkey, "DisplayVersion", "1.1.1");
4311 CHECK_REG_STR(prodkey, "InstallDate", date);
4312 CHECK_REG_STR(prodkey, "InstallSource", temp);
4313 CHECK_REG_ISTR(prodkey, "ModifyPath", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4314 CHECK_REG_STR(prodkey, "Publisher", "Wine");
4315 CHECK_REG_STR(prodkey, "UninstallString", "MsiExec.exe /I{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}");
4316 CHECK_REG_STR(prodkey, "AuthorizedCDFPrefix", NULL);
4317 CHECK_REG_STR(prodkey, "Comments", NULL);
4318 CHECK_REG_STR(prodkey, "Contact", NULL);
4319 CHECK_REG_STR(prodkey, "HelpLink", NULL);
4320 CHECK_REG_STR(prodkey, "HelpTelephone", NULL);
4321 CHECK_REG_STR(prodkey, "InstallLocation", NULL);
4322 CHECK_REG_STR(prodkey, "Readme", NULL);
4323 CHECK_REG_STR(prodkey, "Size", NULL);
4324 CHECK_REG_STR(prodkey, "URLInfoAbout", NULL);
4325 CHECK_REG_STR(prodkey, "URLUpdateInfo", NULL);
4326 CHECK_REG_DWORD(prodkey, "Language", 1033);
4327 CHECK_REG_DWORD(prodkey, "Version", 0x1010001);
4328 CHECK_REG_DWORD(prodkey, "VersionMajor", 1);
4329 CHECK_REG_DWORD(prodkey, "VersionMinor", 1);
4330 CHECK_REG_DWORD(prodkey, "WindowsInstaller", 1);
4331 todo_wine
4332 {
4333 CHECK_REG_DWORD4(prodkey, "EstimatedSize", 12, -12, 10, 24);
4334 }
4335
4336 RegCloseKey(prodkey);
4337
4338 /* complete uninstall */
4339 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4340 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4341 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4342 ok(!pf_exists("msitest"), "Directory not deleted\n");
4343
4344 state = MsiQueryProductStateA(prodcode);
4345 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4346
4347 state = MsiQueryFeatureStateA(prodcode, "feature");
4348 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4349
4350 state = MsiQueryFeatureStateA(prodcode, "montecristo");
4351 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4352
4353 r = pMsiQueryComponentStateA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4354 "{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}", &state);
4355 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4356 ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state);
4357
4358 res = RegOpenKeyExA(uninstall, prodcode, 0, access, &prodkey);
4359 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4360
4361 /* make sure 'Program Files\msitest' is removed */
4362 delete_pfmsitest_files();
4363
4364 error:
4365 RegCloseKey(uninstall);
4366 RegCloseKey(uninstall_32node);
4367 DeleteFileA(msifile);
4368 DeleteFileA("msitest\\maximus");
4369 RemoveDirectoryA("msitest");
4370 }
4371
4372 static void test_publish_sourcelist(void)
4373 {
4374 UINT r;
4375 DWORD size;
4376 CHAR value[MAX_PATH];
4377 CHAR path[MAX_PATH];
4378 CHAR prodcode[] = "{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}";
4379
4380 if (!pMsiSourceListEnumSourcesA || !pMsiSourceListGetInfoA)
4381 {
4382 win_skip("MsiSourceListEnumSourcesA and/or MsiSourceListGetInfoA are not available\n");
4383 return;
4384 }
4385 if (is_process_limited())
4386 {
4387 skip("process is limited\n");
4388 return;
4389 }
4390
4391 CreateDirectoryA("msitest", NULL);
4392 create_file("msitest\\maximus", 500);
4393
4394 create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table));
4395
4396 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4397
4398 r = MsiInstallProductA(msifile, NULL);
4399 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4400 {
4401 skip("Not enough rights to perform tests\n");
4402 goto error;
4403 }
4404 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4405 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4406 ok(pf_exists("msitest"), "File not installed\n");
4407
4408 /* nothing published */
4409 size = MAX_PATH;
4410 lstrcpyA(value, "aaa");
4411 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4412 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4413 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4414 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4415 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4416
4417 size = MAX_PATH;
4418 lstrcpyA(value, "aaa");
4419 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4420 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4421 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4422 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4423 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4424
4425 r = MsiInstallProductA(msifile, "REGISTER_PRODUCT=1");
4426 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4427 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4428 ok(pf_exists("msitest"), "File not installed\n");
4429
4430 /* after RegisterProduct */
4431 size = MAX_PATH;
4432 lstrcpyA(value, "aaa");
4433 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4434 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4435 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4436 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4437 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4438
4439 size = MAX_PATH;
4440 lstrcpyA(value, "aaa");
4441 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4442 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4443 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4444 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4445 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4446
4447 r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1");
4448 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4449 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4450 ok(pf_exists("msitest"), "File not installed\n");
4451
4452 /* after ProcessComponents */
4453 size = MAX_PATH;
4454 lstrcpyA(value, "aaa");
4455 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4456 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4457 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4458 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4459 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4460
4461 size = MAX_PATH;
4462 lstrcpyA(value, "aaa");
4463 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4464 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4465 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4466 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4467 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4468
4469 r = MsiInstallProductA(msifile, "PUBLISH_FEATURES=1");
4470 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4471 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4472 ok(pf_exists("msitest"), "File not installed\n");
4473
4474 /* after PublishFeatures */
4475 size = MAX_PATH;
4476 lstrcpyA(value, "aaa");
4477 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4478 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4479 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4480 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4481 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4482
4483 size = MAX_PATH;
4484 lstrcpyA(value, "aaa");
4485 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4486 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4487 ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r);
4488 ok(size == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, size);
4489 ok(!lstrcmpA(value, "aaa"), "Expected \"aaa\", got \"%s\"\n", value);
4490
4491 r = MsiInstallProductA(msifile, "PUBLISH_PRODUCT=1");
4492 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4493 ok(pf_exists("msitest\\maximus"), "File not installed\n");
4494 ok(pf_exists("msitest"), "File not installed\n");
4495
4496 /* after PublishProduct */
4497 size = MAX_PATH;
4498 lstrcpyA(value, "aaa");
4499 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4500 MSICODE_PRODUCT, INSTALLPROPERTY_PACKAGENAMEA, value, &size);
4501 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4502 ok(!lstrcmpA(value, "msitest.msi"), "Expected 'msitest.msi', got %s\n", value);
4503 ok(size == 11, "Expected 11, got %d\n", size);
4504
4505 size = MAX_PATH;
4506 lstrcpyA(value, "aaa");
4507 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4508 MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, value, &size);
4509 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4510 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
4511 ok(size == 0, "Expected 0, got %d\n", size);
4512
4513 size = MAX_PATH;
4514 lstrcpyA(value, "aaa");
4515 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4516 MSICODE_PRODUCT, INSTALLPROPERTY_DISKPROMPTA, value, &size);
4517 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4518 ok(!lstrcmpA(value, ""), "Expected \"\", got \"%s\"\n", value);
4519 ok(size == 0, "Expected 0, got %d\n", size);
4520
4521 lstrcpyA(path, CURR_DIR);
4522 lstrcatA(path, "\\");
4523
4524 size = MAX_PATH;
4525 lstrcpyA(value, "aaa");
4526 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4527 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDSOURCEA, value, &size);
4528 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4529 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
4530 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
4531
4532 size = MAX_PATH;
4533 lstrcpyA(value, "aaa");
4534 r = pMsiSourceListGetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4535 MSICODE_PRODUCT, INSTALLPROPERTY_LASTUSEDTYPEA, value, &size);
4536 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4537 ok(!lstrcmpA(value, "n"), "Expected \"n\", got \"%s\"\n", value);
4538 ok(size == 1, "Expected 1, got %d\n", size);
4539
4540 size = MAX_PATH;
4541 lstrcpyA(value, "aaa");
4542 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4543 MSICODE_PRODUCT | MSISOURCETYPE_URL, 0, value, &size);
4544 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4545 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
4546 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
4547
4548 size = MAX_PATH;
4549 lstrcpyA(value, "aaa");
4550 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4551 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 0, value, &size);
4552 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4553 ok(!lstrcmpA(value, path), "Expected \"%s\", got \"%s\"\n", path, value);
4554 ok(size == lstrlenA(path), "Expected %d, got %d\n", lstrlenA(path), size);
4555
4556 size = MAX_PATH;
4557 lstrcpyA(value, "aaa");
4558 r = pMsiSourceListEnumSourcesA(prodcode, NULL, MSIINSTALLCONTEXT_USERUNMANAGED,
4559 MSICODE_PRODUCT | MSISOURCETYPE_NETWORK, 1, value, &size);
4560 ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
4561 ok(!lstrcmpA(value, "aaa"), "Expected value to be unchanged, got %s\n", value);
4562 ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size);
4563
4564 /* complete uninstall */
4565 r = MsiInstallProductA(msifile, "FULL=1 REMOVE=ALL");
4566 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
4567 ok(!pf_exists("msitest\\maximus"), "File not deleted\n");
4568 ok(!pf_exists("msitest"), "Directory not deleted\n");
4569
4570 /* make sure 'Program Files\msitest' is removed */
4571 delete_pfmsitest_files();
4572
4573 error:
4574 DeleteFileA(msifile);
4575 DeleteFileA("msitest\\maximus");
4576 RemoveDirectoryA("msitest");
4577 }
4578
4579 static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
4580 {
4581 CHAR path[MAX_PATH];
4582
4583 lstrcpyA(path, PROG_FILES_DIR);
4584 lstrcatA(path, "\\");
4585 lstrcatA(path, file);
4586
4587 if (is_file)
4588 create_file_data(path, data, 500);
4589 else
4590 CreateDirectoryA(path, NULL);
4591 }
4592
4593 #define create_pf(file, is_file) create_pf_data(file, file, is_file)
4594
4595 static void test_remove_files(void)
4596 {
4597 UINT r;
4598
4599 if (is_process_limited())
4600 {
4601 skip("process is limited\n");
4602 return;
4603 }
4604
4605 CreateDirectoryA("msitest", NULL);
4606 create_file("msitest\\hydrogen", 500);
4607 create_file("msitest\\helium", 500);
4608 create_file("msitest\\lithium", 500);
4609
4610 create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table));
4611
4612 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4613
4614 r = MsiInstallProductA(msifile, NULL);
4615 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4616 {
4617 skip("Not enough rights to perform tests\n");
4618 goto error;
4619 }
4620 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4621 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4622 ok(!pf_exists("msitest\\helium"), "File installed\n");
4623 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4624 ok(pf_exists("msitest"), "File not installed\n");
4625
4626 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4627 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4628 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4629 ok(!pf_exists("msitest\\helium"), "File not deleted\n");
4630 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4631 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4632
4633 create_pf("msitest", FALSE);
4634 create_pf("msitest\\hydrogen", TRUE);
4635 create_pf("msitest\\helium", TRUE);
4636 create_pf("msitest\\lithium", TRUE);
4637
4638 r = MsiInstallProductA(msifile, NULL);
4639 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4640 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4641 ok(pf_exists("msitest\\helium"), "File not installed\n");
4642 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4643 ok(pf_exists("msitest"), "File not installed\n");
4644
4645 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4646 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4647 ok(!pf_exists("msitest\\hydrogen"), "File not deleted\n");
4648 ok(delete_pf("msitest\\helium", TRUE), "File deleted\n");
4649 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4650 ok(delete_pf("msitest", FALSE), "Directory deleted\n");
4651
4652 create_pf("msitest", FALSE);
4653 create_pf("msitest\\furlong", TRUE);
4654 create_pf("msitest\\firkin", TRUE);
4655 create_pf("msitest\\fortnight", TRUE);
4656 create_pf("msitest\\becquerel", TRUE);
4657 create_pf("msitest\\dioptre", TRUE);
4658 create_pf("msitest\\attoparsec", TRUE);
4659 create_pf("msitest\\storeys", TRUE);
4660 create_pf("msitest\\block", TRUE);
4661 create_pf("msitest\\siriometer", TRUE);
4662 create_pf("msitest\\cabout", FALSE);
4663 create_pf("msitest\\cabout\\blocker", TRUE);
4664
4665 r = MsiInstallProductA(msifile, NULL);
4666 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4667 ok(pf_exists("msitest\\hydrogen"), "File not installed\n");
4668 ok(!pf_exists("msitest\\helium"), "File installed\n");
4669 ok(pf_exists("msitest\\lithium"), "File not installed\n");
4670 ok(!pf_exists("msitest\\furlong"), "File not deleted\n");
4671 ok(!pf_exists("msitest\\firkin"), "File not deleted\n");
4672 ok(!pf_exists("msitest\\fortnight"), "File not deleted\n");
4673 ok(pf_exists("msitest\\becquerel"), "File not installed\n");
4674 ok(pf_exists("msitest\\dioptre"), "File not installed\n");
4675 ok(pf_exists("msitest\\attoparsec"), "File not installed\n");
4676 ok(!pf_exists("msitest\\storeys"), "File not deleted\n");
4677 ok(!pf_exists("msitest\\block"), "File not deleted\n");
4678 ok(!pf_exists("msitest\\siriometer"), "File not deleted\n");
4679 ok(pf_exists("msitest\\cabout"), "Directory removed\n");
4680 ok(pf_exists("msitest"), "File not installed\n");
4681
4682 create_pf("msitest\\furlong", TRUE);
4683 create_pf("msitest\\firkin", TRUE);
4684 create_pf("msitest\\fortnight", TRUE);
4685 create_pf("msitest\\storeys", TRUE);
4686 create_pf("msitest\\block", TRUE);
4687 create_pf("msitest\\siriometer", TRUE);
4688
4689 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4690 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4691 ok(!delete_pf("msitest\\hydrogen", TRUE), "File not deleted\n");
4692 ok(!delete_pf("msitest\\helium", TRUE), "File not deleted\n");
4693 ok(delete_pf("msitest\\lithium", TRUE), "File deleted\n");
4694 ok(delete_pf("msitest\\furlong", TRUE), "File deleted\n");
4695 ok(delete_pf("msitest\\firkin", TRUE), "File deleted\n");
4696 ok(delete_pf("msitest\\fortnight", TRUE), "File deleted\n");
4697 ok(!delete_pf("msitest\\becquerel", TRUE), "File not deleted\n");
4698 ok(!delete_pf("msitest\\dioptre", TRUE), "File not deleted\n");
4699 ok(delete_pf("msitest\\attoparsec", TRUE), "File deleted\n");
4700 ok(!delete_pf("msitest\\storeys", TRUE), "File not deleted\n");
4701 ok(!delete_pf("msitest\\block", TRUE), "File not deleted\n");
4702 ok(delete_pf("msitest\\siriometer", TRUE), "File deleted\n");
4703 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4704 ok(pf_exists("msitest"), "Directory deleted\n");
4705
4706 r = MsiInstallProductA(msifile, NULL);
4707 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4708 ok(delete_pf("msitest\\hydrogen", TRUE), "File not installed\n");
4709 ok(!delete_pf("msitest\\helium", TRUE), "File installed\n");
4710 ok(delete_pf("msitest\\lithium", TRUE), "File not installed\n");
4711 ok(pf_exists("msitest\\cabout"), "Directory deleted\n");
4712 ok(pf_exists("msitest"), "Directory deleted\n");
4713
4714 delete_pf("msitest\\cabout\\blocker", TRUE);
4715
4716 r = MsiInstallProductA(msifile, "REMOVE=ALL");
4717 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4718 ok(!delete_pf("msitest\\cabout", FALSE), "Directory not deleted\n");
4719 delete_pf("msitest", FALSE);
4720
4721 error:
4722 DeleteFileA(msifile);
4723 DeleteFileA("msitest\\hydrogen");
4724 DeleteFileA("msitest\\helium");
4725 DeleteFileA("msitest\\lithium");
4726 RemoveDirectoryA("msitest");
4727 }
4728
4729 static void test_move_files(void)
4730 {
4731 UINT r;
4732 char props[MAX_PATH];
4733
4734 if (is_process_limited())
4735 {
4736 skip("process is limited\n");
4737 return;
4738 }
4739
4740 CreateDirectoryA("msitest", NULL);
4741 create_file("msitest\\augustus", 100);
4742 create_file("cameroon", 100);
4743 create_file("djibouti", 100);
4744 create_file("egypt", 100);
4745 create_file("finland", 100);
4746 create_file("gambai", 100);
4747 create_file("honduras", 100);
4748 create_file("msitest\\india", 100);
4749 create_file("japan", 100);
4750 create_file("kenya", 100);
4751 CreateDirectoryA("latvia", NULL);
4752 create_file("nauru", 100);
4753 create_file("peru", 100);
4754 create_file("apple", 100);
4755 create_file("application", 100);
4756 create_file("ape", 100);
4757 create_file("foo", 100);
4758 create_file("fao", 100);
4759 create_file("fbod", 100);
4760 create_file("budding", 100);
4761 create_file("buddy", 100);
4762 create_file("bud", 100);
4763 create_file("bar", 100);
4764 create_file("bur", 100);
4765 create_file("bird", 100);
4766
4767 create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table));
4768
4769 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4770
4771 /* if the source or dest property is not a full path,
4772 * windows tries to access it as a network resource
4773 */
4774
4775 sprintf(props, "SOURCEFULL=\"%s\\\" DESTFULL=\"%s\\msitest\" "
4776 "FILEPATHBAD=\"%s\\japan\" FILEPATHGOOD=\"%s\\kenya\"",
4777 CURR_DIR, PROG_FILES_DIR, CURR_DIR, CURR_DIR);
4778
4779 r = MsiInstallProductA(msifile, props);
4780 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4781 {
4782 skip("Not enough rights to perform tests\n");
4783 goto error;
4784 }
4785 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4786 ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
4787 ok(!delete_pf("msitest\\dest", TRUE), "File copied\n");
4788 ok(delete_pf("msitest\\canada", TRUE), "File not copied\n");
4789 ok(delete_pf("msitest\\dominica", TRUE), "File not moved\n");
4790 ok(!delete_pf("msitest\\elsalvador", TRUE), "File moved\n");
4791 ok(!delete_pf("msitest\\france", TRUE), "File moved\n");
4792 ok(!delete_pf("msitest\\georgia", TRUE), "File moved\n");
4793 ok(delete_pf("msitest\\hungary", TRUE), "File not moved\n");
4794 ok(!delete_pf("msitest\\indonesia", TRUE), "File moved\n");
4795 ok(!delete_pf("msitest\\jordan", TRUE), "File moved\n");
4796 ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
4797 ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
4798 ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
4799 ok(delete_pf("msitest\\poland", TRUE), "File not moved\n");
4800 /* either apple or application will be moved depending on directory order */
4801 if (!delete_pf("msitest\\apple", TRUE))
4802 ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
4803 else
4804 ok(!delete_pf("msitest\\application", TRUE), "File should not exist\n");
4805 ok(delete_pf("msitest\\wildcard", TRUE), "File not moved\n");
4806 ok(!delete_pf("msitest\\ape", TRUE), "File moved\n");
4807 /* either fao or foo will be moved depending on directory order */
4808 if (delete_pf("msitest\\foo", TRUE))
4809 ok(!delete_pf("msitest\\fao", TRUE), "File should not exist\n");
4810 else
4811 ok(delete_pf("msitest\\fao", TRUE), "File not moved\n");
4812 ok(delete_pf("msitest\\single", TRUE), "File not moved\n");
4813 ok(!delete_pf("msitest\\fbod", TRUE), "File moved\n");
4814 ok(delete_pf("msitest\\budding", TRUE), "File not moved\n");
4815 ok(delete_pf("msitest\\buddy", TRUE), "File not moved\n");
4816 ok(!delete_pf("msitest\\bud", TRUE), "File moved\n");
4817 ok(delete_pf("msitest\\bar", TRUE), "File not moved\n");
4818 ok(delete_pf("msitest\\bur", TRUE), "File not moved\n");
4819 ok(!delete_pf("msitest\\bird", TRUE), "File moved\n");
4820 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4821 ok(DeleteFileA("cameroon"), "File moved\n");
4822 ok(!DeleteFileA("djibouti"), "File not moved\n");
4823 ok(DeleteFileA("egypt"), "File moved\n");
4824 ok(DeleteFileA("finland"), "File moved\n");
4825 ok(DeleteFileA("gambai"), "File moved\n");
4826 ok(!DeleteFileA("honduras"), "File not moved\n");
4827 ok(DeleteFileA("msitest\\india"), "File moved\n");
4828 ok(DeleteFileA("japan"), "File moved\n");
4829 ok(!DeleteFileA("kenya"), "File not moved\n");
4830 ok(RemoveDirectoryA("latvia"), "Directory moved\n");
4831 ok(!DeleteFileA("nauru"), "File not moved\n");
4832 ok(!DeleteFileA("peru"), "File not moved\n");
4833 ok(!DeleteFileA("apple"), "File not moved\n");
4834 ok(!DeleteFileA("application"), "File not moved\n");
4835 ok(DeleteFileA("ape"), "File moved\n");
4836 ok(!DeleteFileA("foo"), "File not moved\n");
4837 ok(!DeleteFileA("fao"), "File not moved\n");
4838 ok(DeleteFileA("fbod"), "File moved\n");
4839 ok(!DeleteFileA("budding"), "File not moved\n");
4840 ok(!DeleteFileA("buddy"), "File not moved\n");
4841 ok(DeleteFileA("bud"), "File moved\n");
4842 ok(!DeleteFileA("bar"), "File not moved\n");
4843 ok(!DeleteFileA("bur"), "File not moved\n");
4844 ok(DeleteFileA("bird"), "File moved\n");
4845
4846 error:
4847 DeleteFileA("cameroon");
4848 DeleteFileA("djibouti");
4849 DeleteFileA("egypt");
4850 DeleteFileA("finland");
4851 DeleteFileA("gambai");
4852 DeleteFileA("honduras");
4853 DeleteFileA("japan");
4854 DeleteFileA("kenya");
4855 DeleteFileA("nauru");
4856 DeleteFileA("peru");
4857 DeleteFileA("apple");
4858 DeleteFileA("application");
4859 DeleteFileA("ape");
4860 DeleteFileA("foo");
4861 DeleteFileA("fao");
4862 DeleteFileA("fbod");
4863 DeleteFileA("budding");
4864 DeleteFileA("buddy");
4865 DeleteFileA("bud");
4866 DeleteFileA("bar");
4867 DeleteFileA("bur");
4868 DeleteFileA("bird");
4869 DeleteFileA("msitest\\india");
4870 DeleteFileA("msitest\\augustus");
4871 RemoveDirectoryA("latvia");
4872 RemoveDirectoryA("msitest");
4873 DeleteFileA(msifile);
4874 }
4875
4876 static void test_duplicate_files(void)
4877 {
4878 UINT r;
4879
4880 if (is_process_limited())
4881 {
4882 skip("process is limited\n");
4883 return;
4884 }
4885
4886 CreateDirectoryA("msitest", NULL);
4887 create_file("msitest\\maximus", 500);
4888 create_database(msifile, df_tables, sizeof(df_tables) / sizeof(msi_table));
4889
4890 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4891
4892 /* fails if the destination folder is not a valid property */
4893
4894 r = MsiInstallProductA(msifile, NULL);
4895 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4896 {
4897 skip("Not enough rights to perform tests\n");
4898 goto error;
4899 }
4900 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4901 ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
4902 ok(delete_pf("msitest\\augustus", TRUE), "File not duplicated\n");
4903 ok(delete_pf("msitest\\this\\doesnot\\exist\\maximus", TRUE), "File not duplicated\n");
4904 ok(delete_pf("msitest\\this\\doesnot\\exist", FALSE), "Directory not created\n");
4905 ok(delete_pf("msitest\\this\\doesnot", FALSE), "Directory not created\n");
4906 ok(delete_pf("msitest\\this", FALSE), "Directory not created\n");
4907 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4908
4909 error:
4910 DeleteFileA("msitest\\maximus");
4911 RemoveDirectoryA("msitest");
4912 DeleteFileA(msifile);
4913 }
4914
4915 static void test_write_registry_values(void)
4916 {
4917 UINT r;
4918 LONG res;
4919 HKEY hkey;
4920 DWORD type, size;
4921 CHAR path[MAX_PATH];
4922
4923 if (is_process_limited())
4924 {
4925 skip("process is limited\n");
4926 return;
4927 }
4928
4929 CreateDirectoryA("msitest", NULL);
4930 create_file("msitest\\augustus", 500);
4931
4932 create_database(msifile, wrv_tables, sizeof(wrv_tables) / sizeof(msi_table));
4933
4934 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
4935
4936 if (is_64bit)
4937 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Wine\\msitest", 0, NULL, 0,
4938 KEY_ALL_ACCESS, NULL, &hkey, NULL);
4939 else
4940 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", 0, NULL, 0, KEY_ALL_ACCESS,
4941 NULL, &hkey, NULL);
4942 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4943
4944 res = RegSetValueExA(hkey, "Value1", 0, REG_MULTI_SZ, (const BYTE *)"two\0", 5);
4945 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4946 res = RegSetValueExA(hkey, "Value2", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4947 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4948 res = RegSetValueExA(hkey, "Value3", 0, REG_MULTI_SZ, (const BYTE *)"two\0", 5);
4949 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4950 res = RegSetValueExA(hkey, "Value4", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4951 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4952 res = RegSetValueExA(hkey, "Value5", 0, REG_MULTI_SZ, (const BYTE *)"one\0two\0", 9);
4953 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4954 res = RegSetValueExA(hkey, "Value6", 0, REG_MULTI_SZ, (const BYTE *)"one\0", 5);
4955 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4956 res = RegSetValueExA(hkey, "Value7", 0, REG_SZ, (const BYTE *)"one", 4);
4957 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4958 RegCloseKey(hkey);
4959
4960 r = MsiInstallProductA(msifile, NULL);
4961 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
4962 {
4963 skip("Not enough rights to perform tests\n");
4964 goto error;
4965 }
4966 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
4967 ok(delete_pf("msitest\\augustus", TRUE), "File installed\n");
4968 ok(delete_pf("msitest", FALSE), "Directory not created\n");
4969
4970 if (is_64bit)
4971 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wow6432Node\\Wine\\msitest", 0, KEY_ALL_ACCESS, &hkey);
4972 else
4973 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest", 0, KEY_ALL_ACCESS, &hkey);
4974 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4975
4976 size = MAX_PATH;
4977 type = 0xdeadbeef;
4978 memset(path, 'a', MAX_PATH);
4979 res = RegQueryValueExA(hkey, "Value", NULL, &type, (LPBYTE)path, &size);
4980 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4981 ok(!memcmp(path, "one\0two\0three\0\0", size), "Wrong multi-sz data\n");
4982 ok(size == 15, "Expected 15, got %d\n", size);
4983 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4984
4985 res = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL);
4986 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
4987
4988 res = action_RegDeleteTreeA(hkey, "VisualStudio", KEY_ALL_ACCESS);
4989 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4990
4991 size = MAX_PATH;
4992 type = 0xdeadbeef;
4993 memset(path, 'a', MAX_PATH);
4994 res = RegQueryValueExA(hkey, "Value1", NULL, &type, (LPBYTE)path, &size);
4995 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
4996 ok(!memcmp(path, "one\0", size), "Wrong multi-sz data\n");
4997 ok(size == 5, "Expected 5, got %d\n", size);
4998 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
4999
5000 size = MAX_PATH;
5001 type = 0xdeadbeef;
5002 memset(path, 'a', MAX_PATH);
5003 res = RegQueryValueExA(hkey, "Value2", NULL, &type, (LPBYTE)path, &size);
5004 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5005 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
5006 ok(size == 9, "Expected 9, got %d\n", size);
5007 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5008
5009 size = MAX_PATH;
5010 type = 0xdeadbeef;
5011 memset(path, 'a', MAX_PATH);
5012 res = RegQueryValueExA(hkey, "Value3", NULL, &type, (LPBYTE)path, &size);
5013 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5014 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
5015 ok(size == 9, "Expected 9, got %d\n", size);
5016 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5017
5018 size = MAX_PATH;
5019 type = 0xdeadbeef;
5020 memset(path, 'a', MAX_PATH);
5021 res = RegQueryValueExA(hkey, "Value4", NULL, &type, (LPBYTE)path, &size);
5022 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5023 ok(!memcmp(path, "one\0two\0", size), "Wrong multi-sz data\n");
5024 ok(size == 9, "Expected 9, got %d\n", size);
5025 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5026
5027 size = MAX_PATH;
5028 type = 0xdeadbeef;
5029 memset(path, 'a', MAX_PATH);
5030 res = RegQueryValueExA(hkey, "Value5", NULL, &type, (LPBYTE)path, &size);
5031 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5032 ok(!memcmp(path, "one\0two\0three\0", size), "Wrong multi-sz data\n");
5033 ok(size == 15, "Expected 15, got %d\n", size);
5034 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5035
5036 size = MAX_PATH;
5037 type = 0xdeadbeef;
5038 memset(path, 'a', MAX_PATH);
5039 res = RegQueryValueExA(hkey, "Value6", NULL, &type, (LPBYTE)path, &size);
5040 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5041 ok(!memcmp(path, "", size), "Wrong multi-sz data\n");
5042 ok(size == 1, "Expected 1, got %d\n", size);
5043 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5044
5045 size = MAX_PATH;
5046 type = 0xdeadbeef;
5047 memset(path, 'a', MAX_PATH);
5048 res = RegQueryValueExA(hkey, "Value7", NULL, &type, (LPBYTE)path, &size);
5049 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5050 ok(!memcmp(path, "two\0", size), "Wrong multi-sz data\n");
5051 ok(size == 5, "Expected 5, got %d\n", size);
5052 ok(type == REG_MULTI_SZ, "Expected REG_MULTI_SZ, got %d\n", type);
5053
5054 RegDeleteValueA(hkey, "Value");
5055 RegDeleteValueA(hkey, "Value1");
5056 RegDeleteValueA(hkey, "Value2");
5057 RegDeleteValueA(hkey, "Value3");
5058 RegDeleteValueA(hkey, "Value4");
5059 RegDeleteValueA(hkey, "Value5");
5060 RegDeleteValueA(hkey, "Value6");
5061 RegDeleteValueA(hkey, "Value7");
5062 RegCloseKey(hkey);
5063 RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
5064
5065 error:
5066 DeleteFileA(msifile);
5067 DeleteFileA("msitest\\augustus");
5068 RemoveDirectoryA("msitest");
5069 }
5070
5071 static void test_envvar(void)
5072 {
5073 static const char *results[] =
5074 {
5075 "1;2", /* MSITESTVAR11 */
5076 "1", /* MSITESTVAR12 */
5077 "1;2", /* MSITESTVAR13 */
5078 ";1;", /* MSITESTVAR14 */
5079 ";;1;;", /* MSITESTVAR15 */
5080 " 1 ", /* MSITESTVAR16 */
5081 ";;2;;1", /* MSITESTVAR17 */
5082 "1;;2;;", /* MSITESTVAR18 */
5083 "1", /* MSITESTVAR19 */
5084 "1", /* MSITESTVAR20 */
5085 NULL
5086 };
5087 UINT r;
5088 HKEY env;
5089 LONG res;
5090 DWORD type, size;
5091 char buffer[16];
5092 UINT i;
5093
5094 if (is_process_limited())
5095 {
5096 skip("process is limited\n");
5097 return;
5098 }
5099
5100 create_test_files();
5101 create_database(msifile, env_tables, sizeof(env_tables) / sizeof(msi_table));
5102
5103 res = RegCreateKeyExA(HKEY_CURRENT_USER, "Environment", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &env, NULL);
5104 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5105
5106 res = RegSetValueExA(env, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"0", 2);
5107 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5108
5109 res = RegSetValueExA(env, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"0", 2);
5110 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5111
5112 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5113
5114 r = MsiInstallProductA(msifile, NULL);
5115 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5116 {
5117 skip("Not enough rights to perform tests\n");
5118 goto error;
5119 }
5120 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5121
5122 type = REG_NONE;
5123 size = sizeof(buffer);
5124 buffer[0] = 0;
5125 res = RegQueryValueExA(env, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
5126 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5127 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
5128 ok(!lstrcmpA(buffer, "1"), "Expected \"1\", got %s\n", buffer);
5129
5130 res = RegDeleteValueA(env, "MSITESTVAR1");
5131 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5132
5133 type = REG_NONE;
5134 size = sizeof(buffer);
5135 buffer[0] = 0;
5136 res = RegQueryValueExA(env, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
5137 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5138 ok(type == REG_SZ, "Expected REG_SZ, got %u\n", type);
5139 ok(!lstrcmpA(buffer, "1"), "Expected \"1\", got %s\n", buffer);
5140
5141 res = RegDeleteValueA(env, "MSITESTVAR2");
5142 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5143
5144 res = RegDeleteValueA(env, "MSITESTVAR3");
5145 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5146
5147 res = RegDeleteValueA(env, "MSITESTVAR4");
5148 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5149
5150 res = RegDeleteValueA(env, "MSITESTVAR5");
5151 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5152
5153 res = RegDeleteValueA(env, "MSITESTVAR6");
5154 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5155
5156 res = RegDeleteValueA(env, "MSITESTVAR7");
5157 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5158
5159 res = RegDeleteValueA(env, "MSITESTVAR8");
5160 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5161
5162 res = RegDeleteValueA(env, "MSITESTVAR9");
5163 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5164
5165 res = RegDeleteValueA(env, "MSITESTVAR10");
5166 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
5167
5168 i = 11;
5169 while (results[i - 11])
5170 {
5171 char name[20];
5172 sprintf(name, "MSITESTVAR%d", i);
5173
5174 type = REG_NONE;
5175 size = sizeof(buffer);
5176 buffer[0] = 0;
5177 res = RegQueryValueExA(env, name, NULL, &type, (LPBYTE)buffer, &size);
5178 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
5179 ok(type == REG_SZ, "%d: Expected REG_SZ, got %u\n", i, type);
5180 ok(!lstrcmpA(buffer, results[i - 11]), "%d: Expected %s, got %s\n", i, results[i - 11], buffer);
5181
5182 res = RegDeleteValueA(env, name);
5183 ok(res == ERROR_SUCCESS, "%d: Expected ERROR_SUCCESS, got %d\n", i, res);
5184 i++;
5185 }
5186
5187 delete_pf("msitest\\cabout\\new\\five.txt", TRUE);
5188 delete_pf("msitest\\cabout\\new", FALSE);
5189 delete_pf("msitest\\cabout\\four.txt", TRUE);
5190 delete_pf("msitest\\cabout", FALSE);
5191 delete_pf("msitest\\changed\\three.txt", TRUE);
5192 delete_pf("msitest\\changed", FALSE);
5193 delete_pf("msitest\\first\\two.txt", TRUE);
5194 delete_pf("msitest\\first", FALSE);
5195 delete_pf("msitest\\filename", TRUE);
5196 delete_pf("msitest\\one.txt", TRUE);
5197 delete_pf("msitest\\service.exe", TRUE);
5198 delete_pf("msitest\\service2.exe", TRUE);
5199 delete_pf("msitest", FALSE);
5200
5201 error:
5202 RegDeleteValueA(env, "MSITESTVAR1");
5203 RegDeleteValueA(env, "MSITESTVAR2");
5204 RegCloseKey(env);
5205
5206 delete_test_files();
5207 DeleteFileA(msifile);
5208 }
5209
5210 static void test_create_remove_folder(void)
5211 {
5212 UINT r;
5213
5214 if (is_process_limited())
5215 {
5216 skip("process is limited\n");
5217 return;
5218 }
5219
5220 CreateDirectoryA("msitest", NULL);
5221 CreateDirectoryA("msitest\\first", NULL);
5222 CreateDirectoryA("msitest\\second", NULL);
5223 create_file("msitest\\first\\one.txt", 1000);
5224 create_file("msitest\\second\\two.txt", 1000);
5225 create_database(msifile, cf_tables, sizeof(cf_tables) / sizeof(msi_table));
5226
5227 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5228
5229 r = MsiInstallProductA(msifile, NULL);
5230 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5231 {
5232 skip("Not enough rights to perform tests\n");
5233 goto error;
5234 }
5235 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5236
5237 ok(pf_exists("msitest\\first\\one.txt"), "file not installed\n");
5238 ok(pf_exists("msitest\\first"), "directory not created\n");
5239 ok(pf_exists("msitest\\second\\two.txt"), "file not installed\n");
5240 ok(pf_exists("msitest\\second"), "directory not created\n");
5241 ok(pf_exists("msitest\\third"), "directory not created\n");
5242 ok(pf_exists("msitest"), "directory not created\n");
5243
5244 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5245 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5246
5247 ok(!pf_exists("msitest\\first\\one.txt"), "file not removed\n");
5248 ok(!pf_exists("msitest\\first"), "directory not removed\n");
5249 ok(!pf_exists("msitest\\second\\two.txt"), "file not removed\n");
5250 ok(!pf_exists("msitest\\second"), "directory not removed\n");
5251 ok(!pf_exists("msitest\\third"), "directory not removed\n");
5252 todo_wine ok(!pf_exists("msitest"), "directory not removed\n");
5253
5254 error:
5255 DeleteFileA("msitest\\first\\one.txt");
5256 DeleteFileA("msitest\\second\\two.txt");
5257 RemoveDirectoryA("msitest\\first");
5258 RemoveDirectoryA("msitest\\second");
5259 RemoveDirectoryA("msitest");
5260 DeleteFileA(msifile);
5261 }
5262
5263 static void test_start_services(void)
5264 {
5265 UINT r;
5266 SC_HANDLE scm, service;
5267 BOOL ret;
5268 DWORD error = ERROR_SUCCESS;
5269
5270 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5271 if (!scm && GetLastError() == ERROR_ACCESS_DENIED)
5272 {
5273 skip("Not enough rights to perform tests\n");
5274 return;
5275 }
5276 ok(scm != NULL, "Failed to open the SC Manager\n");
5277 if (!scm) return;
5278
5279 service = OpenServiceA(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
5280 if (!service && GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST)
5281 {
5282 win_skip("The 'Spooler' service does not exist\n");
5283 CloseServiceHandle(scm);
5284 return;
5285 }
5286 ok(service != NULL, "Failed to open Spooler, error %d\n", GetLastError());
5287 if (!service) {
5288 CloseServiceHandle(scm);
5289 return;
5290 }
5291
5292 ret = StartServiceA(service, 0, NULL);
5293 if (!ret && (error = GetLastError()) != ERROR_SERVICE_ALREADY_RUNNING)
5294 {
5295 skip("Spooler service not available, skipping test\n");
5296 CloseServiceHandle(service);
5297 CloseServiceHandle(scm);
5298 return;
5299 }
5300
5301 CloseServiceHandle(service);
5302 CloseServiceHandle(scm);
5303
5304 create_test_files();
5305 create_database(msifile, sss_tables, sizeof(sss_tables) / sizeof(msi_table));
5306
5307 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5308
5309 r = MsiInstallProductA(msifile, NULL);
5310 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5311
5312 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5313 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5314 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5315 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5316 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5317 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5318 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5319 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5320 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5321 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5322 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5323 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5324 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5325
5326 delete_test_files();
5327 DeleteFileA(msifile);
5328
5329 if (error == ERROR_SUCCESS)
5330 {
5331 SERVICE_STATUS status;
5332
5333 scm = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5334 service = OpenServiceA(scm, "Spooler", SC_MANAGER_ALL_ACCESS);
5335
5336 ret = ControlService(service, SERVICE_CONTROL_STOP, &status);
5337 ok(ret, "ControlService failed %u\n", GetLastError());
5338
5339 CloseServiceHandle(service);
5340 CloseServiceHandle(scm);
5341 }
5342 }
5343
5344 static void test_delete_services(void)
5345 {
5346 UINT r;
5347 SC_HANDLE manager, service;
5348 DWORD error;
5349
5350 if (is_process_limited())
5351 {
5352 skip("process is limited\n");
5353 return;
5354 }
5355
5356 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5357 ok(manager != NULL, "can't open service manager %u\n", GetLastError());
5358 if (!manager) return;
5359
5360 service = CreateServiceA(manager, "TestService3", "TestService3",
5361 SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_DEMAND_START,
5362 SERVICE_ERROR_NORMAL, "C:\\doesnt_exist.exe", NULL, NULL, NULL, NULL, NULL);
5363 ok(service != NULL, "can't create service %u\n", GetLastError());
5364 CloseServiceHandle(service);
5365 CloseServiceHandle(manager);
5366 if (!service) goto error;
5367
5368 create_test_files();
5369 create_database(msifile, sds_tables, sizeof(sds_tables) / sizeof(msi_table));
5370
5371 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5372
5373 r = MsiInstallProductA(msifile, NULL);
5374 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5375 {
5376 skip("Not enough rights to perform tests\n");
5377 goto error;
5378 }
5379 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5380
5381 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5382 ok(manager != NULL, "can't open service manager\n");
5383 if (!manager) goto error;
5384
5385 service = OpenServiceA(manager, "TestService3", GENERIC_ALL);
5386 error = GetLastError();
5387 ok(service == NULL, "TestService3 not deleted\n");
5388 ok(error == ERROR_SERVICE_DOES_NOT_EXIST, "wrong error %u\n", error);
5389 CloseServiceHandle(manager);
5390
5391 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5392 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5393
5394 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5395 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5396 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5397 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5398 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5399 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5400 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5401 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5402 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5403 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5404 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5405 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5406 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5407
5408 error:
5409 delete_test_files();
5410 DeleteFileA(msifile);
5411 }
5412
5413 static void test_install_services(void)
5414 {
5415 UINT r;
5416 SC_HANDLE manager, service;
5417 BOOL ret;
5418
5419 if (is_process_limited())
5420 {
5421 skip("process is limited\n");
5422 return;
5423 }
5424
5425 create_test_files();
5426 create_database(msifile, sis_tables, sizeof(sis_tables) / sizeof(msi_table));
5427
5428 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5429
5430 r = MsiInstallProductA(msifile, NULL);
5431 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5432 {
5433 skip("Not enough rights to perform tests\n");
5434 goto error;
5435 }
5436 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5437
5438 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5439 ok(manager != NULL, "can't open service manager\n");
5440 if (!manager) goto error;
5441
5442 service = OpenServiceA(manager, "TestService", GENERIC_ALL);
5443 ok(service != NULL, "TestService not installed\n");
5444 CloseServiceHandle(service);
5445
5446 service = OpenServiceA(manager, "TestService4", GENERIC_ALL);
5447 ok(service == NULL, "TestService4 installed\n");
5448 CloseServiceHandle(manager);
5449
5450 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5451 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5452
5453 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5454 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5455 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5456 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5457 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5458 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5459 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5460 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5461 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5462 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5463 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5464 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5465 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5466
5467 manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS);
5468 ok(manager != NULL, "can't open service manager\n");
5469 if (!manager) goto error;
5470
5471 service = OpenServiceA(manager, "TestService", GENERIC_ALL);
5472 ok(service != NULL, "TestService doesn't exist\n");
5473
5474 ret = DeleteService( service );
5475 ok( ret, "failed to delete service %u\n", GetLastError() );
5476
5477 CloseServiceHandle(service);
5478 CloseServiceHandle(manager);
5479
5480 error:
5481 delete_test_files();
5482 DeleteFileA(msifile);
5483 }
5484
5485 static void test_self_registration(void)
5486 {
5487 UINT r;
5488
5489 if (is_process_limited())
5490 {
5491 skip("process is limited\n");
5492 return;
5493 }
5494
5495 create_test_files();
5496 create_database(msifile, sr_tables, sizeof(sr_tables) / sizeof(msi_table));
5497
5498 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5499
5500 r = MsiInstallProductA(msifile, NULL);
5501 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5502 {
5503 skip("Not enough rights to perform tests\n");
5504 goto error;
5505 }
5506 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5507
5508 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5509 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5510 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5511 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5512 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5513 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5514 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5515 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5516 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5517 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5518 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5519 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5520 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5521
5522 error:
5523 delete_test_files();
5524 DeleteFileA(msifile);
5525 }
5526
5527 static void test_register_font(void)
5528 {
5529 static const char regfont1[] = "Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
5530 static const char regfont2[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Fonts";
5531 LONG ret;
5532 HKEY key;
5533 UINT r;
5534 REGSAM access = KEY_ALL_ACCESS;
5535
5536 if (is_process_limited())
5537 {
5538 skip("process is limited\n");
5539 return;
5540 }
5541
5542 create_test_files();
5543 create_file("msitest\\font.ttf", 1000);
5544 create_database(msifile, font_tables, sizeof(font_tables) / sizeof(msi_table));
5545
5546 if (is_wow64)
5547 access |= KEY_WOW64_64KEY;
5548
5549 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5550
5551 r = MsiInstallProductA(msifile, NULL);
5552 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5553 {
5554 skip("Not enough rights to perform tests\n");
5555 goto error;
5556 }
5557 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5558
5559 ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, regfont1, 0, access, &key);
5560 if (ret)
5561 RegOpenKeyExA(HKEY_LOCAL_MACHINE, regfont2, 0, access, &key);
5562
5563 ret = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
5564 ok(ret != ERROR_FILE_NOT_FOUND, "unexpected result %d\n", ret);
5565
5566 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5567 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5568
5569 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5570
5571 ret = RegQueryValueExA(key, "msi test font", NULL, NULL, NULL, NULL);
5572 ok(ret == ERROR_FILE_NOT_FOUND, "unexpected result %d\n", ret);
5573
5574 RegDeleteValueA(key, "msi test font");
5575 RegCloseKey(key);
5576
5577 error:
5578 DeleteFileA("msitest\\font.ttf");
5579 delete_test_files();
5580 DeleteFileA(msifile);
5581 }
5582
5583 static void test_validate_product_id(void)
5584 {
5585 UINT r;
5586
5587 if (is_process_limited())
5588 {
5589 skip("process is limited\n");
5590 return;
5591 }
5592
5593 create_test_files();
5594 create_database(msifile, vp_tables, sizeof(vp_tables) / sizeof(msi_table));
5595
5596 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5597
5598 r = MsiInstallProductA(msifile, NULL);
5599 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5600 {
5601 skip("Not enough rights to perform tests\n");
5602 goto error;
5603 }
5604 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5605
5606 r = MsiInstallProductA(msifile, "SET_PRODUCT_ID=1");
5607 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5608
5609 r = MsiInstallProductA(msifile, "SET_PRODUCT_ID=2");
5610 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5611
5612 r = MsiInstallProductA(msifile, "PIDKEY=123-1234567");
5613 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5614
5615 ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n");
5616 ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n");
5617 ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n");
5618 ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n");
5619 ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n");
5620 ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n");
5621 ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
5622 ok(delete_pf("msitest\\first", FALSE), "Directory not created\n");
5623 ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
5624 ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
5625 ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
5626 ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n");
5627 ok(delete_pf("msitest", FALSE), "Directory not created\n");
5628
5629 error:
5630 delete_test_files();
5631 DeleteFileA(msifile);
5632 }
5633
5634 static void test_install_remove_odbc(void)
5635 {
5636 UINT r;
5637
5638 if (is_process_limited())
5639 {
5640 skip("process is limited\n");
5641 return;
5642 }
5643
5644 create_test_files();
5645 create_file("msitest\\ODBCdriver.dll", 1000);
5646 create_file("msitest\\ODBCdriver2.dll", 1000);
5647 create_file("msitest\\ODBCtranslator.dll", 1000);
5648 create_file("msitest\\ODBCtranslator2.dll", 1000);
5649 create_file("msitest\\ODBCsetup.dll", 1000);
5650 create_database(msifile, odbc_tables, sizeof(odbc_tables) / sizeof(msi_table));
5651
5652 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5653
5654 r = MsiInstallProductA(msifile, NULL);
5655 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5656 {
5657 skip("Not enough rights to perform tests\n");
5658 goto error;
5659 }
5660 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5661
5662 ok(pf_exists("msitest\\ODBCdriver.dll"), "file not created\n");
5663 ok(pf_exists("msitest\\ODBCdriver2.dll"), "file not created\n");
5664 ok(pf_exists("msitest\\ODBCtranslator.dll"), "file not created\n");
5665 ok(pf_exists("msitest\\ODBCtranslator2.dll"), "file not created\n");
5666 ok(pf_exists("msitest\\ODBCsetup.dll"), "file not created\n");
5667
5668 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5669 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5670
5671 ok(!delete_pf("msitest\\ODBCdriver.dll", TRUE), "file not removed\n");
5672 ok(!delete_pf("msitest\\ODBCdriver2.dll", TRUE), "file not removed\n");
5673 ok(!delete_pf("msitest\\ODBCtranslator.dll", TRUE), "file not removed\n");
5674 ok(!delete_pf("msitest\\ODBCtranslator2.dll", TRUE), "file not removed\n");
5675 ok(!delete_pf("msitest\\ODBCsetup.dll", TRUE), "file not removed\n");
5676 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5677
5678 error:
5679 DeleteFileA("msitest\\ODBCdriver.dll");
5680 DeleteFileA("msitest\\ODBCdriver2.dll");
5681 DeleteFileA("msitest\\ODBCtranslator.dll");
5682 DeleteFileA("msitest\\ODBCtranslator2.dll");
5683 DeleteFileA("msitest\\ODBCsetup.dll");
5684 delete_test_files();
5685 DeleteFileA(msifile);
5686 }
5687
5688 static void test_register_typelib(void)
5689 {
5690 UINT r;
5691
5692 if (is_process_limited())
5693 {
5694 skip("process is limited\n");
5695 return;
5696 }
5697
5698 create_test_files();
5699 create_file("msitest\\typelib.dll", 1000);
5700 create_database(msifile, tl_tables, sizeof(tl_tables) / sizeof(msi_table));
5701
5702 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5703
5704 r = MsiInstallProductA(msifile, "REGISTER_TYPELIB=1");
5705 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5706 {
5707 skip("Not enough rights to perform tests\n");
5708 goto error;
5709 }
5710 ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r);
5711
5712 r = MsiInstallProductA(msifile, NULL);
5713 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5714
5715 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5716 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5717
5718 ok(!delete_pf("msitest\\typelib.dll", TRUE), "file not removed\n");
5719 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5720
5721 error:
5722 DeleteFileA("msitest\\typelib.dll");
5723 delete_test_files();
5724 DeleteFileA(msifile);
5725 }
5726
5727 static void test_create_remove_shortcut(void)
5728 {
5729 UINT r;
5730
5731 if (is_process_limited())
5732 {
5733 skip("process is limited\n");
5734 return;
5735 }
5736
5737 create_test_files();
5738 create_file("msitest\\target.txt", 1000);
5739 create_database(msifile, crs_tables, sizeof(crs_tables) / sizeof(msi_table));
5740
5741 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5742
5743 r = MsiInstallProductA(msifile, NULL);
5744 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5745 {
5746 skip("Not enough rights to perform tests\n");
5747 goto error;
5748 }
5749 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5750
5751 ok(pf_exists("msitest\\target.txt"), "file not created\n");
5752 ok(pf_exists("msitest\\shortcut.lnk"), "file not created\n");
5753
5754 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5755 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5756
5757 ok(!delete_pf("msitest\\shortcut.lnk", TRUE), "file not removed\n");
5758 ok(!delete_pf("msitest\\target.txt", TRUE), "file not removed\n");
5759 todo_wine ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5760
5761 error:
5762 DeleteFileA("msitest\\target.txt");
5763 delete_test_files();
5764 DeleteFileA(msifile);
5765 }
5766
5767 static void test_publish_components(void)
5768 {
5769 static const char keypath[] =
5770 "Software\\Microsoft\\Installer\\Components\\0CBCFA296AC907244845745CEEB2F8AA";
5771
5772 UINT r;
5773 LONG res;
5774 HKEY key;
5775
5776 if (is_process_limited())
5777 {
5778 skip("process is limited\n");
5779 return;
5780 }
5781
5782 create_test_files();
5783 create_file("msitest\\english.txt", 1000);
5784 create_database(msifile, pub_tables, sizeof(pub_tables) / sizeof(msi_table));
5785
5786 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5787
5788 r = MsiInstallProductA(msifile, NULL);
5789 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5790 {
5791 skip("Not enough rights to perform tests\n");
5792 goto error;
5793 }
5794 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5795
5796 res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
5797 ok(res == ERROR_SUCCESS, "components key not created %d\n", res);
5798
5799 res = RegQueryValueExA(key, "english.txt", NULL, NULL, NULL, NULL);
5800 ok(res == ERROR_SUCCESS, "value not found %d\n", res);
5801 RegCloseKey(key);
5802
5803 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5804 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5805
5806 res = RegOpenKeyA(HKEY_CURRENT_USER, keypath, &key);
5807 ok(res == ERROR_FILE_NOT_FOUND, "unexpected result %d\n", res);
5808
5809 ok(!delete_pf("msitest\\english.txt", TRUE), "file not removed\n");
5810 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5811
5812 error:
5813 DeleteFileA("msitest\\english.txt");
5814 delete_test_files();
5815 DeleteFileA(msifile);
5816 }
5817
5818 static void test_remove_duplicate_files(void)
5819 {
5820 UINT r;
5821
5822 if (is_process_limited())
5823 {
5824 skip("process is limited\n");
5825 return;
5826 }
5827
5828 create_test_files();
5829 create_file("msitest\\original.txt", 1000);
5830 create_file("msitest\\original2.txt", 1000);
5831 create_file("msitest\\original3.txt", 1000);
5832 create_database(msifile, rd_tables, sizeof(rd_tables) / sizeof(msi_table));
5833
5834 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5835
5836 r = MsiInstallProductA(msifile, NULL);
5837 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5838 {
5839 skip("Not enough rights to perform tests\n");
5840 goto error;
5841 }
5842 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5843
5844 ok(pf_exists("msitest\\original.txt"), "file not created\n");
5845 ok(pf_exists("msitest\\original2.txt"), "file not created\n");
5846 ok(!pf_exists("msitest\\original3.txt"), "file created\n");
5847 ok(pf_exists("msitest\\duplicate.txt"), "file not created\n");
5848 ok(!pf_exists("msitest\\duplicate2.txt"), "file created\n");
5849
5850 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5851 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5852
5853 ok(delete_pf("msitest\\original.txt", TRUE), "file removed\n");
5854 ok(!delete_pf("msitest\\original2.txt", TRUE), "file not removed\n");
5855 ok(!delete_pf("msitest\\original3.txt", TRUE), "file not removed\n");
5856 ok(!delete_pf("msitest\\duplicate.txt", TRUE), "file not removed\n");
5857 ok(!delete_pf("msitest\\duplicate2.txt", TRUE), "file not removed\n");
5858 ok(delete_pf("msitest", FALSE), "directory removed\n");
5859
5860 error:
5861 DeleteFileA("msitest\\original.txt");
5862 DeleteFileA("msitest\\original2.txt");
5863 DeleteFileA("msitest\\original3.txt");
5864 delete_test_files();
5865 DeleteFileA(msifile);
5866 }
5867
5868 static void test_remove_registry_values(void)
5869 {
5870 UINT r;
5871 LONG res;
5872 HKEY key;
5873 REGSAM access = KEY_ALL_ACCESS;
5874
5875 if (is_process_limited())
5876 {
5877 skip("process is limited\n");
5878 return;
5879 }
5880
5881 create_test_files();
5882 create_file("msitest\\registry.txt", 1000);
5883 create_database(msifile, rrv_tables, sizeof(rrv_tables) / sizeof(msi_table));
5884
5885 if (is_wow64)
5886 access |= KEY_WOW64_64KEY;
5887
5888 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
5889
5890 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, NULL, 0, access, NULL, &key, NULL);
5891 RegSetValueExA(key, "value1", 0, REG_SZ, (const BYTE *)"1", 2);
5892 RegCloseKey(key);
5893
5894 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, NULL, 0, access, NULL, &key, NULL);
5895 RegSetValueExA(key, "value2", 0, REG_SZ, (const BYTE *)"2", 2);
5896 RegCloseKey(key);
5897
5898 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", 0, NULL, 0, access, NULL, &key, NULL);
5899 RegSetValueExA(key, "", 0, REG_SZ, (const BYTE *)"default", 8);
5900 RegSetValueExA(key, "valueA", 0, REG_SZ, (const BYTE *)"A", 2);
5901 RegSetValueExA(key, "valueB", 0, REG_SZ, (const BYTE *)"B", 2);
5902 RegCloseKey(key);
5903
5904 RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", 0, NULL, 0, access, NULL, &key, NULL);
5905 RegSetValueExA(key, "", 0, REG_SZ, (const BYTE *)"default", 8);
5906 RegSetValueExA(key, "valueB", 0, REG_SZ, (const BYTE *)"B", 2);
5907 RegCloseKey(key);
5908
5909 r = MsiInstallProductA(msifile, NULL);
5910 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
5911 {
5912 skip("Not enough rights to perform tests\n");
5913 goto error;
5914 }
5915 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5916
5917 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, access, &key);
5918 ok(res == ERROR_SUCCESS, "key removed\n");
5919 RegCloseKey(key);
5920
5921 if (is_64bit)
5922 {
5923 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\key2", 0, KEY_ALL_ACCESS, &key);
5924 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5925 }
5926 else
5927 {
5928 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, KEY_ALL_ACCESS, &key);
5929 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5930 }
5931
5932 res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, NULL, 0, access, NULL, &key, NULL);
5933 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
5934 RegCloseKey(key);
5935
5936 r = MsiInstallProductA(msifile, "REMOVE=ALL");
5937 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
5938
5939 if (is_64bit)
5940 {
5941 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\key1", 0, KEY_ALL_ACCESS, &key);
5942 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5943 }
5944 else
5945 {
5946 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", 0, KEY_ALL_ACCESS, &key);
5947 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5948 }
5949
5950 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", 0, access, &key);
5951 ok(res == ERROR_SUCCESS, "key removed\n");
5952 RegCloseKey(key);
5953
5954 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", 0, access, &key);
5955 ok(res == ERROR_SUCCESS, "key removed\n");
5956 RegCloseKey(key);
5957
5958 if (is_64bit)
5959 {
5960 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wow6432Node\\Wine\\keyB", 0, KEY_ALL_ACCESS, &key);
5961 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5962 }
5963 else
5964 {
5965 res = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", 0, KEY_ALL_ACCESS, &key);
5966 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
5967 }
5968
5969 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", access);
5970 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", access);
5971 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine", access);
5972
5973 ok(!delete_pf("msitest\\registry.txt", TRUE), "file not removed\n");
5974 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
5975
5976 error:
5977 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key1", access);
5978 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\key2", access);
5979 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyA", access);
5980 delete_key(HKEY_LOCAL_MACHINE, "Software\\Wine\\keyB", access);
5981
5982 DeleteFileA("msitest\\registry.txt");
5983 delete_test_files();
5984 DeleteFileA(msifile);
5985 }
5986
5987 static void test_find_related_products(void)
5988 {
5989 UINT r;
5990
5991 if (is_process_limited())
5992 {
5993 skip("process is limited\n");
5994 return;
5995 }
5996
5997 create_test_files();
5998 create_file("msitest\\product.txt", 1000);
5999 create_database(msifile, frp_tables, sizeof(frp_tables) / sizeof(msi_table));
6000
6001 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6002
6003 r = MsiInstallProductA(msifile, NULL);
6004 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6005 {
6006 skip("Not enough rights to perform tests\n");
6007 goto error;
6008 }
6009 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6010
6011 /* install again, so it finds the upgrade code */
6012 r = MsiInstallProductA(msifile, NULL);
6013 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6014
6015 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6016 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6017
6018 ok(!delete_pf("msitest\\product.txt", TRUE), "file not removed\n");
6019 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6020
6021 error:
6022 DeleteFileA("msitest\\product.txt");
6023 delete_test_files();
6024 DeleteFileA(msifile);
6025 }
6026
6027 static void test_remove_ini_values(void)
6028 {
6029 UINT r;
6030 DWORD len;
6031 char inifile[MAX_PATH], buf[0x10];
6032 HANDLE file;
6033 BOOL ret;
6034
6035 if (is_process_limited())
6036 {
6037 skip("process is limited\n");
6038 return;
6039 }
6040
6041 create_test_files();
6042 create_file("msitest\\inifile.txt", 1000);
6043 create_database(msifile, riv_tables, sizeof(riv_tables) / sizeof(msi_table));
6044
6045 lstrcpyA(inifile, PROG_FILES_DIR);
6046 lstrcatA(inifile, "\\msitest");
6047 ret = CreateDirectoryA(inifile, NULL);
6048 if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
6049 {
6050 skip("Not enough rights to perform tests\n");
6051 goto error;
6052 }
6053 lstrcatA(inifile, "\\test.ini");
6054 file = CreateFileA(inifile, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS, 0, NULL);
6055 CloseHandle(file);
6056
6057 ret = WritePrivateProfileStringA("section1", "key1", "value1", inifile);
6058 ok(ret, "failed to write profile string %u\n", GetLastError());
6059
6060 ret = WritePrivateProfileStringA("sectionA", "keyA", "valueA", inifile);
6061 ok(ret, "failed to write profile string %u\n", GetLastError());
6062
6063 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6064
6065 r = MsiInstallProductA(msifile, NULL);
6066 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6067
6068 len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), inifile);
6069 ok(len == 6, "got %u expected 6\n", len);
6070
6071 len = GetPrivateProfileStringA("sectionA", "keyA", NULL, buf, sizeof(buf), inifile);
6072 ok(!len, "got %u expected 0\n", len);
6073
6074 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6075 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6076
6077 len = GetPrivateProfileStringA("section1", "key1", NULL, buf, sizeof(buf), inifile);
6078 ok(!len, "got %u expected 0\n", len);
6079
6080 len = GetPrivateProfileStringA("sectionA", "keyA", NULL, buf, sizeof(buf), inifile);
6081 ok(!len, "got %u expected 0\n", len);
6082
6083 todo_wine ok(!delete_pf("msitest\\test.ini", TRUE), "file removed\n");
6084 ok(!delete_pf("msitest\\inifile.txt", TRUE), "file not removed\n");
6085 ok(delete_pf("msitest", FALSE), "directory removed\n");
6086
6087 error:
6088 DeleteFileA("msitest\\inifile.txt");
6089 delete_test_files();
6090 DeleteFileA(msifile);
6091 }
6092
6093 static void test_remove_env_strings(void)
6094 {
6095 UINT r;
6096 LONG res;
6097 HKEY key;
6098 DWORD type, size;
6099 char buffer[0x10];
6100
6101 if (is_process_limited())
6102 {
6103 skip("process is limited\n");
6104 return;
6105 }
6106
6107 create_test_files();
6108 create_file("msitest\\envvar.txt", 1000);
6109 create_database(msifile, res_tables, sizeof(res_tables) / sizeof(msi_table));
6110
6111 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6112
6113 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
6114 ok(!res, "failed to open environment key %d\n", res);
6115
6116 RegSetValueExA(key, "MSITESTVAR1", 0, REG_SZ, (const BYTE *)"1", 2);
6117 RegSetValueExA(key, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"1", 2);
6118 RegSetValueExA(key, "MSITESTVAR3", 0, REG_SZ, (const BYTE *)"1", 2);
6119 RegSetValueExA(key, "MSITESTVAR4", 0, REG_SZ, (const BYTE *)"1", 2);
6120 RegSetValueExA(key, "MSITESTVAR5", 0, REG_SZ, (const BYTE *)"1", 2);
6121
6122 RegCloseKey(key);
6123
6124 r = MsiInstallProductA(msifile, NULL);
6125 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6126 {
6127 skip("Not enough rights to perform tests\n");
6128 goto error;
6129 }
6130 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6131
6132 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
6133 ok(!res, "failed to open environment key %d\n", res);
6134
6135 type = REG_NONE;
6136 buffer[0] = 0;
6137 size = sizeof(buffer);
6138 res = RegQueryValueExA(key, "MSITESTVAR1", NULL, &type, (LPBYTE)buffer, &size);
6139 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6140 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6141 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6142
6143 type = REG_NONE;
6144 buffer[0] = 0;
6145 size = sizeof(buffer);
6146 res = RegQueryValueExA(key, "MSITESTVAR2", NULL, &type, (LPBYTE)buffer, &size);
6147 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6148 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6149 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6150
6151 type = REG_NONE;
6152 buffer[0] = 0;
6153 size = sizeof(buffer);
6154 res = RegQueryValueExA(key, "MSITESTVAR3", NULL, &type, (LPBYTE)buffer, &size);
6155 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6156 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6157 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6158
6159 type = REG_NONE;
6160 buffer[0] = 0;
6161 size = sizeof(buffer);
6162 res = RegQueryValueExA(key, "MSITESTVAR4", NULL, &type, (LPBYTE)buffer, &size);
6163 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6164 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6165 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6166
6167 type = REG_NONE;
6168 buffer[0] = 0;
6169 size = sizeof(buffer);
6170 res = RegQueryValueExA(key, "MSITESTVAR5", NULL, &type, (LPBYTE)buffer, &size);
6171 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6172 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6173 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6174
6175 RegCloseKey(key);
6176
6177 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6178 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6179
6180 res = RegOpenKeyA(HKEY_CURRENT_USER, "Environment", &key);
6181 ok(!res, "failed to open environment key %d\n", res);
6182
6183 res = RegQueryValueExA(key, "MSITESTVAR1", NULL, NULL, NULL, NULL);
6184 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6185
6186 res = RegQueryValueExA(key, "MSITESTVAR2", NULL, NULL, NULL, NULL);
6187 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6188
6189 type = REG_NONE;
6190 buffer[0] = 0;
6191 size = sizeof(buffer);
6192 res = RegQueryValueExA(key, "MSITESTVAR3", NULL, &type, (LPBYTE)buffer, &size);
6193 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6194 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6195 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6196 RegDeleteValueA(key, "MSITESTVAR3");
6197
6198 res = RegQueryValueExA(key, "MSITESTVAR4", NULL, NULL, NULL, NULL);
6199 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6200
6201 type = REG_NONE;
6202 buffer[0] = 0;
6203 size = sizeof(buffer);
6204 res = RegQueryValueExA(key, "MSITESTVAR5", NULL, &type, (LPBYTE)buffer, &size);
6205 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6206 ok(type == REG_SZ, "expected REG_SZ, got %u\n", type);
6207 ok(!lstrcmpA(buffer, "1"), "expected \"1\", got \"%s\"\n", buffer);
6208 RegDeleteValueA(key, "MSITESTVAR5");
6209
6210 ok(!delete_pf("msitest\\envvar.txt", TRUE), "file not removed\n");
6211 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6212
6213 error:
6214 RegDeleteValueA(key, "MSITESTVAR1");
6215 RegDeleteValueA(key, "MSITESTVAR2");
6216 RegDeleteValueA(key, "MSITESTVAR3");
6217 RegDeleteValueA(key, "MSITESTVAR4");
6218 RegDeleteValueA(key, "MSITESTVAR5");
6219 RegCloseKey(key);
6220
6221 DeleteFileA("msitest\\envvar.txt");
6222 delete_test_files();
6223 DeleteFileA(msifile);
6224 }
6225
6226 static void test_register_class_info(void)
6227 {
6228 UINT r;
6229 LONG res;
6230 HKEY hkey;
6231
6232 if (is_process_limited())
6233 {
6234 skip("process is limited\n");
6235 return;
6236 }
6237
6238 create_test_files();
6239 create_file("msitest\\class.txt", 1000);
6240 create_database(msifile, rci_tables, sizeof(rci_tables) / sizeof(msi_table));
6241
6242 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6243
6244 r = MsiInstallProductA(msifile, NULL);
6245 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6246 {
6247 skip("Not enough rights to perform tests\n");
6248 goto error;
6249 }
6250 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6251
6252 if (is_64bit)
6253 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6254 else
6255 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6256 ok(res == ERROR_SUCCESS, "key not created\n");
6257 RegCloseKey(hkey);
6258
6259 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6260 ok(res == ERROR_SUCCESS, "key not created\n");
6261 RegCloseKey(hkey);
6262
6263 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &hkey);
6264 ok(res == ERROR_SUCCESS, "key not created\n");
6265 RegCloseKey(hkey);
6266
6267 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6268 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6269
6270 if (is_64bit)
6271 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6272 else
6273 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6274 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6275
6276 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "FileType\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6277 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6278
6279 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "AppID\\{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}", &hkey);
6280 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6281
6282 ok(!delete_pf("msitest\\class.txt", TRUE), "file not removed\n");
6283 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6284
6285 error:
6286 DeleteFileA("msitest\\class.txt");
6287 delete_test_files();
6288 DeleteFileA(msifile);
6289 }
6290
6291 static void test_register_extension_info(void)
6292 {
6293 UINT r;
6294 LONG res;
6295 HKEY hkey;
6296
6297 if (is_process_limited())
6298 {
6299 skip("process is limited\n");
6300 return;
6301 }
6302
6303 create_test_files();
6304 create_file("msitest\\extension.txt", 1000);
6305 create_database(msifile, rei_tables, sizeof(rei_tables) / sizeof(msi_table));
6306
6307 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6308
6309 r = MsiInstallProductA(msifile, NULL);
6310 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6311 {
6312 skip("Not enough rights to perform tests\n");
6313 goto error;
6314 }
6315 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6316
6317 res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &hkey);
6318 ok(res == ERROR_SUCCESS, "key not created\n");
6319 RegCloseKey(hkey);
6320
6321 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1\\shell\\Open\\command", &hkey);
6322 ok(res == ERROR_SUCCESS, "key not created\n");
6323 RegCloseKey(hkey);
6324
6325 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6326 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6327
6328 res = RegOpenKeyA(HKEY_CLASSES_ROOT, ".extension", &hkey);
6329 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6330
6331 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Prog.Id.1", &hkey);
6332 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6333
6334 ok(!delete_pf("msitest\\extension.txt", TRUE), "file not removed\n");
6335 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6336
6337 error:
6338 DeleteFileA("msitest\\extension.txt");
6339 delete_test_files();
6340 DeleteFileA(msifile);
6341 }
6342
6343 static void test_register_progid_info(void)
6344 {
6345 UINT r;
6346 LONG res;
6347 HKEY hkey;
6348
6349 if (is_process_limited())
6350 {
6351 skip("process is limited\n");
6352 return;
6353 }
6354
6355 create_test_files();
6356 create_file("msitest\\progid.txt", 1000);
6357 create_database(msifile, rpi_tables, sizeof(rpi_tables) / sizeof(msi_table));
6358
6359 res = RegCreateKeyExA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", 0, NULL, 0,
6360 KEY_ALL_ACCESS, NULL, &hkey, NULL);
6361 ok(res == ERROR_SUCCESS, "key not created\n");
6362 RegCloseKey(hkey);
6363
6364 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6365
6366 r = MsiInstallProductA(msifile, NULL);
6367 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6368 {
6369 skip("Not enough rights to perform tests\n");
6370 goto error;
6371 }
6372 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6373
6374 if (is_64bit)
6375 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6376 else
6377 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6378 ok(res == ERROR_SUCCESS, "key not created\n");
6379 RegCloseKey(hkey);
6380
6381 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.1", &hkey);
6382 ok(res == ERROR_SUCCESS, "key not created\n");
6383 RegCloseKey(hkey);
6384
6385 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class", &hkey);
6386 ok(res == ERROR_SUCCESS, "key not created\n");
6387 RegCloseKey(hkey);
6388
6389 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.2", &hkey);
6390 ok(res == ERROR_SUCCESS, "key not created\n");
6391 RegCloseKey(hkey);
6392
6393 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass.1", &hkey);
6394 ok(res == ERROR_SUCCESS, "key not created\n");
6395 RegCloseKey(hkey);
6396
6397 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass", &hkey);
6398 ok(res == ERROR_SUCCESS, "key not created\n");
6399 RegCloseKey(hkey);
6400
6401 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass.1", &hkey);
6402 ok(res == ERROR_FILE_NOT_FOUND, "key created\n");
6403 if (res == ERROR_SUCCESS) RegCloseKey(hkey);
6404
6405 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass", &hkey);
6406 ok(res == ERROR_FILE_NOT_FOUND, "key created\n");
6407
6408 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", &hkey);
6409 ok(res == ERROR_SUCCESS, "key deleted\n");
6410 if (res == ERROR_SUCCESS) RegCloseKey(hkey);
6411
6412 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned2", &hkey);
6413 ok(res == ERROR_FILE_NOT_FOUND, "key created\n");
6414
6415 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Extension", &hkey);
6416 ok(res == ERROR_SUCCESS, "key not created\n");
6417 RegCloseKey(hkey);
6418
6419 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6420 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6421
6422 if (is_64bit)
6423 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6424 else
6425 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey);
6426 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6427
6428 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.1", &hkey);
6429 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6430
6431 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class", &hkey);
6432 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6433
6434 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.2", &hkey);
6435 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6436
6437 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass.1", &hkey);
6438 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6439
6440 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass", &hkey);
6441 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6442
6443 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass.1", &hkey);
6444 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6445
6446 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass", &hkey);
6447 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6448
6449 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", &hkey);
6450 ok(res == ERROR_SUCCESS, "key deleted\n");
6451 if (res == ERROR_SUCCESS) RegCloseKey(hkey);
6452
6453 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned2", &hkey);
6454 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6455
6456 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Extension", &hkey);
6457 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6458
6459 ok(!delete_pf("msitest\\progid.txt", TRUE), "file not removed\n");
6460 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6461
6462 error:
6463 DeleteFileA("msitest\\progid.txt");
6464 delete_test_files();
6465 DeleteFileA(msifile);
6466 RegDeleteKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned");
6467 }
6468
6469 static void test_register_mime_info(void)
6470 {
6471 UINT r;
6472 LONG res;
6473 HKEY hkey;
6474
6475 if (is_process_limited())
6476 {
6477 skip("process is limited\n");
6478 return;
6479 }
6480
6481 create_test_files();
6482 create_file("msitest\\mime.txt", 1000);
6483 create_database(msifile, rmi_tables, sizeof(rmi_tables) / sizeof(msi_table));
6484
6485 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6486
6487 r = MsiInstallProductA(msifile, NULL);
6488 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6489 {
6490 skip("Not enough rights to perform tests\n");
6491 goto error;
6492 }
6493 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6494
6495 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &hkey);
6496 ok(res == ERROR_SUCCESS, "key not created\n");
6497 RegCloseKey(hkey);
6498
6499 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6500 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6501
6502 res = RegOpenKeyA(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\mime/type", &hkey);
6503 ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n");
6504
6505 ok(!delete_pf("msitest\\mime.txt", TRUE), "file not removed\n");
6506 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6507
6508 error:
6509 DeleteFileA("msitest\\mime.txt");
6510 delete_test_files();
6511 DeleteFileA(msifile);
6512 }
6513
6514 static void test_publish_assemblies(void)
6515 {
6516 static const char manifest[] =
6517 "<assemblyIdentity type=\"win32\" name=\"Wine.Win32.Assembly\" "
6518 "version=\"1.0.0.0\" publicKeyToken=\"abcdef0123456789\" "
6519 "processorArchitecture=\"x86\"/>";
6520 static const char manifest_local[] =
6521 "<assemblyIdentity type=\"win32\" name=\"Wine.Win32.Local.Assembly\" "
6522 "version=\"1.0.0.0\" publicKeyToken=\"abcdef0123456789\" "
6523 "processorArchitecture=\"x86\"/>";
6524 static const char classes_path_dotnet[] =
6525 "Installer\\Assemblies\\Global";
6526 static const char classes_path_dotnet_local[] =
6527 "Installer\\Assemblies\\C:|Program Files|msitest|application_dotnet.txt";
6528 static const char classes_path_dotnet_local_wow64[] =
6529 "Installer\\Assemblies\\C:|Program Files (x86)|msitest|application_dotnet.txt";
6530 static const char classes_path_win32[] =
6531 "Installer\\Win32Assemblies\\Global";
6532 static const char classes_path_win32_local[] =
6533 "Installer\\Win32Assemblies\\C:|Program Files|msitest|application_win32.txt";
6534 static const char classes_path_win32_local_wow64[] =
6535 "Installer\\Win32Assemblies\\C:|Program Files (x86)|msitest|application_win32.txt";
6536 static const char path_dotnet[] =
6537 "Software\\Microsoft\\Installer\\Assemblies\\Global";
6538 static const char path_dotnet_local[] =
6539 "Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files|msitest|application_dotnet.txt";
6540 static const char path_dotnet_local_wow64[] =
6541 "Software\\Microsoft\\Installer\\Assemblies\\C:|Program Files (x86)|msitest|application_dotnet.txt";
6542 static const char path_win32[] =
6543 "Software\\Microsoft\\Installer\\Win32Assemblies\\Global";
6544 static const char path_win32_local[] =
6545 "Software\\Microsoft\\Installer\\Win32Assemblies\\C:|Program Files|msitest|application_win32.txt";
6546 static const char path_win32_local_wow64[] =
6547 "Software\\Microsoft\\Installer\\Win32Assemblies\\C:|Program Files (x86)|msitest|application_win32.txt";
6548 static const char name_dotnet[] =
6549 "Wine.Dotnet.Assembly,processorArchitecture=\"MSIL\",publicKeyToken=\"abcdef0123456789\","
6550 "version=\"1.0.0.0\",culture=\"neutral\"";
6551 static const char name_dotnet_local[] =
6552 "Wine.Dotnet.Local.Assembly,processorArchitecture=\"MSIL\",publicKeyToken=\"abcdef0123456789\","
6553 "version=\"1.0.0.0\",culture=\"neutral\"";
6554 static const char name_win32[] =
6555 "Wine.Win32.Assembly,processorArchitecture=\"x86\",publicKeyToken=\"abcdef0123456789\","
6556 "type=\"win32\",version=\"1.0.0.0\"";
6557 static const char name_win32_local[] =
6558 "Wine.Win32.Local.Assembly,processorArchitecture=\"x86\",publicKeyToken=\"abcdef0123456789\","
6559 "type=\"win32\",version=\"1.0.0.0\"";
6560 UINT r;
6561 LONG res;
6562 HKEY hkey;
6563 const char *path;
6564 int access;
6565
6566 if (is_process_limited())
6567 {
6568 skip("process is limited\n");
6569 return;
6570 }
6571
6572 create_test_files();
6573 create_file("msitest\\win32.txt", 1000);
6574 create_file("msitest\\win32_local.txt", 1000);
6575 create_file("msitest\\dotnet.txt", 1000);
6576 create_file("msitest\\dotnet_local.txt", 1000);
6577 create_file_data("msitest\\manifest.txt", manifest, 0);
6578 create_file_data("msitest\\manifest_local.txt", manifest_local, 0);
6579 create_file("msitest\\application_win32.txt", 1000);
6580 create_file("msitest\\application_dotnet.txt", 1000);
6581 create_database(msifile, pa_tables, sizeof(pa_tables) / sizeof(msi_table));
6582
6583 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6584
6585 r = MsiInstallProductA(msifile, NULL);
6586 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6587 {
6588 skip("Not enough rights to perform tests\n");
6589 goto done;
6590 }
6591 if (r == ERROR_INSTALL_FAILURE)
6592 {
6593 skip("No support for installing side-by-side assemblies\n");
6594 goto done;
6595 }
6596 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6597
6598 res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &hkey);
6599 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6600 CHECK_REG_STR(hkey, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
6601 RegCloseKey(hkey);
6602
6603 path = (is_wow64 || is_64bit) ? path_dotnet_local_wow64 : path_dotnet_local;
6604 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6605 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6606 CHECK_REG_STR(hkey, name_dotnet_local, "rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox");
6607 RegCloseKey(hkey);
6608
6609 res = RegOpenKeyA(HKEY_CURRENT_USER, path_win32, &hkey);
6610 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6611 "Expected ERROR_SUCCESS, got %d\n", res);
6612 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32, "rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%");
6613 RegCloseKey(hkey);
6614
6615 path = (is_wow64 || is_64bit) ? path_win32_local_wow64 : path_win32_local;
6616 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6617 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6618 "Expected ERROR_SUCCESS, got %d\n", res);
6619 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32_local, "rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
6620 RegCloseKey(hkey);
6621
6622 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6623 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6624
6625 res = RegOpenKeyA(HKEY_CURRENT_USER, path_dotnet, &hkey);
6626 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6627 if (res == ERROR_SUCCESS)
6628 {
6629 res = RegDeleteValueA(hkey, name_dotnet);
6630 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6631 RegCloseKey(hkey);
6632 }
6633
6634 path = (is_wow64 || is_64bit) ? path_dotnet_local_wow64 : path_dotnet_local;
6635 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6636 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6637
6638 res = RegOpenKeyA(HKEY_CURRENT_USER, path_win32, &hkey);
6639 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6640 if (res == ERROR_SUCCESS)
6641 {
6642 res = RegDeleteValueA(hkey, name_win32);
6643 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6644 RegCloseKey(hkey);
6645 }
6646
6647 path = (is_wow64 || is_64bit) ? path_win32_local_wow64 : path_win32_local;
6648 res = RegOpenKeyA(HKEY_CURRENT_USER, path, &hkey);
6649 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6650
6651 r = MsiInstallProductA(msifile, "ALLUSERS=1");
6652 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6653
6654 access = KEY_QUERY_VALUE;
6655 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_dotnet, 0, access, &hkey);
6656 if (res == ERROR_FILE_NOT_FOUND && is_wow64) /* Vista WOW64 */
6657 {
6658 trace("Using 64-bit registry view for HKCR\\Installer\n");
6659 access = KEY_QUERY_VALUE | KEY_WOW64_64KEY;
6660 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_dotnet, 0, access, &hkey);
6661 }
6662 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6663 CHECK_REG_STR(hkey, name_dotnet, "rcHQPHq?CA@Uv-XqMI1e>Z'q,T*76M@=YEg6My?~]");
6664 RegCloseKey(hkey);
6665
6666 path = (is_wow64 || is_64bit) ? classes_path_dotnet_local_wow64 : classes_path_dotnet_local;
6667 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
6668 ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
6669 CHECK_REG_STR(hkey, name_dotnet_local, "rcHQPHq?CA@Uv-XqMI1e>LF,8A?0d.AW@vcZ$Cgox");
6670 RegCloseKey(hkey);
6671
6672 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, classes_path_win32, 0, access, &hkey);
6673 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6674 "Expected ERROR_SUCCESS, got %d\n", res);
6675 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32, "rcHQPHq?CA@Uv-XqMI1e>}NJjwR'%D9v1p!v{WV(%");
6676 RegCloseKey(hkey);
6677
6678 path = (is_wow64 || is_64bit) ? classes_path_win32_local_wow64 : classes_path_win32_local;
6679 res = RegOpenKeyExA(HKEY_CLASSES_ROOT, path, 0, access, &hkey);
6680 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND /* win2k without sxs support */,
6681 "Expected ERROR_SUCCESS, got %d\n", res);
6682 if (res == ERROR_SUCCESS) CHECK_REG_STR(hkey, name_win32_local, "rcHQPHq?CA@Uv-XqMI1e>C)Uvlj*53A)u(QQ9=)X!");
6683 RegCloseKey(hkey);
6684
6685 r = MsiInstallProductA(msifile, "REMOVE=ALL ALLUSERS=1");
6686 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6687
6688 res = RegOpenKeyA(HKEY_CLASSES_ROOT, classes_path_dotnet, &hkey);
6689 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6690 if (res == ERROR_SUCCESS)
6691 {
6692 res = RegDeleteValueA(hkey, name_dotnet);
6693 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6694 RegCloseKey(hkey);
6695 }
6696
6697 path = (is_wow64 || is_64bit) ? classes_path_dotnet_local_wow64 : classes_path_dotnet_local;
6698 res = RegOpenKeyA(HKEY_CLASSES_ROOT, path, &hkey);
6699 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6700
6701 res = RegOpenKeyA(HKEY_CLASSES_ROOT, classes_path_win32, &hkey);
6702 ok(res == ERROR_SUCCESS || res == ERROR_FILE_NOT_FOUND, "got %d\n", res);
6703 if (res == ERROR_SUCCESS)
6704 {
6705 res = RegDeleteValueA(hkey, name_win32);
6706 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6707 RegCloseKey(hkey);
6708 }
6709
6710 path = (is_wow64 || is_64bit) ? classes_path_win32_local_wow64 : classes_path_win32_local;
6711 res = RegOpenKeyA(HKEY_CLASSES_ROOT, path, &hkey);
6712 ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
6713
6714 done:
6715 DeleteFileA("msitest\\win32.txt");
6716 DeleteFileA("msitest\\win32_local.txt");
6717 DeleteFileA("msitest\\dotnet.txt");
6718 DeleteFileA("msitest\\dotnet_local.txt");
6719 DeleteFileA("msitest\\manifest.txt");
6720 DeleteFileA("msitest\\manifest_local.txt");
6721 DeleteFileA("msitest\\application_win32.txt");
6722 DeleteFileA("msitest\\application_dotnet.txt");
6723 delete_test_files();
6724 DeleteFileA(msifile);
6725 }
6726
6727 static void test_remove_existing_products(void)
6728 {
6729 UINT r;
6730
6731 if (is_process_limited())
6732 {
6733 skip("process is limited\n");
6734 return;
6735 }
6736
6737 create_test_files();
6738 create_file("msitest\\rep.txt", 1000);
6739 create_database(msifile, rep_tables, sizeof(rep_tables) / sizeof(msi_table));
6740
6741 MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
6742
6743 r = MsiInstallProductA(msifile, NULL);
6744 if (r == ERROR_INSTALL_PACKAGE_REJECTED)
6745 {
6746 skip("Not enough rights to perform tests\n");
6747 goto error;
6748 }
6749 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6750
6751 r = MsiInstallProductA(msifile, "REMOVE=ALL");
6752 ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
6753
6754 ok(!delete_pf("msitest\\rep.txt", TRUE), "file not removed\n");
6755 ok(!delete_pf("msitest", FALSE), "directory not removed\n");
6756
6757 error:
6758 DeleteFileA("msitest\\rep.txt");
6759 delete_test_files();
6760 DeleteFileA(msifile);
6761 }
6762
6763 START_TEST(action)
6764 {
6765 DWORD len;
6766 char temp_path[MAX_PATH], prev_path[MAX_PATH], log_file[MAX_PATH];
6767 STATEMGRSTATUS status;
6768 BOOL ret = FALSE;
6769
6770 init_functionpointers();
6771
6772 if (pIsWow64Process)
6773 pIsWow64Process(GetCurrentProcess(), &is_wow64);
6774
6775 GetCurrentDirectoryA(MAX_PATH, prev_path);
6776 GetTempPathA(MAX_PATH, temp_path);
6777 SetCurrentDirectoryA(temp_path);
6778
6779 lstrcpyA(CURR_DIR, temp_path);
6780 len = lstrlenA(CURR_DIR);
6781
6782 if(len && (CURR_DIR[len - 1] == '\\'))
6783 CURR_DIR[len - 1] = 0;
6784
6785 ok(get_system_dirs(), "failed to retrieve system dirs\n");
6786 ok(get_user_dirs(), "failed to retrieve user dirs\n");
6787
6788 /* Create a restore point ourselves so we circumvent the multitude of restore points
6789 * that would have been created by all the installation and removal tests.
6790 *
6791 * This is not needed on version 5.0 where setting MSIFASTINSTALL prevents the
6792 * creation of restore points.
6793 */
6794 if (pSRSetRestorePointA && !pMsiGetComponentPathExA)
6795 {
6796 memset(&status, 0, sizeof(status));
6797 ret = notify_system_change(BEGIN_NESTED_SYSTEM_CHANGE, &status);
6798 }
6799
6800 /* Create only one log file and don't append. We have to pass something
6801 * for the log mode for this to work. The logfile needs to have an absolute
6802 * path otherwise we still end up with some extra logfiles as some tests
6803 * change the current directory.
6804 */
6805 lstrcpyA(log_file, temp_path);
6806 lstrcatA(log_file, "\\msitest.log");
6807 MsiEnableLogA(INSTALLLOGMODE_FATALEXIT, log_file, 0);
6808
6809 test_register_product();
6810 test_publish_product();
6811 test_publish_features();
6812 test_register_user();
6813 test_process_components();
6814 test_publish();
6815 test_publish_sourcelist();
6816 test_remove_files();
6817 test_move_files();
6818 test_duplicate_files();
6819 test_write_registry_values();
6820 test_envvar();
6821 test_create_remove_folder();
6822 test_start_services();
6823 test_delete_services();
6824 test_install_services();
6825 test_self_registration();
6826 test_register_font();
6827 test_validate_product_id();
6828 test_install_remove_odbc();
6829 test_register_typelib();
6830 test_create_remove_shortcut();
6831 test_publish_components();
6832 test_remove_duplicate_files();
6833 test_remove_registry_values();
6834 test_find_related_products();
6835 test_remove_ini_values();
6836 test_remove_env_strings();
6837 test_register_class_info();
6838 test_register_extension_info();
6839 test_register_progid_info();
6840 test_register_mime_info();
6841 test_publish_assemblies();
6842 test_remove_existing_products();
6843
6844 DeleteFileA(log_file);
6845
6846 if (pSRSetRestorePointA && !pMsiGetComponentPathExA && ret)
6847 {
6848 ret = notify_system_change(END_NESTED_SYSTEM_CHANGE, &status);
6849 if (ret)
6850 remove_restore_point(status.llSequenceNumber);
6851 }
6852 FreeLibrary(hsrclient);
6853
6854 SetCurrentDirectoryA(prev_path);
6855 }